Re: git replace: should it check for object type, and can it replace merges?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 5, 2013, 16:41 UTC
- Message-ID
- <7v1u68m6nj.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CAP8UFD3yHMKfBdjHc6CxeAXSdQ=ua1MddAb5rRXV3TU0ZW7g6w@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> writes:
Show 23 quoted lines
> Hi, > > On Sat, Aug 3, 2013 at 5:13 PM, Philip Oakley <philipoakley@iee.org> wrote: >> A recent comment http://stackoverflow.com/a/18027030/717355 on a question I >> asked two years ago about 'grafts' and 'replace' indicates that users think >> that 'git replace' can't replace a merge commit. The documentation doesn't >> have any examples and gives the naive impression that one should only >> replace a simple commit with another simple commit. > > I am sorry if the documentation gives this impression. > I'd like to fix it, but I am not sure what should be changed. > Should adding an example be enough? Or do you want it to state that explicitely? > >> Having looked at the code, I realised that anything can be replaced with >> anything, which is perhaps not what was intended. > > The documentation says in the "BUGS" section: > > "And of course things may break if an object of one type is replaced > by an object of another type (for example a blob replaced by a > commit)." > > So yes it is a know bug.
Is that even a BUG? The users are pretty much asking for it if they place an object name of a random wrong object themselves.
I agree that a hand-holding wrapper "git replace" could help them to avoid mistakes, though.