Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to check prune command retains tagged unpushed objects #4962

Merged
merged 2 commits into from Apr 25, 2022

Conversation

chrisd8088
Copy link
Contributor

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 by git 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 the prune 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 and oid_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.

In PR git-lfs#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 by "git 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 the "prune" 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"
and "oid_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.
@chrisd8088 chrisd8088 requested a review from a team as a code owner April 25, 2022 15:32
@chrisd8088 chrisd8088 merged commit 32d3ba7 into git-lfs:main Apr 25, 2022
@chrisd8088 chrisd8088 deleted the prune-check-unpushed-tag branch April 25, 2022 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants