Skip to content

Instantly share code, notes, and snippets.

@vmg
Created January 23, 2014 23:54
Show Gist options
  • Save vmg/8589317 to your computer and use it in GitHub Desktop.
Save vmg/8589317 to your computer and use it in GitHub Desktop.
From 4aa903b97d6532e46666f5aed966696716e5ee40 Mon Sep 17 00:00:00 2001
From: Vicent Marti <tanoku@gmail.com>
Date: Sat, 21 Dec 2013 14:33:46 +0100
Subject: [PATCH] Add `pack.honorpackkeep` config var
---
builtin/repack.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/builtin/repack.c b/builtin/repack.c
index e0c1b1e..89eb3aa 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -9,6 +9,7 @@
#include "argv-array.h"
static int delta_base_offset = 1;
+static int honor_pack_keep = 1;
static char *packdir, *packtmp;
static const char *const git_repack_usage[] = {
@@ -22,6 +23,10 @@ static int repack_config(const char *var, const char *value, void *cb)
delta_base_offset = git_config_bool(var, value);
return 0;
}
+ if (!strcmp(var, "repack.honorpackkeep")) {
+ honor_pack_keep = git_config_bool(var, value);
+ return 0;
+ }
return git_default_config(var, value, cb);
}
@@ -196,10 +201,11 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
argv_array_push(&cmd_args, "pack-objects");
argv_array_push(&cmd_args, "--keep-true-parents");
- argv_array_push(&cmd_args, "--honor-pack-keep");
argv_array_push(&cmd_args, "--non-empty");
argv_array_push(&cmd_args, "--all");
argv_array_push(&cmd_args, "--reflog");
+ if (honor_pack_keep)
+ argv_array_push(&cmd_args, "--honor-pack-keep");
if (window)
argv_array_pushf(&cmd_args, "--window=%u", window);
if (window_memory)
--
1.8.5.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment