summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-02-27 10:56:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-02-27 20:04:23 (GMT)
commit0cc77c386cea7afebb54a5e7263ca37569ecfe7a (patch)
treee718edef67b0e74a1cdcb3850b0479aedb226585 /builtin
parent5f95c9f850b19b368c43ae399cc831b17a26a5ac (diff)
downloadgit-0cc77c386cea7afebb54a5e7263ca37569ecfe7a.zip
git-0cc77c386cea7afebb54a5e7263ca37569ecfe7a.tar.gz
git-0cc77c386cea7afebb54a5e7263ca37569ecfe7a.tar.bz2
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