summaryrefslogtreecommitdiff
path: root/lib/checkout_op.tcl
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-07-22 04:09:53 -0400
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-07-22 04:09:53 -0400
commit7bd197c7ba0b93744bf0f804ec4fb0d448044e83 (patch)
treec3c96a9054cdfdb3175fdc2ddf7b74efa869bfb3 /lib/checkout_op.tcl
parentgit-gui: Completely remove my Tools/Migrate hack (diff)
downloadtgif-7bd197c7ba0b93744bf0f804ec4fb0d448044e83.tar.xz
git-gui: Fix unnecessary fast-forward during checkout
If we are trying to checkout a local branch which is matched to a remote tracking branch, but the local branch is newer than the remote tracking branch we actually just want to switch to the local branch. The local branch is "Already up to date". Unfortunately we tossed away the local branch's commit SHA-1 and kept the remote tracking branch's SHA-1, which meant that the user lost the local changes when we updated the working directory. At least we did not update the local branch ref, so the user's data was still intact. We now toss the tracking branch's SHA-1 and replace with the local branch's SHA-1 before the checkout, ensuring that we pass of the right tree to git-read-tree when we update the working directory. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/checkout_op.tcl')
-rw-r--r--lib/checkout_op.tcl1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl
index 0571115128..8c42ca8005 100644
--- a/lib/checkout_op.tcl
+++ b/lib/checkout_op.tcl
@@ -201,6 +201,7 @@ method _update_ref {} {
# The current branch is actually newer.
#
set new $cur
+ set new_hash $cur
} else {
_error $this "Branch '$newbranch' already exists.\n\nIt cannot fast-forward to $new_expr.\nA merge is required."
return 0