From: Junio C Hamano Date: Sun, 7 Aug 2005 03:59:47 +0000 (-0700) Subject: Stash away the original head in ORIG_HEAD when resetting. X-Git-Tag: v0.99.4~3^2~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=32173e69881a35e4e7a53be3ba80091ae9fa8f35;p=git.git Stash away the original head in ORIG_HEAD when resetting. 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 --- diff --git a/git-reset-script b/git-reset-script index b6476edc3..49994df7a 100755 --- a/git-reset-script +++ b/git-reset-script @@ -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"