aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Terekhov <termim@gmail.com>2020-06-06 04:33:38 +0000
committerPratyush Yadav <me@yadavpratyush.com>2020-06-08 15:01:46 +0530
commita7473956f7e0ff710f6928b1c23a577f66cb4165 (patch)
treef705800282a6243305f94212ee38035d97007552
parentc195247812f8cd38ba7e1c603112e6c1d8d8e71e (diff)
downloadgit-a7473956f7e0ff710f6928b1c23a577f66cb4165.tar.xz
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>
-rw-r--r--lib/choose_repository.tcl27
1 files changed, 3 insertions, 24 deletions
diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index e54f3e66d8..af1fee7c75 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -357,31 +357,10 @@ proc _is_git {path {outdir_var ""}} {
if {$outdir_var ne ""} {
upvar 1 $outdir_var outdir
}
- if {[file isfile $path]} {
- set fp [open $path r]
- gets $fp line
- close $fp
- if {[regexp "^gitdir: (.+)$" $line line link_target]} {
- set path [file join [file dirname $path] $link_target]
- set path [file normalize $path]
- }
- }
-
- if {[file exists [file join $path HEAD]]
- && [file exists [file join $path objects]]
- && [file exists [file join $path config]]} {
- set outdir $path
- return 1
- }
- if {[is_Cygwin]} {
- if {[file exists [file join $path HEAD]]
- && [file exists [file join $path objects.lnk]]
- && [file exists [file join $path config.lnk]]} {
- set outdir $path
- return 1
- }
+ if {[catch {set outdir [git rev-parse --resolve-git-dir $path]}]} {
+ return 0
}
- return 0
+ return 1
}
proc _objdir {path} {