aboutsummaryrefslogtreecommitdiff
path: root/replace-object.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-02-14 12:54:20 -0800
committerJunio C Hamano <gitster@pobox.com>2020-02-14 12:54:20 -0800
commit56ceb64eb0377acb2884226d4fb7d7c3f4032354 (patch)
tree3ab8775533954b285d1abf67d2ea0f53c7149154 /replace-object.h
parent0da63da7942ce810126cd54d9f72a46f3d616895 (diff)
parentf1928f04b2510c522c25d482e6ab4a17077add9a (diff)
downloadgit-56ceb64eb0377acb2884226d4fb7d7c3f4032354.tar.xz
Merge branch 'mt/threaded-grep-in-object-store'
Traditionally, we avoided threaded grep while searching in objects (as opposed to files in the working tree) as accesses to the object layer is not thread-safe. This limitation is getting lifted. * mt/threaded-grep-in-object-store: grep: use no. of cores as the default no. of threads grep: move driver pre-load out of critical section grep: re-enable threads in non-worktree case grep: protect packed_git [re-]initialization grep: allow submodule functions to run in parallel submodule-config: add skip_if_read option to repo_read_gitmodules() grep: replace grep_read_mutex by internal obj read lock object-store: allow threaded access to object reading replace-object: make replace operations thread-safe grep: fix racy calls in grep_objects() grep: fix race conditions at grep_submodule() grep: fix race conditions on userdiff calls
Diffstat (limited to 'replace-object.h')
-rw-r--r--replace-object.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/replace-object.h b/replace-object.h
index 04ed7a85a2..3fbc32eb7b 100644
--- a/replace-object.h
+++ b/replace-object.h
@@ -24,12 +24,17 @@ const struct object_id *do_lookup_replace_object(struct repository *r,
* name (replaced recursively, if necessary). The return value is
* either sha1 or a pointer to a permanently-allocated value. When
* object replacement is suppressed, always return sha1.
+ *
+ * Note: some thread debuggers might point a data race on the
+ * replace_map_initialized reading in this function. However, we know there's no
+ * problem in the value being updated by one thread right after another one read
+ * it here (and it should be written to only once, anyway).
*/
static inline const struct object_id *lookup_replace_object(struct repository *r,
const struct object_id *oid)
{
if (!read_replace_refs ||
- (r->objects->replace_map &&
+ (r->objects->replace_map_initialized &&
r->objects->replace_map->map.tablesize == 0))
return oid;
return do_lookup_replace_object(r, oid);