summaryrefslogtreecommitdiff
path: root/builtin/repack.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-03-20 18:43:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-20 19:41:38 (GMT)
commit8d422993617be42a48a54fd7325d5ba5350c1082 (patch)
treed45cdb4f36b544a6b76a04a45a6694b27e8fa292 /builtin/repack.c
parentff4056bbc35aa499f449cbab46702a76cea0e532 (diff)
downloadgit-8d422993617be42a48a54fd7325d5ba5350c1082.zip
git-8d422993617be42a48a54fd7325d5ba5350c1082.tar.gz
git-8d422993617be42a48a54fd7325d5ba5350c1082.tar.bz2
repack: turn on "ref paranoia" when doing a destructive repack
If we are repacking with "-ad", we will drop any unreachable objects. Likewise, using "-Ad --unpack-unreachable=<time>" will drop any old, unreachable objects. In these cases, we want to make sure the reachability we compute with "--all" is complete. We can do this by passing GIT_REF_PARANOIA=1 in the environment to pack-objects. Note that "-Ad" is safe already, because it only loosens unreachable objects. It is up to "git prune" to avoid deleting them. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/repack.c')
-rw-r--r--builtin/repack.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index 3f852f3..2fe1b30 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -228,13 +228,17 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
get_non_kept_pack_filenames(&existing_packs);
if (existing_packs.nr && delete_redundant) {
- if (unpack_unreachable)
+ if (unpack_unreachable) {
argv_array_pushf(&cmd.args,
"--unpack-unreachable=%s",
unpack_unreachable);
- else if (pack_everything & LOOSEN_UNREACHABLE)
+ argv_array_push(&cmd.env_array, "GIT_REF_PARANOIA=1");
+ } else if (pack_everything & LOOSEN_UNREACHABLE) {
argv_array_push(&cmd.args,
"--unpack-unreachable");
+ } else {
+ argv_array_push(&cmd.env_array, "GIT_REF_PARANOIA=1");
+ }
}
} else {
argv_array_push(&cmd.args, "--unpacked");