author | Deskin Miller <deskinm@umich.edu> | |
Tue, 7 Oct 2008 05:37:48 +0000 (01:37 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 8 Oct 2008 14:18:44 +0000 (07:18 -0700) | ||
commit | 0a2c7eea41867ead2b2fb1d5898494c3a72405e5 | |
tree | 1d7f37adb2db0e4a944132e95a3e2d5ca9bdae41 | tree | snapshot |
parent | bf07cc58aeb84b1262cc58f571d2f7033474efa7 | commit | diff |
git init: --bare/--shared overrides system/global config
If core.bare or core.sharedRepository are set in /etc/gitconfig or
~/.gitconfig, then 'git init' will read the values when constructing a
new config file; reading them, however, will override the values
specified on the command line. In the case of --bare, this ends up
causing a segfault, without the repository being properly initialised;
in the case of --shared, the permissions are set according to the
existing config settings, not what was specified on the command line.
This fix saves any specified values for --bare and --shared prior to
reading existing config settings, and restores them after reading but
before writing the new config file. core.bare is ignored in all
situations, while core.sharedRepository will only be used if --shared
is not specified to git init.
Also includes testcases which use a specified global config file
override, demonstrating the former failure scenario.
Signed-off-by: Deskin Miller <deskinm@umich.edu>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
If core.bare or core.sharedRepository are set in /etc/gitconfig or
~/.gitconfig, then 'git init' will read the values when constructing a
new config file; reading them, however, will override the values
specified on the command line. In the case of --bare, this ends up
causing a segfault, without the repository being properly initialised;
in the case of --shared, the permissions are set according to the
existing config settings, not what was specified on the command line.
This fix saves any specified values for --bare and --shared prior to
reading existing config settings, and restores them after reading but
before writing the new config file. core.bare is ignored in all
situations, while core.sharedRepository will only be used if --shared
is not specified to git init.
Also includes testcases which use a specified global config file
override, demonstrating the former failure scenario.
Signed-off-by: Deskin Miller <deskinm@umich.edu>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
builtin-init-db.c | diff | blob | history | |
t/t0001-init.sh | diff | blob | history |