Use git-update-ref in scripts.

This uses the git-update-ref command in scripts for safer updates.
Also places where we used to read HEAD ref by using "cat" were fixed
to use git-rev-parse.  This will matter when we start using symbolic
references.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano
2005-09-27 18:14:27 -07:00
parent a7928f8ec7
commit bf7960eb51
9 changed files with 39 additions and 32 deletions

View File

@ -6,10 +6,10 @@
. git-sh-setup || die "Not a git archive"
orig_head=$(cat "$GIT_DIR/HEAD") || die "Pulling into a black hole?"
orig_head=$(git-rev-parse --verify HEAD) || die "Pulling into a black hole?"
git-fetch --update-head-ok "$@" || exit 1
curr_head=$(cat "$GIT_DIR/HEAD")
curr_head=$(git-rev-parse --verify HEAD)
if test "$curr_head" != "$orig_head"
then
# The fetch involved updating the current branch.
@ -40,4 +40,4 @@ case "$merge_head" in
esac
merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD")
git-resolve "$(cat "$GIT_DIR"/HEAD)" $merge_head "$merge_name"
git-resolve "$curr_head" $merge_head "$merge_name"