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

Re: [PATCH] rev-parse --git-path: fix output when running in a subdirectory

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 9, 2017, 21:11 UTC
Message-ID
<alpine.DEB.2.20.1702092208220.3496@virtualbox>
In-Reply-To
<CANoM8SWv+KD92T263gS0Uxxi2ekNQdo0aNGx3AmweVasXk3GbA@mail.gmail.com>
Hi Mike,
On Thu, 9 Feb 2017, Mike Rappazzo wrote:
Show 17 quoted lines
> On Thu, Feb 9, 2017 at 4:48 AM, Duy Nguyen <pclouds@gmail.com> wrote:
>
> > Relevant thread in the past [1] which fixes both --git-path and
> > --git-common-dir. I think the author dropped it somehow (or forgot
> > about it, I know I did). Sorry can't comment on that thread, or this
> > patch, yet.
> 
> I didn't exactly forget it (I have it sitting in a branch), I wasn't
> sure what else was needed (from a v5 I guess), so it has stagnated.
> 
> There was also another patch [1] at the time done by SZEDER Gábor trying
> to speed up the completion scripts by adding `git rev-parse
> --absolute-git-dir` option to deal with this case as well.
> 
> > [1] http://public-inbox.org/git/1464261556-89722-1-git-send-email-rappazzo@gmail.com/
> 
> [1] http://public-inbox.org/git/20170203024829.8071-16-szeder.dev@gmail.com/

Ah, so I was not the only person reporting this bug, but I am seemingly having as much luck getting a fix in.

I had a quick look at your v4: http://public-inbox.org/git/1464261556-89722-3-git-send-email-rappazzo@gmail.com/

It seems you replaced the git_path() by a combination of git_dir() and relative_path(), but that would break the use case where git_path() handles certain arguments specially, e.g. "objects" which knows that the .git/objects/ path can be overridden via the environment.

I tried very hard to keep that working in my patch, essentially by emulating what git_path() does already when being called in a worktree's subdirectory: make the path absolute.

Ciao, Johannes

Previous: Mike RappazzoNext: Junio C Hamano
Message 8 of 27 in “rev-parse --git-path: fix output when running in a subdirectory”
  1. rev-parse --git-path: fix output when running in a subdirectoryJohannes Schindelin, Feb 8, 2017
  2. Junio C HamanoFeb 8, 2017
  3. Johannes SchindelinFeb 9, 2017
  4. Junio C HamanoFeb 9, 2017
  5. Jeff KingFeb 10, 2017
  6. Duy NguyenFeb 9, 2017
  7. Mike RappazzoFeb 9, 2017
  8. Johannes SchindelinFeb 9, 2017
  9. Junio C HamanoFeb 9, 2017
  10. Johannes SchindelinFeb 9, 2017
  11. Junio C HamanoFeb 9, 2017
  12. Mike RappazzoFeb 10, 2017
  13. Johannes SchindelinFeb 10, 2017
  14. 0/2 Fix bugs in rev-parse's output when run in a subdirectoryJohannes Schindelin, Feb 10, 2017
  15. 2/2 rev-parse: fix several options when running in a subdirectoryJohannes Schindelin, Feb 10, 2017
  16. Junio C HamanoFeb 10, 2017
  17. Johannes SchindelinFeb 17, 2017
  18. 1/2 rev-parse tests: add tests executed from a subdirectoryJohannes Schindelin, Feb 10, 2017
  19. Junio C HamanoFeb 10, 2017
  20. Johannes SchindelinFeb 17, 2017
  21. Junio C HamanoFeb 10, 2017
  22. Johannes SchindelinFeb 17, 2017
  23. Junio C HamanoFeb 10, 2017
  24. 0/2 Fix bugs in rev-parse's output when run in a subdirectoryJohannes Schindelin, Feb 17, 2017
  25. 1/2 rev-parse tests: add tests executed from a subdirectoryJohannes Schindelin, Feb 17, 2017
  26. 2/2 rev-parse: fix several options when running in a subdirectoryJohannes Schindelin, Feb 17, 2017
  27. Junio C HamanoFeb 17, 2017

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.