Skip to content

Commit cc6825e

Browse files
remram44patthoyts
authored andcommitted
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 <[email protected]> Signed-off-by: Remi Rampin <[email protected]> Signed-off-by: Pat Thoyts <[email protected]>
1 parent ce3e848 commit cc6825e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/choose_repository.tcl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,16 @@ method _git_init {} {
339339
}
340340

341341
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+
342352
if {[file exists [file join $path HEAD]]
343353
&& [file exists [file join $path objects]]
344354
&& [file exists [file join $path config]]} {

0 commit comments

Comments
 (0)