summaryrefslogtreecommitdiff
path: root/builtin/grep.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-01-29 12:47:56 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-01-29 12:47:56 -0800
commit371820d5f1bb3c3e691ad21cee652c02c36ea758 (patch)
treead479bc8fd4e4c59c93807fe47355ef6fccf68e5 /builtin/grep.c
parentMerge branch 'jt/upload-pack-deepen-relative-proto-v2' (diff)
parentcache: make oidcpy always copy GIT_MAX_RAWSZ bytes (diff)
downloadtgif-371820d5f1bb3c3e691ad21cee652c02c36ea758.tar.xz
Merge branch 'bc/tree-walk-oid'
The code to walk tree objects has been taught that we may be working with object names that are not computed with SHA-1. * bc/tree-walk-oid: cache: make oidcpy always copy GIT_MAX_RAWSZ bytes tree-walk: store object_id in a separate member match-trees: use hashcpy to splice trees match-trees: compute buffer offset correctly when splicing tree-walk: copy object ID before use
Diffstat (limited to 'builtin/grep.c')
-rw-r--r--builtin/grep.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index dc91838764..dd52ea968b 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -570,7 +570,7 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
strbuf_add(base, entry.path, te_len);
if (S_ISREG(entry.mode)) {
- hit |= grep_oid(opt, entry.oid, base->buf, tn_len,
+ hit |= grep_oid(opt, &entry.oid, base->buf, tn_len,
check_attr ? base->buf + tn_len : NULL);
} else if (S_ISDIR(entry.mode)) {
enum object_type type;
@@ -578,10 +578,10 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
void *data;
unsigned long size;
- data = lock_and_read_oid_file(entry.oid, &type, &size);
+ data = lock_and_read_oid_file(&entry.oid, &type, &size);
if (!data)
die(_("unable to read tree (%s)"),
- oid_to_hex(entry.oid));
+ oid_to_hex(&entry.oid));
strbuf_addch(base, '/');
init_tree_desc(&sub, data, size);
@@ -589,7 +589,7 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
check_attr, repo);
free(data);
} else if (recurse_submodules && S_ISGITLINK(entry.mode)) {
- hit |= grep_submodule(opt, repo, pathspec, entry.oid,
+ hit |= grep_submodule(opt, repo, pathspec, &entry.oid,
base->buf, base->buf + tn_len);
}