lib-submodule-update.sh: reorder create_lib_submodule_repo
[gitweb.git] / t / lib-submodule-update.sh
index 915eb4a7c65ca5c574beddc676bf0115990eec3f..5df528ea815dd9a2091eef9c70e92d13e20c219e 100755 (executable)
 # - Tracked file replaced by submodule (replace_sub1_with_file =>
 #   replace_file_with_sub1)
 #
-#                   --O-----O
-#                  /  ^     replace_directory_with_sub1
-#                 /   replace_sub1_with_directory
-#                /----O
-#               /     ^
-#              /      modify_sub1
-#      O------O-------O
-#      ^      ^\      ^
-#      |      | \     remove_sub1
-#      |      |  -----O-----O
-#      |      |   \   ^     replace_file_with_sub1
-#      |      |    \  replace_sub1_with_file
-#      |   add_sub1 --O-----O
-# no_submodule        ^     valid_sub1
-#                     invalid_sub1
+#                     ----O
+#                    /    ^
+#                   /     remove_sub1
+#                  /
+#       add_sub1  /-------O
+#             |  /        ^
+#             | /         modify_sub1
+#             v/
+#      O------O-----------O---------O
+#      ^       \          ^         replace_directory_with_sub1
+#      |        \         replace_sub1_with_directory
+# no_submodule   \
+#                 --------O---------O
+#                  \      ^         replace_file_with_sub1
+#                   \     replace_sub1_with_file
+#                    \
+#                     ----O---------O
+#                         ^         valid_sub1
+#                         invalid_sub1
 #
+
 create_lib_submodule_repo () {
        git init submodule_update_repo &&
        (
@@ -49,10 +54,11 @@ create_lib_submodule_repo () {
                git config submodule.sub1.ignore all &&
                git add .gitmodules &&
                git commit -m "Add sub1" &&
-               git checkout -b remove_sub1 &&
+
+               git checkout -b remove_sub1 add_sub1 &&
                git revert HEAD &&
 
-               git checkout -b "modify_sub1" "add_sub1" &&
+               git checkout -b modify_sub1 add_sub1 &&
                git submodule update &&
                (
                        cd sub1 &&
@@ -67,7 +73,7 @@ create_lib_submodule_repo () {
                git add sub1 &&
                git commit -m "Modify sub1" &&
 
-               git checkout -b "replace_sub1_with_directory" "add_sub1" &&
+               git checkout -b replace_sub1_with_directory add_sub1 &&
                git submodule update &&
                git -C sub1 checkout modifications &&
                git rm --cached sub1 &&
@@ -75,22 +81,25 @@ create_lib_submodule_repo () {
                git config -f .gitmodules --remove-section "submodule.sub1" &&
                git add .gitmodules sub1/* &&
                git commit -m "Replace sub1 with directory" &&
+
                git checkout -b replace_directory_with_sub1 &&
                git revert HEAD &&
 
-               git checkout -b "replace_sub1_with_file" "add_sub1" &&
+               git checkout -b replace_sub1_with_file add_sub1 &&
                git rm sub1 &&
                echo "content" >sub1 &&
                git add sub1 &&
                git commit -m "Replace sub1 with file" &&
+
                git checkout -b replace_file_with_sub1 &&
                git revert HEAD &&
 
-               git checkout -b "invalid_sub1" "add_sub1" &&
+               git checkout -b invalid_sub1 add_sub1 &&
                git update-index --cacheinfo 160000 0123456789012345678901234567890123456789 sub1 &&
                git commit -m "Invalid sub1 commit" &&
                git checkout -b valid_sub1 &&
                git revert HEAD &&
+
                git checkout master
        )
 }