public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Csaba Kiraly <kiraly@disi•unitn.it>
To: git@vger•kernel.org
Cc: Dan Zwell <dzwell@zwell•net>,
	"Shawn O. Pearce" <spearce@spearce•org>,
	Pat Thoyts <patthoyts@users•sourceforge.net>,
	Csaba Kiraly <kiraly@fbk•eu>
Subject: [PATCH v2] git-gui: fix problem with gui.maxfilesdisplayed
Date: Mon, 15 Dec 2014 16:38:00 +0100	[thread overview]
Message-ID: <548F0058.9090701@disi.unitn.it> (raw)
In-Reply-To: <54490495.2010200@disi.unitn.it>

gui.maxfilesdisplayed (added in dd6451f9c7c5a36d3006231b618ac6da06c7c7b4)
was applied brute force on the file list in alphabetic order. As a result,
files that had modifications might not be displayed by git-gui. Even
worse, files that are already in the index might not be displayed, which
makes git-gui hard to use in some workflows.

This fix changes the meaning of gui.maxfilesdisplayed, making it a soft
limit that only applies to "_O" files, i.e. files that are "Untracked,
not staged".

Signed-off-by: Csaba Kiraly <kiraly@disi•unitn.it>
---
 git-gui.sh | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index 27ce0e3..0e4b05a 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1965,20 +1965,22 @@ proc display_all_files {} {
 
 	set to_display [lsort [array names file_states]]
 	set display_limit [get_config gui.maxfilesdisplayed]
-	if {[llength $to_display] > $display_limit} {
-		if {!$files_warning} {
-			# do not repeatedly warn:
-			set files_warning 1
-			info_popup [mc "Displaying only %s of %s files." \
-				$display_limit [llength $to_display]]
-		}
-		set to_display [lrange $to_display 0 [expr {$display_limit-1}]]
-	}
+	set displayed 0
 	foreach path $to_display {
 		set s $file_states($path)
 		set m [lindex $s 0]
 		set icon_name [lindex $s 1]
 
+		if {$displayed > $display_limit && [string index $m 1] eq {O} } {
+			if {!$files_warning} {
+				# do not repeatedly warn:
+				set files_warning 1
+				info_popup [mc "Display limit (gui.maxfilesdisplayed = %s) reached, not showing all %s files." \
+					$display_limit [llength $to_display]]
+			}
+			continue
+		}
+
 		set s [string index $m 0]
 		if {$s ne {U} && $s ne {_}} {
 			display_all_files_helper $ui_index $path \
@@ -1993,6 +1995,7 @@ proc display_all_files {} {
 		if {$s ne {_}} {
 			display_all_files_helper $ui_workdir $path \
 				$icon_name $s
+			incr displayed
 		}
 	}
 
-- 
1.9.1

  reply	other threads:[~2014-12-15 15:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23 13:37 [PATCH 1/2] git-gui: fix problem with "important" files not shown if, gui.maxfilesdisplayed is exceeded Csaba Kiraly
2014-12-15 15:38 ` Csaba Kiraly [this message]
2015-01-13  0:32   ` [PATCH v2] git-gui: fix problem with gui.maxfilesdisplayed Pat Thoyts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=548F0058.9090701@disi.unitn.it \
    --to=kiraly@disi$(echo .)unitn.it \
    --cc=dzwell@zwell$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=kiraly@fbk$(echo .)eu \
    --cc=patthoyts@users$(echo .)sourceforge.net \
    --cc=spearce@spearce$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox