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

Re: [silly] loose, pack, and another thing?

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 3, 2023, 21:26 UTC
Message-ID
<xmqqo7hfwg6m.fsf@gitster.g>
In-Reply-To
<20231003190955.GA1562@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 5 quoted lines
> One thing that scares me about a regular "ln" between the worktree and
> odb is that you are very susceptible to corrupting the repository by
> modifying the worktree file with regular tools. If they do a complete
> rewrite and atomic rename (or link) to put the new file in place, that
> is OK. But opening the file for appending, or general writing, is bad.
Very true.
> You can get some safety with the immutable attribute (which applies to
> the inode itself, and thus any path that hardlinks to it). But setting
> that usually requires being root. And it creates other irritations for
> normal use (you have to unset it before even removing the hardlink).

As a regular user, "chmod a-w" has the same characteristics (works at the inode level) but without "cannot remove it" downside. It used to be sufficient in RCS and CVS days, though, as a signal that you are only to look at it without touching it, to "chmod a-w" a path that is checked out but not for modifying. Some editors even offer to do chmod u+w for you when saving, so if we want absolute safety, it may not be enough.

> It would be nice if there was some portable copy-on-write abstraction we
> could rely on, but I don't think there is one.
;-)
Previous: Jeff KingNext: Jeff King
Message 6 of 7 in “[silly] loose, pack, and another thing?”
  1. Junio C HamanoSep 27, 2023
  2. Christian CouderSep 27, 2023
  3. Jonathan TanSep 28, 2023
  4. Jonathan TanSep 28, 2023
  5. Jeff KingOct 3, 2023
  6. Junio C HamanoOct 3, 2023
  7. Jeff KingOct 4, 2023

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.