git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rémi Rampin" <remirampin@gmail.com>
To: Chris Packham <judge.packham@gmail.com>,
	Pat Thoyts <patthoyts@users.sourceforge.net>
Cc: GIT <git@vger.kernel.org>
Subject: Re: [git-gui] bug report: "Open existing repository" dialog fails on submodules
Date: Mon, 2 Feb 2015 10:59:41 -0500	[thread overview]
Message-ID: <CAMto89CHf4OT_S05SaRrVRZvF-PH2_6DrcEpdGiUfaRGutJQHw@mail.gmail.com> (raw)
In-Reply-To: <CAFOYHZBpVf0Dk=aM3hbpVjwc-f_WtZx+Myaja6=V2KXCDijsQA@mail.gmail.com>

2015-02-02 3:41 UTC-05:00, Chris Packham <judge.packham@gmail.com>:
> [...]
> But it actually looks like git rev-parse --resolve-git-dir $path needs
> to be run inside a git repository _any_ git repository, which seems a
> bit backwards to me.
> [...]

Indeed, looking at git-rev-parse(1), the correct option might be
--show-toplevel, which will print the cwd if it is the top-level of a
non-bare repository:

    cd $candidate && test $(git rev-parse --show-toplevel) = $candidate

or

    test $(git --git-dir=$candidate rev-parse --show-toplevel) = $candidate

Of course Git will resolve symlinks at this point, so $candidate has
to be resolved first for the equality to make sense.

Other solution is to parse the "gitdir: ..." format and recurse, which
is not exactly hard (provided you speak Tcl).

  parent reply	other threads:[~2015-02-02 16:00 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 [this message]
2015-02-02 17:24     ` [PATCH 1/2] Fixes _is_git Remi Rampin
2015-02-02 17:24       ` [PATCH 2/2] Makes _do_open2 set _gitdir to actual path Remi Rampin
2015-02-03  8:51         ` 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=CAMto89CHf4OT_S05SaRrVRZvF-PH2_6DrcEpdGiUfaRGutJQHw@mail.gmail.com \
    --to=remirampin@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=judge.packham@gmail.com \
    --cc=patthoyts@users.sourceforge.net \
    /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).