git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Nanako Shiraishi <nanako3@lavabit.com>,
	Nathan Yergler <nathan@creativecommons.org>,
	Michael J Gruber <git@drmicha.warpmail.net>,
	Asheesh Laroia <asheesh@asheesh.org>,
	git@vger.kernel.org
Subject: Re: [PATCH 1/3] Add "partial commit" tests during a conflicted merge
Date: Thu, 22 Jan 2009 23:16:43 -0800	[thread overview]
Message-ID: <7vab9i331g.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <49796D0C.5070408@viscovery.net> (Johannes Sixt's message of "Fri, 23 Jan 2009 08:09:00 +0100")

Johannes Sixt <j.sixt@viscovery.net> 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.

Avoiding --only is to prevent a much more dangerous glitch.

Suppose you and the other have two paths diverged, and one merges cleanly
and the other results in conflict.  When "git merge" gives control back to
you, the cleanly merged result is ALREADY IN THE INDEX.

Now you futz with the other path, and say

	git commit --only other

What --only tells git is "I do not care what I've staged in the index.
Start from the contents of HEAD commit, and update the index entry at these
paths (and these path _ONLY_), and commit the contents registered in the
index.

That is why --include is the only sane semantics during a conflicted
merge.  I thought you should know better, as you were the one who gave the
explanation to Nathan, which triggered Nana's response, which resulted in
this series.

  reply	other threads:[~2009-01-23  7:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-21 21:00 Short "git commit $file" syntax fails in the face of a resolved conflict Asheesh Laroia
2009-01-21 21:35 ` Michael J Gruber
2009-01-21 21:46   ` Nathan Yergler
2009-01-22  7:28     ` Johannes Sixt
2009-01-22  9:17     ` Michael J Gruber
2009-01-23  0:45     ` Nanako Shiraishi
2009-01-23  2:55       ` Asheesh Laroia
2009-01-23  6:15       ` Junio C Hamano
2009-01-23  6:17         ` [PATCH 1/3] Add "partial commit" tests during a conflicted merge Junio C Hamano
2009-01-23  7:09           ` Johannes Sixt
2009-01-23  7:16             ` Junio C Hamano [this message]
2009-01-23  7:32               ` Johannes Sixt
2009-01-23  7:39                 ` Junio C Hamano
2009-01-23  6:19         ` [PATCH 2/3] builtin-commit: shorten eye-sore overlong lines Junio C Hamano
2009-01-23  6:21         ` [PATCH 3/3] git commit: pathspec without -i/-o implies -i semantics during a merge Junio C Hamano
2009-01-23  9:51           ` Pieter de Bie
2009-01-23 17:01             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vab9i331g.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=asheesh@asheesh.org \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    --cc=nanako3@lavabit.com \
    --cc=nathan@creativecommons.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).