summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-07-20 02:13:24 -0400
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-07-21 05:00:36 -0400
commit60f7352fe1ae3d42ca7bd7611b6b787ff70cd813 (patch)
treec6bc6c5e790a3b5679ab4e8f641c05bb2c8d530c
parentgit-gui: Automatically backup the user's commit buffer (diff)
downloadtgif-60f7352fe1ae3d42ca7bd7611b6b787ff70cd813.tar.xz
git-gui: Save the merge base during checkout_op processing
I've decided to teach checkout_op how to perform more than just a fast-forward and reset type of merge. This way we can also do a full recursive merge even when we are recreating an existing branch from a remote. To help with that process I'm saving the merge-base we computed during the ff/reset/fail decision process, in case we need it later on when we actually start a true merge operation. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--lib/checkout_op.tcl10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl
index 00a994be12..262dc96895 100644
--- a/lib/checkout_op.tcl
+++ b/lib/checkout_op.tcl
@@ -12,6 +12,7 @@ field new_ref ; # ref we are updating/creating
field parent_w .; # window that started us
field merge_type none; # type of merge to apply to existing branch
+field merge_base {}; # merge base if we have another ref involved
field fetch_spec {}; # refetch tracking branch if used?
field checkout 1; # actually checkout the branch?
field create 0; # create the branch if it doesn't exist?
@@ -180,15 +181,14 @@ method _update_ref {} {
# No merge would be required, don't compute anything.
#
} else {
- set mrb {}
- catch {set mrb [git merge-base $new $cur]}
+ catch {set merge_base [git merge-base $new $cur]}
switch -- $merge_type {
ff {
- if {$mrb eq $new} {
+ if {$merge_base eq $new} {
# The current branch is actually newer.
#
set new $cur
- } elseif {$mrb eq $cur} {
+ } elseif {$merge_base eq $cur} {
# The current branch is older.
#
set reflog_msg "merge $new_expr: Fast-forward"
@@ -198,7 +198,7 @@ method _update_ref {} {
}
}
reset {
- if {$mrb eq $cur} {
+ if {$merge_base eq $cur} {
# The current branch is older.
#
set reflog_msg "merge $new_expr: Fast-forward"