Re: newbie questions about git design and features (some wrt hg)
- From
Junio C Hamano <junkio@cox.net>
- Date
- Jan 31, 2007, 20:01 UTC
- Message-ID
- <7vabzzvud0.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <eppshi$1l4$1@sea.gmane.org>
Jakub Narebski <jnareb@gmail.com> writes:
Show 10 quoted lines
> Theodore Tso wrote: >> >> To be fair hg modifies files using O_APPEND only. That isn't quite as >> safe as "only creating new files", but it is relatively safe. > > From (libc.info): > -- Macro: int O_APPEND > ... > I don't quote understand how that would help hg (Mercurial) to have > operations like commit, pull/fetch or push atomic, i.e. all or nothing.
If I remember correctly, thanks to their log-like file format, they can rely on O_APPEND to do the right thing when growing, and aborting the current transaction is just a truncate away (or a set of truncates on the files appended in the transaction, if hg touches more than one log-like file but I do not know if hg uses only one file or more than one). That's one of the things I found clean and beautiful (from theoretical point of view, at least) in their design. I do not think O_APPEND is not used to control concurrent operations.