git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [git-gui] bug report: "Open existing repository" dialog fails on submodules

From
Rémi Rampin <remirampin@gmail.com>
Date
Feb 2, 2015, 15:59 UTC
Message-ID
<CAMto89CHf4OT_S05SaRrVRZvF-PH2_6DrcEpdGiUfaRGutJQHw@mail.gmail.com>
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>:
Show 5 quoted lines
> [...]
> 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).

Previous: Chris PackhamNext: Remi Rampin
Message 4 of 14 in “[git-gui] bug report: "Open existing repository" dialog fails on submodules”
  1. Rémi RampinJan 30, 2015
  2. Chris PackhamFeb 2, 2015
  3. Chris PackhamFeb 2, 2015
  4. Rémi RampinFeb 2, 2015
  5. 1/2 Fixes _is_gitRemi Rampin, Feb 2, 2015
  6. 2/2 Makes _do_open2 set _gitdir to actual pathRemi Rampin, Feb 2, 2015
  7. Chris PackhamFeb 3, 2015
  8. Rémi RampinFeb 3, 2015
  9. Chris PackhamFeb 3, 2015
  10. Rémi RampinFeb 3, 2015
  11. Chris PackhamFeb 5, 2015
  12. 0/2 gitfile support git git-guiRemi Rampin, Feb 5, 2015
  13. 1/2 Fixes chooser not accepting gitfilesRemi Rampin, Feb 5, 2015
  14. 2/2 Makes chooser set 'gitdir' to the resolved pathRemi Rampin, Feb 5, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.