Anonymous avatar Anonymous committed 4890f62

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>;

Comments (0)

Files changed (2)

 	exit 0
 	;;
 ?*' '?*)
-	var=`git-var -l | sed -ne 's/^pull\.octopus=/-s /p'`
+	var=`git repo-config --get pull.octopus`
 	if test '' = "$var"
 	then
 		strategy_default_args='-s octopus'
 	else
-		strategy_default_args=$var
+		strategy_default_args="-s $var"
 	fi
 	;;
 *)
-	var=`git-var -l | sed -ne 's/^pull\.twohead=/-s /p'`
+	var=`git repo-config --get pull.twohead`
 	if test '' = "$var"
 	then
 		strategy_default_args='-s recursive'
 	else
-		strategy_default_args=$var
+		strategy_default_args="-s $var"
 	fi
 	;;
 esac
 	: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
 
 	# Make sure we are in a valid repository of a vintage we understand.
-	GIT_DIR="$GIT_DIR" git-var GIT_AUTHOR_IDENT >/dev/null || exit
+	GIT_DIR="$GIT_DIR" git repo-config --get core.nosuch >/dev/null
+	if test $? == 128
+	then
+	    exit
+	fi
 else
 	GIT_DIR=$(git-rev-parse --git-dir) || exit
 fi
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.