From: Junio C Hamano Date: Mon, 09 Apr 2007 06:13:35 GMT Subject: [PATCH 4/4] Teach git-reset to use index BASE extension. Message-ID: <7vlkh23wj4.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <7vps6e5b93.fsf_-_@assigned-by-dhcp.cox.net> 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 --- 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