Skip to content

Add --verify-unreachable option to LFS prune#5648

Merged
bk2204 merged 2 commits intogit-lfs:mainfrom
Anchorpoint-Software:prune-improve-verify
Feb 22, 2024
Merged

Add --verify-unreachable option to LFS prune#5648
bk2204 merged 2 commits intogit-lfs:mainfrom
Anchorpoint-Software:prune-improve-verify

Conversation

@jochenhz
Copy link
Contributor

@jochenhz jochenhz commented Feb 8, 2024

This PR should close #5642

LFS prune offers --verify-remote, a command that exits whenever a reachable object is not on the remote.
Hence, it still prunes non-reachable objects, e.g. referenced by orphan commits.

This PR adds a new option --verify-unreachable that additionally verifies those unreachable objects, so there is a guarantee that data is never lost.

In addition to that, a new option --when-unverified=<halt,continue> can change the default behaviour to not exit when a file is unverified but continue to prune the verified objects.

@jochenhz jochenhz requested a review from a team as a code owner February 8, 2024 12:37
@jochenhz jochenhz force-pushed the prune-improve-verify branch from 39a82b0 to 5edc1a2 Compare February 8, 2024 14:53
LFS prune offers --verify-remote, a command that exits whenever a reachable object is not on the remote. Hence, it still prunes non-reachable objects, e.g. referenced by orphan commits.
This commit adds a new option --verify-unreachable that additionally verifies those unreachable objects, so there is a guarantee that data is never lost.
In addition to that, a new option --when-unverified=<halt,continue> can change the default behaviour to not exit when a file is unverified but continue to prune the verified objects.
@jochenhz jochenhz force-pushed the prune-improve-verify branch from 5edc1a2 to 2be5d26 Compare February 8, 2024 16:31
@jochenhz
Copy link
Contributor Author

jochenhz commented Feb 8, 2024

@bk2204 the t-credentials.sh fails on macOS and I don't know why that might happen. If I run cibuild on my mac, everything is green. Any idea?

@bk2204
Copy link
Member

bk2204 commented Feb 9, 2024

That test can be a little flaky; I've marked it for rebuild.

@bk2204 bk2204 merged commit 61ee329 into git-lfs:main Feb 22, 2024
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request May 15, 2025
In commit 2be5d26 of PR git-lfs#5648 we
enhanced the "git lfs prune" command, in part by adding support for a
new --when-unverified option which controls how the command behaves
when the --verify-remote option is specified and an object which
would otherwise be pruned is not verified as present on the current
Git remote.

In our git-lfs-prune(1) manual page we describe the --when-unverified
option as accepting a parameter whose name we give as "<halt,continue>",
with the intent that this should indicate that only the values "halt"
and "continue" will be accepted for this option.

However, following both our own convention and that of Git's own
documentation, we generally use angle brackets around the name of a
parameter to indicate that the user should substitute their own value
for the argument, and then refer to that parameter by that name, with
the angle brackets included.

So as to make the git-lfs-prune(1) manual page more consistent with
this practice, we change the name of the --when-unverified option's
parameter to "<action>", and then expand the description of the option
to explain the two acceptable values for that parameter, namely "halt"
(the default) and "continue".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Add a --safe option to LFS prune

2 participants