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

Re: [BUG] git-new-workdir doesn't understand packed refs

From
Julian Phillips <julian@quantumfyre.co.uk>
Date
Apr 18, 2007, 11:55 UTC
Message-ID
<Pine.LNX.4.64.0704181251040.19261@reaper.quantumfyre.co.uk>
In-Reply-To
<20070418081122.GB32634@xp.machine.xx>
On Wed, 18 Apr 2007, Peter Baumann wrote:
Show 29 quoted lines
> On Wed, Apr 18, 2007 at 12:40:10AM -0700, Junio C Hamano wrote:
>>
>> We can do one of two things.  I am not sure which one is better.
>>
>>  (0) The effect of 'git gc' by definition in the symlink-shared
>>      work tree should be the same as in the original repository
>>      as the former is to share all the refspace and object
>>      database.  So we _could_ declare that running 'git gc' in
>>      symlink-shared work tree is insane and educate people to
>>      run that in the original repository.  This is _not_ doing
>>      anything.
>>
>>  (1) We could by convention declare a worktree whose .git/refs
>>      is a symlink, and have git-gc and friends check for it, and
>>      either refuse to run or automatically chdir and run there.
>>
>>      If we were to do this, we probably should check more than
>>      just .git/refs but some other symlinks under .git/ as well.
>>
>>  (2) We could dereference .git/packed-refs, when it is a
>>      symlink, by hand, just like we dereference a symlink HEAD
>>      by hand (see resolve_ref() in refs.c), and run the
>>      creat-to-temp-and-then-rename sequence to update the real
>>      file that is pointed at by it.
>>
>
> Its not all the clear which one is the best, but (2) sounds as the most
> promosing aproach. Hopefully, I'll have time to cook up a patch this
> evening.

Personally I think (1) might be slightly better, in the refuse to run form. gc is a repository operation, not a working directory one - and by refusing to run in a workdir this is made clear. You could print out a message that includes the location of the actual repo to be more friendly though.

But whatever solution you go for, you can't use _any_ workdir that points at a repo that is having gc run on, either directly or indirectly, without risky odd behaviour.

-- 
Julian

  ---
Q:	How many supply-siders does it take to change a light bulb?
A:	None.  The darkness will cause the light bulb to change by itself.
Previous: Peter BaumannNext: Junio C Hamano
Message 7 of 22 in “[BUG] git-new-workdir doesn't understand packed refs”
  1. Peter BaumannApr 17, 2007
  2. Julian PhillipsApr 17, 2007
  3. Peter BaumannApr 18, 2007
  4. Julian PhillipsApr 18, 2007
  5. Junio C HamanoApr 18, 2007
  6. Peter BaumannApr 18, 2007
  7. Julian PhillipsApr 18, 2007
  8. Junio C HamanoApr 18, 2007
  9. Peter BaumannApr 18, 2007
  10. Junio C HamanoApr 18, 2007
  11. Peter BaumannApr 18, 2007
  12. Junio C HamanoApr 18, 2007
  13. Peter BaumannApr 18, 2007
  14. Junio C HamanoApr 18, 2007
  15. Add test for symlinked .git/packed-refsPeter Baumann, Apr 19, 2007
  16. Junio C HamanoApr 19, 2007
  17. pack-refs: dereference .git/packed-refs if it is a symlinkPeter Baumann, Apr 20, 2007
  18. Junio C HamanoApr 21, 2007
  19. Julian PhillipsApr 18, 2007
  20. pack-refs: dereference .git/packed-refs if it is a symlinkPeter Baumann, Apr 18, 2007
  21. Linus TorvaldsApr 18, 2007
  22. Peter BaumannApr 18, 2007

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.