summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-09-24 12:40:44 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-09-25 01:48:38 (GMT)
commit81d4d3dddc5e96aea45a2623c9b1840491348b92 (patch)
treeb166dc46ce198b7062ffeed5bacfe87fea5702ab
parent40f86af01b061fbbd1e46d125280073322bf9f33 (diff)
downloadgit-81d4d3dddc5e96aea45a2623c9b1840491348b92.zip
git-81d4d3dddc5e96aea45a2623c9b1840491348b92.tar.gz
git-81d4d3dddc5e96aea45a2623c9b1840491348b92.tar.bz2
git-gui: Keep the UI responsive while counting objects in clone
If we are doing a "standard" clone by way of hardlinking the objects (or copying them if hardlinks are not available) the UI can freeze up for a good few seconds while Tcl scans all of the object directories. This is espeically noticed on a Windows system when you are working off network shares and need to wait for both the NT overheads and the network. We now show a progress bar as we count the objects and build our list of things to copy. This keeps the user amused and also makes sure we run the Tk event loop often enough that the window can still be dragged around the desktop. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--lib/choose_repository.tcl30
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index 9074c1b..4ad1f78 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -462,20 +462,42 @@ method _do_clone2 {} {
switch -exact -- $clone_type {
hardlink {
+ set o_cons [status_bar::new $w_body]
+ pack $w_body -fill x -padx 10
+
+ $o_cons start \
+ [mc "Counting objects"] \
+ [mc "buckets"]
+ update
+
set tolink [list]
+ set buckets [glob \
+ -tails \
+ -nocomplain \
+ -directory [file join $objdir] ??]
+ set bcnt [expr {[llength $buckets] + 2}]
+ set bcur 1
+ $o_cons update $bcur $bcnt
+ update
+
file mkdir [file join .git objects pack]
foreach i [glob -tails -nocomplain \
-directory [file join $objdir pack] *] {
lappend tolink [file join pack $i]
}
- foreach i [glob -tails -nocomplain \
- -directory [file join $objdir] ??] {
+ $o_cons update [incr bcur] $bcnt
+ update
+
+ foreach i $buckets {
file mkdir [file join .git objects $i]
foreach j [glob -tails -nocomplain \
-directory [file join $objdir $i] *] {
lappend tolink [file join $i $j]
}
+ $o_cons update [incr bcur] $bcnt
+ update
}
+ $o_cons stop
if {$tolink eq {}} {
info_popup [strcat \
@@ -483,13 +505,11 @@ method _do_clone2 {} {
"\n" \
[mc "The 'master' branch has not been initialized."] \
]
+ destroy $w_body
set done 1
return
}
- set o_cons [status_bar::new $w_body]
- pack $w_body -fill x -padx 10
-
set i [lindex $tolink 0]
if {[catch {
file link -hard \