Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/grep.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index c8037388c6e..e58e57504c3 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);