Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2022-02-02 05:37:29 +0300
committerJunio C Hamano <gitster@pobox.com>2022-02-02 21:02:27 +0300
commit7b90ab467a658b2fb1b7c15c7d634e06f35f4ef2 (patch)
tree223e2be7ced848f782226bc6bd984f065f0cf546 /tmp-objdir.c
parentdb757e8b8d5527c195c461a04ec35d141ddea48e (diff)
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>
Diffstat (limited to 'tmp-objdir.c')
-rw-r--r--tmp-objdir.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tmp-objdir.c b/tmp-objdir.c
index 3d38eeab66..adf6033549 100644
--- a/tmp-objdir.c
+++ b/tmp-objdir.c
@@ -79,6 +79,11 @@ static void remove_tmp_objdir_on_signal(int signo)
raise(signo);
}
+void tmp_objdir_discard_objects(struct tmp_objdir *t)
+{
+ remove_dir_recursively(&t->path, REMOVE_DIR_KEEP_TOPLEVEL);
+}
+
/*
* These env_* functions are for setting up the child environment; the
* "replace" variant overrides the value of any existing variable with that