diff options
author | Phil Hord <phil.hord@gmail.com> | 2021-01-20 19:23:32 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-21 16:05:05 -0800 |
commit | 8198907795500a5054ad04507b9189cfa5431737 (patch) | |
tree | 72c6b5d84acb3f503b49dca7370a8a50d6cf9ccf /contrib/stats/mailmap.pl | |
parent | The third batch (diff) | |
download | tgif-8198907795500a5054ad04507b9189cfa5431737.tar.xz |
use delete_refs when deleting tags or branches
'git tag -d' accepts one or more tag refs to delete, but each deletion
is done by calling `delete_ref` on each argv. This is very slow when
removing from packed refs. Use delete_refs instead so all the removals
can be done inside a single transaction with a single update.
Do the same for 'git branch -d'.
Since delete_refs performs all the packed-refs delete operations
inside a single transaction, if any of the deletes fail then all
them will be skipped. In practice, none of them should fail since
we verify the hash of each one before calling delete_refs, but some
network error or odd permissions problem could have different results
after this change.
Also, since the file-backed deletions are not performed in the same
transaction, those could succeed even when the packed-refs transaction
fails.
After deleting branches, remove the branch config only if the branch
ref was removed and was not subsequently added back in.
A manual test deleting 24,000 tags took about 30 minutes using
delete_ref. It takes about 5 seconds using delete_refs.
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Phil Hord <phil.hord@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/stats/mailmap.pl')
0 files changed, 0 insertions, 0 deletions