Skip to content

Commit 83da013

Browse files
remram44patthoyts
authored andcommitted
git-gui: Makes chooser set 'gitdir' to the resolved path
If _is_git follows a "gitdir: ..." file link to get to the actual repository, we want _gitdir to be set to that final path. Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Remi Rampin <[email protected]> Signed-off-by: Pat Thoyts <[email protected]>
1 parent cc6825e commit 83da013

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/choose_repository.tcl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,10 @@ method _git_init {} {
338338
return 1
339339
}
340340

341-
proc _is_git {path} {
341+
proc _is_git {path {outdir_var ""}} {
342+
if {$outdir_var ne ""} {
343+
upvar 1 $outdir_var outdir
344+
}
342345
if {[file isfile $path]} {
343346
set fp [open $path r]
344347
gets $fp line
@@ -352,12 +355,14 @@ proc _is_git {path} {
352355
if {[file exists [file join $path HEAD]]
353356
&& [file exists [file join $path objects]]
354357
&& [file exists [file join $path config]]} {
358+
set outdir $path
355359
return 1
356360
}
357361
if {[is_Cygwin]} {
358362
if {[file exists [file join $path HEAD]]
359363
&& [file exists [file join $path objects.lnk]]
360364
&& [file exists [file join $path config.lnk]]} {
365+
set outdir $path
361366
return 1
362367
}
363368
}
@@ -1103,7 +1108,7 @@ method _open_local_path {} {
11031108
}
11041109

11051110
method _do_open2 {} {
1106-
if {![_is_git [file join $local_path .git]]} {
1111+
if {![_is_git [file join $local_path .git] actualgit]} {
11071112
error_popup [mc "Not a Git repository: %s" [file tail $local_path]]
11081113
return
11091114
}
@@ -1116,7 +1121,7 @@ method _do_open2 {} {
11161121
}
11171122

11181123
_append_recentrepos [pwd]
1119-
set ::_gitdir .git
1124+
set ::_gitdir $actualgit
11201125
set ::_prefix {}
11211126
set done 1
11221127
}

0 commit comments

Comments
 (0)