Re: [PATCH 3/5] backfill: accept revision arguments
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Mar 23, 2026, 00:35 UTC
- Message-ID
- <89d1cc54-f2db-4177-ba5a-4d20a2cbd9c2@gmail.com>
- In-Reply-To
- <abvH6LUu953rrQzS@pks.im>
On 3/19/26 5:54 AM, Patrick Steinhardt wrote:
Show 23 quoted lines
> On Tue, Mar 17, 2026 at 12:29:19AM +0000, Derrick Stolee via GitGitGadget wrote: >> From: Derrick Stolee <stolee@gmail.com> >> >> The existing implementation of 'git backfill' only includes downloading >> missing blobs reachable from HEAD. Advanced uses may desire more general >> commit limiting options, such as '--all' for all references, specifying a >> commit range via negative references, or specifying a recency of use such as >> with '--since=<date>'. >> >> All of these options are available if we use setup_revisions() to parse the >> unknown arguments with the revision machinery. This opens up a large number >> of possibilities, only a small set of which are tested here. >> >> For documentation, we avoid duplicating the option documentation and instead >> link to the documentation of 'git rev-list'. >> >> Note that these arguments currently allow specifying a pathspec, which >> modifies the commit history checks but does not limit the paths used in the >> backfill logic. This will be updated in a future change. > > Makes me wonder whether reversing the order would have avoided this > slight awkwardness. But let's just stick with the current order, the end > result would be the same anyway.
True, we could have added the pathspec logic first, but we wouldn't be able to test it right away because the parsing comes through the rev-list.
Show 22 quoted lines
>> Signed-off-by: Derrick Stolee <stolee@gmail.com>
>> ---
>> Documentation/git-backfill.adoc | 3 +
>> builtin/backfill.c | 19 ++--
>> t/t5620-backfill.sh | 156 ++++++++++++++++++++++++++++++++
>> 3 files changed, 172 insertions(+), 6 deletions(-)
>>
>> diff --git a/builtin/backfill.c b/builtin/backfill.c
>> index e80fc1b694..1b5595b27c 100644
>> --- a/builtin/backfill.c
>> +++ b/builtin/backfill.c
>> @@ -92,13 +92,14 @@ static int do_backfill(struct backfill_context *ctx)
>> }
>> }
>>
>> - repo_init_revisions(ctx->repo, &revs, "");
>> - handle_revision_arg("HEAD", &revs, 0, 0);
>> + /* Walk from HEAD if otherwise unspecified. */
>> + if (!ctx->revs.pending.nr)
>> + handle_revision_arg("HEAD", &ctx->revs, 0, 0);
>
> Can we use `add_head_to_pending(&ctx->revs)` instead?Nice. We absolutely can and should.
Thanks, -Stolee