summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2014-02-27 05:56:31 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-02-27 12:04:23 -0800
commit0cc77c386cea7afebb54a5e7263ca37569ecfe7a (patch)
treee718edef67b0e74a1cdcb3850b0479aedb226585 /builtin
parentGit 1.9.0 (diff)
downloadtgif-0cc77c386cea7afebb54a5e7263ca37569ecfe7a.tar.xz
shallow: use stat_validity to check for up-to-date file
When we are about to write the shallow file, we check that it has not changed since we last read it. Instead of hand-rolling this, we can use stat_validity. This is built around the index stat-check, so it is more robust than just checking the mtime, as we do now (it uses the same check as we do for index files). The new code also handles the case of a shallow file appearing unexpectedly. With the current code, two simultaneous processes making us shallow (e.g., two "git fetch --depth=1" running at the same time in a non-shallow repository) can race to overwrite each other. As a bonus, we also remove a race in determining the stat information of what we read (we stat and then open, leaving a race window; instead we should open and then fstat the descriptor). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
0 files changed, 0 insertions, 0 deletions