summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 045f82c)
raw | patch | inline | side by side (parent: 045f82c)
author | Junio C Hamano <junkio@cox.net> | |
Sun, 7 Aug 2005 03:59:47 +0000 (20:59 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 10 Aug 2005 06:38:49 +0000 (23:38 -0700) |
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>
HEAD in ORIG_HEAD, just like git-resolve-script does.
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-reset-script | patch | blob | history |
diff --git a/git-reset-script b/git-reset-script
index b6476edc30b9e8f7c991ebd9e25b530ec49b8253..49994df7a2329a87a65588be94088198d208ba1a 100755 (executable)
--- a/git-reset-script
+++ b/git-reset-script
. 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"