git-gui: Allow users to delete branches merged upstream.
Most of the time when you are deleting branches you want to delete those which have been merged into your upstream source. Typically that means it has been merged into the tip commit of some tracking branch, and the current branch (or any other head) doesn't matter. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Jan 21, 2007 at 02:21 UTC
0a25f93cdaee5ef4da67c4b1db2cb06bfc88e84a
1 file changed
+11
-3
git-gui.sh
+11
-3
@@ -1891,7 +1891,7 @@ Delete the above branches?}
1891
}
1892
1893
proc do_delete_branch {} {
1894
- global all_heads current_branch
1894
+ global all_heads tracking_branches current_branch
1895
global delete_branch_checkhead delete_branch_head
1896
1897
set delete_branch_checkhead 1
@@ -1932,15 +1932,23 @@ proc do_delete_branch {} {
1932
pack $w.list.l -fill both -pady 5 -padx 5
1933
pack $w.list -fill both -pady 5 -padx 5
1934
1935
+ set all_trackings [list]
1936
+ foreach b [array names tracking_branches] {
1937
+ regsub ^refs/(heads|remotes)/ $b {} b
1938
+ lappend all_trackings $b
1939
+ }
1940
+
1941
labelframe $w.validate \
1942
-text {Only Delete If} \
1943
-font font_ui
1944
frame $w.validate.head
1945
checkbutton $w.validate.head.r \
1940
- -text {Already Merged Into Local Branch:} \
1946
+ -text {Already Merged Into:} \
1947
-variable delete_branch_checkhead \
1948
-font font_ui
1943
- eval tk_optionMenu $w.validate.head.m delete_branch_head $all_heads
1949
+ eval tk_optionMenu $w.validate.head.m delete_branch_head \
1950
+ $all_heads \
1951
+ [lsort -unique $all_trackings]
1952
pack $w.validate.head.r -side left
1953
pack $w.validate.head.m -side left
1954
pack $w.validate.head -padx 5 -fill x -expand 1