chainlint: let here-doc and multi-line string commence on same line
[gitweb.git] / t / lib-submodule-update.sh
index 38dadd2c2902f3621d54168d32a54d7863497968..e90ec7908771788d0d7723d2dd729b6defb4bb7f 100755 (executable)
@@ -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 &&
@@ -755,7 +755,7 @@ test_submodule_recursing_with_args_common() {
                        : >sub1/untrackedfile &&
                        test_must_fail $command replace_sub1_with_file &&
                        test_superproject_content origin/add_sub1 &&
-                       test_submodule_content sub1 origin/add_sub1
+                       test_submodule_content sub1 origin/add_sub1 &&
                        test -f sub1/untracked_file
                )
        '
@@ -842,7 +842,7 @@ test_submodule_switch_recursing_with_args () {
                        cd submodule_update &&
                        git branch -t add_sub1 origin/add_sub1 &&
                        : >sub1 &&
-                       echo sub1 >.git/info/exclude
+                       echo sub1 >.git/info/exclude &&
                        $command add_sub1 &&
                        test_superproject_content origin/add_sub1 &&
                        test_submodule_content sub1 origin/add_sub1
@@ -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 &&
@@ -968,7 +969,6 @@ test_submodule_forced_switch_recursing_with_args () {
                        rm -rf .git/modules/sub1 &&
                        $command replace_sub1_with_directory &&
                        test_superproject_content origin/replace_sub1_with_directory &&
-                       test_submodule_content sub1 origin/modify_sub1
                        test_git_directory_exists sub1
                )
        '
@@ -1014,4 +1014,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
+               )
+       '
 }