Re: [GSoC] [PATCH] builtin/gc: Replace run_command with C function refs_pack_refs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024-03-28 12:00, vk wrote:
Replace "git pack-refs" with C function refs_pack_refs
for maintenance_task_pack_refs(). C function refs_pack_refs
can be called directly, hence saving an external process.
---
 builtin/gc.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/builtin/gc.c b/builtin/gc.c
index 3c874b248b..b55c5f5225 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -42,6 +42,8 @@
 #include "setup.h"
 #include "trace2.h"

+#include <revision.h>
+
 #define FAILED_RUN "failed to run %s"

 static const char * const builtin_gc_usage[] = {
@@ -218,14 +220,29 @@ static int pack_refs_condition(void)

static int maintenance_task_pack_refs(MAYBE_UNUSED struct maintenance_run_opts *opts)
 {
-	struct child_process cmd = CHILD_PROCESS_INIT;

-	cmd.git_cmd = 1;
-	strvec_pushl(&cmd.args, "pack-refs", "--all", "--prune", NULL);
-	if (opts->auto_flag)
-		strvec_push(&cmd.args, "--auto");

I forgot to add this --auto optional logic. Will add it in the following patch.

Thanks





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux