Hi Patrick, On Mon, Jul 7, 2025 at 11:38 AM Patrick Steinhardt <ps@xxxxxx> wrote: > > On Fri, Jul 04, 2025 at 07:42:35PM +0530, Ayush Chandekar wrote: > > diff --git a/builtin/prune.c b/builtin/prune.c > > index dab3c19b6f..320e9c2341 100644 > > --- a/builtin/prune.c > > +++ b/builtin/prune.c > > @@ -173,20 +171,19 @@ int cmd_prune(int argc, > > expire = TIME_MAX; > > save_commit_buffer = 0; > > disable_replace_refs(); > > - repo_init_revisions(the_repository, &revs, prefix); > > > > argc = parse_options(argc, argv, prefix, options, prune_usage, 0); > > > > - if (the_repository->repository_format_precious_objects) > > + repo_init_revisions(repo, &revs, prefix); > > + if (repo->repository_format_precious_objects) > > die(_("cannot prune in a precious-objects repo")); > > > > Okay, we now only end up using the passed-in potentially-NULL `repo` > after we have called `parse_options`. Makes sense. > > > diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh > > index 6824581317..8f59b867f2 100755 > > --- a/t/t1517-outside-repo.sh > > +++ b/t/t1517-outside-repo.sh > > @@ -114,4 +114,11 @@ test_expect_success 'update-server-info does not crash with -h' ' > > test_grep "[Uu]sage: git update-server-info " usage > > ' > > > > +test_expect_success 'prune does not crash with -h' ' > > + test_expect_code 129 git prune -h >usage && > > + test_grep "[Uu]sage: git prune " usage && > > + test_expect_code 129 nongit git prune -h >usage && > > + test_grep "[Uu]sage: git prune " usage > > +' > > + > > test_done > > And we have another test that verifies that all of this works outside of > a repository. > > This addresses my review comments, so this version looks good to me. > Thanks! > > Patrick Thanks a lot for reviewing! Ayush