summaryrefslogtreecommitdiff
path: root/lib/transport.tcl
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-05-28 11:04:59 -0400
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-05-28 17:50:40 -0400
commit5b6ffff644237682c5a20e8ec0a16164bdeb3bfb (patch)
tree92f7b4ef0b1d753ddc5974f56265751f0ebc4a0f /lib/transport.tcl
parentgit gui 0.8.0 (diff)
downloadtgif-5b6ffff644237682c5a20e8ec0a16164bdeb3bfb.tar.xz
git-gui: GUI support for running 'git remote prune <name>'
In some workflows it is common for a large number of temporary branches to be created in a remote repository, get fetched to clients that typically only use git-gui, and then later have those branches deleted from the remote repository once they have been fully merged into all destination branches. Users of git-gui would obviously like to have their local tracking branches cleaned up for them, otherwise their local tracking branch namespace would grow out of control. The best known way to remove these tracking branches is to run "git remote prune <remotename>". Even though it is more of a Porcelain command than plumbing I'm invoking it through the UI, because frankly I don't see a reason to reimplement its ls-remote output filtering and config file parsing. A new configuration option (gui.pruneduringfetch) can be used to automatically enable running "git remote prune <remotename>" after the fetch of that remote also completes successfully. This is off by default as it require an additional network connection and is not very fast on Cygwin if a large number of tracking branches have been removed (due to the 2 fork+exec calls per branch). Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/transport.tcl')
-rw-r--r--lib/transport.tcl16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/transport.tcl b/lib/transport.tcl
index c0e7d20fce..e8ebc6eda0 100644
--- a/lib/transport.tcl
+++ b/lib/transport.tcl
@@ -5,9 +5,19 @@ proc fetch_from {remote} {
set w [console::new \
"fetch $remote" \
"Fetching new changes from $remote"]
- set cmd [list git fetch]
- lappend cmd $remote
- console::exec $w $cmd
+ set cmds [list]
+ lappend cmds [list exec git fetch $remote]
+ if {[is_config_true gui.pruneduringfetch]} {
+ lappend cmds [list exec git remote prune $remote]
+ }
+ console::chain $w $cmds
+}
+
+proc prune_from {remote} {
+ set w [console::new \
+ "remote prune $remote" \
+ "Pruning tracking branches deleted from $remote"]
+ console::exec $w [list git remote prune $remote]
}
proc push_to {remote} {