From: Junio C Hamano Date: Wed, 5 Oct 2011 19:35:53 +0000 (-0700) Subject: Merge branch 'nm/grep-object-sha1-lock' X-Git-Tag: v1.7.8-rc0~154 X-Git-Url: https://www.git.lorimer.id.au/gitweb.git/diff_plain/00723b02912cc9dae1ee5601ab4b942fdd42ff52?hp=1b840a56629c8c0620c261672cc5d4d35ba253fa Merge branch 'nm/grep-object-sha1-lock' * nm/grep-object-sha1-lock: grep: Fix race condition in delta_base_cache Conflicts: builtin/grep.c --- diff --git a/builtin/grep.c b/builtin/grep.c index 1c359c2671..a286692e46 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -598,8 +598,11 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec, struct strbuf base; int hit, len; + read_sha1_lock(); data = read_object_with_reference(obj->sha1, tree_type, &size, NULL); + read_sha1_unlock(); + if (!data) die(_("unable to read tree (%s)"), sha1_to_hex(obj->sha1));