remove --prune from git fetch to avoid side-effects with read-only filesystems (#13645)#13679
remove --prune from git fetch to avoid side-effects with read-only filesystems (#13645)#13679Byron wants to merge 1 commit intogitbutlerapp:masterfrom
--prune from git fetch to avoid side-effects with read-only filesystems (#13645)#13679Conversation
…y filesystems (gitbutlerapp#13645) When a ref `refs/heads/head` exists on the remote, it creates ambiguity with the equally present `refs/remotes/origin/HEAD` when fetching to a local clone. If the remote `HEAD` points to `refs/heads/main` and we have a packed-refs file on a case-sensitive filesystem that looks like 1 │ # pack-refs with: peeled fully-peeled sorted 2 │ c30c646d31032f05ad62e5d2a967298c33df0f6f refs/remotes/origin/head 3 │ c30c646d31032f05ad62e5d2a967298c33df0f6f refs/remotes/origin/main Then `--prune` will *somehow* complain about `origin/head` and completely remove `origin/main` from packed-refs. So removing `--prune` fixes this, but it will also leave the remote-ref cleanup to the users. Separating this into specific on-demand maintenance seems like a good idea. Note that with ref-tables, this will not be an issue, but in general, auto-pruning as an operation that removes refs that the user might expect seems to be something to avoid as well.
There was a problem hiding this comment.
Pull request overview
This PR adjusts GitButler’s Git fetch wrapper to avoid automatic ref pruning, preventing destructive side effects in edge cases (notably when the remote contains a branch named head that can collide with origin/HEAD on some filesystems and lead to unexpected packed-refs rewrites).
Changes:
- Remove
--prunefrom thegit fetchinvocation used bycrates/gitbutler-git’s repository fetch helper.
|
@krlvi |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8af6544dd2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
i think the prune was added because at some point we had gitbutler disable GC which was later removed. And this can now be removed too |
When a ref
refs/heads/headexists on the remote, it creates ambiguity with the equally presentrefs/remotes/origin/HEADwhen fetching to a local clone. If the remoteHEADpoints torefs/heads/mainand we have a packed-refs file on a case-sensitive filesystem that looks likeThen
--prunewill somehow complain aboutorigin/headand completely removeorigin/mainfrom packed-refs.So removing
--prunefixes this, but it will also leave the remote-ref cleanup to the users.Separating this into specific on-demand maintenance seems like a good idea.
Note that with ref-tables, this will not be an issue, but in general, auto-pruning as an operation that removes refs that the user might expect seems to be something to avoid as well.
Fixes #13645.