Add test to check prune
command retains tagged unpushed objects
#4962
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In PR #742 the
git lfs prune
command was introduced along with accompanying tests, one of which is the"prune keep unpushed"
test that checks whether Git LFS objects referenced by not-yet-pushed commits are always retained bygit lfs prune
.In commit 978899e of that PR the initial version of the
prune
tests included some fixture data with commits that were referenced via a tag only, not via a branch ref. However, the test never confirmed that the Git LFS objects in these commits were retained by theprune
command.This initial test was then refactored into several tests in commits 03b85e0 and 58dfa23, including the
"prune keep unpushed"
one, and in the process two lines were left which referred to the fixture data (oid_keepunpushedtagged1
andoid_keepunpushedtagged2
) but this data was otherwise dropped from the test, and no tag check was implemented.We therefore re-introduce some fixture data for this test which simulates a tag that points to a commit from a deleted branch, so that the tag is the only reference to this commit and its ancestors. We then ensure that
git lfs prune
retains all the Git LFS objects from these commits, even if they are not recent, when they have not been pushed. Once they are pushed, we then confirm that only the object in the tagged commit is retained (because it is a referenced by a recent ref).We also update a comment in the
"prune unreferenced and old"
test which refers to a filename in its fixture data that corresponds to how it was originally defined in commit 978899e, but which was subsequently changed (at the same time the comment was added) in commit 03b85e0.