{"thread":{"id":"37787","subject":"[PATCH 1/2] git-gui: fix problem with \"important\" files not shown if, gui.maxfilesdisplayed is exceeded","startedAt":"2014-10-23T13:37:25Z","lastAt":"2015-01-13T00:32:43Z","messageCount":3,"participants":["Csaba Kiraly","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"250983","messageId":"54490495.2010200@disi.unitn.it","threadId":"37787","inReplyTo":null,"subject":"[PATCH 1/2] git-gui: fix problem with \"important\" files not shown if, gui.maxfilesdisplayed is exceeded","fromName":"Csaba Kiraly","fromEmail":"kiraly@disi.unitn.it","sentAt":"2014-10-23T13:37:25Z","receivedAt":"2014-10-23T13:37:25Z","isPatch":true,"sender":{"key":"kiraly@disi.unitn.it","avatar":null},"body":"gui.maxfilesdisplayed (added in dd6451f9c7c5a36d3006231b618ac6da06c7c7b4)\nwas applied brute force on the file list in alphabetic order. As a result,\nfiles that had modifications might not be displayed by git-gui. Even\nworse, files that are already in the index might not be displayed, which\nmakes git-gui unusable.\n\nThis fix changes the meaning of gui.maxfilesdisplayed, making it a soft\nlimit that only applies to \"_O\" files, i.e. files that are \"Untracked,\nnot staged\".\n\nSigned-off-by: Csaba Kiraly <kiraly@disi.unitn.it>\n---\n git-gui.sh | 21 ++++++++++++---------\n 1 file changed, 12 insertions(+), 9 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex bf68699..f86a948 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -1967,20 +1967,22 @@ proc display_all_files {} {\n \n     set to_display [lsort [array names file_states]]\n     set display_limit [get_config gui.maxfilesdisplayed]\n-    if {[llength $to_display] > $display_limit} {\n-        if {!$files_warning} {\n-            # do not repeatedly warn:\n-            set files_warning 1\n-            info_popup [mc \"Displaying only %s of %s files.\" \\\n-                $display_limit [llength $to_display]]\n-        }\n-        set to_display [lrange $to_display 0 [expr {$display_limit-1}]]\n-    }\n+    set displayed 0\n     foreach path $to_display {\n         set s $file_states($path)\n         set m [lindex $s 0]\n         set icon_name [lindex $s 1]\n \n+        if {$displayed > $display_limit && [string index $m 1] eq {O} } {\n+            if {!$files_warning} {\n+                # do not repeatedly warn:\n+                set files_warning 1\n+                info_popup [mc \"Displaying only %s of %s files.\" \\\n+                    $display_limit [llength $to_display]]\n+            }\n+            continue\n+        }\n+\n         set s [string index $m 0]\n         if {$s ne {U} && $s ne {_}} {\n             display_all_files_helper $ui_index $path \\\n@@ -1995,6 +1997,7 @@ proc display_all_files {} {\n         if {$s ne {_}} {\n             display_all_files_helper $ui_workdir $path \\\n                 $icon_name $s\n+            incr displayed\n         }\n     }\n \n-- \n1.9.1\n"},{"id":"253692","messageId":"548F0058.9090701@disi.unitn.it","threadId":"37787","inReplyTo":"54490495.2010200@disi.unitn.it","subject":"[PATCH v2] git-gui: fix problem with gui.maxfilesdisplayed","fromName":"Csaba Kiraly","fromEmail":"kiraly@disi.unitn.it","sentAt":"2014-12-15T15:38:00Z","receivedAt":"2014-12-15T15:38:00Z","isPatch":true,"sender":{"key":"kiraly@disi.unitn.it","avatar":null},"body":"gui.maxfilesdisplayed (added in dd6451f9c7c5a36d3006231b618ac6da06c7c7b4)\nwas applied brute force on the file list in alphabetic order. As a result,\nfiles that had modifications might not be displayed by git-gui. Even\nworse, files that are already in the index might not be displayed, which\nmakes git-gui hard to use in some workflows.\n\nThis fix changes the meaning of gui.maxfilesdisplayed, making it a soft\nlimit that only applies to \"_O\" files, i.e. files that are \"Untracked,\nnot staged\".\n\nSigned-off-by: Csaba Kiraly <kiraly@disi.unitn.it>\n---\n git-gui.sh | 21 ++++++++++++---------\n 1 file changed, 12 insertions(+), 9 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 27ce0e3..0e4b05a 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -1965,20 +1965,22 @@ proc display_all_files {} {\n \n \tset to_display [lsort [array names file_states]]\n \tset display_limit [get_config gui.maxfilesdisplayed]\n-\tif {[llength $to_display] > $display_limit} {\n-\t\tif {!$files_warning} {\n-\t\t\t# do not repeatedly warn:\n-\t\t\tset files_warning 1\n-\t\t\tinfo_popup [mc \"Displaying only %s of %s files.\" \\\n-\t\t\t\t$display_limit [llength $to_display]]\n-\t\t}\n-\t\tset to_display [lrange $to_display 0 [expr {$display_limit-1}]]\n-\t}\n+\tset displayed 0\n \tforeach path $to_display {\n \t\tset s $file_states($path)\n \t\tset m [lindex $s 0]\n \t\tset icon_name [lindex $s 1]\n \n+\t\tif {$displayed > $display_limit && [string index $m 1] eq {O} } {\n+\t\t\tif {!$files_warning} {\n+\t\t\t\t# do not repeatedly warn:\n+\t\t\t\tset files_warning 1\n+\t\t\t\tinfo_popup [mc \"Display limit (gui.maxfilesdisplayed = %s) reached, not showing all %s files.\" \\\n+\t\t\t\t\t$display_limit [llength $to_display]]\n+\t\t\t}\n+\t\t\tcontinue\n+\t\t}\n+\n \t\tset s [string index $m 0]\n \t\tif {$s ne {U} && $s ne {_}} {\n \t\t\tdisplay_all_files_helper $ui_index $path \\\n@@ -1993,6 +1995,7 @@ proc display_all_files {} {\n \t\tif {$s ne {_}} {\n \t\t\tdisplay_all_files_helper $ui_workdir $path \\\n \t\t\t\t$icon_name $s\n+\t\t\tincr displayed\n \t\t}\n \t}\n \n-- \n1.9.1\n"},{"id":"254578","messageId":"87siffmses.fsf@red.patthoyts.tk","threadId":"37787","inReplyTo":"548F0058.9090701@disi.unitn.it","subject":"Re: [PATCH v2] git-gui: fix problem with gui.maxfilesdisplayed","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2015-01-13T00:32:43Z","receivedAt":"2015-01-13T00:32:43Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Csaba Kiraly <kiraly@disi.unitn.it> writes:\n\n>gui.maxfilesdisplayed (added in dd6451f9c7c5a36d3006231b618ac6da06c7c7b4)\n>was applied brute force on the file list in alphabetic order. As a result,\n>files that had modifications might not be displayed by git-gui. Even\n>worse, files that are already in the index might not be displayed, which\n>makes git-gui hard to use in some workflows.\n>\n>This fix changes the meaning of gui.maxfilesdisplayed, making it a soft\n>limit that only applies to \"_O\" files, i.e. files that are \"Untracked,\n>not staged\".\n>\n>Signed-off-by: Csaba Kiraly <kiraly@disi.unitn.it>\n>---\n> git-gui.sh | 21 ++++++++++++---------\n> 1 file changed, 12 insertions(+), 9 deletions(-)\n>\n>diff --git a/git-gui.sh b/git-gui.sh\n>index 27ce0e3..0e4b05a 100755\n>--- a/git-gui.sh\n>+++ b/git-gui.sh\n>@@ -1965,20 +1965,22 @@ proc display_all_files {} {\n> \n> \tset to_display [lsort [array names file_states]]\n> \tset display_limit [get_config gui.maxfilesdisplayed]\n>-\tif {[llength $to_display] > $display_limit} {\n>-\t\tif {!$files_warning} {\n>-\t\t\t# do not repeatedly warn:\n>-\t\t\tset files_warning 1\n>-\t\t\tinfo_popup [mc \"Displaying only %s of %s files.\" \\\n>-\t\t\t\t$display_limit [llength $to_display]]\n>-\t\t}\n>-\t\tset to_display [lrange $to_display 0 [expr {$display_limit-1}]]\n>-\t}\n>+\tset displayed 0\n> \tforeach path $to_display {\n> \t\tset s $file_states($path)\n> \t\tset m [lindex $s 0]\n> \t\tset icon_name [lindex $s 1]\n> \n>+\t\tif {$displayed > $display_limit && [string index $m 1] eq {O} } {\n>+\t\t\tif {!$files_warning} {\n>+\t\t\t\t# do not repeatedly warn:\n>+\t\t\t\tset files_warning 1\n>+\t\t\t\tinfo_popup [mc \"Display limit (gui.maxfilesdisplayed = %s) reached, not showing all %s files.\" \\\n>+\t\t\t\t\t$display_limit [llength $to_display]]\n>+\t\t\t}\n>+\t\t\tcontinue\n>+\t\t}\n>+\n> \t\tset s [string index $m 0]\n> \t\tif {$s ne {U} && $s ne {_}} {\n> \t\t\tdisplay_all_files_helper $ui_index $path \\\n>@@ -1993,6 +1995,7 @@ proc display_all_files {} {\n> \t\tif {$s ne {_}} {\n> \t\t\tdisplay_all_files_helper $ui_workdir $path \\\n> \t\t\t\t$icon_name $s\n>+\t\t\tincr displayed\n> \t\t}\n> \t}\n\nI found a way to test this and it seems fine. The message box points out\nthe new controlling config variable which is good. Applied to the master\nbranch.\n\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"}]}