Skip to content

Commit

Permalink
Stash away the original head in ORIG_HEAD when resetting.
Browse files Browse the repository at this point in the history
When rewinding the head, stash away the value of the original
HEAD in ORIG_HEAD, just like git-resolve-script does.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Aug 10, 2005
1 parent 045f82c commit 32173e6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion git-reset-script
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
. git-sh-setup-script || die "Not a git archive"
rev=$(git-rev-parse --revs-only --verify --default HEAD "$@") || exit
rev=$(git-rev-parse --revs-only --verify $rev^0) || exit
git-read-tree --reset "$rev" && echo "$rev" > "$GIT_DIR/HEAD"
git-read-tree --reset "$rev" && {
if orig=$(git-rev-parse --verify HEAD 2>/dev/null)
then
echo "$orig" >"$GIT_DIR/ORIG_HEAD"
fi
echo "$rev" > "$GIT_DIR/HEAD"
}
git-update-cache --refresh
rm -f "$GIT_DIR/MERGE_HEAD"

0 comments on commit 32173e6

Please sign in to comment.