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 <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
83da013998a93bf3413eae4bf8d6aca01550188b
1 file changed
+8
-3
lib/choose_repository.tcl
+8
-3
@@ -338,7 +338,10 @@ method _git_init {} {
338
return 1
339
}
340
341
-proc _is_git {path} {
341
+proc _is_git {path {outdir_var ""}} {
342
+ if {$outdir_var ne ""} {
343
+ upvar 1 $outdir_var outdir
344
+ }
345
if {[file isfile $path]} {
346
set fp [open $path r]
347
gets $fp line
@@ -352,12 +355,14 @@ proc _is_git {path} {
355
if {[file exists [file join $path HEAD]]
356
&& [file exists [file join $path objects]]
357
&& [file exists [file join $path config]]} {
358
+ set outdir $path
359
return 1
360
}
361
if {[is_Cygwin]} {
362
if {[file exists [file join $path HEAD]]
363
&& [file exists [file join $path objects.lnk]]
364
&& [file exists [file join $path config.lnk]]} {
365
+ set outdir $path
366
return 1
367
}
368
}
@@ -1103,7 +1108,7 @@ method _open_local_path {} {
1108
}
1109
1110
method _do_open2 {} {
1106
- if {![_is_git [file join $local_path .git]]} {
1111
+ if {![_is_git [file join $local_path .git] actualgit]} {
1112
error_popup [mc "Not a Git repository: %s" [file tail $local_path]]
1113
return
1114
}
@@ -1116,7 +1121,7 @@ method _do_open2 {} {
1121
}
1122
1123
_append_recentrepos [pwd]
1119
- set ::_gitdir .git
1124
+ set ::_gitdir $actualgit
1125
set ::_prefix {}
1126
set done 1
1127
}