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

Re: [PATCH] pack-refs: dereference .git/packed-refs if it is a symlink

From
Junio C Hamano <junkio@cox.net>
Date
Apr 21, 2007, 20:05 UTC
Message-ID
<7vk5w5trvl.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20070420165256.GA14318@xp.machine.xx>
Peter Baumann <waste.manager@gmx.de> writes:
Show 8 quoted lines
> git-new-workdir creates a new working directory where everything
> necessary, including .git/packed-refs, is symlinked to your master repo.
> But git-pack-refs breaks the symlink, so you could accidentally loose some
> refs.
>
> This fixes git-pack-refs to first dereference .git/packed-refs if it is a
> symlink. While we are it, add some tests to prevent this from happening
> again.

Because you are only fixing the case where the worktree is borrowing the packed-refs file from a real repository with a symlink trick, and we do not know if somebody had his packed-refs as a symlink to some random place for reasons other than creating a lightweight worktree (maybe there was a mistake), I am wondering if it makes sense to be more strict about the value we read from readlink().

For example, if it does not end with "/packed-refs", doesn't it suggest that the reason because the symlink is there is different from the case you are handling (i.e. it is not a packed-refs symlink in a lightweight worktree that points at the corresponding real repository)? I wonder if in such a case we would want to signal an error, instead of overwriting whatever real file the symlink points at. Or is it too strict and paranoid? I dunno.

Previous: Peter BaumannNext: Julian Phillips
Message 18 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.