recursive submodules: test for relative paths
"git submodule update --init --recursive" uses full path to refer to
the true location of the repository in the "gitdir:" pointer for
nested submodules; the command used to use relative paths.
This was reported by Norio Nomura in $gmane/290280.
The root cause for that bug is in using recursive submodules as
their relative path handling was broken in ee8838d (2015-09-08,
submodule: rewrite `module_clone` shell function in C).
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
			
			
This commit is contained in:
		 Stefan Beller
					Stefan Beller
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							ee8838d157
						
					
				
				
					commit
					3fea121df3
				
			| @ -818,6 +818,47 @@ test_expect_success 'submodule add --name allows to replace a submodule with ano | |||||||
| 	) | 	) | ||||||
| ' | ' | ||||||
|  |  | ||||||
|  | test_expect_failure 'recursive relative submodules stay relative' ' | ||||||
|  | 	test_when_finished "rm -rf super clone2 subsub sub3" && | ||||||
|  | 	mkdir subsub && | ||||||
|  | 	( | ||||||
|  | 		cd subsub && | ||||||
|  | 		git init && | ||||||
|  | 		>t && | ||||||
|  | 		git add t && | ||||||
|  | 		git commit -m "initial commit" | ||||||
|  | 	) && | ||||||
|  | 	mkdir sub3 && | ||||||
|  | 	( | ||||||
|  | 		cd sub3 && | ||||||
|  | 		git init && | ||||||
|  | 		>t && | ||||||
|  | 		git add t && | ||||||
|  | 		git commit -m "initial commit" && | ||||||
|  | 		git submodule add ../subsub dirdir/subsub && | ||||||
|  | 		git commit -m "add submodule subsub" | ||||||
|  | 	) && | ||||||
|  | 	mkdir super && | ||||||
|  | 	( | ||||||
|  | 		cd super && | ||||||
|  | 		git init && | ||||||
|  | 		>t && | ||||||
|  | 		git add t && | ||||||
|  | 		git commit -m "initial commit" && | ||||||
|  | 		git submodule add ../sub3 && | ||||||
|  | 		git commit -m "add submodule sub" | ||||||
|  | 	) && | ||||||
|  | 	git clone super clone2 && | ||||||
|  | 	( | ||||||
|  | 		cd clone2 && | ||||||
|  | 		git submodule update --init --recursive && | ||||||
|  | 		echo "gitdir: ../.git/modules/sub3" >./sub3/.git_expect && | ||||||
|  | 		echo "gitdir: ../../../.git/modules/sub3/modules/dirdir/subsub" >./sub3/dirdir/subsub/.git_expect | ||||||
|  | 	) && | ||||||
|  | 	test_cmp clone2/sub3/.git_expect clone2/sub3/.git && | ||||||
|  | 	test_cmp clone2/sub3/dirdir/subsub/.git_expect clone2/sub3/dirdir/subsub/.git | ||||||
|  | ' | ||||||
|  |  | ||||||
| test_expect_success 'submodule add with an existing name fails unless forced' ' | test_expect_success 'submodule add with an existing name fails unless forced' ' | ||||||
| 	( | 	( | ||||||
| 		cd addtest2 && | 		cd addtest2 && | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user