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

gc: add --expire-to option #1843

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adlternative
Copy link

I want to perform a "safe" garbage collection for the Git repository
on the server, which avoids data corruption issues caused by
concurrent pushes during git GC. To achieve this, I currently need to
use git repack --cruft --expire-to=<dir> and git prune
in combination. However, it would be simpler if we could directly use
--expire-to=<dir> with the git-gc command.

cc: [email protected]
cc: [email protected]

This commit extends the functionality of `git gc`
by adding a new option, `--expire-to=<dir>`. Previously,
this feature was implemented in `git repack` (see 91badeb),
allowing users to specify a directory where unreachable and
expired cruft packs are stored during garbage collection.
However, users had to run `git repack --cruft --expire-to=<dir>`
followed by `git prune` to achieve similar results within `git gc`.

By introducing `--expire-to=<dir>` directly into `git gc`,
we simplify the process for users who wish to manage their
repository's cleanup more efficiently. This change involves
passing the `--expire-to=<dir>` parameter through to `git repack`,
making it easier for users to set up a backup location for cruft
packs that will be pruned.

Signed-off-by: ZheNing Hu <[email protected]>
@adlternative
Copy link
Author

/submit

Copy link

gitgitgadget bot commented Dec 24, 2024

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-1843/adlternative/zh/gc-expire-to-v1

To fetch this version to local tag pr-1843/adlternative/zh/gc-expire-to-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-1843/adlternative/zh/gc-expire-to-v1

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.

1 participant