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

Re: rev-parse --show-toplevel broken during exec'ed rebase?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 12, 2018, 14:49 UTC
Message-ID
<nycvar.QRO.7.76.6.1807121647310.75@tvgsbejvaqbjf.bet>
In-Reply-To
<CAF8PYMikJZF4Qk4VHhAUPB80LG=gjZBVNBu0yGKCLLPpdG_3sg@mail.gmail.com>
Hi Vitali,
[please avoid top-posting on this mailing list]
On Wed, 11 Jul 2018, Vitali Lovich wrote:
Show 25 quoted lines
> On Wed, Jul 11, 2018 at 7:50 PM Vitali Lovich <vlovich@gmail.com> wrote:
> >
> > Typically git rev-parse --show-toplevel prints the folder containing
> > the .git folder regardless what subdirectory one is in.  One exception
> > I have found is that if one is within the context of git rebase --exec
> > then show-toplevel always just prints the current directory it's
> > running from.
> >
> > Repro (starting with cwd within git project):
> > > (cd xdiff; git rev-parse --show-toplevel)
> > ... path to git repository
> > > git rebase -i 18404434bf406f6a6f892ed73320c5cf9cc187dd
> > # Stop at some commit for editing
> > > (cd xdiff; git rev-parse --show-toplevel)
> > ... path to git repository
> > > git rebase 18404434bf406f6a6f892ed73320c5cf9cc187dd -x "(cd xdiff; git rev-parse --show-toplevel)"
> > ... path to git repository/xdiff !!!
> >
> > This seems like incorrect behaviour to me since it's a weird
> > inconsistency (even with other rebase contexts) & the documentation
> > says "Show the absolute path of the top-level directory." with no
> > caveats.
>
> Sorry.  Forgot to include the git versions I tested with (2.13.1,
> 2.17.0, 2.18.0)

This is actually not so much a bug in `rebase` as in `rev-parse --show-top-level`:

	$ GIT_DIR=$PWD/.git git -C xdiff rev-parse --show-toplevel
	C:/git-sdk-64/usr/src/git/xdiff

Ciao, Johannes

Previous: Vitali LovichNext: Johannes Schindelin
Message 3 of 22 in “rev-parse --show-toplevel broken during exec'ed rebase?”
  1. Vitali LovichJul 12, 2018
  2. Vitali LovichJul 12, 2018
  3. Johannes SchindelinJul 12, 2018
  4. Johannes SchindelinJul 12, 2018
  5. Junio C HamanoJul 12, 2018
  6. Vitali LovichJul 12, 2018
  7. brian m. carlsonJul 13, 2018
  8. Jeff KingJul 13, 2018
  9. brian m. carlsonJul 13, 2018
  10. sequencer: pass absolute GIT_WORK_TREE to exec commandsbrian m. carlson, Jul 14, 2018
  11. Jeff KingJul 14, 2018
  12. brian m. carlsonJul 14, 2018
  13. sequencer: pass absolute GIT_WORK_TREE to exec commandsbrian m. carlson, Jul 14, 2018
  14. Jeff KingJul 14, 2018
  15. Johannes SchindelinJul 14, 2018
  16. brian m. carlsonJul 14, 2018
  17. Junio C HamanoJul 16, 2018
  18. Jeff KingJul 16, 2018
  19. Junio C HamanoJul 16, 2018
  20. Johannes SchindelinJul 19, 2018
  21. SZEDER GáborJul 19, 2018
  22. Junio C HamanoJul 19, 2018

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.