Subject: Re: git archive: tar.umask ignored

From: René Scharfe <[email-masked]>
Date: Tue, 12 Apr 2011 20:19:35 +0200

Am 12.04.2011 11:39, schrieb Jacek Masiulaniec:
> Hello git@,
>
> I believe git has an issue with command line override of configuration options.
> Notice how in both cases below the file mode is 775 despite tar.umask
> difference:
>
> [jacekm@localhost git]$ ./git --version
> git version 1.7.4.4
> [jacekm@localhost git]$ ./git archive --remote=/repo/website.git HEAD
> | tar -tvf - | head -1
> drwxrwxr-x root/root         0 2011-04-11 13:47:09 bin/
> [jacekm@localhost git]$ ./git -c tar.umask=0022 archive
> --remote=/repo/website.git HEAD | tar -tvf - | head -1
> drwxrwxr-x root/root         0 2011-04-11 13:47:09 bin/
> [jacekm@localhost git]$
>
> In contrast, tweaking tar.umask in ~/.gitconfig does have the desired
> impact on the file mode.

The local setting of tar.umask does not affect the archive created at 
the remote end.  If your "remote" repository is in fact located on the 
same machine and accessed with the same user then of course settings in 
~/.gitconfig will take effect.

If --remote is specified then the local archive process just passes all 
command line options (except --remote itself, --output and --exec) to 
the other side which then does all the actual work.  The config option 
tar.umask is not even read in that case.

We'd need to read all relevant config settings (from the command line, 
and perhaps the user's config file and the system-wide one, but not the 
ones from any local repository) and then pass them over somehow.  We 
could piggy-back on the existing command line option passing, but for 
that we'd need to add new command line options.  OK, just a single one, 
because archive only recognizes tar.umask currently.

Would a new --umask command line option alone (that overrides any config 
setting) be sufficient for your use case?

Thanks,
René