From: Remi Rampin <remirampin@gmail.com>
To: git@vger.kernel.org
Cc: Remi Rampin <remirampin@gmail.com>
Subject: [PATCH 2/2] Makes _do_open2 set _gitdir to actual path
Date: Mon, 2 Feb 2015 12:24:43 -0500 [thread overview]
Message-ID: <1422897883-11036-2-git-send-email-remirampin@gmail.com> (raw)
In-Reply-To: <1422897883-11036-1-git-send-email-remirampin@gmail.com>
If _is_git had to follow "gitdir: ..." files to reach the actual Git
directory, we set _gitdir to that final path.
---
lib/choose_repository.tcl | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index 49ff641..641068d 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -338,13 +338,17 @@ 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]} {
- return [_is_git [file join [file dirname $path] $link_target]]
+ set link_target_abs [file join [file dirname $path] $link_target]
+ return [_is_git $link_target_abs outdir]
}
return 0
}
@@ -352,12 +356,14 @@ proc _is_git {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
}
}
@@ -1103,7 +1109,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
}
@@ -1116,7 +1122,7 @@ method _do_open2 {} {
}
_append_recentrepos [pwd]
- set ::_gitdir .git
+ set ::_gitdir $actualgit
set ::_prefix {}
set done 1
}
--
1.9.5.msysgit.0
next prev parent reply other threads:[~2015-02-02 17:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 21:46 [git-gui] bug report: "Open existing repository" dialog fails on submodules Rémi Rampin
2015-02-02 8:41 ` Chris Packham
2015-02-02 8:43 ` Chris Packham
2015-02-02 15:59 ` Rémi Rampin
2015-02-02 17:24 ` [PATCH 1/2] Fixes _is_git Remi Rampin
2015-02-02 17:24 ` Remi Rampin [this message]
2015-02-03 8:51 ` [PATCH 2/2] Makes _do_open2 set _gitdir to actual path Chris Packham
2015-02-03 16:00 ` Rémi Rampin
2015-02-03 8:44 ` [PATCH 1/2] Fixes _is_git Chris Packham
2015-02-03 15:52 ` Rémi Rampin
2015-02-05 8:13 ` Chris Packham
2015-02-05 16:20 ` [PATCH 0/2] gitfile support git git-gui Remi Rampin
2015-02-05 16:20 ` [PATCH 1/2] Fixes chooser not accepting gitfiles Remi Rampin
2015-02-05 16:20 ` [PATCH 2/2] Makes chooser set 'gitdir' to the resolved path Remi Rampin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1422897883-11036-2-git-send-email-remirampin@gmail.com \
--to=remirampin@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).