summaryrefslogtreecommitdiff
path: root/reflog-walk.c
diff options
context:
space:
mode:
authorLibravatar Michael Haggerty <mhagger@alum.mit.edu>2017-01-06 17:22:33 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-01-07 19:30:09 -0800
commit1fb0c809859252f037286d32f56432444d65bd38 (patch)
treea72fe64688ababc3661d5012a24e11371742037f /reflog-walk.c
parentlog_ref_setup(): separate code for create vs non-create (diff)
downloadtgif-1fb0c809859252f037286d32f56432444d65bd38.tar.xz
log_ref_setup(): improve robustness against races
Change log_ref_setup() to use raceproof_create_file() to create the new logfile. This makes it more robust against a race against another process that might be trying to clean up empty directories while we are trying to create a new logfile. This also means that it will only call create_leading_directories() if open() fails, which should be a net win. Even in the cases where we are willing to create a new logfile, it will usually be the case that the logfile already exists, or if not then that the directory containing the logfile already exists. In such cases, we will save some work that was previously done unconditionally. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reflog-walk.c')
0 files changed, 0 insertions, 0 deletions