{"thread":{"id":"31376","subject":"[PATCH/RFC] Add gui.displayuntracked option","startedAt":"2012-08-28T20:46:47Z","lastAt":"2012-08-28T20:46:47Z","messageCount":1,"participants":["Max Kirillov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"198014","messageId":"20120828204647.GA15612@findesk","threadId":"31376","inReplyTo":null,"subject":"[PATCH/RFC] Add gui.displayuntracked option","fromName":"Max Kirillov","fromEmail":"max@max630.net","sentAt":"2012-08-28T20:46:47Z","receivedAt":"2012-08-28T20:46:47Z","isPatch":true,"sender":{"key":"max@max630.net","avatar":"https://avatars.githubusercontent.com/u/381560?v=4"},"body":"When git is used to track only a subset of a directory, or\nthere is no sure way to divide files to ignore from files to track,\ngit user have to live with large number of untracked files. These files\npresent in file list, and should always be scrolled through\nto handle real changes. Situation can become even worse, then number\nof the untracked files grows above the maxfilesdisplayed limit. In the\ncase, even staged files can be hidden by git-gui.\n\nThis change introduces new configuration variable gui.displayuntracked,\nwhich, when set to false, instructs git-gui not to show untracked files\nin files list. They can be staged from commandline or other tools (like\nIDE of file manager), then they become visible. Default value of the\noption is true, which is compatible with current behavior.\n\nSigned-off-by: Max Kirillov <max@max630.net>\n---\n git-gui/git-gui.sh     |   14 ++++++++++----\n git-gui/lib/option.tcl |    1 +\n 2 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex ba4e5c1..504fc4a 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -897,6 +897,7 @@ set font_descs {\n \t{fontdiff font_diff {mc \"Diff/Console Font\"}}\n }\n set default_config(gui.stageuntracked) ask\n+set default_config(gui.displayuntracked) true\n \n ######################################################################\n ##\n@@ -1535,18 +1536,23 @@ proc rescan_stage2 {fd after} {\n \tset buf_rdf {}\n \tset buf_rlo {}\n \n-\tset rescan_active 3\n+\tset rescan_active 2\n \tui_status [mc \"Scanning for modified files ...\"]\n \tset fd_di [git_read diff-index --cached -z [PARENT]]\n \tset fd_df [git_read diff-files -z]\n-\tset fd_lo [eval git_read ls-files --others -z $ls_others]\n \n \tfconfigure $fd_di -blocking 0 -translation binary -encoding binary\n \tfconfigure $fd_df -blocking 0 -translation binary -encoding binary\n-\tfconfigure $fd_lo -blocking 0 -translation binary -encoding binary\n+\n \tfileevent $fd_di readable [list read_diff_index $fd_di $after]\n \tfileevent $fd_df readable [list read_diff_files $fd_df $after]\n-\tfileevent $fd_lo readable [list read_ls_others $fd_lo $after]\n+\n+\tif {[is_config_true gui.displayuntracked]} {\n+\t\tset fd_lo [eval git_read ls-files --others -z $ls_others]\n+\t\tfconfigure $fd_lo -blocking 0 -translation binary -encoding binary\n+\t\tfileevent $fd_lo readable [list read_ls_others $fd_lo $after]\n+\t\tincr rescan_active\n+\t}\n }\n \n proc load_message {file} {\ndiff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl\nindex 0cf1da1..2177db6 100644\n--- a/git-gui/lib/option.tcl\n+++ b/git-gui/lib/option.tcl\n@@ -159,6 +159,7 @@ proc do_options {} {\n \t\t{c gui.encoding {mc \"Default File Contents Encoding\"}}\n \t\t{b gui.warndetachedcommit {mc \"Warn before committing to a detached head\"}}\n \t\t{s gui.stageuntracked {mc \"Staging of untracked files\"} {list \"yes\" \"no\" \"ask\"}}\n+\t\t{b gui.displayuntracked {mc \"Show untracked files\"}}\n \t\t} {\n \t\tset type [lindex $option 0]\n \t\tset name [lindex $option 1]\n-- \n1.7.9.1\n"}]}