diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-09-21 11:44:23 -0400 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-09-21 21:58:38 -0400 |
commit | 2fe167b67a479b19e52b974f9518436565e6793b (patch) | |
tree | d3485c30028286e5ec558d83a111d9cb0f745dc0 | |
parent | 299077fb40eac1e128b7bc09d5d992960e6f11c2 (diff) | |
download | git-2fe167b67a479b19e52b974f9518436565e6793b.tar.gz git-2fe167b67a479b19e52b974f9518436565e6793b.tar.xz |
git-gui: Ensure .git/info/exclude is honored in Cygwin workdirs
If we are using Cygwin and the git repository is actually a
workdir (by way of git-new-workdir) but this Tcl process is
a native Tcl/Tk and not the Cygwin Tcl/Tk then we are unable
to traverse the .git/info path as it is a Cygwin symlink and
not a standard Windows directory.
So we actually need to start a Cygwin process that can do the
path translation for us and let it test for .git/info/exclude
so we know if we can include that file in our git-ls-files or
not.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rwxr-xr-x | git-gui.sh | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/git-gui.sh b/git-gui.sh index 62e165227..c8375029d 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -907,6 +907,35 @@ proc rescan {after {honor_trustmtime 1}} { } } +if {[is_Cygwin]} { + set is_git_info_link {} + set is_git_info_exclude {} + proc have_info_exclude {} { + global is_git_info_link is_git_info_exclude + + if {$is_git_info_link eq {}} { + set is_git_info_link [file isfile [gitdir info.lnk]] + } + + if {$is_git_info_link} { + if {$is_git_info_exclude eq {}} { + if {[catch {exec test -f [gitdir info exclude]}]} { + set is_git_info_exclude 0 + } else { + set is_git_info_exclude 1 + } + } + return $is_git_info_exclude + } else { + return [file readable [gitdir info exclude]] + } + } +} else { + proc have_info_exclude {} { + return [file readable [gitdir info exclude]] + } +} + proc rescan_stage2 {fd after} { global rescan_active buf_rdi buf_rdf buf_rlo @@ -917,9 +946,8 @@ proc rescan_stage2 {fd after} { } set ls_others [list --exclude-per-directory=.gitignore] - set info_exclude [gitdir info exclude] - if {[file readable $info_exclude]} { - lappend ls_others "--exclude-from=$info_exclude" + if {[have_info_exclude]} { + lappend ls_others "--exclude-from=[gitdir info exclude]" } set user_exclude [get_config core.excludesfile] if {$user_exclude ne {} && [file readable $user_exclude]} { |