]> git.ipfire.org Git - thirdparty/git.git/commit
refs: fix migration of reflogs respecting "core.logAllRefUpdates"
authorPatrick Steinhardt <ps@pks.im>
Wed, 22 Jan 2025 09:48:06 +0000 (10:48 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Jan 2025 18:00:33 +0000 (10:00 -0800)
commita0bea0978fe80a64e7ccc27d9cafc1725a61e6dc
tree0e28acea8429aa07deed0ba66ab61f6fd2f87548
parent8ddcdc1bb33ccf803461dd2365146f9341bf9312
refs: fix migration of reflogs respecting "core.logAllRefUpdates"

In 246cebe320 (refs: add support for migrating reflogs, 2024-12-16) we
have added support to git-refs(1) to migrate reflogs between reference
backends. It was reported [1] though that not we don't migrate reflogs
for a subset of references, most importantly "refs/stash".

This issue is caused by us still honoring "core.logAllRefUpdates" when
trying to migrate reflogs: we do queue the updates, but depending on the
value of that config we may decide to just skip writing the reflog entry
altogether. And given that:

  - The default for "core.logAllRefUpdates" is to only create reflogs
    for branches, remotes, note refs and "HEAD"

  - "refs/stash" is neither of these ref types.

We end up skipping the reflog creation for that particular reference.

Fix the bug by setting `REF_FORCE_CREATE_REFLOG`, which instructs the
ref backends to create the reflog entry regardless of the config or any
preexisting state.

[1]: <Z5BTQRlsOj1sygun@tapette.crustytoothpaste.net>

Reported-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
t/t1460-refs-migrate.sh