@matheusbsbs / matheus-bagliano / commits / a7473956f7
Fork 0

git-gui: allow opening work trees from the startup dialog

In proc _is_git check that supplied path is a valid work tree path. This allows the choose_repository::pick dialog to accept path to a work tree directory. Signed-off-by: Mikhail Terekhov <termim@gmail.com> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

Mikhail Terekhov committed Jun 6, 2020 at 04:33 UTC a7473956f7e0ff710f6928b1c23a577f66cb4165
1 file changed +3 -24
lib/choose_repository.tcl
+3 -24
@@ -357,31 +357,10 @@ proc _is_git {path {outdir_var ""}} {
357 if {$outdir_var ne ""} {
358 upvar 1 $outdir_var outdir
359 }
360 - if {[file isfile $path]} {
361 - set fp [open $path r]
362 - gets $fp line
363 - close $fp
364 - if {[regexp "^gitdir: (.+)$" $line line link_target]} {
365 - set path [file join [file dirname $path] $link_target]
366 - set path [file normalize $path]
367 - }
368 - }
369 -
370 - if {[file exists [file join $path HEAD]]
371 - && [file exists [file join $path objects]]
372 - && [file exists [file join $path config]]} {
373 - set outdir $path
374 - return 1
375 - }
376 - if {[is_Cygwin]} {
377 - if {[file exists [file join $path HEAD]]
378 - && [file exists [file join $path objects.lnk]]
379 - && [file exists [file join $path config.lnk]]} {
380 - set outdir $path
381 - return 1
382 - }
360 + if {[catch {set outdir [git rev-parse --resolve-git-dir $path]}]} {
361 + return 0
362 }
384 - return 0
363 + return 1
364 }
365
366 proc _objdir {path} {