summaryrefslogtreecommitdiff
path: root/tests/test-prune.sh
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2016-08-08 15:41:09 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2016-08-09 15:12:35 +0000
commitfd9536bb19dc70f14a9fe0f622f52aa80d36b85b (patch)
tree9e635567d80f2603bfc26b26e2f8db8c864cb32f /tests/test-prune.sh
parent056cc0543f2a965fbcb66952b9c9d295fdd2e865 (diff)
downloadostree-fd9536bb19dc70f14a9fe0f622f52aa80d36b85b.tar.gz
prune: Retain the tip of each ref even with date pruning
I hit an error with [CAHC](https://wiki.centos.org/SpecialInterestGroup/Atomic/Devel) where we were doing time-based pruning. `ostree summary -u` started failing, and it took me a bit to realize it was because we were pruning even the tip of old branches, which I was not at all expecting, and I don't think users will too. Perhaps in the future we could add some sort of --prune-ref-tips or something if people wanted it, but I doubt it. Closes: #445 Approved by: jlebon
Diffstat (limited to 'tests/test-prune.sh')
-rwxr-xr-xtests/test-prune.sh16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/test-prune.sh b/tests/test-prune.sh
index d32edbc0..5134d560 100755
--- a/tests/test-prune.sh
+++ b/tests/test-prune.sh
@@ -87,25 +87,31 @@ assert_file_has_content tombstonecommitcount "^1$"
${CMD_PREFIX} ostree prune --repo=repo --refs-only --depth=0 -v
find repo/objects -name '*.commit' | wc -l > commitcount
assert_file_has_content commitcount "^1$"
-${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="2010-10-29 12:43:29 +0000"
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="2005-10-29 12:43:29 +0000"
+${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="2010-10-29 12:43:29 +0000"
find repo/objects -name '*.commit' | wc -l > commitcount
assert_file_has_content commitcount "^3$"
${CMD_PREFIX} ostree --repo=repo prune --keep-younger-than="2015-10-29 12:43:29 +0000"
find repo/objects -name '*.commit' | wc -l > commitcount
-assert_file_has_content commitcount "^1$"
+assert_file_has_content commitcount "^2$"
${CMD_PREFIX} ostree prune --repo=repo --refs-only --depth=0 -v
find repo/objects -name '*.commit' | wc -l > commitcount
-assert_file_has_content commitcount "^1$"
+assert_file_has_content commitcount "^2$"
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="October 25 1985"
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="October 21 2015"
find repo/objects -name '*.commit' | wc -l > commitcount
-assert_file_has_content commitcount "^3$"
+assert_file_has_content commitcount "^4$"
${CMD_PREFIX} ostree --repo=repo prune --keep-younger-than="1 week ago"
find repo/objects -name '*.commit' | wc -l > commitcount
-assert_file_has_content commitcount "^1$"
+assert_file_has_content commitcount "^2$"
+
+${CMD_PREFIX} ostree --repo=repo commit --branch=oldcommit tree --timestamp="2005-10-29 12:43:29 +0000"
+oldcommit_rev=$($OSTREE --repo=repo rev-parse oldcommit)
+$OSTREE ls ${oldcommit_rev}
+${CMD_PREFIX} ostree --repo=repo prune --keep-younger-than="1 week ago"
+$OSTREE ls ${oldcommit_rev}
${CMD_PREFIX} ostree --repo=repo pull --depth=-1 origin test
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="November 05 1955"