Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-01-26 10:02:09 +0300
committerShawn O. Pearce <spearce@spearce.org>2007-01-26 10:02:09 +0300
commitbc7452f5e7c0c472bc580e2e00d84f31d1af50ce (patch)
tree1e1f2f2194ed371b88ccb15a0e572ae51834dbb6 /git-gui.sh
parent6c3d1481bab96659a80771194d935cb6db02300e (diff)
git-gui: Use builtin version of 'git gc'.
Technically the new git-gc command is strictly Porcelain; its invoking multiple plumbing commands to do its work. Since git-gui tries to not rely on Porclain we shouldn't be invoking git-gc directly, instead we should perform its tasks on our own. To make this easy I've created console_chain, which takes a list of tasks to perform and runs them all in the same console window. If any individual task fails then the chain stops running and the window shows a failure bar. Only once all tasks have been completed will it invoke console_done with a successful status. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh45
1 files changed, 43 insertions, 2 deletions
diff --git a/git-gui.sh b/git-gui.sh
index d264558076..0982da5690 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2917,9 +2917,45 @@ proc console_read {w fd after} {
fconfigure $fd -blocking 0
}
-proc console_done {w ok} {
+proc console_chain {cmdlist w {ok 1}} {
+ if {$ok} {
+ if {[llength $cmdlist] == 0} {
+ console_done $w $ok
+ return
+ }
+
+ set cmd [lindex $cmdlist 0]
+ set cmdlist [lrange $cmdlist 1 end]
+
+ if {[lindex $cmd 0] eq {console_exec}} {
+ console_exec $w \
+ [lindex $cmd 1] \
+ [list console_chain $cmdlist]
+ } else {
+ uplevel #0 $cmd $cmdlist $w $ok
+ }
+ } else {
+ console_done $w $ok
+ }
+}
+
+proc console_done {args} {
global console_cr console_data
+ switch -- [llength $args] {
+ 2 {
+ set w [lindex $args 0]
+ set ok [lindex $args 1]
+ }
+ 3 {
+ set w [lindex $args 1]
+ set ok [lindex $args 2]
+ }
+ default {
+ error "wrong number of args: console_done ?ignored? w ok"
+ }
+ }
+
if {$ok} {
if {[winfo exists $w]} {
$w.m.s conf -background green -text {Success}
@@ -3038,7 +3074,12 @@ proc do_stats {} {
proc do_gc {} {
set w [new_console {gc} {Compressing the object database}]
- console_exec $w {git gc} console_done
+ console_chain {
+ {console_exec {git pack-refs --prune}}
+ {console_exec {git reflog expire --all}}
+ {console_exec {git repack -a -d -l}}
+ {console_exec {git rerere gc}}
+ } $w
}
proc do_fsck_objects {} {