Skip to content

Commit

Permalink
git-gui: Ensure .git/info/exclude is honored in Cygwin workdirs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce committed Sep 22, 2007
1 parent 299077f commit 2fe167b
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]} {
Expand Down

0 comments on commit 2fe167b

Please sign in to comment.