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

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

From
Jeff King <peff@peff.net>
Date
Jul 16, 2018, 18:39 UTC
Message-ID
<20180716183942.GB22298@sigill.intra.peff.net>
In-Reply-To
<xmqqsh4jt5d0.fsf@gitster-ct.c.googlers.com>
On Mon, Jul 16, 2018 at 11:14:51AM -0700, Junio C Hamano wrote:
Show 18 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > None of which is too surprising. The root of the bug is in the
> > conversion to rebase--helper, I think, when presumably we started
> > setting GIT_DIR at all (but I didn't dig further). Then 09d7b6c6fa fixed
> > _one_ fallout of that, which was relative paths, but didn't help the
> > subdirectory case.
> >
> > Just reading over this thread, I suspect the simplest fix is to pass
> > GIT_DIR and GIT_WORK_TREE together, which is almost always the right
> > thing to do.
> 
> Perhaps.  Not exporting GIT_DIR (unless the end-user already did to
> the environment before starting "git rebase"---it would be a bad
> change to unexport it unconditionally) may probably be a way to make
> rebase--helper conversion more faithful to the original scripted
> Porcelain, but I suspect in practice always giving GIT_DIR and
> GIT_WORK_TREE would work well for many existing hooks.

Yeah, that may be an option. I don't remember if this was discussed in this thread or elsewhere, but setting GIT_DIR is a regression for hooks, etc, which do:

  git -C /some/other/repo log

or similar. I'm not sure if that falls under "actual regression" or "just how it happened to work in the past". I'm not even sure it worked that way _consistently_ in the past.

The best practice if you're switching directories is to do:
  unset $(git rev-parse --local-env-vars)
though I highly doubt that most people bother.
-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 18 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.