aboutsummaryrefslogtreecommitdiff
path: root/t/t5304-prune.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-12-05 20:02:54 +0700
committerJunio C Hamano <gitster@pobox.com>2013-12-10 16:14:19 -0800
commiteab3296c7e5c99f559818357e70eeae09c24ac99 (patch)
treee8ded7e86858b5a28315e8b4d7687235f0e5e2d7 /t/t5304-prune.sh
parent0d7d285f0e29abb994fe32db87ee81b00f403bd2 (diff)
downloadgit-eab3296c7e5c99f559818357e70eeae09c24ac99.tar.gz
git-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 't/t5304-prune.sh')
-rwxr-xr-xt/t5304-prune.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index e4bb3a145..66c9a4173 100755
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -221,4 +221,14 @@ EOF
test_cmp expected actual
'
+test_expect_success 'prune .git/shallow' '
+ SHA1=`echo hi|git commit-tree HEAD^{tree}` &&
+ echo $SHA1 >.git/shallow &&
+ git prune --dry-run >out &&
+ grep $SHA1 .git/shallow &&
+ grep $SHA1 out &&
+ git prune &&
+ ! test -f .git/shallow
+'
+
test_done