diff options
author | Jeff King <peff@peff.net> | 2014-10-15 18:42:22 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-10-16 10:10:43 -0700 |
commit | 33d4221c79c89844bed6b9558cc2bc497251ef70 (patch) | |
tree | b4a7b668169de14ba0d6033d299d97cb8df1b823 /ppc | |
parent | pack-objects: match prune logic for discarding objects (diff) | |
download | tgif-33d4221c79c89844bed6b9558cc2bc497251ef70.tar.xz |
write_sha1_file: freshen existing objects
When we try to write a loose object file, we first check
whether that object already exists. If so, we skip the
write as an optimization. However, this can interfere with
prune's strategy of using mtimes to mark files in progress.
For example, if a branch contains a particular tree object
and is deleted, that tree object may become unreachable, and
have an old mtime. If a new operation then tries to write
the same tree, this ends up as a noop; we notice we
already have the object and do nothing. A prune running
simultaneously with this operation will see the object as
old, and may delete it.
We can solve this by "freshening" objects that we avoid
writing by updating their mtime. The algorithm for doing so
is essentially the same as that of has_sha1_file. Therefore
we provide a new (static) interface "check_and_freshen",
which finds and optionally freshens the object. It's trivial
to implement freshening and simple checking by tweaking a
single parameter.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ppc')
0 files changed, 0 insertions, 0 deletions