aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index da6e9e7f49..e87847fa4b 100644
--- a/diff.c
+++ b/diff.c
@@ -5224,6 +5224,8 @@ static int diff_opt_find_object(const struct option *option,
struct object_id oid;
BUG_ON_OPT_NEG(unset);
+ if (!startup_info->have_repository)
+ return error(_("--find-object requires a git repository"));
if (repo_get_oid(the_repository, arg, &oid))
return error(_("unable to resolve '%s'"), arg);