summaryrefslogtreecommitdiff
path: root/imap-send.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-10-15 22:42:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-16 17:10:43 (GMT)
commit33d4221c79c89844bed6b9558cc2bc497251ef70 (patch)
treeb4a7b668169de14ba0d6033d299d97cb8df1b823 /imap-send.c
parentabcb86553d3ec4afffa4e3963089dffe0559740e (diff)
downloadgit-33d4221c79c89844bed6b9558cc2bc497251ef70.zip
git-33d4221c79c89844bed6b9558cc2bc497251ef70.tar.gz
git-33d4221c79c89844bed6b9558cc2bc497251ef70.tar.bz2
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 'imap-send.c')
0 files changed, 0 insertions, 0 deletions