git-gui i18n: internationalize use of colon punctuation
[gitweb.git] / lib / choose_repository.tcl
index 1209fa63e1cd72e5c1353edaa72c58cc38a020d6..75d1da8d31c31db298aea078db863735b6d45439 100644 (file)
@@ -338,16 +338,31 @@ method _git_init {} {
        return 1
 }
 
-proc _is_git {path} {
+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
                }
        }
@@ -530,7 +545,7 @@ method _do_clone {} {
                -text [mc "Recursively clone submodules too"] \
                -variable @recursive \
                -onvalue true -offvalue false
-       pack $args.type_f.recursive
+       pack $args.type_f.recursive -anchor w
        grid $args.type_l $args.type_f -sticky new
 
        grid columnconfigure $args 1 -weight 1
@@ -1093,7 +1108,7 @@ method _open_local_path {} {
 }
 
 method _do_open2 {} {
-       if {![_is_git [file join $local_path .git]]} {
+       if {![_is_git [file join $local_path .git] actualgit]} {
                error_popup [mc "Not a Git repository: %s" [file tail $local_path]]
                return
        }
@@ -1106,7 +1121,7 @@ method _do_open2 {} {
        }
 
        _append_recentrepos [pwd]
-       set ::_gitdir .git
+       set ::_gitdir $actualgit
        set ::_prefix {}
        set done 1
 }