mbox series

[0/2] EDITME: cover title for 493-add-command-to-purge-reflog-entries

Message ID 20250307-493-add-command-to-purge-reflog-entries-v1-0-84ab8529cf9e@gmail.com (mailing list archive)
Headers show
Series EDITME: cover title for 493-add-command-to-purge-reflog-entries | expand

Message

Karthik Nayak March 7, 2025, 11:17 a.m. UTC
Documentation/git-reflog.adoc |  6 ++++
 builtin/reflog.c              | 84 +++++++++++++++++++++++++++++++++++--------
 t/t1410-reflog.sh             | 55 ++++++++++++++++++++++++++++
 3 files changed, 130 insertions(+), 15 deletions(-)

Karthik Nayak (2):
      reflog: drop usage of global variables
      reflog: implement subcommand to drop reflogs

This patch series adds a new 'drop' subcommand to git-reflog that allows
users to delete the reflog for a specified reference. Additionally, it
adds an '--all' flag to enable dropping all reflogs in a repository.
This is a followup to the discussion we had when I sent in a patch to
add '--no-reflog' option to 'git refs migrate' [1].

While 'git-reflog(1)' currently allows users to expire reflogs and
delete individual entries, it lacks functionality to completely remove
reflogs for specific references. This becomes problematic in
repositories where reflogs are not needed but continue to accumulate
entries despite setting 'core.logAllRefUpdates=false'.

The first patch is a small cleanup which ensures that 'builtin/reflog.c' no
longer uses global variables. The second patch add the required changes.

[1]: https://lore.kernel.org/all/xmqqa5aqu7g9.fsf@gitster.g/



base-commit: e969bc875963a10890d61ba84eab3a460bd9e535
change-id: 20250306-493-add-command-to-purge-reflog-entries-bd22547ad34a

Thanks
- Karthik

Comments

Kristoffer Haugsbakk March 10, 2025, 7:39 a.m. UTC | #1
On Fri, Mar 7, 2025, at 12:17, Karthik Nayak wrote:
> This patch series adds a new 'drop' subcommand to git-reflog that allows
> users to delete the reflog for a specified reference. Additionally, it
> adds an '--all' flag to enable dropping all reflogs in a repository.
> This is a followup to the discussion we had when I sent in a patch to
> add '--no-reflog' option to 'git refs migrate' [1].

I’ve been wanting a command to drop reflogs.  I use `always` and get a
lot of entries that I don’t care about.  But I don’t want to set it to
`true` because I care about some of them.

So this is great.
Karthik Nayak March 10, 2025, 12:34 p.m. UTC | #2
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:

> On Fri, Mar 7, 2025, at 12:17, Karthik Nayak wrote:
>> This patch series adds a new 'drop' subcommand to git-reflog that allows
>> users to delete the reflog for a specified reference. Additionally, it
>> adds an '--all' flag to enable dropping all reflogs in a repository.
>> This is a followup to the discussion we had when I sent in a patch to
>> add '--no-reflog' option to 'git refs migrate' [1].
>
> I’ve been wanting a command to drop reflogs.  I use `always` and get a
> lot of entries that I don’t care about.  But I don’t want to set it to
> `true` because I care about some of them.
>
> So this is great.
>

That's good to know! I was surprised that this didn't exist till date.

> --
> Kristoffer Haugsbakk
Junio C Hamano March 10, 2025, 3:28 p.m. UTC | #3
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:

> I’ve been wanting a command to drop reflogs.  I use `always` and get a
> lot of entries that I don’t care about.  But I don’t want to set it to
> `true` because I care about some of them.

I am not sure what these references to always and true are about,
but nevertheless, instead of having to release entries one by one
with "git reflog delete", a command that lets you discard all the
reflog entries for a given ref would be a great addition to the
toolset.

Thanks for commenting.