Isolate git operations with a new repository#575
Isolate git operations with a new repository#575howtonotwin wants to merge 2 commits intoMic92:mainfrom
Conversation
Clarify that "the changes to be tested" can EITHER take the form of a commit OR can be uncommitted changes by using one "changes" variable where applicable instead of a pair of variables where exactly one is not None. Also introduce an enum to name the different forms of uncommitted changes instead of using a bool.
Shallow fetch operations permanently change the shallow configuration of the repository they run in. Using a temporary worktree does not protect the user's repository against such modifications. Switch to using a new separate repository to provide appropriate protection. Set up the alternates mechanism to have the new repository share storage with the original. This cannot be done automatically by git-clone since git-clone refuses to use a shallow repository as an alternate object store (for good reason!). Manually create the new repository and provide it with a copy of the original's shallow configuration to make this use of alternates correct.
8b52c7b to
38fa2c9
Compare
|
Doesn't this make the experience for people with full clones worse? I would suggest to use an extra local repository where those changes do not effect your main repo. |
|
The stronger isolation means
If these are problematic, then the Current |
Which can be a problem and as you wrote further down we don't want to open a can of worms propagating those.
Which is bad
Low level surgery could easily break on an update because it is low level things which we should avoid using if possible. I have a hard time seeing that this outweighs the downsides. We make the logic even more complicated for something very little people use and testing it is also not easy. If you effectively want to contribute to nixpkgs you need a pretty full clone anyway as otherwise rebasing on staging or doing a backport is not possible. Also that every git command needs to be handled very carefully makes this very easy to create in the future with every change related to git commands which is not possible to be checked by everyone. |
|
I kind of agree with @SuperSandro2000 here. |
|
I mostly wrote this to have a I do think that mainline (which already special cases shallow repositories) should at least warn/require a flag/document/do something to clarify that it is destructive (not just liable to error out) when run on a shallow clone. |
Shallow fetch operations permanently change the shallow configuration of the repository they run in. Using a temporary worktree does not protect the user's repository against such modifications. Switch to using a new separate repository to provide appropriate protection. Fixes #573.
Set up the alternates mechanism to have the new repository share storage with the original. This cannot be done automatically by
git-clonesincegit-clonerefuses to use a shallow repository as an alternate object store (for good reason!). Manually create the new repository and provide it with a copy of the original's shallow configuration to make this use of alternates correct.On the way I ended up doing a bit of refactoring re: the handling of
nixpkgs-review wip.This PR is a little rough around the edges, but it does seem to work and not bork my repository anymore.