lib-submodule-update.sh: reorder create_lib_submodule_repo

Redraw the ASCII art describing the setup using more space, such that it is easier to understand. The leaf commits are now ordered the same way the actual code is ordered. Add empty lines to the setup code separating each of the leaf commits, each starting with a "checkout -b". Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Mar 14, 2017 at 14:46 UTC eb41e7feed1a48374a799ec9207d18ee97fb3082
1 file changed +29 -20
t/lib-submodule-update.sh
+29 -20
@@ -15,22 +15,27 @@
15 # - Tracked file replaced by submodule (replace_sub1_with_file =>
16 # replace_file_with_sub1)
17 #
18 -# --O-----O
19 -# / ^ replace_directory_with_sub1
20 -# / replace_sub1_with_directory
21 -# /----O
22 -# / ^
23 -# / modify_sub1
24 -# O------O-------O
25 -# ^ ^\ ^
26 -# | | \ remove_sub1
27 -# | | -----O-----O
28 -# | | \ ^ replace_file_with_sub1
29 -# | | \ replace_sub1_with_file
30 -# | add_sub1 --O-----O
31 -# no_submodule ^ valid_sub1
32 -# invalid_sub1
18 +# ----O
19 +# / ^
20 +# / remove_sub1
21 +# /
22 +# add_sub1 /-------O
23 +# | / ^
24 +# | / modify_sub1
25 +# v/
26 +# O------O-----------O---------O
27 +# ^ \ ^ replace_directory_with_sub1
28 +# | \ replace_sub1_with_directory
29 +# no_submodule \
30 +# --------O---------O
31 +# \ ^ replace_file_with_sub1
32 +# \ replace_sub1_with_file
33 +# \
34 +# ----O---------O
35 +# ^ valid_sub1
36 +# invalid_sub1
37 #
38 +
39 create_lib_submodule_repo () {
40 git init submodule_update_repo &&
41 (
@@ -49,10 +54,11 @@ create_lib_submodule_repo () {
54 git config submodule.sub1.ignore all &&
55 git add .gitmodules &&
56 git commit -m "Add sub1" &&
52 - git checkout -b remove_sub1 &&
57 +
58 + git checkout -b remove_sub1 add_sub1 &&
59 git revert HEAD &&
60
55 - git checkout -b "modify_sub1" "add_sub1" &&
61 + git checkout -b modify_sub1 add_sub1 &&
62 git submodule update &&
63 (
64 cd sub1 &&
@@ -67,7 +73,7 @@ create_lib_submodule_repo () {
73 git add sub1 &&
74 git commit -m "Modify sub1" &&
75
70 - git checkout -b "replace_sub1_with_directory" "add_sub1" &&
76 + git checkout -b replace_sub1_with_directory add_sub1 &&
77 git submodule update &&
78 git -C sub1 checkout modifications &&
79 git rm --cached sub1 &&
@@ -75,22 +81,25 @@ create_lib_submodule_repo () {
81 git config -f .gitmodules --remove-section "submodule.sub1" &&
82 git add .gitmodules sub1/* &&
83 git commit -m "Replace sub1 with directory" &&
84 +
85 git checkout -b replace_directory_with_sub1 &&
86 git revert HEAD &&
87
81 - git checkout -b "replace_sub1_with_file" "add_sub1" &&
88 + git checkout -b replace_sub1_with_file add_sub1 &&
89 git rm sub1 &&
90 echo "content" >sub1 &&
91 git add sub1 &&
92 git commit -m "Replace sub1 with file" &&
93 +
94 git checkout -b replace_file_with_sub1 &&
95 git revert HEAD &&
96
89 - git checkout -b "invalid_sub1" "add_sub1" &&
97 + git checkout -b invalid_sub1 add_sub1 &&
98 git update-index --cacheinfo 160000 0123456789012345678901234567890123456789 sub1 &&
99 git commit -m "Invalid sub1 commit" &&
100 git checkout -b valid_sub1 &&
101 git revert HEAD &&
102 +
103 git checkout master
104 )
105 }