From: Doug Kelly <dougk.ff7@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, sunshine@sunshineco.com,
Doug Kelly <dougk.ff7@gmail.com>
Subject: [PATCH v4 1/2] t4255: test am submodule with diff.submodule
Date: Wed, 7 Jan 2015 14:13:42 -0600 [thread overview]
Message-ID: <1420661623-30692-1-git-send-email-dougk.ff7@gmail.com> (raw)
In-Reply-To: <1419635506-5045-1-git-send-email-dougk.ff7@gmail.com>
git am will break when using diff.submodule=log; add some test cases
to illustrate this breakage as simply as possible. There are
currently two ways this can fail:
* With errors ("unrecognized input"), if only change
* Silently (no submodule change), if other files change
Test for both conditions and ensure without diff.submodule this works.
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Doug Kelly <dougk.ff7@gmail.com>
---
Updated to remove test_ticks and clean the commit message.
t/t4255-am-submodule.sh | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/t/t4255-am-submodule.sh b/t/t4255-am-submodule.sh
index 8bde7db..a38c305 100755
--- a/t/t4255-am-submodule.sh
+++ b/t/t4255-am-submodule.sh
@@ -18,4 +18,74 @@ am_3way () {
KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
test_submodule_switch "am_3way"
+test_expect_success 'setup diff.submodule' '
+ test_commit one &&
+ INITIAL=$(git rev-parse HEAD) &&
+
+ git init submodule &&
+ (
+ cd submodule &&
+ test_commit two &&
+ git rev-parse HEAD >../initial-submodule
+ ) &&
+ git submodule add ./submodule &&
+ git commit -m first &&
+
+ (
+ cd submodule &&
+ test_commit three &&
+ git rev-parse HEAD >../first-submodule
+ ) &&
+ git add submodule &&
+ git commit -m second &&
+ SECOND=$(git rev-parse HEAD) &&
+
+ (
+ cd submodule &&
+ git mv two.t four.t &&
+ git commit -m "second submodule" &&
+ git rev-parse HEAD >../second-submodule
+ ) &&
+ test_commit four &&
+ git add submodule &&
+ git commit --amend --no-edit &&
+ THIRD=$(git rev-parse HEAD) &&
+ git submodule update --init
+'
+
+run_test() {
+ START_COMMIT=$1 &&
+ EXPECT=$2 &&
+ test_might_fail git am --abort &&
+ git reset --hard $START_COMMIT &&
+ rm -f *.patch &&
+ git format-patch -1 &&
+ git reset --hard $START_COMMIT^ &&
+ git submodule update &&
+ git am *.patch &&
+ git submodule update &&
+ git -C submodule rev-parse HEAD >actual &&
+ test_cmp $EXPECT actual
+}
+
+test_expect_success 'diff.submodule unset' '
+ test_unconfig diff.submodule &&
+ run_test $SECOND first-submodule
+'
+
+test_expect_success 'diff.submodule unset with extra file' '
+ test_unconfig diff.submodule &&
+ run_test $THIRD second-submodule
+'
+
+test_expect_failure 'diff.submodule=log' '
+ test_config diff.submodule log &&
+ run_test $SECOND first-submodule
+'
+
+test_expect_failure 'diff.submodule=log with extra file' '
+ test_config diff.submodule log &&
+ run_test $THIRD second-submodule
+'
+
test_done
--
2.0.5
next prev parent reply other threads:[~2015-01-07 20:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-26 23:11 [PATCH 0/2] Fix issue with format-patch and diff.submodule Doug Kelly
2014-12-26 23:11 ` [PATCH 1/2] t4255: test am submodule with diff.submodule Doug Kelly
2014-12-28 0:37 ` Eric Sunshine
2014-12-28 1:00 ` Doug Kelly
2014-12-29 15:42 ` Junio C Hamano
2015-01-07 19:34 ` Doug Kelly
2015-01-07 20:20 ` Junio C Hamano
2014-12-26 23:11 ` [PATCH 2/2] format-patch: ignore diff.submodule setting Doug Kelly
2014-12-28 1:04 ` [PATCH v2 1/2] t4255: test am submodule with diff.submodule Doug Kelly
2014-12-28 1:04 ` [PATCH v2 2/2] format-patch: ignore diff.submodule setting Doug Kelly
2014-12-28 2:24 ` [PATCH v2 1/2] t4255: test am submodule with diff.submodule Eric Sunshine
2015-01-07 19:31 ` [PATCH v3 " Doug Kelly
2015-01-07 19:31 ` [PATCH v3 2/2] format-patch: ignore diff.submodule setting Doug Kelly
2015-01-07 20:06 ` [PATCH v3 1/2] t4255: test am submodule with diff.submodule Eric Sunshine
2015-01-07 20:13 ` Doug Kelly [this message]
2015-01-07 20:13 ` [PATCH v4 2/2] format-patch: ignore diff.submodule setting Doug Kelly
2015-01-07 20:32 ` [PATCH v5 1/2] t4255: test am submodule with diff.submodule Doug Kelly
2015-01-07 20:32 ` [PATCH v5 2/2] format-patch: ignore diff.submodule setting Doug Kelly
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=1420661623-30692-1-git-send-email-dougk.ff7@gmail.com \
--to=dougk.ff7@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sunshine@sunshineco.com \
/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).