Code

Remove MERGE_HEAD in "git checkout/reset"
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 21 Jun 2005 22:40:00 +0000 (15:40 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 21 Jun 2005 22:40:00 +0000 (15:40 -0700)
Both of these scripts will end up resetting the index to some specific
head, and any unresolved merge will be forgotten.

git-checkout-script
git-reset-script

index 5b49662e623a4f68f2796458daea3875911afb68..870b1a3ef9ad71699ee0a6c967e91eaab0932573 100755 (executable)
@@ -37,4 +37,15 @@ then
        git-checkout-cache -q -f -u -a
 else
     git-read-tree -m -u $old $new
-fi && [ "$branch" ] && ln -sf "refs/heads/$branch" "$GIT_DIR/HEAD"
+fi
+
+# 
+# Switch the HEAD pointer to the new branch if it we
+# checked out a branch head, and remove any potential
+# old MERGE_HEAD's (subsequent commits will clearly not
+# be based on them, since we re-set the index)
+#
+if [ "$?" -eq 0 ]; then
+       [ "$branch" ] && ln -sf "refs/heads/$branch" "$GIT_DIR/HEAD"
+       rm -f "$GIT_DIR/MERGE_HEAD"
+fi
index eaefd00d9d1e8adddb56040af0156d209815cc89..fe773388c9d55fdb87967bc04765fa94a83bf2c7 100755 (executable)
@@ -1,3 +1,5 @@
 #!/bin/sh
+: ${GIT_DIR=.git}
 git-read-tree --reset HEAD
 git-update-cache --refresh
+rm -f "$GIT_DIR/MERGE_HEAD"