git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Ben Peart <benpeart@microsoft.com>,
	Stefan Beller <sbeller@google.com>
Subject: sb/submodule-move-nested breaks t7411 under GIT_FSMONITOR_TEST
Date: Fri, 25 May 2018 14:28:56 +0200	[thread overview]
Message-ID: <87lgc77wc7.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqvabm6csb.fsf@gitster-ct.c.googlers.com>


On Thu, May 17 2018, Junio C Hamano wrote:

> * sb/submodule-move-nested (2018-03-29) 6 commits
>   (merged to 'next' on 2018-04-25 at 86b177433a)
>  + submodule: fixup nested submodules after moving the submodule
>  + submodule-config: remove submodule_from_cache
>  + submodule-config: add repository argument to submodule_from_{name, path}
>  + submodule-config: allow submodule_free to handle arbitrary repositories
>  + grep: remove "repo" arg from non-supporting funcs
>  + submodule.h: drop declaration of connect_work_tree_and_git_dir
>
>  Moving a submodule that itself has submodule in it with "git mv"
>  forgot to make necessary adjustment to the nested sub-submodules;
>  now the codepath learned to recurse into the submodules.

I didn't spot this earlier because I don't test this a lot, but I've
bisected the following breakage down to da62f786d2 ("submodule: fixup
nested submodules after moving the submodule", 2018-03-28) (and manually
confirmed by reverting). On Linux both Debian & CentOS I get tests 3 and
4 failing with:

     GIT_FSMONITOR_TEST=$PWD/t7519/fsmonitor-all ./t7411-submodule-config.sh

-v -x output follows:

expecting success: 
	mkdir submodule &&
	(cd submodule &&
		git init &&
		echo a >a &&
		git add . &&
		git commit -ma
	) &&
	mkdir super &&
	(cd super &&
		git init &&
		git submodule add ../submodule &&
		git submodule add ../submodule a &&
		git commit -m "add as submodule and as a" &&
		git mv a b &&
		git commit -m "move a to b"
	)

+ mkdir submodule
+ cd submodule
+ git init
Initialized empty Git repository in /home/avar/g/git/t/trash directory.t7411-submodule-config/submodule/.git/
+ echo a
+ git add .
+ git commit -ma
[master (root-commit) 27e9f0e] a
 Author: A U Thor <author@example.com>
 1 file changed, 1 insertion(+)
 create mode 100644 a
+ mkdir super
+ cd super
+ git init
Initialized empty Git repository in /home/avar/g/git/t/trash directory.t7411-submodule-config/super/.git/
+ git submodule add ../submodule
Cloning into '/home/avar/g/git/t/trash directory.t7411-submodule-config/super/submodule'...
done.
+ git submodule add ../submodule a
Cloning into '/home/avar/g/git/t/trash directory.t7411-submodule-config/super/a'...
done.
+ git commit -m add as submodule and as a
[master (root-commit) 5a1dac1] add as submodule and as a
 Author: A U Thor <author@example.com>
 3 files changed, 8 insertions(+)
 create mode 100644 .gitmodules
 create mode 160000 a
 create mode 160000 submodule
+ git mv a b
+ git commit -m move a to b
[master ab1e9c7] move a to b
 Author: A U Thor <author@example.com>
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename a => b (100%)
ok 1 - submodule config cache setup

expecting success: 
	test_when_finished "rm -rf repo" &&
	test_create_repo repo &&
	cat >repo/.gitmodules <<-\EOF &&
	[submodule "s"]
		path
		ignore
	EOF
	(
		cd repo &&
		test_must_fail test-submodule-config "" s 2>actual &&
		test_i18ngrep "bad config" actual
	)

+ test_when_finished rm -rf repo
+ test 0 = 0
+ test_cleanup={ rm -rf repo
		} && (exit "$eval_ret"); eval_ret=$?; :
+ test_create_repo repo
+ test 1 = 1
+ repo=repo
+ mkdir -p repo
+ cd repo
+ /home/avar/g/git/t/../git-init --template=/home/avar/g/git/t/../templates/blt/
Initialized empty Git repository in /home/avar/g/git/t/trash directory.t7411-submodule-config/repo/.git/
+ mv .git/hooks .git/hooks-disabled
+ cat
+ cd repo
+ test_must_fail test-submodule-config  s
+ test_i18ngrep bad config actual
+ test -n 
+ test x! = xbad config
+ grep bad config actual
fatal: bad config line 2 in file /home/avar/g/git/t/trash directory.t7411-submodule-config/repo/.gitmodules
+ rm -rf repo
+ exit 0
+ eval_ret=0
+ :
ok 2 - configuration parsing with error

expecting success: 
	(cd super &&
		test-submodule-config \
			HEAD^ a \
			HEAD b \
			HEAD^ submodule \
			HEAD submodule \
				>actual &&
		test_cmp expect actual
	)

+ cd super
+ test-submodule-config HEAD^ a HEAD b HEAD^ submodule HEAD submodule
warning: ab1e9c76c1e6a15df51b20e75552ec5ad00708ac:.gitmodules, multiple configurations found for 'submodule.submodule.path'. Skipping second one!
warning: ab1e9c76c1e6a15df51b20e75552ec5ad00708ac:.gitmodules, multiple configurations found for 'submodule.submodule.url'. Skipping second one!
warning: ab1e9c76c1e6a15df51b20e75552ec5ad00708ac:.gitmodules, multiple configurations found for 'submodule.a.path'. Skipping second one!
warning: ab1e9c76c1e6a15df51b20e75552ec5ad00708ac:.gitmodules, multiple configurations found for 'submodule.a.url'. Skipping second one!
Submodule not found.
Usage: /home/avar/g/git/t/helper/test-submodule-config [<commit> <submodulepath>] ...
error: last command exited with $?=1
not ok 3 - test parsing and lookup of submodule config by path
#	
#		(cd super &&
#			test-submodule-config \
#				HEAD^ a \
#				HEAD b \
#				HEAD^ submodule \
#				HEAD submodule \
#					>actual &&
#			test_cmp expect actual
#		)
#	

expecting success: 
	(cd super &&
		test-submodule-config --name \
			HEAD^ a \
			HEAD a \
			HEAD^ submodule \
			HEAD submodule \
				>actual &&
		test_cmp expect actual
	)

+ cd super
+ test-submodule-config --name HEAD^ a HEAD a HEAD^ submodule HEAD submodule
+ test_cmp expect actual
+ diff -u expect actual
--- expect	2018-05-25 12:28:30.000000000 +0000
+++ actual	2018-05-25 12:28:30.000000000 +0000
@@ -1,4 +1,4 @@
 Submodule name: 'a' for path 'a'
-Submodule name: 'a' for path 'b'
+Submodule name: 'a' for path 'a'
 Submodule name: 'submodule' for path 'submodule'
 Submodule name: 'submodule' for path 'submodule'
error: last command exited with $?=1
not ok 4 - test parsing and lookup of submodule config by name
#	
#		(cd super &&
#			test-submodule-config --name \
#				HEAD^ a \
#				HEAD a \
#				HEAD^ submodule \
#				HEAD submodule \
#					>actual &&
#			test_cmp expect actual
#		)
#	

expecting success: 
	(cd super &&
		cp .gitmodules .gitmodules.bak &&
		echo "	value = \"" >>.gitmodules &&
		git add .gitmodules &&
		mv .gitmodules.bak .gitmodules &&
		git commit -m "add error" &&
		test-submodule-config \
			HEAD b \
			HEAD submodule \
				>actual &&
		test_cmp expect_error actual
	)

+ cd super
+ cp .gitmodules .gitmodules.bak
+ echo 	value = "
+ git add .gitmodules
+ mv .gitmodules.bak .gitmodules
+ git commit -m add error
[master 7cb6f0e] add error
 Author: A U Thor <author@example.com>
 1 file changed, 2 insertions(+), 1 deletion(-)
+ test-submodule-config HEAD b HEAD submodule
error: bad config line 7 in submodule-blob 7cb6f0e38e67568f41da9828cc7d5eb1c753b7b4:.gitmodules
+ test_cmp expect_error actual
+ diff -u expect_error actual
ok 5 - error in one submodule config lets continue

expecting success: 
	(cd super &&
		sha1=$(git rev-parse HEAD) &&
		test-submodule-config \
			HEAD b \
			HEAD submodule \
				2>actual_err &&
		test_i18ngrep "submodule-blob $sha1:.gitmodules" actual_err >/dev/null
	)

+ cd super
+ git rev-parse HEAD
+ sha1=7cb6f0e38e67568f41da9828cc7d5eb1c753b7b4
+ test-submodule-config HEAD b HEAD submodule
Submodule name: 'a' for path 'b'
Submodule name: 'submodule' for path 'submodule'
+ test_i18ngrep submodule-blob 7cb6f0e38e67568f41da9828cc7d5eb1c753b7b4:.gitmodules actual_err
+ test -n 
+ test x! = xsubmodule-blob 7cb6f0e38e67568f41da9828cc7d5eb1c753b7b4:.gitmodules
+ grep submodule-blob 7cb6f0e38e67568f41da9828cc7d5eb1c753b7b4:.gitmodules actual_err
ok 6 - error message contains blob reference

expecting success: 
	(
		cd super &&
		git tag new_tag &&
		tree=$(git rev-parse HEAD^{tree}) &&
		commit=$(git rev-parse HEAD^{commit}) &&
		test-submodule-config $commit b >expect &&
		test-submodule-config $tree b >actual.1 &&
		test-submodule-config new_tag b >actual.2 &&
		test_cmp expect actual.1 &&
		test_cmp expect actual.2
	)

+ cd super
+ git tag new_tag
+ git rev-parse HEAD^{tree}
+ tree=934687743cd5ca685cfa8d3c77aaebb75ee12e1f
+ git rev-parse HEAD^{commit}
+ commit=7cb6f0e38e67568f41da9828cc7d5eb1c753b7b4
+ test-submodule-config 7cb6f0e38e67568f41da9828cc7d5eb1c753b7b4 b
error: bad config line 7 in submodule-blob 7cb6f0e38e67568f41da9828cc7d5eb1c753b7b4:.gitmodules
+ test-submodule-config 934687743cd5ca685cfa8d3c77aaebb75ee12e1f b
error: bad config line 7 in submodule-blob 934687743cd5ca685cfa8d3c77aaebb75ee12e1f:.gitmodules
+ test-submodule-config new_tag b
error: bad config line 7 in submodule-blob 7cb6f0e38e67568f41da9828cc7d5eb1c753b7b4:.gitmodules
+ test_cmp expect actual.1
+ diff -u expect actual.1
+ test_cmp expect actual.2
+ diff -u expect actual.2
ok 7 - using different treeishs works

expecting success: 
	(cd super &&
		git config -f .gitmodules \
			submodule.submodule.fetchrecursesubmodules blabla &&
		git add .gitmodules &&
		git config --unset -f .gitmodules \
			submodule.submodule.fetchrecursesubmodules &&
		git commit -m "add error in fetchrecursesubmodules" &&
		test-submodule-config \
			HEAD b \
			HEAD submodule \
				>actual &&
		test_cmp expect_error actual  &&
		git reset --hard HEAD^
	)

+ cd super
+ git config -f .gitmodules submodule.submodule.fetchrecursesubmodules blabla
+ git add .gitmodules
+ git config --unset -f .gitmodules submodule.submodule.fetchrecursesubmodules
+ git commit -m add error in fetchrecursesubmodules
[master 1fa1547] add error in fetchrecursesubmodules
 Author: A U Thor <author@example.com>
 1 file changed, 1 insertion(+), 1 deletion(-)
+ test-submodule-config HEAD b HEAD submodule
+ test_cmp expect_error actual
+ diff -u expect_error actual
+ git reset --hard HEAD^
HEAD is now at 7cb6f0e add error
ok 8 - error in history in fetchrecursesubmodule lets continue

# failed 2 among 8 test(s)
1..8

  parent reply	other threads:[~2018-05-25 12:29 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-17  6:01 What's cooking in git.git (May 2018, #02; Thu, 17) Junio C Hamano
2018-05-17  6:39 ` jk/branch-l-0-deprecation (was Re: What's cooking in git.git (May 2018, #02; Thu, 17)) Kaartic Sivaraam
2018-05-17  9:48   ` Ævar Arnfjörð Bjarmason
2018-05-17 11:00     ` Kaartic Sivaraam
2018-05-17 12:02       ` Ævar Arnfjörð Bjarmason
2018-05-17 13:36     ` Jeff King
2018-05-24 15:10       ` Kaartic Sivaraam
2018-05-24 19:22         ` Jeff King
2018-05-24 19:31           ` [PATCH] branch: issue "-l" deprecation warning after pager starts Jeff King
2018-05-25  1:55             ` Junio C Hamano
2018-05-25  2:40               ` Jeff King
2018-05-25  8:56                 ` Junio C Hamano
2018-05-25  9:14                   ` Junio C Hamano
2018-05-25 17:10                     ` Jeff King
2018-05-26  2:37                       ` Junio C Hamano
2018-05-25 21:00                     ` [RFC PATCH 0/3] usage: prefix all lines in `vreportf()`, not just the first Martin Ågren
2018-05-25 21:00                       ` [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()` Martin Ågren
2018-05-28  8:27                         ` Junio C Hamano
2018-05-28 18:40                         ` Duy Nguyen
2018-05-29 21:33                           ` Jeff King
2018-05-29 21:39                         ` Jeff King
2018-05-30  1:42                           ` Junio C Hamano
2018-05-30  6:00                             ` Junio C Hamano
2018-05-30 10:26                               ` Martin Ågren
2018-05-31  6:07                                 ` Jeff King
2018-05-25 21:00                       ` [RFC PATCH 2/3] usage: prefix all lines in `vreportf()`, not just the first Martin Ågren
2018-05-28  9:25                         ` Junio C Hamano
2018-05-28 18:45                           ` Duy Nguyen
2018-05-28 21:45                             ` Junio C Hamano
2018-05-29  4:49                               ` Martin Ågren
2018-05-29  5:50                                 ` Junio C Hamano
2018-05-29 10:30                                   ` Martin Ågren
2018-05-29 12:08                                     ` Junio C Hamano
2018-05-29 15:50                                 ` Duy Nguyen
2018-05-30 10:19                                   ` Martin Ågren
2018-05-29 21:32                           ` Jeff King
2018-05-30 10:20                             ` Martin Ågren
2018-05-25 21:00                       ` [RFC PATCH 3/3] usage: translate the "error: "-prefix and others Martin Ågren
2018-05-26  2:32                   ` [PATCH] branch: issue "-l" deprecation warning after pager starts Junio C Hamano
2018-05-26  2:33                     ` Junio C Hamano
2018-05-29 21:20                     ` Jeff King
2018-05-29 21:21                       ` Jeff King
2018-05-30  2:48                         ` Junio C Hamano
2018-05-31  5:44                           ` Jeff King
2018-05-26 19:39                 ` Kaartic Sivaraam
2018-06-02  4:46                 ` Duy Nguyen
2018-06-02  8:10                   ` Jeff King
2018-05-26 18:45             ` Kaartic Sivaraam
2018-05-29 21:15               ` Jeff King
2018-05-30  2:52                 ` Junio C Hamano
2018-05-31  5:51                   ` Jeff King
2018-06-01  1:35                     ` Junio C Hamano
2018-05-31  5:52                   ` Kaartic.Sivaraam
2018-05-17 13:22 ` What's cooking in git.git (May 2018, #02; Thu, 17) Derrick Stolee
2018-05-17 18:20 ` Stefan Beller
2018-05-17 18:29   ` [PATCH 0/2] Reroll 2 last commits of sb/object-store-replace Stefan Beller
2018-05-17 18:29     ` [PATCH 1/2] object.c: free replace map in raw_object_store_clear Stefan Beller
2018-05-17 18:29     ` [PATCH 2/2] replace-object.c: remove the_repository from prepare_replace_object Stefan Beller
2018-05-17 18:40   ` [PATCH] merge-recursive: give notice when submodule commit gets fast-forwarded Stefan Beller
2018-05-18 19:43     ` [PATCH v2 0/1] rebased: inform about auto submodule ff Leif Middelschulte
2018-05-18 19:48     ` [PATCH v3 " Leif Middelschulte
2018-05-18 19:48       ` [PATCH 1/1] Inform about fast-forwarding of submodules during merge Leif Middelschulte
2018-05-18 21:25         ` Elijah Newren
2018-05-21  4:12           ` Junio C Hamano
2018-05-17 19:46   ` [PATCH 0/8] Reroll of sb/diff-color-move-more Stefan Beller
2018-05-17 19:46     ` [PATCH 1/8] xdiff/xdiff.h: remove unused flags Stefan Beller
2018-05-17 19:46     ` [PATCH 2/8] xdiff/xdiffi.c: remove unneeded function declarations Stefan Beller
2018-05-17 19:46     ` [PATCH 3/8] diff.c: do not pass diff options as keydata to hashmap Stefan Beller
2018-05-17 19:46     ` [PATCH 4/8] diff.c: adjust hash function signature to match hashmap expectation Stefan Beller
2018-05-17 19:46     ` [PATCH 5/8] diff.c: add a blocks mode for moved code detection Stefan Beller
2018-05-17 19:46     ` [PATCH 6/8] diff.c: decouple white space treatment from move detection algorithm Stefan Beller
2018-05-18  4:00       ` Simon Ruderich
2018-05-18 19:25         ` Stefan Beller
2018-05-17 19:46     ` [PATCH 7/8] diff.c: add --color-moved-ignore-space-delta option Stefan Beller
2018-05-17 19:46     ` [PATCH 8/8] diff: color-moved white space handling options imply color-moved Stefan Beller
2018-05-17 22:53     ` [PATCH 0/8] Reroll of sb/diff-color-move-more Jonathan Tan
2018-06-07 23:54     ` Jacob Keller
2018-05-17 22:36   ` What's cooking in git.git (May 2018, #02; Thu, 17) Junio C Hamano
2018-05-17 22:39     ` Stefan Beller
2018-05-17 22:56     ` Junio C Hamano
2018-05-17 22:58       ` Stefan Beller
2018-05-21  1:57 ` brian m. carlson
2018-05-21 17:36   ` Stefan Beller
2018-05-25 12:28 ` Ævar Arnfjörð Bjarmason [this message]
2018-05-25 17:27   ` sb/submodule-move-nested breaks t7411 under GIT_FSMONITOR_TEST Stefan Beller
2018-05-25 19:49   ` Stefan Beller
2018-09-06 12:31     ` Ævar Arnfjörð Bjarmason
2018-09-06 16:57       ` Stefan Beller
2018-09-06 19:03         ` Ben Peart
2018-09-06 20:14           ` Stefan Beller
2018-09-06 20:34             ` [PATCH] git-mv: allow submodules and fsmonitor to work together Stefan Beller
2018-09-10 15:58               ` Ben Peart
2018-09-10 16:29                 ` [PATCH v1] " Ben Peart
2018-09-10 17:07                   ` Stefan Beller
2018-09-10 19:38                     ` Ben Peart

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=87lgc77wc7.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=benpeart@microsoft.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).