summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9feefbd)
raw | patch | inline | side by side (parent: 9feefbd)
author | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 25 Jul 2007 08:54:53 +0000 (04:54 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 25 Jul 2007 08:54:53 +0000 (04:54 -0400) |
If we are merging a tracking branch we know exactly what remote URL
that branch is fetched from, and what its name is on that remote
repository. In this case we can setup a merge message that looks
just like a standard `git-pull $remote $branch` operation by filling
out FETCH_HEAD before we start git-merge, and then run git-merge just
like git-pull does.
I think the result of this behavior is that merges look a lot nicer
when the came off of local tracking branches, because they no longer
say "commit 'origin/...'" to describe the commit being merged but
instead now mention the specific repository we fetched those commits
from.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
that branch is fetched from, and what its name is on that remote
repository. In this case we can setup a merge message that looks
just like a standard `git-pull $remote $branch` operation by filling
out FETCH_HEAD before we start git-merge, and then run git-merge just
like git-pull does.
I think the result of this behavior is that merges look a lot nicer
when the came off of local tracking branches, because they no longer
say "commit 'origin/...'" to describe the commit being merged but
instead now mention the specific repository we fetched those commits
from.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
lib/merge.tcl | patch | blob | history |
diff --git a/lib/merge.tcl b/lib/merge.tcl
index 62434ff310f80c180a31ae3ba985c7db2c3182ba..c8b486710aa66afce100219a1167618a0103cd87 100644 (file)
--- a/lib/merge.tcl
+++ b/lib/merge.tcl
}
method _start {} {
- global HEAD current_branch
+ global HEAD current_branch remote_url
set name [_rev $this]
if {$name eq {}} {
return
}
- set cmd [list git merge $name]
- set msg "Merging $current_branch and $name"
+ set spec [$w_rev get_tracking_branch]
+ set cmit [$w_rev get_commit]
+ set cmd [list git]
+ lappend cmd merge
+ lappend cmd --strategy=recursive
+
+ set fh [open [gitdir FETCH_HEAD] w]
+ fconfigure $fh -translation lf
+ if {$spec eq {}} {
+ set remote .
+ set branch $name
+ set stitle $branch
+ } else {
+ set remote $remote_url([lindex $spec 1])
+ set branch [lindex $spec 2]
+ set stitle "$branch of $remote"
+ }
+ regsub ^refs/heads/ $branch {} branch
+ puts $fh "$cmit\t\tbranch '$branch' of $remote"
+ close $fh
+
+ lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
+ lappend cmd HEAD
+ lappend cmd $cmit
+
+ set msg "Merging $current_branch and $stitle"
ui_status "$msg..."
- set cons [console::new "Merge" $cmd]
+ set cons [console::new "Merge" "merge $stitle"]
console::exec $cons $cmd [cb _finish $cons]
wm protocol $w WM_DELETE_WINDOW {}