@matheusbsbs / matheus-bagliano / commits / 2fe167b67a
Fork 0

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>

Shawn O. Pearce committed Sep 21, 2007 at 11:44 UTC 2fe167b67a479b19e52b974f9518436565e6793b
1 file changed +31 -3
git-gui.sh
+31 -3
@@ -907,6 +907,35 @@ proc rescan {after {honor_trustmtime 1}} {
907 }
908 }
909
910 +if {[is_Cygwin]} {
911 + set is_git_info_link {}
912 + set is_git_info_exclude {}
913 + proc have_info_exclude {} {
914 + global is_git_info_link is_git_info_exclude
915 +
916 + if {$is_git_info_link eq {}} {
917 + set is_git_info_link [file isfile [gitdir info.lnk]]
918 + }
919 +
920 + if {$is_git_info_link} {
921 + if {$is_git_info_exclude eq {}} {
922 + if {[catch {exec test -f [gitdir info exclude]}]} {
923 + set is_git_info_exclude 0
924 + } else {
925 + set is_git_info_exclude 1
926 + }
927 + }
928 + return $is_git_info_exclude
929 + } else {
930 + return [file readable [gitdir info exclude]]
931 + }
932 + }
933 +} else {
934 + proc have_info_exclude {} {
935 + return [file readable [gitdir info exclude]]
936 + }
937 +}
938 +
939 proc rescan_stage2 {fd after} {
940 global rescan_active buf_rdi buf_rdf buf_rlo
941
@@ -917,9 +946,8 @@ proc rescan_stage2 {fd after} {
946 }
947
948 set ls_others [list --exclude-per-directory=.gitignore]
920 - set info_exclude [gitdir info exclude]
921 - if {[file readable $info_exclude]} {
922 - lappend ls_others "--exclude-from=$info_exclude"
949 + if {[have_info_exclude]} {
950 + lappend ls_others "--exclude-from=[gitdir info exclude]"
951 }
952 set user_exclude [get_config core.excludesfile]
953 if {$user_exclude ne {} && [file readable $user_exclude]} {