git-gui: Fixes chooser not accepting gitfiles
Support the case where .git is a platform independent symbolic link and not a directory. This occurs when --separate-git-dir is used when creating the local repository to store the .git directory elsewhere. git-gui does not support such repositories when using the repository chooser as the test to determine that the chosen directory is a git repository fails for such repositories. This commit enables _is_git to read the real location from the symbolic link file. Signed-off-by: Chris Packham <judge.packham@gmail.com> Signed-off-by: Remi Rampin <remirampin@gmail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Remi Rampin committed
Mar 6, 2015 at 11:21 UTC
cc6825e194c86382068548354faa43839410a8d3
1 file changed
+10
lib/choose_repository.tcl
+10
@@ -339,6 +339,16 @@ method _git_init {} {
339
}
340
341
proc _is_git {path} {
342
+ if {[file isfile $path]} {
343
+ set fp [open $path r]
344
+ gets $fp line
345
+ close $fp
346
+ if {[regexp "^gitdir: (.+)$" $line line link_target]} {
347
+ set path [file join [file dirname $path] $link_target]
348
+ set path [file normalize $path]
349
+ }
350
+ }
351
+
352
if {[file exists [file join $path HEAD]]
353
&& [file exists [file join $path objects]]
354
&& [file exists [file join $path config]]} {