Merge branch 'hv/submodule-update-none'
* hv/submodule-update-none: add update 'none' flag to disable update of submodule by default submodule: move update configuration variable further upmaint
						commit
						61f9db7a50
					
				|  | @ -120,6 +120,8 @@ too (and can also report changes to a submodule's work tree). | |||
| init:: | ||||
| 	Initialize the submodules, i.e. register each submodule name | ||||
| 	and url found in .gitmodules into .git/config. | ||||
| 	It will also copy the value of `submodule.$name.update` into | ||||
| 	.git/config. | ||||
| 	The key used in .git/config is `submodule.$name.url`. | ||||
| 	This command does not alter existing information in .git/config. | ||||
| 	You can then customize the submodule clone URLs in .git/config | ||||
|  | @ -133,7 +135,7 @@ update:: | |||
| 	checkout the commit specified in the index of the containing repository. | ||||
| 	This will make the submodules HEAD be detached unless `--rebase` or | ||||
| 	`--merge` is specified or the key `submodule.$name.update` is set to | ||||
| 	`rebase` or `merge`. | ||||
| 	`rebase`, `merge` or `none`. | ||||
| + | ||||
| If the submodule is not yet initialized, and you just want to use the | ||||
| setting as stored in .gitmodules, you can automatically initialize the | ||||
|  | @ -141,6 +143,10 @@ submodule with the `--init` option. | |||
| + | ||||
| If `--recursive` is specified, this command will recurse into the | ||||
| registered submodules, and update any nested submodules within. | ||||
| + | ||||
| If the configuration key `submodule.$name.update` is set to `none` the | ||||
| submodule with name `$name` will not be updated by default. This can be | ||||
| overriden by adding `--checkout` to the command. | ||||
|  | ||||
| summary:: | ||||
| 	Show commit summary between the given commit (defaults to HEAD) and | ||||
|  |  | |||
|  | @ -30,6 +30,7 @@ test_expect_success 'setup a submodule tree' ' | |||
| 	git clone super submodule && | ||||
| 	git clone super rebasing && | ||||
| 	git clone super merging && | ||||
| 	git clone super none && | ||||
| 	(cd super && | ||||
| 	 git submodule add ../submodule submodule && | ||||
| 	 test_tick && | ||||
|  | @ -58,6 +59,11 @@ test_expect_success 'setup a submodule tree' ' | |||
| 	 test_tick && | ||||
| 	 git commit -m "rebasing" | ||||
| 	) | ||||
| 	(cd super && | ||||
| 	 git submodule add ../none none && | ||||
| 	 test_tick && | ||||
| 	 git commit -m "none" | ||||
| 	) | ||||
| ' | ||||
|  | ||||
| test_expect_success 'submodule update detaching the HEAD ' ' | ||||
|  | @ -298,6 +304,62 @@ test_expect_success 'submodule update ignores update=rebase config for new submo | |||
| 	) | ||||
| ' | ||||
|  | ||||
| test_expect_success 'submodule init picks up update=none' ' | ||||
| 	(cd super && | ||||
| 	 git config -f .gitmodules submodule.none.update none && | ||||
| 	 git submodule init none && | ||||
| 	 test "none" = "$(git config submodule.none.update)" | ||||
| 	) | ||||
| ' | ||||
|  | ||||
| test_expect_success 'submodule update - update=none in .git/config' ' | ||||
| 	(cd super && | ||||
| 	 git config submodule.submodule.update none && | ||||
| 	 (cd submodule && | ||||
| 	  git checkout master && | ||||
| 	  compare_head | ||||
| 	 ) && | ||||
| 	 git diff --raw | grep "	submodule" && | ||||
| 	 git submodule update && | ||||
| 	 git diff --raw | grep "	submodule" && | ||||
| 	 (cd submodule && | ||||
| 	  compare_head | ||||
| 	 ) && | ||||
| 	 git config --unset submodule.submodule.update && | ||||
| 	 git submodule update submodule | ||||
| 	) | ||||
| ' | ||||
|  | ||||
| test_expect_success 'submodule update - update=none in .git/config but --checkout given' ' | ||||
| 	(cd super && | ||||
| 	 git config submodule.submodule.update none && | ||||
| 	 (cd submodule && | ||||
| 	  git checkout master && | ||||
| 	  compare_head | ||||
| 	 ) && | ||||
| 	 git diff --raw | grep "	submodule" && | ||||
| 	 git submodule update --checkout && | ||||
| 	 test_must_fail git diff --raw \| grep "	submodule" && | ||||
| 	 (cd submodule && | ||||
| 	  test_must_fail compare_head | ||||
| 	 ) && | ||||
| 	 git config --unset submodule.submodule.update | ||||
| 	) | ||||
| ' | ||||
|  | ||||
| test_expect_success 'submodule update --init skips submodule with update=none' ' | ||||
| 	(cd super && | ||||
| 	 git add .gitmodules && | ||||
| 	 git commit -m ".gitmodules" | ||||
| 	) && | ||||
| 	git clone super cloned && | ||||
| 	(cd cloned && | ||||
| 	 git submodule update --init && | ||||
| 	 test -e submodule/.git && | ||||
| 	 test_must_fail test -e none/.git | ||||
| 	) | ||||
| ' | ||||
|  | ||||
| test_expect_success 'submodule update continues after checkout error' ' | ||||
| 	(cd super && | ||||
| 	 git reset --hard HEAD && | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Junio C Hamano
						Junio C Hamano