After resetting the HEAD to point at a different commit, the
user obviously intends to make the next commit a child of the
updated HEAD commit. Record it in the index so that we can
detect the case where somebody else updates the tip of the
current branch while we are looking the other way.
Signed-off-by: Junio C Hamano <redacted>
---
git-reset.sh | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/git-reset.sh b/git-reset.sh
index fee6d98..982c726 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -71,7 +71,7 @@ then
die "Cannot do a soft reset in the middle of a merge."
fi
else
- git-read-tree --reset $update "$rev" || exit
+ git-read-tree --reset $update --set-base="$rev" "$rev" || exit
fi
# Any resets update HEAD to the head being switched to.
@@ -93,10 +93,11 @@ case "$reset_type" in
}
;;
--soft )
- ;; # Nothing else to do
+ git-update-index --set-base "$rev"
+ ;;
--mixed )
# Report what has not been updated.
- git-update-index --refresh
+ git-update-index --set-base "$rev" --refresh
;;
esac
--
1.5.1.730.g0d43be