diff options
author | Martin Ågren <martin.agren@gmail.com> | 2017-11-01 21:45:06 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-02 10:58:08 +0900 |
commit | 9560e6245a1a0b7483a57d7018e5b7a852fdba62 (patch) | |
tree | bc9dba86af84553eda04fe6c4008590d744e3c17 /t/t4150-am.sh | |
parent | grep: recurse in-process using 'struct repository' (diff) | |
download | tgif-9560e6245a1a0b7483a57d7018e5b7a852fdba62.tar.xz |
grep: take the read-lock when adding a submodule
With --recurse-submodules, we add each submodule that we encounter to
the list of alternate object databases. With threading, our changes to
the list are not protected against races. Indeed, ThreadSanitizer
reports a race when we call `add_to_alternates_memory()` around the same
time that another thread is reading in the list through
`read_sha1_file()`.
Take the grep read-lock while adding the submodule. The lock is used to
serialize uses of non-thread-safe parts of Git's API, including
`read_sha1_file()`.
Helped-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4150-am.sh')
0 files changed, 0 insertions, 0 deletions