Merge branch 'mm/diff-no-index-find-object' into next

"git diff --no-index --find-object=<object-name>" outside a
repository of course wouldn't be able to find the object and died
while parsing the command line, which is made to die in a bit more
user-friendly way.

* mm/diff-no-index-find-object:
  diff: fix crash with --find-object outside repository
This commit is contained in:
Junio C Hamano
2026-03-03 13:41:21 -08:00
2 changed files with 12 additions and 0 deletions

2
diff.c
View File

@@ -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);