diff options
author | Junio C Hamano <junkio@cox.net> | 2005-09-27 18:14:27 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-09-28 16:42:44 -0700 |
commit | bf7960eb51a26bcf52f27a60bfcf005661266b1e (patch) | |
tree | baeef0ee852f787668eceadd7aefa29b79add7a7 /git-merge.sh | |
parent | a7928f8ec7fb3c368e6086ab48f41e33a22e1b94 (diff) | |
download | git-bf7960eb51a26bcf52f27a60bfcf005661266b1e.tar.gz |
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>
Diffstat (limited to 'git-merge.sh')
-rwxr-xr-x | git-merge.sh | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/git-merge.sh b/git-merge.sh index 5890c7b1c0..29e86c6953 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -116,8 +116,9 @@ case "$#,$common" in # Again the most common case of merging one remote. echo "Updating from $head to $1." git-update-index --refresh 2>/dev/null - git-read-tree -u -m $head "$1" || exit 1 - git-rev-parse --verify "$1^0" > "$GIT_DIR/HEAD" + git-read-tree -u -m $head "$1" && + new_head=$(git-rev-parse --verify "$1^0") && + git-update-ref HEAD "$new_head" "$head" || exit 1 summary "$1" dropsave exit 0 @@ -215,9 +216,9 @@ then do parents="$parents -p $remote" done - result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) + result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) || exit echo "Committed merge $result_commit, made by $wt_strategy." - echo $result_commit >"$GIT_DIR/HEAD" + git-update-ref HEAD $result_commit $head summary $result_commit dropsave exit 0 |