From (libc.info):
-- Macro: int O_APPEND
The bit that enables append mode for the file. If set, then all
`write' operations write the data at the end of the file, extending
it, regardless of the current file position. This is the only
reliable way to append to a file. In append mode, you are
guaranteed that the data you write will always go to the current
end of the file, regardless of other processes writing to the
file. Conversely, if you simply set the file position to the end
of file and write, then another process can extend the file after
you set the file position but before you write, resulting in your
data appearing someplace before the real end of file.
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.
In hg you have to update individual files (blobs buckets) storing delta
and perhaps full version, update manifest file (flat tree) and update
changelog (commit): what happens if for example there are two concurrent
operations trying to update repository, e.g. two push operations in parallel
(from two different developers), or fetch from cron and commit? What
happens if operation is interrupted (e.g. lost connection to network during
fetch)?
In git both situations result in some prune-able and fsck-visible crud in
repository, but repository stays uncorrupted, and all operations are atomic
(all or nothing).
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html