summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-21 02:21:45 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-21 02:54:26 -0500
commit0a25f93cdaee5ef4da67c4b1db2cb06bfc88e84a (patch)
tree2447a61952c9f0a10b3b050fe200211caf9917f5
parentgit-gui: Implemented local branch deletion. (diff)
downloadtgif-0a25f93cdaee5ef4da67c4b1db2cb06bfc88e84a.tar.xz
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>
-rwxr-xr-xgit-gui.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 48b11111b2..85be9833a0 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1891,7 +1891,7 @@ Delete the above branches?}
}
proc do_delete_branch {} {
- global all_heads current_branch
+ global all_heads tracking_branches current_branch
global delete_branch_checkhead delete_branch_head
set delete_branch_checkhead 1
@@ -1932,15 +1932,23 @@ proc do_delete_branch {} {
pack $w.list.l -fill both -pady 5 -padx 5
pack $w.list -fill both -pady 5 -padx 5
+ set all_trackings [list]
+ foreach b [array names tracking_branches] {
+ regsub ^refs/(heads|remotes)/ $b {} b
+ lappend all_trackings $b
+ }
+
labelframe $w.validate \
-text {Only Delete If} \
-font font_ui
frame $w.validate.head
checkbutton $w.validate.head.r \
- -text {Already Merged Into Local Branch:} \
+ -text {Already Merged Into:} \
-variable delete_branch_checkhead \
-font font_ui
- eval tk_optionMenu $w.validate.head.m delete_branch_head $all_heads
+ eval tk_optionMenu $w.validate.head.m delete_branch_head \
+ $all_heads \
+ [lsort -unique $all_trackings]
pack $w.validate.head.r -side left
pack $w.validate.head.m -side left
pack $w.validate.head -padx 5 -fill x -expand 1