From e0db1dd7d4bc87825f0d7d743f1a01b4461a59ff Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Tue, 8 Apr 2014 21:30:51 +0200 Subject: git-gui: show staged submodules regardless of ignore config Currently setting submodule..ignore and/or diff.ignoreSubmodules to "all" suppresses all output of submodule changes for git-gui. This is really confusing, as even when the user chooses to record a new commit for an ignored submodule by adding it manually this change won't show up under "Staged Changes (Will Commit)". Fix that by using the '--ignore-submodules=dirty' option for both callers of "git diff-index --cached" when the underlying git version supports that option. Signed-off-by: Jens Lehmann Signed-off-by: Junio C Hamano Signed-off-by: Pat Thoyts --- git-gui.sh | 6 +++++- lib/diff.tcl | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/git-gui.sh b/git-gui.sh index cf2209b4f2..c69bfb310e 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1558,7 +1558,11 @@ proc rescan_stage2 {fd after} { set rescan_active 2 ui_status [mc "Scanning for modified files ..."] - set fd_di [git_read diff-index --cached -z [PARENT]] + if {[git-version >= "1.7.2"]} { + set fd_di [git_read diff-index --cached --ignore-submodules=dirty -z [PARENT]] + } else { + set fd_di [git_read diff-index --cached -z [PARENT]] + } set fd_df [git_read diff-files -z] fconfigure $fd_di -blocking 0 -translation binary -encoding binary diff --git a/lib/diff.tcl b/lib/diff.tcl index 30d9a79776..b0a5180af7 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -287,6 +287,9 @@ proc start_show_diff {cont_info {add_opts {}}} { if {$w eq $ui_index} { lappend cmd diff-index lappend cmd --cached + if {[git-version >= "1.7.2"]} { + lappend cmd --ignore-submodules=dirty + } } elseif {$w eq $ui_workdir} { if {[string first {U} $m] >= 0} { lappend cmd diff -- cgit v1.2.3 From 3decb8e0ac5d951f0a0cf6e604790b471aef22e1 Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Sat, 17 May 2014 21:49:05 +0200 Subject: git-gui: tolerate major version changes when comparing the git version Since git 2.0.0 starting git gui in a submodule using a gitfile fails with the following error: No working directory ../../../ couldn't change working directory to "../../../": no such file or directory This is because "git rev-parse --show-toplevel" is only run when git gui sees a git version of at least 1.7.0 (which is the version in which the --show-toplevel option was introduced). But "package vsatisfies" returns false when the major version changes, which is not what we want here. Fix that for both places where the git version is checked using vsatisfies by appending a '-' to the version number. This tells vsatisfies that a change of the major version is not considered to be a problem, as long as the new major version is larger. This is done for both the place that caused the reported bug and another spot where the git version is tested for another feature. Reported-by: Chris Packham Reported-by: Yann Dirson Signed-off-by: Jens Lehmann --- git-gui.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index c69bfb310e..b186329d28 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1283,7 +1283,7 @@ load_config 0 apply_config # v1.7.0 introduced --show-toplevel to return the canonical work-tree -if {[package vsatisfies $_git_version 1.7.0]} { +if {[package vsatisfies $_git_version 1.7.0-]} { if { [is_Cygwin] } { catch {set _gitworktree [exec cygpath --windows [git rev-parse --show-toplevel]]} } else { @@ -1539,7 +1539,7 @@ proc rescan_stage2 {fd after} { close $fd } - if {[package vsatisfies $::_git_version 1.6.3]} { + if {[package vsatisfies $::_git_version 1.6.3-]} { set ls_others [list --exclude-standard] } else { set ls_others [list --exclude-per-directory=.gitignore] -- cgit v1.2.3