All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] git-gui: fix problem with "important" files not shown if, gui.maxfilesdisplayed is exceeded
@ 2014-10-23 13:37 Csaba Kiraly
  2014-12-15 15:38 ` [PATCH v2] git-gui: fix problem with gui.maxfilesdisplayed Csaba Kiraly
  0 siblings, 1 reply; 3+ messages in thread
From: Csaba Kiraly @ 2014-10-23 13:37 UTC (permalink / raw)
  To: git; +Cc: Dan Zwell, Shawn O. Pearce, Pat Thoyts, Csaba Kiraly

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 unusable.

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 bf68699..f86a948 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1967,20 +1967,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 "Displaying only %s of %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 \
@@ -1995,6 +1997,7 @@ proc display_all_files {} {
         if {$s ne {_}} {
             display_all_files_helper $ui_workdir $path \
                 $icon_name $s
+            incr displayed
         }
     }
 
-- 
1.9.1

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

* [PATCH v2] git-gui: fix problem with gui.maxfilesdisplayed
  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
  2015-01-13  0:32   ` Pat Thoyts
  0 siblings, 1 reply; 3+ messages in thread
From: Csaba Kiraly @ 2014-12-15 15:38 UTC (permalink / raw)
  To: git; +Cc: Dan Zwell, Shawn O. Pearce, Pat Thoyts, Csaba Kiraly

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

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

* Re: [PATCH v2] git-gui: fix problem with gui.maxfilesdisplayed
  2014-12-15 15:38 ` [PATCH v2] git-gui: fix problem with gui.maxfilesdisplayed Csaba Kiraly
@ 2015-01-13  0:32   ` Pat Thoyts
  0 siblings, 0 replies; 3+ messages in thread
From: Pat Thoyts @ 2015-01-13  0:32 UTC (permalink / raw)
  To: Csaba Kiraly; +Cc: git, Dan Zwell, Shawn O. Pearce, Csaba Kiraly

Csaba Kiraly <kiraly@disi.unitn.it> writes:

>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
> 		}
> 	}

I found a way to test this and it seems fine. The message box points out
the new controlling config variable which is good. Applied to the master
branch.

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

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

end of thread, other threads:[~2015-01-13  0:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v2] git-gui: fix problem with gui.maxfilesdisplayed Csaba Kiraly
2015-01-13  0:32   ` Pat Thoyts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.