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>
This commit is contained in:
Stefan Beller 2017-03-14 14:46:26 -07:00 committed by Junio C Hamano
parent 4682085cd4
commit eb41e7feed

View File

@ -15,22 +15,27 @@
# - 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
)
}