git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, sbeller@google.com,
	Elijah Newren <newren@gmail.com>
Subject: [PATCH v2 0/3] Add testcases showing suboptimal submodule/path conflict handling
Date: Tue, 10 Jul 2018 20:56:56 -0700	[thread overview]
Message-ID: <20180711035659.27352-1-newren@gmail.com> (raw)
In-Reply-To: <20180707204404.7208-1-newren@gmail.com>

This patch series documents a few problems with submodules and merging,
first mentioned at [1].

Changes since v1 (full range-diff below):
  - Incorporate suggestions from Stefan: use test_commit and git
    submodule add (note that git submodule add means there will also
    be a .gitmodules file, so the count of tracked files goes up by
    1)
  - Explain the tests a little better
  - Test the merge --abort case a little more thoroughly.

[1] https://public-inbox.org/git/CABPp-BHDrw_dAESic3xK7kC3jMgKeNQuPQF69OpbVYhRkbhJsw@mail.gmail.com/

Elijah Newren (3):
  t7405: add a file/submodule conflict
  t7405: add a directory/submodule conflict
  t7405: verify 'merge --abort' works after submodule/path conflicts

 t/t7405-submodule-merge.sh | 173 +++++++++++++++++++++++++++++++++++++
 1 file changed, 173 insertions(+)

1:  44bc2a05f ! 1:  16f6622ce t7405: add a file/submodule conflict
    @@ -32,20 +32,14 @@
     +		git branch B &&
     +
     +		git checkout B &&
    -+		echo contents >path &&
    ++		echo content >path &&
     +		git add path &&
     +		git commit -m B &&
     +
     +		git checkout A &&
     +		test_create_repo path &&
    -+		(
    -+			cd path &&
    -+
    -+			echo hello >world &&
    -+			git add world &&
    -+			git commit -m "submodule"
    -+		) &&
    -+		git add path &&
    ++		test_commit -C path world &&
    ++		git submodule add ./path &&
     +		git commit -m A
     +	)
     +'
    @@ -56,16 +50,20 @@
     +		cd file-submodule &&
     +
     +		git checkout A^0 &&
    -+		test_must_fail git merge B^0 >out 2>err &&
    ++		test_must_fail git merge B^0 &&
     +
     +		git ls-files -s >out &&
    -+		test_line_count = 2 out &&
    ++		test_line_count = 3 out &&
     +		git ls-files -u >out &&
     +		test_line_count = 2 out &&
     +
     +		# path/ is still a submodule
     +		test_path_is_dir path/.git &&
     +
    ++		# There is a submodule at "path", so B:path cannot be written
    ++		# there.  We expect it to be written somewhere in the same
    ++		# directory, though, so just grep for its content in all
    ++		# files, and ignore "grep: path: Is a directory" message
     +		echo Checking if contents from B:path showed up anywhere &&
     +		grep -q content * 2>/dev/null
     +	)
2:  2fa139d3b ! 2:  31dc3bc4e t7405: add a directory/submodule conflict
    @@ -56,14 +56,8 @@
     +
     +		git checkout A &&
     +		test_create_repo path &&
    -+		(
    -+			cd path &&
    -+
    -+			echo hello >world &&
    -+			git add world &&
    -+			git commit -m "submodule"
    -+		) &&
    -+		git add path &&
    ++		test_commit -C path hello world &&
    ++		git submodule add ./path &&
     +		git commit -m A
     +	)
     +'
    @@ -77,7 +71,7 @@
     +		test_must_fail git merge B1^0 &&
     +
     +		git ls-files -s >out &&
    -+		test_line_count = 2 out &&
    ++		test_line_count = 3 out &&
     +		git ls-files -u >out &&
     +		test_line_count = 1 out &&
     +
    @@ -87,6 +81,9 @@
     +		echo Checking if contents from B1:path/file showed up &&
     +		# Would rather use grep -r, but that is GNU extension...
     +		git ls-files -co | xargs grep -q contents 2>/dev/null &&
    ++
    ++		# However, B1:path/file should NOT have shown up at path/file,
    ++		# because we should not write into the submodule
     +		test_path_is_missing path/file
     +	)
     +'
3:  b2a44bedf ! 3:  49719952b t7405: verify 'merge --abort' works after submodule/path conflicts
    @@ -39,12 +39,17 @@
     +	test_when_finished "git -C directory-submodule reset --hard" &&
     +	(
     +		cd directory-submodule &&
    -+
    -+		git checkout A^0 &&
    -+		test_must_fail git merge B2^0 >out 2>err &&
      
    ++		git checkout A^0 &&
    ++		test_must_fail git merge B2^0 &&
     +		test_path_is_file .git/MERGE_HEAD &&
    -+		git merge --abort
    ++
    ++		# merge --abort should succeed, should clear .git/MERGE_HEAD,
    ++		# and should not leave behind any conflicted files
    ++		git merge --abort &&
    ++		test_path_is_missing .git/MERGE_HEAD &&
    ++		git ls-files -u >conflicts &&
    ++		test_must_be_empty conflicts
      	)
      '
      
-- 
2.18.0.132.g6e63b23f4

  parent reply	other threads:[~2018-07-11  3:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-07 20:44 [PATCH 0/3] Add testcases showing suboptimal submodule/path conflict handling Elijah Newren
2018-07-07 20:44 ` [PATCH 1/3] t7405: add a file/submodule conflict Elijah Newren
2018-07-09 21:11   ` Stefan Beller
2018-07-10 15:28     ` Elijah Newren
2018-07-10 15:53       ` Stefan Beller
2018-07-10 17:30         ` Elijah Newren
2018-07-07 20:44 ` [PATCH 2/3] t7405: add a directory/submodule conflict Elijah Newren
2018-07-07 20:44 ` [PATCH 3/3] t7405: verify 'merge --abort' works after submodule/path conflicts Elijah Newren
2018-07-11  3:56 ` Elijah Newren [this message]
2018-07-11  3:56   ` [PATCH v2 1/3] t7405: add a file/submodule conflict Elijah Newren
2018-07-11  3:56   ` [PATCH v2 2/3] t7405: add a directory/submodule conflict Elijah Newren
2018-07-11  3:56   ` [PATCH v2 3/3] t7405: verify 'merge --abort' works after submodule/path conflicts Elijah Newren

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20180711035659.27352-1-newren@gmail.com \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sbeller@google.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).