Subject: Re: [PATCH v3] builtin/refs: add '--skip-reflog' flag to bypass reflog migration

From: Junio C Hamano <[email-masked]>
Date: Wed, 12 Feb 2025 14:25:10 -0800

Karthik Nayak <[email-masked]> writes:

> The 'git-refs(1)' migrate subcommand, which transfers repositories
> between reference backends, currently migrates reflogs by default as of
> 246cebe320 (refs: add support for migrating reflogs, 2024-12-16).
>
> While this behavior is desirable for most client-side repositories,
> server-side repositories are not expected to contain reflogs. However,
> due to historical reasons, some may still have them. This could be
> caused, for example, by bugs, misconfiguration, or an administrator
> enabling reflogs on the server for debugging purposes.
>
> To address this, introduce the --skip-reflog flag, allowing users to
> bypass reflog migration. This ensures that the repository ends up in the
> expected state after migration.

I do not quite understand the motivation behind this change.

If a repository has reflog that you do not need by mistake or
misconfiguration, I agree that there should be a way for you to
remove the reflog.  Removing it while converting the ref backend may
be a convenient way if and only if the reason why you noticed such a
repository with unwanted reflog is because you were about to migrate
it, but regardless of when you notice such refs with unwanted log,
you would want to be able to drop their logs.  You may not even be
planning to migrate your backend when you noticed that the refs have
unwanted log, you may have already migrated long time ago when you
noticed that the refs have unwanted log, or you may not even be
planning to migrate in the first place.  Even after you migrated
your backend, an administrator may have to enable reflog for
debugging, and then after the administrator is done, then what?
Should the backend migrated back from reftable to files and then
back again, only to pass this --skip-reflog option?

Wouldn't it be a lot more flexible if you add a new subcommand
"drop" to the "git reflog" command?