summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-12-05 20:02:54 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-12-10 16:14:19 -0800
commiteab3296c7e5c99f559818357e70eeae09c24ac99 (patch)
treee8ded7e86858b5a28315e8b4d7687235f0e5e2d7 /builtin
parentclone: use git protocol for cloning shallow repo locally (diff)
downloadtgif-eab3296c7e5c99f559818357e70eeae09c24ac99.tar.xz
prune: clean .git/shallow after pruning objects
This patch teaches "prune" to remove shallow roots that are no longer reachable from any refs (e.g. when the relevant refs are removed). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/gc.c1
-rw-r--r--builtin/prune.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index c14190f840..cec8ecd754 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -16,6 +16,7 @@
#include "run-command.h"
#include "sigchain.h"
#include "argv-array.h"
+#include "commit.h"
#define FAILED_RUN "failed to run %s"
diff --git a/builtin/prune.c b/builtin/prune.c
index 6366917c6d..2214040349 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -170,5 +170,9 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
s = mkpathdup("%s/pack", get_object_directory());
remove_temporary_files(s);
free(s);
+
+ if (is_repository_shallow())
+ prune_shallow(show_only);
+
return 0;
}