diff options
| author | Junio C Hamano <gitster@pobox.com> | 2020-10-27 15:09:46 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2020-10-27 15:09:46 -0700 |
| commit | ae84e924dafbaf1eb907065e9fc9c246acb2c265 (patch) | |
| tree | f1772106851cabdd043098b30250c62a1c712d6d /builtin/grep.c | |
| parent | 63e52739d272278d89dc9f2a78d1f9887ef28732 (diff) | |
| parent | 5eb2ed691b809a55b024b8c10739254ea2ac48b7 (diff) | |
| download | git-ae84e924dafbaf1eb907065e9fc9c246acb2c265.tar.gz | |
Merge branch 'rs/tighten-callers-of-deref-tag'
Code clean-up.
* rs/tighten-callers-of-deref-tag:
line-log: handle deref_tag() returning NULL
blame: handle deref_tag() returning NULL
grep: handle deref_tag() returning NULL
Diffstat (limited to 'builtin/grep.c')
| -rw-r--r-- | builtin/grep.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index c8037388c6..e58e57504c 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -670,6 +670,17 @@ static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec, NULL, 0); obj_read_unlock(); + if (!real_obj) { + char hex[GIT_MAX_HEXSZ + 1]; + const char *name = list->objects[i].name; + + if (!name) { + oid_to_hex_r(hex, &list->objects[i].item->oid); + name = hex; + } + die(_("invalid object '%s' given."), name); + } + /* load the gitmodules file for this rev */ if (recurse_submodules) { submodule_free(opt->repo); |
