git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Nanako Shiraishi <nanako3@lavabit.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>,
	Nathan Yergler <nathan@creativecommons.org>,
	Michael J Gruber <git@drmicha.warpmail.net>,
	Asheesh Laroia <asheesh@asheesh.org>,
	git@vger.kernel.org
Subject: [PATCH 1/3] Add "partial commit" tests during a conflicted merge
Date: Thu, 22 Jan 2009 22:17:53 -0800	[thread overview]
Message-ID: <7vbpty4kby.fsf_-_@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7viqo64kfo.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Thu, 22 Jan 2009 22:15:39 -0800")

We are supposed to reject "--only path..." aka "a partial commit" during a
conflicted merge resolution, and accept "--include path..." aka "an also
commit" in such a case.

Recent git (since v1.3.0) always assumes that "git commit" with paths but
without --only nor --include requests the "--only" semantics, but there is
a discussion that it might be a good idea to assume "--include" semantics
during a merge.

The last test this commit adds expects such a behaviour and marked as
"expect_failure".  It will be changed by the third patch in the series.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t7501-commit.sh |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index b4e2b4d..0c10105 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -365,4 +365,48 @@ test_expect_success 'amend using the message from a commit named with tag' '
 
 '
 
+test_expect_success 'setup merge commit with paths test' '
+	git reset --hard &&
+	git checkout HEAD^0 &&
+	echo frotz >file &&
+	test_tick &&
+	git add file &&
+	git commit -a -m "one side says frotz" &&
+	git tag one-side-says-frotz &&
+	git reset --hard HEAD^ &&
+	echo nitfol >file &&
+	test_tick &&
+	git add file &&
+	git commit -a -m "the other side says nitfol" &&
+	git tag the-other-side-says-nitfol
+'
+
+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 &&
+	git reset --hard
+'
+
+test_expect_success 'allow --include 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-include >file &&
+	git commit -m merge --include file &&
+	git reset --hard
+'
+
+test_expect_failure 'assume --include 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-assumed >file &&
+	git add file &&
+	git commit -m merge file &&
+	git reset --hard
+'
+
 test_done
-- 
1.6.1.265.g9a013

  reply	other threads:[~2009-01-23  6:20 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         ` Junio C Hamano [this message]
2009-01-23  7:09           ` [PATCH 1/3] Add "partial commit" tests during a conflicted merge Johannes Sixt
2009-01-23  7:16             ` Junio C Hamano
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=7vbpty4kby.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).