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

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

From
PBPeter Baumann <waste.manager@gmx.de>
Date
Apr 18, 2007, 08:11 UTC
Message-ID
<20070418081122.GB32634@xp.machine.xx>
In-Reply-To
<7v7isajfl1.fsf@assigned-by-dhcp.cox.net>
On Wed, Apr 18, 2007 at 12:40:10AM -0700, Junio C Hamano wrote:
Show 35 quoted lines
> Peter Baumann <waste.manager@gmx.de> writes:
> 
> > The problem is, when I created the new workdir, I don't have a file
> > .git/packed-refs, so a new workdir was created with a dangling symlink,
> > e.g.  workdir/.git/packed-refs -> repo/.git/packed-refs (but the last one
> > doesn't exist). As it seems, git gc removes the dangling symlink and
> > replaces it with a file.
> 
> Yes, packed-refs file is creat-to-temp-and-then-rename, and we
> will lose the sharing if it is run in the symlink-shared work
> tree.
> 
> 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.

-Peter
Previous: Junio C HamanoNext: Julian Phillips
Message 6 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.