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

Re: [PATCH 0/9] setup_git_directory(): return to original cwd upon reaching .git

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Jul 24, 2010, 11:45 UTC
Message-ID
<AANLkTik44c_piRQopbK9utUS30E37LnjTMLs_Wp_8TV9@mail.gmail.com>
In-Reply-To
<20100724111505.GC7150@burratino>
2010/7/24 Jonathan Nieder <jrnieder@gmail.com>:
Show 13 quoted lines
> Hi Duy,
>
> Nguyễn Thái Ngọc Duy wrote:
>
>> Prefix and cwd should be consistent.
>
> I agree with this, but it took me a while to figure out why your fix
> is safe.  Here’s how I figured it out.
>
> Patch 1 cleans up the test script you added a test to.  After cleaning
> it up, it is clearer the test does not belong there.
>
> Patch 2 creates a proper home for the new test.

The test was originally to demostrate the breakage and apply was chosen because it's the first command I found applicable. I doubt if only "apply" (and index-pack) were affected.

But anyway, more tests can't harm git.
>
> Patches 3-7 split up setup_git_directory_gently() into small enough
> pieces that a person with a short attention span can read it now.
> No functional change intended.

Yeah. I tempted to clean up setup_*_gently too, by splitting the discovery path ($GIT_DIR check, chdir up...) and the real setup (bunch of global variables, prefix, check_format, set_git_dir) apart. The was painful and did not improve readability as much. I gave up.

> Patch 8 is your fix.  I removed the comment (which was just confusing
> me) and clarified the commit message to compensate
If that makes it easier to understand, I'm OK.
Show 7 quoted lines
> Patch 9 is your patch to revert the other, now redundant fix, also
> with commit message tweaks.
>
> After this exercise, your patches still look good. :)  Maybe these
> by-products could be useful somehow.
>
> Thoughts (especially improvements) welcome.
-- 
Duy
Previous: Jonathan Nieder
Message 20 of 20 in “worktree setup: return to original cwd if prefix is set NULL”
  1. 1/2 worktree setup: return to original cwd if prefix is set NULLNguyễn Thái Ngọc Duy, Jul 23, 2010
  2. 2/2 Revert "rehabilitate 'git index-pack' inside the object store"Nguyễn Thái Ngọc Duy, Jul 23, 2010
  3. Ævar Arnfjörð BjarmasonJul 23, 2010
  4. Nguyen Thai Ngoc DuyJul 24, 2010
  5. Ævar Arnfjörð BjarmasonJul 24, 2010
  6. 1/2 worktree setup: return to original cwd if prefix is set NULLNguyễn Thái Ngọc Duy, Jul 23, 2010
  7. 0/9 setup_git_directory(): return to original cwd upon reaching .gitJonathan Nieder, Jul 24, 2010
  8. 1/9 t1501 (rev-parse): clarifyJonathan Nieder, Jul 24, 2010
  9. 2/9 tests: try git apply from subdir of toplevelJonathan Nieder, Jul 24, 2010
  10. 3/9 setup: split off $GIT_DIR-set case from setup_git_directory_gentlyJonathan Nieder, Jul 24, 2010
  11. Nguyen Thai Ngoc DuyJul 24, 2010
  12. 4/9 setup: split off a function to checks working dir for .git fileJonathan Nieder, Jul 24, 2010
  13. Nguyen Thai Ngoc DuyJul 24, 2010
  14. Jonathan NiederJul 24, 2010
  15. 5/9 setup: split off code to handle stumbling upon a repositoryJonathan Nieder, Jul 24, 2010
  16. 6/9 setup: split off a function to handle hitting ceiling in repo searchJonathan Nieder, Jul 24, 2010
  17. 7/9 setup: split off get_device_or_die helperJonathan Nieder, Jul 24, 2010
  18. 8/9 setup: do not forget working dir from subdir of gitdirJonathan Nieder, Jul 24, 2010
  19. 9/9 Revert "rehabilitate 'git index-pack' inside the object store"Jonathan Nieder, Jul 24, 2010
  20. Nguyen Thai Ngoc DuyJul 24, 2010

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.