From: Johannes Sixt Date: Fri, 23 Jan 2009 07:32:15 GMT Subject: Re: [PATCH 1/3] Add "partial commit" tests during a conflicted merge Message-ID: <4979727F.80007@viscovery.net> In-Reply-To: <7vab9i331g.fsf@gitster.siamese.dyndns.org> Junio C Hamano schrieb: > Johannes Sixt writes: > >>> +test_expect_success 'reject --only during a merge' ' >>> + git checkout HEAD^0 && >>> + git reset --hard the-other-side-says-nitfol && >>> + test_must_fail git merge one-side-says-frotz && >>> + echo yomin-only >file && >>> + test_must_fail git commit -m merge --only file && >> I don't see why this must fail: 'file' is the only file that is different >> from HEAD. Yes, currently we fail; but if something is about to be >> changed, then this can change as well. > > Not at all. Read again what I said: 'file' is the *ONLY* file that is different from HEAD. Why should an explicit --only not work in this case? > Avoiding --only is to prevent a much more dangerous glitch. [...] We are in total agreement about what you said in the rest of the message. I'm proposing that, during a merge, if --only was given (or remains the implicit choice), then we compare the index with HEAD, and if nothing outside the given pathspec differs from HEAD, then allow the commit. -- Hannes