@matheusbsbs / matheus-bagliano / commits / 4890f62bc0
Fork 0

Avoid using "git-var -l" until it gets fixed.

This is to be nicer to people with unusable GECOS field. "git-var -l" is currently broken in that when used by a user who does not have a usable GECOS field and has not corrected it by exporting GIT_COMMITTER_NAME environment variable it dies when it tries to output GIT_COMMITTER_IDENT (same thing for AUTHOR). "git-pull" used "git-var -l" only because it needed to get a configuration variable before "git-repo-config --get" was introduced. Use the latter tool designed exactly for this purpose. "git-sh-setup" used "git-var GIT_AUTHOR_IDENT" without actually wanting to use its value. The only purpose was to cause the command to check and barf if the repository format version recorded in the $GIT_DIR/config file is too new for us to deal with correctly. Instead, use "repo-config --get" on a random property and see if it die()s, and check if the exit status is 128 (comes from die -- missing variable is reported with exit status 1, so we can tell that case apart). Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 11, 2006 at 12:39 UTC 4890f62bc02929b174ff5fa0e3656ea3d40f0e57
2 files changed +9 -5
git-pull.sh
+4 -4
@@ -70,21 +70,21 @@ case "$merge_head" in
70 exit 0
71 ;;
72 ?*' '?*)
73 - var=`git-var -l | sed -ne 's/^pull\.octopus=/-s /p'`
73 + var=`git repo-config --get pull.octopus`
74 if test '' = "$var"
75 then
76 strategy_default_args='-s octopus'
77 else
78 - strategy_default_args=$var
78 + strategy_default_args="-s $var"
79 fi
80 ;;
81 *)
82 - var=`git-var -l | sed -ne 's/^pull\.twohead=/-s /p'`
82 + var=`git repo-config --get pull.twohead`
83 if test '' = "$var"
84 then
85 strategy_default_args='-s recursive'
86 else
87 - strategy_default_args=$var
87 + strategy_default_args="-s $var"
88 fi
89 ;;
90 esac
git-sh-setup.sh
+5 -1
@@ -41,7 +41,11 @@ then
41 : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
42
43 # Make sure we are in a valid repository of a vintage we understand.
44 - GIT_DIR="$GIT_DIR" git-var GIT_AUTHOR_IDENT >/dev/null || exit
44 + GIT_DIR="$GIT_DIR" git repo-config --get core.nosuch >/dev/null
45 + if test $? == 128
46 + then
47 + exit
48 + fi
49 else
50 GIT_DIR=$(git-rev-parse --git-dir) || exit
51 fi