git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Limited git-gui to displaying 5000 new files
@ 2009-06-30 20:37 Dan Zwell
  2009-08-10 15:38 ` Shawn O. Pearce
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Zwell @ 2009-06-30 20:37 UTC (permalink / raw)
  To: Git Mailing List, Shawn O. Pearce, raa.lkml

When there is a large number of new or modified files,
"display_all_files" takes a long time, and git-gui appears to
hang. Limit the display to 5000 files, by default. This number
is configurable as gui.maxfilesdisplayed.

Show a warning if the list of files is truncated.

Signed-off-by: Dan Zwell <dzwell@zwell.net>
---
 git-gui.sh |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index 14b92ba..5a20923 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -745,6 +745,8 @@ set default_config(gui.newbranchtemplate) {}
 set default_config(gui.spellingdictionary) {}
 set default_config(gui.fontui) [font configure font_ui]
 set default_config(gui.fontdiff) [font configure font_diff]
+# TODO: this option should be added to the git-config documentation
+set default_config(gui.maxfilesdisplayed) 5000
 set font_descs {
 	{fontui   font_ui   {mc "Main Font"}}
 	{fontdiff font_diff {mc "Diff/Console Font"}}
@@ -1702,6 +1704,8 @@ proc display_all_files {} {
 	global ui_index ui_workdir
 	global file_states file_lists
 	global last_clicked
+	global files_warning
+	global default_config
 
 	$ui_index conf -state normal
 	$ui_workdir conf -state normal
@@ -1713,7 +1717,18 @@ proc display_all_files {} {
 	set file_lists($ui_index) [list]
 	set file_lists($ui_workdir) [list]
 
-	foreach path [lsort [array names file_states]] {
+	set to_display [lsort [array names file_states]]
+	set display_limit $default_config(gui.maxfilesdisplayed)
+	if {[llength $to_display] > $display_limit} {
+		if {![info exists files_warning] || !$files_warning} {
+			set warning "Displaying only $display_limit of "
+			append warning "[llength $to_display] files."
+			info_popup [mc $warning]
+			set files_warning 1
+		}
+		set to_display [lrange $to_display 0 [expr {$display_limit-1}]]
+	}
+	foreach path $to_display {
 		set s $file_states($path)
 		set m [lindex $s 0]
 		set icon_name [lindex $s 1]
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-08-12 17:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-30 20:37 [PATCH] Limited git-gui to displaying 5000 new files Dan Zwell
2009-08-10 15:38 ` Shawn O. Pearce
2009-08-10 17:06   ` Alex Riesen
2009-08-10 17:08     ` Shawn O. Pearce
2009-08-10 15:15       ` Dan Zwell
2009-08-11 18:23   ` [PATCH] Limit git-gui to display a maximum number of files Dan Zwell
2009-08-11 20:29     ` Shawn O. Pearce
2009-08-11 18:50       ` Dan Zwell
2009-08-12 14:43         ` Shawn O. Pearce
2009-08-12 15:24           ` [PATCH] git-gui: Update russian translation Alex Riesen
2009-08-12 15:40             ` Shawn O. Pearce
2009-08-12 15:51               ` Dan Zwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).