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

Re: [PATCH] multi-pack-index: fix --object-dir from outside repo

From
Johannes Berg <johannes@sipsolutions.net>
Date
Aug 23, 2021, 08:10 UTC
Message-ID
<caafaf945ec43ba606b054bf4c4faa42e35a8db1.camel@sipsolutions.net>
In-Reply-To
<xmqqo89osi0b.fsf@gitster.g>
On Mon, 2021-08-23 at 01:05 -0700, Junio C Hamano wrote:
Show 14 quoted lines
> Johannes Berg <johannes@sipsolutions.net> writes:
> 
> > I just needed to go outside the current test git directory, the tests
> > are running in a way that the current working directory is already the
> > git tree I'm operating in.
> > 
> > > Even if you mean to use "cd",
> > > please do so within a sub-shell.
> > 
> > I thought about it, but clearly all the tests are run in a sub-shell, so
> > it didn't seem necessary? But happy to change, I don't really care
> > either way.
> 
> Please learn to care before you write your next test, then ;-)
Hey now, I'm fixing your segfaults ;-)
> These tests are not run in a sub-shell; they are eval'ed, so that
> the assignment they make to variables can persist and affect the
> next test piece.

Makes sense. FWIW, the test *did* restore the CWD so things worked, and subshells are actually ugly (need to import test-lib-functions.sh again if you want to use those), but I'll make it work somehow.

More importantly, how do you feel about the "cd /"?

The tests are always run in a place where there's a parent git folder (even if it's git itself), so you cannot reproduce the segfault in a test without the "cd /", though I guess "cd /tmp" would also work or something, but "cd /" felt pretty safe, hopefully not many people have "/.git" on their system.

johannes
Previous: Junio C HamanoNext: Derrick Stolee
Message 5 of 11 in “multi-pack-index: fix --object-dir from outside repo”
  1. multi-pack-index: fix --object-dir from outside repoJohannes Berg, Aug 20, 2021
  2. Derrick StoleeAug 22, 2021
  3. Johannes BergAug 23, 2021
  4. Junio C HamanoAug 23, 2021
  5. Johannes BergAug 23, 2021
  6. Derrick StoleeAug 23, 2021
  7. Johannes BergAug 23, 2021
  8. Junio C HamanoAug 23, 2021
  9. Junio C HamanoAug 23, 2021
  10. Taylor BlauAug 23, 2021
  11. Johannes BergAug 23, 2021

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.