log: clean unneeded objects during log --remerge-diff

The --remerge-diff option will need to create new blobs and trees
representing the "automatic merge" state.  If one is traversing a
long project history, one can easily get hundreds of thousands of
loose objects generated during `log --remerge-diff`.  However, none of
those loose objects are needed after we have completed our diff
operation; they can be summarily deleted.

Add a new helper function to tmp_objdir to discard all the contained
objects, and call it after each merge is handled.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren
2022-02-02 02:37:29 +00:00
committed by Junio C Hamano
parent db757e8b8d
commit 7b90ab467a
5 changed files with 28 additions and 7 deletions

View File

@@ -46,6 +46,12 @@ int tmp_objdir_migrate(struct tmp_objdir *);
*/
int tmp_objdir_destroy(struct tmp_objdir *);
/*
* Remove all objects from the temporary object directory, while leaving it
* around so more objects can be added.
*/
void tmp_objdir_discard_objects(struct tmp_objdir *);
/*
* Add the temporary object directory as an alternate object store in the
* current process.