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
This commit is contained in:
1 parent
056cc0543f
commit
fd9536bb19
2 files changed
+31
-5
No files matched your search
+11
-5
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user