Re: Should 'git replace' respect GIT_NAMESPACE?
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Jan 15, 2025, 09:21 UTC
- Message-ID
- <CAP8UFD1ioX4R6J+Spb2oPEeTHvUBrt62iBqvRgMNJVbp45sw_Q@mail.gmail.com>
- In-Reply-To
- <CAFAcib9cJOp26J=PxU3XwmLT0hQVqCb8vcS7MdGpFd5TNVfDzw@mail.gmail.com>
On Tue, Jan 14, 2025 at 11:40 PM Josh Bleecher Snyder <josharian@gmail.com> wrote:
Show 8 quoted lines
> Do you have suggestions for alternative mechanisms I might use? > > I want to be able to easily enable/disable a set of replace directives > for the purposes of running other git commands, without globally > altering the repository. Otherwise I have to worry about locking, > cleanup when something goes wrong, and state visibility and > management. All possible to fix, but messy compared with something > like namespaces.
The simplest would likely be to develop a small set of shell scripts/commands to move or copy replace refs around. These scripts or commands could use `git for-each-ref` to get replace ref information and then `git update-ref` to create and/or delete replace refs.
For example a 'mv-rep-refs <src> <dst>' command would move all the refs under "refs/replace/views/<src>/" to "refs/replace/views/<dst>/" except if <src> or <dst> is '.' which would mean "refs/replace/". Then `mv-rep-refs build-fixes .` could activate the replace refs that fix the build.
Alternatively you could work on implementing a similar "view" mechanism in Git itself and submit your patches here.