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:
@ -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
|
||||
|
Reference in New Issue
Block a user