summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a6c9b08)
raw | patch | inline | side by side (parent: a6c9b08)
author | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 2 May 2007 18:25:22 +0000 (14:25 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 8 May 2007 03:35:52 +0000 (23:35 -0400) |
Johannes Sixt pointed out that git-gui was randomly selecting
which branch (or tag!) it will show in the merge dialog when
more than one ref points at the same commit. This can be a
problem for the user if they want to merge a branch, but the
ref that git-gui selected to display was actually a tag that
points at the commit at the tip of that branch. Since the
user is looking for the branch, and not the tag, its confusing
to not find it, and worse, merging the tag causes git-merge to
generate a different message than if the branch was selected.
While I am in here and am messing around I have changed the
for-each-ref usage to take advantage of its --tcl formatting,
and to fetch the subject line of the commit (or tag) we are
looking at. This way we could present the subject line in the
UI to the user, given them an even better chance to select
the correct branch.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
which branch (or tag!) it will show in the merge dialog when
more than one ref points at the same commit. This can be a
problem for the user if they want to merge a branch, but the
ref that git-gui selected to display was actually a tag that
points at the commit at the tip of that branch. Since the
user is looking for the branch, and not the tag, its confusing
to not find it, and worse, merging the tag causes git-merge to
generate a different message than if the branch was selected.
While I am in here and am messing around I have changed the
for-each-ref usage to take advantage of its --tcl formatting,
and to fetch the subject line of the commit (or tag) we are
looking at. This way we could present the subject line in the
UI to the user, given them an even better chance to select
the correct branch.
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 21cd83d9c8eb1ae623dad5e65e794bde7b6cfab8..8a07660e156ae3c3f4b9b05455064d30405ea193 100644 (file)
--- a/lib/merge.tcl
+++ b/lib/merge.tcl
pack $w.source.l -side left -fill both -expand 1
pack $w.source -fill both -expand 1 -pady 5 -padx 5
- set cmd [list git for-each-ref]
- lappend cmd {--format=%(objectname) %(*objectname) %(refname)}
+ set fmt {list %(objectname) %(*objectname) %(refname) %(subject)}
+ set cmd [list git for-each-ref --tcl --format=$fmt]
lappend cmd refs/heads
lappend cmd refs/remotes
lappend cmd refs/tags
set fr_fd [open "| $cmd" r]
fconfigure $fr_fd -translation binary
while {[gets $fr_fd line] > 0} {
- set line [split $line { }]
- set sha1([lindex $line 0]) [lindex $line 2]
- set sha1([lindex $line 1]) [lindex $line 2]
+ set line [eval $line]
+ set ref [lindex $line 2]
+ regsub ^refs/(heads|remotes|tags)/ $ref {} ref
+ set subj($ref) [lindex $line 3]
+ lappend sha1([lindex $line 0]) $ref
+ if {[lindex $line 1] ne {}} {
+ lappend sha1([lindex $line 1]) $ref
+ }
}
close $fr_fd
set fr_fd [open "| git rev-list --all --not HEAD"]
while {[gets $fr_fd line] > 0} {
if {[catch {set ref $sha1($line)}]} continue
- regsub ^refs/(heads|remotes|tags)/ $ref {} ref
- lappend to_show $ref
+ foreach n $ref {
+ lappend to_show $n
+ }
}
close $fr_fd