Skip to content

Commit a117fa2

Browse files
Csaba Kiralypatthoyts
authored andcommitted
git-gui: fix problem with gui.maxfilesdisplayed
gui.maxfilesdisplayed (added in dd6451f) 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 <[email protected]> Signed-off-by: Pat Thoyts <[email protected]>
1 parent cdc6aba commit a117fa2

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

git-gui.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,20 +1965,22 @@ proc display_all_files {} {
19651965
19661966
set to_display [lsort [array names file_states]]
19671967
set display_limit [get_config gui.maxfilesdisplayed]
1968-
if {[llength $to_display] > $display_limit} {
1969-
if {!$files_warning} {
1970-
# do not repeatedly warn:
1971-
set files_warning 1
1972-
info_popup [mc "Displaying only %s of %s files." \
1973-
$display_limit [llength $to_display]]
1974-
}
1975-
set to_display [lrange $to_display 0 [expr {$display_limit-1}]]
1976-
}
1968+
set displayed 0
19771969
foreach path $to_display {
19781970
set s $file_states($path)
19791971
set m [lindex $s 0]
19801972
set icon_name [lindex $s 1]
19811973
1974+
if {$displayed > $display_limit && [string index $m 1] eq {O} } {
1975+
if {!$files_warning} {
1976+
# do not repeatedly warn:
1977+
set files_warning 1
1978+
info_popup [mc "Display limit (gui.maxfilesdisplayed = %s) reached, not showing all %s files." \
1979+
$display_limit [llength $to_display]]
1980+
}
1981+
continue
1982+
}
1983+
19821984
set s [string index $m 0]
19831985
if {$s ne {U} && $s ne {_}} {
19841986
display_all_files_helper $ui_index $path \
@@ -1993,6 +1995,7 @@ proc display_all_files {} {
19931995
if {$s ne {_}} {
19941996
display_all_files_helper $ui_workdir $path \
19951997
$icon_name $s
1998+
incr displayed
19961999
}
19972000
}
19982001

0 commit comments

Comments
 (0)