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.
;-)