summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kirillov <max@max630.net>2013-08-21 06:29:13 +0300
committerPat Thoyts <patthoyts@users.sourceforge.net>2013-08-27 20:06:42 +0100
commite632b3c0d37e5f61012dad6bb44c9a2a53a69f67 (patch)
tree9b48848a49387e681629988b4592221e414eecbd
parentd478056c7dcc2aab690edf0036238e761c789007 (diff)
downloadgit-e632b3c0d37e5f61012dad6bb44c9a2a53a69f67.tar.gz
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 <max@max630.net> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
-rwxr-xr-xgit-gui.sh14
-rw-r--r--lib/option.tcl1
2 files changed, 11 insertions, 4 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 4a6929ebbf..32303b01c9 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -913,6 +913,7 @@ set font_descs {
{fontdiff font_diff {mc "Diff/Console Font"}}
}
set default_config(gui.stageuntracked) ask
+set default_config(gui.displayuntracked) true
######################################################################
##
@@ -1551,18 +1552,23 @@ proc rescan_stage2 {fd after} {
set buf_rdf {}
set buf_rlo {}
- set rescan_active 3
+ set rescan_active 2
ui_status [mc "Scanning for modified files ..."]
set fd_di [git_read diff-index --cached -z [PARENT]]
set fd_df [git_read diff-files -z]
- set fd_lo [eval git_read ls-files --others -z $ls_others]
fconfigure $fd_di -blocking 0 -translation binary -encoding binary
fconfigure $fd_df -blocking 0 -translation binary -encoding binary
- fconfigure $fd_lo -blocking 0 -translation binary -encoding binary
+
fileevent $fd_di readable [list read_diff_index $fd_di $after]
fileevent $fd_df readable [list read_diff_files $fd_df $after]
- fileevent $fd_lo readable [list read_ls_others $fd_lo $after]
+
+ if {[is_config_true gui.displayuntracked]} {
+ set fd_lo [eval git_read ls-files --others -z $ls_others]
+ fconfigure $fd_lo -blocking 0 -translation binary -encoding binary
+ fileevent $fd_lo readable [list read_ls_others $fd_lo $after]
+ incr rescan_active
+ }
}
proc load_message {file {encoding {}}} {
diff --git a/lib/option.tcl b/lib/option.tcl
index 07dee60f9f..23c9ae72a4 100644
--- a/lib/option.tcl
+++ b/lib/option.tcl
@@ -160,6 +160,7 @@ proc do_options {} {
{c gui.encoding {mc "Default File Contents Encoding"}}
{b gui.warndetachedcommit {mc "Warn before committing to a detached head"}}
{s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}}
+ {b gui.displayuntracked {mc "Show untracked files"}}
} {
set type [lindex $option 0]
set name [lindex $option 1]