From 6419a12397c8ea2017a2540e23c8ea3cc67ce60f Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Fri, 5 Jan 2018 12:03:01 -0800 Subject: t/lib-submodule-update.sh: clarify test Keep the local branch name as the upstream branch name to avoid confusion. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- t/lib-submodule-update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index 38dadd2c29..d7699046f6 100755 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -664,8 +664,8 @@ test_submodule_recursing_with_args_common() { cd submodule_update && git -C sub1 checkout -b keep_branch && git -C sub1 rev-parse HEAD >expect && - git branch -t check-keep origin/modify_sub1 && - $command check-keep && + git branch -t modify_sub1 origin/modify_sub1 && + $command modify_sub1 && test_superproject_content origin/modify_sub1 && test_submodule_content sub1 origin/modify_sub1 && git -C sub1 rev-parse keep_branch >actual && -- cgit v1.2.3 From 63d963a4706c6a085f6d790d7e589de3e9b369a4 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Fri, 5 Jan 2018 12:03:02 -0800 Subject: t/lib-submodule-update.sh: fix test ignoring ignored files in submodules It turns out that the test replacing a submodule with a file with the submodule containing an ignored file is incorrectly titled, because the test put the file in place, but never ignored that file. When having an untracked file Instead of an ignored file in the submodule, git should refuse to remove the submodule, but that is a bug in the implementation of recursing into submodules, such that the test just passed, removing the untracked file. Fix the test first; in a later patch we'll fix gits behavior, that will make sure untracked files are not deleted. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- t/lib-submodule-update.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index d7699046f6..fb0173ea87 100755 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -885,6 +885,7 @@ test_submodule_switch_recursing_with_args () { ( cd submodule_update && git branch -t replace_sub1_with_file origin/replace_sub1_with_file && + echo ignored >.git/modules/sub1/info/exclude && : >sub1/ignored && $command replace_sub1_with_file && test_superproject_content origin/replace_sub1_with_file && -- cgit v1.2.3 From 7dcc1f4df8c74ec43d9b3e8c97aa985c2663b467 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Fri, 5 Jan 2018 12:03:04 -0800 Subject: submodule: submodule_move_head omits old argument in forced case When using hard reset or forced checkout with the option to recurse into submodules, the submodules need to be reset, too. It turns out that we need to omit the duplicate old argument to read-tree in all forced cases to omit the 2 way merge and use the more assertive behavior of reading the specific new tree into the index and updating the working tree. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- t/lib-submodule-update.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 't') diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index fb0173ea87..1f38a85371 100755 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -1015,4 +1015,18 @@ test_submodule_forced_switch_recursing_with_args () { test_submodule_content sub1 origin/modify_sub1 ) ' + + test_expect_success "$command: changed submodule worktree is reset" ' + prolog && + reset_work_tree_to_interested add_sub1 && + ( + cd submodule_update && + rm sub1/file1 && + : >sub1/new_file && + git -C sub1 add new_file && + $command HEAD && + test_path_is_file sub1/file1 && + test_path_is_missing sub1/new_file + ) + ' } -- cgit v1.2.3