Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit e632b3c

Browse files
max630patthoyts
authored andcommitted
git-gui: Add gui.displayuntracked option
When git is used to track only a subset of a directory, or there is no sure way to divide files to ignore from files to track, git user have to live with large number of untracked files. These files present in file list, and should always be scrolled through to handle real changes. Situation can become even worse, then number of the untracked files grows above the maxfilesdisplayed limit. In the case, even staged can be hidden by git-gui. This change introduces new configuration variable gui.displayuntracked, which, when set to false, instructs git-gui not to show untracked files in files list. They can be staged from commandline or other tools (like IDE of file manager), then they become visible. Default value of the option is true, which is compatible with current behavior. Signed-off-by: Max Kirillov <[email protected]> Signed-off-by: Pat Thoyts <[email protected]>
1 parent d478056 commit e632b3c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

git-gui.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,7 @@ set font_descs {
913913
{fontdiff font_diff {mc "Diff/Console Font"}}
914914
}
915915
set default_config(gui.stageuntracked) ask
916+
set default_config(gui.displayuntracked) true
916917
917918
######################################################################
918919
##
@@ -1551,18 +1552,23 @@ proc rescan_stage2 {fd after} {
15511552
set buf_rdf {}
15521553
set buf_rlo {}
15531554
1554-
set rescan_active 3
1555+
set rescan_active 2
15551556
ui_status [mc "Scanning for modified files ..."]
15561557
set fd_di [git_read diff-index --cached -z [PARENT]]
15571558
set fd_df [git_read diff-files -z]
1558-
set fd_lo [eval git_read ls-files --others -z $ls_others]
15591559
15601560
fconfigure $fd_di -blocking 0 -translation binary -encoding binary
15611561
fconfigure $fd_df -blocking 0 -translation binary -encoding binary
1562-
fconfigure $fd_lo -blocking 0 -translation binary -encoding binary
1562+
15631563
fileevent $fd_di readable [list read_diff_index $fd_di $after]
15641564
fileevent $fd_df readable [list read_diff_files $fd_df $after]
1565-
fileevent $fd_lo readable [list read_ls_others $fd_lo $after]
1565+
1566+
if {[is_config_true gui.displayuntracked]} {
1567+
set fd_lo [eval git_read ls-files --others -z $ls_others]
1568+
fconfigure $fd_lo -blocking 0 -translation binary -encoding binary
1569+
fileevent $fd_lo readable [list read_ls_others $fd_lo $after]
1570+
incr rescan_active
1571+
}
15661572
}
15671573
15681574
proc load_message {file {encoding {}}} {

lib/option.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ proc do_options {} {
160160
{c gui.encoding {mc "Default File Contents Encoding"}}
161161
{b gui.warndetachedcommit {mc "Warn before committing to a detached head"}}
162162
{s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}}
163+
{b gui.displayuntracked {mc "Show untracked files"}}
163164
} {
164165
set type [lindex $option 0]
165166
set name [lindex $option 1]

0 commit comments

Comments
 (0)