@matheusbsbs / matheus-bagliano / commits / cdf6e08880
Fork 0

git-gui: Permit merging tags into the current branch.

It was pointed out on the git mailing list by Martin Koegler that we did not show tags as possible things to merge into the current branch. They actually are, and core Git's Grand Unified Merge Driver will accept them just like any other commit. So our merge dialog now requests all refs/heads, refs/remotes and refs/tags named refs and attempts to match them against the commits not in HEAD. One complicating factor here is that we must use the %(*objectname) field when talking about an annotated tag, as they will not appear in the output of rev-list. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Feb 13, 2007 at 23:43 UTC cdf6e08880b4924fa717bd6ca700081f445c9065
1 file changed +5 -3
git-gui.sh
+5 -3
@@ -2916,14 +2916,16 @@ proc do_local_merge {} {
2916 pack $w.source -fill both -expand 1 -pady 5 -padx 5
2917
2918 set cmd [list git for-each-ref]
2919 - lappend cmd {--format=%(objectname) %(refname)}
2919 + lappend cmd {--format=%(objectname) %(*objectname) %(refname)}
2920 lappend cmd refs/heads
2921 lappend cmd refs/remotes
2922 + lappend cmd refs/tags
2923 set fr_fd [open "| $cmd" r]
2924 fconfigure $fr_fd -translation binary
2925 while {[gets $fr_fd line] > 0} {
2926 set line [split $line { }]
2926 - set sha1([lindex $line 0]) [lindex $line 1]
2927 + set sha1([lindex $line 0]) [lindex $line 2]
2928 + set sha1([lindex $line 1]) [lindex $line 2]
2929 }
2930 close $fr_fd
2931
@@ -2931,7 +2933,7 @@ proc do_local_merge {} {
2933 set fr_fd [open "| git rev-list --all --not HEAD"]
2934 while {[gets $fr_fd line] > 0} {
2935 if {[catch {set ref $sha1($line)}]} continue
2934 - regsub ^refs/(heads|remotes)/ $ref {} ref
2936 + regsub ^refs/(heads|remotes|tags)/ $ref {} ref
2937 lappend to_show $ref
2938 }
2939 close $fr_fd