From eed44435ba2ab7baef99fb218cf95090128238a9 Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Wed, 21 Nov 2018 10:04:31 +0100 Subject: [PATCH 01/12] fix test of restoring submodule.*.update --- test/get.sh | 12 ++++++++---- test/helpers.sh | 17 ----------------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/test/get.sh b/test/get.sh index 8dc9fb76..92aefd73 100755 --- a/test/get.sh +++ b/test/get.sh @@ -317,7 +317,6 @@ it_preserves_the_submodule_update_method() { local submodule_repo=${repo_with_submodule_info#*,} local submodule_name=${submodule_repo##*/} local main_repo_last_commit_id=$(git -C $main_repo rev-parse HEAD) - local submodule_repo_last_commit_id=$(git -C $submodule_repo rev-parse HEAD) local dest=$TMPDIR/destination @@ -332,9 +331,14 @@ it_preserves_the_submodule_update_method() { rm -rf "$dest" - get_uri_with_submodules_and_git_config \ - "file://$main_repo" $dest "submodule.${submodule_name}.update" "merge" \ - | jq -e " + git -C "$main_repo" config --file .gitmodules --replace-all "submodule.${submodule_name}.update" merge + git -C "$main_repo" add .gitmodules + git -C "$main_repo" commit -m 'Add .gitmodules' >/dev/null + + local main_repo_last_commit_id=$(git -C $main_repo rev-parse HEAD) + local submodule_repo_last_commit_id=$(git -C $submodule_repo rev-parse HEAD) + + get_uri_with_submodules_all "file://$main_repo" 1 $dest | jq -e " .version == {ref: $(echo $main_repo_last_commit_id | jq -R .)} " diff --git a/test/helpers.sh b/test/helpers.sh index 23e109f7..67749ef0 100644 --- a/test/helpers.sh +++ b/test/helpers.sh @@ -455,23 +455,6 @@ get_uri_with_submodules_all() { }" | ${resource_dir}/in "$3" | tee /dev/stderr } -get_uri_with_submodules_and_git_config() { - jq -n "{ - source: { - uri: $(echo $1 | jq -R .), - git_config: [ - { - name: $(echo $3 | jq -R .), - value: $(echo $4 | jq -R .) - } - ] - }, - params: { - submodules: \"all\", - } - }" | ${resource_dir}/in "$2" | tee /dev/stderr -} - get_uri_with_submodules_and_parameter_remote() { jq -n "{ source: { From 25b090b594f41d342f9067504b522db7140d29e5 Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Wed, 21 Nov 2018 10:10:48 +0100 Subject: [PATCH 02/12] fix inversion in restoring submodule.*.update It restored the wrong submodule.*.update Git config value - when it was originally unset, then after restoring it was set to the empty string, and when it was originally set, after restoring it was unset. --- assets/in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/in b/assets/in index 762dfa70..b1b71927 100755 --- a/assets/in +++ b/assets/in @@ -136,9 +136,9 @@ if [ "$submodules" != "none" ]; then for submodule in $submodules; do # remember submodule update config - update_conf_was_set=1 + update_conf_was_set=0 if update_conf="$(git config --get "submodule.${submodule}.update")"; then - update_conf_was_set=0 + update_conf_was_set=1 fi # temporarily set to our shallow clone deepening shell script From af87a76431df8604efbb85d6eabc00bad6b1c828 Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Wed, 21 Nov 2018 10:42:39 +0100 Subject: [PATCH 03/12] fix c&p error in it_preserves_the_submodule_update_method test --- test/get.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/get.sh b/test/get.sh index 92aefd73..9748ae8d 100755 --- a/test/get.sh +++ b/test/get.sh @@ -259,7 +259,7 @@ it_honors_the_depth_flag_for_submodules() { .version == {ref: $(echo $project_last_commit_id | jq -R .)} " - test "$(git -C $project_folder rev-parse HEAD)" = $project_last_commit_id + test "$(git -C $dest_all rev-parse HEAD)" = $project_last_commit_id test "$(git -C $dest_all/$submodule_name rev-list --all --count)" = 1 get_uri_with_submodules_at_depth \ @@ -267,7 +267,7 @@ it_honors_the_depth_flag_for_submodules() { .version == {ref: $(echo $project_last_commit_id | jq -R .)} " - test "$(git -C $project_folder rev-parse HEAD)" = $project_last_commit_id + test "$(git -C $dest_one rev-parse HEAD)" = $project_last_commit_id test "$(git -C $dest_one/$submodule_name rev-list --all --count)" = 1 } From 3fcaef6dcd6e68e74b891f98dd03713f9f6c87ca Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Wed, 21 Nov 2018 10:44:53 +0100 Subject: [PATCH 04/12] rename some vars in a test to prepare for adding more tests --- test/get.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/get.sh b/test/get.sh index 9748ae8d..4b20790a 100755 --- a/test/get.sh +++ b/test/get.sh @@ -251,24 +251,25 @@ it_honors_the_depth_flag_for_submodules() { local submodule_name=$(basename $submodule_folder) local project_last_commit_id=$(git -C $project_folder rev-parse HEAD) - local dest_all=$TMPDIR/destination_all - local dest_one=$TMPDIR/destination_one + local dest_all_depth1=$TMPDIR/destination_all_depth1 get_uri_with_submodules_all \ - "file://"$project_folder 1 $dest_all | jq -e " + "file://"$project_folder 1 $dest_all_depth1 | jq -e " .version == {ref: $(echo $project_last_commit_id | jq -R .)} " - test "$(git -C $dest_all rev-parse HEAD)" = $project_last_commit_id - test "$(git -C $dest_all/$submodule_name rev-list --all --count)" = 1 + test "$(git -C $dest_all_depth1 rev-parse HEAD)" = $project_last_commit_id + test "$(git -C $dest_all_depth1/$submodule_name rev-list --all --count)" = 1 + + local dest_one_depth1=$TMPDIR/destination_one_depth1 get_uri_with_submodules_at_depth \ - "file://"$project_folder 1 $submodule_name $dest_one | jq -e " + "file://"$project_folder 1 $submodule_name $dest_one_depth1 | jq -e " .version == {ref: $(echo $project_last_commit_id | jq -R .)} " - test "$(git -C $dest_one rev-parse HEAD)" = $project_last_commit_id - test "$(git -C $dest_one/$submodule_name rev-list --all --count)" = 1 + test "$(git -C $dest_one_depth1 rev-parse HEAD)" = $project_last_commit_id + test "$(git -C $dest_one_depth1/$submodule_name rev-list --all --count)" = 1 } it_falls_back_to_deep_clone_of_submodule_if_ref_not_found() { From 49aeff5971fee85856cbc6eff36c7c663c1b3aba Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Wed, 21 Nov 2018 10:46:43 +0100 Subject: [PATCH 05/12] add tests for checking out submodules with depth=0 --- test/get.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/get.sh b/test/get.sh index 4b20790a..73a1213c 100755 --- a/test/get.sh +++ b/test/get.sh @@ -251,6 +251,26 @@ it_honors_the_depth_flag_for_submodules() { local submodule_name=$(basename $submodule_folder) local project_last_commit_id=$(git -C $project_folder rev-parse HEAD) + local dest_all_depth0=$TMPDIR/destination_all_depth0 + + get_uri_with_submodules_all \ + "file://"$project_folder 0 $dest_all_depth0 | jq -e " + .version == {ref: $(echo $project_last_commit_id | jq -R .)} + " + + test "$(git -C $dest_all_depth0 rev-parse HEAD)" = $project_last_commit_id + test "$(git -C $dest_all_depth0/$submodule_name rev-list --all --count)" = 2 + + local dest_one_depth0=$TMPDIR/destination_one_depth0 + + get_uri_with_submodules_at_depth \ + "file://"$project_folder 0 $submodule_name $dest_one_depth0 | jq -e " + .version == {ref: $(echo $project_last_commit_id | jq -R .)} + " + + test "$(git -C $dest_one_depth0 rev-parse HEAD)" = $project_last_commit_id + test "$(git -C $dest_one_depth0/$submodule_name rev-list --all --count)" = 2 + local dest_all_depth1=$TMPDIR/destination_all_depth1 get_uri_with_submodules_all \ From 97b56bef29126d813bc7fb0190786f855ebe02bc Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Wed, 21 Nov 2018 11:05:24 +0100 Subject: [PATCH 06/12] do not set custom submodule.*.update script if depth=0 The shallow clone deepening script is no-op if depth is 0 (or not set in params). Setting the submodule update method to run this script when depth is 0 means the submodule will not be correctly updated. --- assets/in | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/assets/in b/assets/in index b1b71927..415ed468 100755 --- a/assets/in +++ b/assets/in @@ -134,26 +134,28 @@ if [ "$submodules" != "none" ]; then git submodule init $submodules fi - for submodule in $submodules; do - # remember submodule update config - update_conf_was_set=0 - if update_conf="$(git config --get "submodule.${submodule}.update")"; then - update_conf_was_set=1 - fi - - # temporarily set to our shallow clone deepening shell script - git config "submodule.${submodule}.update" "!$bin_dir"/deepen_shallow_clone_until_ref_is_found - - concourse_git_resource__depth="$depth" \ - git submodule update --no-fetch $depthflag $submodule_parameters $submodule - - # restore submodule update config - if [ "$update_conf_was_set" != 0 ]; then - git config "submodule.${submodule}.update" "$update_conf" - else - git config --unset "submodule.${submodule}.update" - fi - done + if [ "$depth" -gt 0 ]; then + for submodule in $submodules; do + # remember submodule update config + update_conf_was_set=0 + if update_conf="$(git config --get "submodule.${submodule}.update")"; then + update_conf_was_set=1 + fi + + # temporarily set to our shallow clone deepening shell script + git config "submodule.${submodule}.update" "!$bin_dir"/deepen_shallow_clone_until_ref_is_found + + concourse_git_resource__depth="$depth" \ + git submodule update --no-fetch $depthflag $submodule_parameters $submodule + + # restore submodule update config + if [ "$update_conf_was_set" != 0 ]; then + git config "submodule.${submodule}.update" "$update_conf" + else + git config --unset "submodule.${submodule}.update" + fi + done + fi fi if [ "$disable_git_lfs" != "true" ]; then From 52ac4794c68d133303578a10fc9c478992e0bfd6 Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Wed, 21 Nov 2018 11:09:47 +0100 Subject: [PATCH 07/12] check depth in assets/in and not the shallow clone deepening script `assets/in` should only call the script when deepening a shallow clone is actually needed - ie. when depth > 0. Now with the submodule shallow clone deepening already checking depth > 0, that's simple. --- .../deepen_shallow_clone_until_ref_is_found | 55 +++++++++---------- assets/in | 6 +- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/assets/deepen_shallow_clone_until_ref_is_found b/assets/deepen_shallow_clone_until_ref_is_found index 1b576d52..97c37ee4 100755 --- a/assets/deepen_shallow_clone_until_ref_is_found +++ b/assets/deepen_shallow_clone_until_ref_is_found @@ -20,31 +20,30 @@ readonly ref="$1" # In either case we try to deepen the shallow clone until we find $ref, reach # the max depth of the repo, or give up after a given depth and resort to deep # clone. -if [ "$concourse_git_resource__depth" -gt 0 ]; then - depth="$concourse_git_resource__depth" - git_dir="$(git rev-parse --git-dir)" - readonly git_dir - - while ! git checkout -q "$ref" &>/dev/null; do - # once the depth of a shallow clone reaches the max depth of the origin - # repo, Git silenty turns it into a deep clone - if [ ! -e "$git_dir"/shallow ]; then - echo "Reached max depth of the origin repo while deepening the shallow clone, it's a deep clone now" - break - fi - - echo "Could not find ref ${ref} in a shallow clone of depth ${depth}" - - (( depth *= 2 )) - - if [ "$depth" -gt "$max_depth" ]; then - echo "Reached depth threshold ${max_depth}, falling back to deep clone..." - git fetch --unshallow origin - - break - fi - - echo "Deepening the shallow clone to depth ${depth}..." - git fetch --depth "$depth" origin - done -fi + +depth="$concourse_git_resource__depth" +git_dir="$(git rev-parse --git-dir)" +readonly git_dir + +while ! git checkout -q "$ref" &>/dev/null; do + # once the depth of a shallow clone reaches the max depth of the origin + # repo, Git silenty turns it into a deep clone + if [ ! -e "$git_dir"/shallow ]; then + echo "Reached max depth of the origin repo while deepening the shallow clone, it's a deep clone now" + break + fi + + echo "Could not find ref ${ref} in a shallow clone of depth ${depth}" + + (( depth *= 2 )) + + if [ "$depth" -gt "$max_depth" ]; then + echo "Reached depth threshold ${max_depth}, falling back to deep clone..." + git fetch --unshallow origin + + break + fi + + echo "Deepening the shallow clone to depth ${depth}..." + git fetch --depth "$depth" origin +done diff --git a/assets/in b/assets/in index 415ed468..186bf0dd 100755 --- a/assets/in +++ b/assets/in @@ -73,8 +73,10 @@ cd $destination git fetch origin refs/notes/*:refs/notes/* -concourse_git_resource__depth="$depth" \ - "$bin_dir"/deepen_shallow_clone_until_ref_is_found "$ref" +if [ "$depth" -gt 0 ]; then + concourse_git_resource__depth="$depth" \ + "$bin_dir"/deepen_shallow_clone_until_ref_is_found "$ref" +fi git checkout -q $ref From 82ef5a393a1b1e5a00f5413175f10350800491e8 Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Fri, 7 Dec 2018 12:00:07 +0100 Subject: [PATCH 08/12] submodule deepening test: test for the commit hash in submodule This is a failing test for https://github.com/concourse/git-resource/pull/226#discussion_r235502254 --- test/get.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/get.sh b/test/get.sh index 73a1213c..458cbf3f 100755 --- a/test/get.sh +++ b/test/get.sh @@ -250,6 +250,7 @@ it_honors_the_depth_flag_for_submodules() { local submodule_folder=$(echo $repo_with_submodule_info | cut -d "," -f2) local submodule_name=$(basename $submodule_folder) local project_last_commit_id=$(git -C $project_folder rev-parse HEAD) + local submodule_last_commit_id=$(git -C $project_folder/$submodule_name rev-parse HEAD) local dest_all_depth0=$TMPDIR/destination_all_depth0 @@ -259,7 +260,8 @@ it_honors_the_depth_flag_for_submodules() { " test "$(git -C $dest_all_depth0 rev-parse HEAD)" = $project_last_commit_id - test "$(git -C $dest_all_depth0/$submodule_name rev-list --all --count)" = 2 + test "$(git -C $dest_all_depth0/$submodule_name rev-parse HEAD)" = $submodule_last_commit_id + test "$(git -C $dest_all_depth0/$submodule_name rev-list --all --count)" \> 1 local dest_one_depth0=$TMPDIR/destination_one_depth0 @@ -269,7 +271,8 @@ it_honors_the_depth_flag_for_submodules() { " test "$(git -C $dest_one_depth0 rev-parse HEAD)" = $project_last_commit_id - test "$(git -C $dest_one_depth0/$submodule_name rev-list --all --count)" = 2 + test "$(git -C $dest_all_depth0/$submodule_name rev-parse HEAD)" = $submodule_last_commit_id + test "$(git -C $dest_one_depth0/$submodule_name rev-list --all --count)" \> 1 local dest_all_depth1=$TMPDIR/destination_all_depth1 @@ -279,6 +282,7 @@ it_honors_the_depth_flag_for_submodules() { " test "$(git -C $dest_all_depth1 rev-parse HEAD)" = $project_last_commit_id + test "$(git -C $dest_all_depth1/$submodule_name rev-parse HEAD)" = $submodule_last_commit_id test "$(git -C $dest_all_depth1/$submodule_name rev-list --all --count)" = 1 local dest_one_depth1=$TMPDIR/destination_one_depth1 @@ -289,6 +293,7 @@ it_honors_the_depth_flag_for_submodules() { " test "$(git -C $dest_one_depth1 rev-parse HEAD)" = $project_last_commit_id + test "$(git -C $dest_all_depth1/$submodule_name rev-parse HEAD)" = $submodule_last_commit_id test "$(git -C $dest_one_depth1/$submodule_name rev-list --all --count)" = 1 } From e31d5cea9237e7d833dc4d18709df822814e97ad Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Fri, 7 Dec 2018 12:00:07 +0100 Subject: [PATCH 09/12] submodule deepening test: test for failure if the ref cannot be found This is a failing test for https://github.com/concourse/git-resource/pull/226#discussion_r235502484 --- test/get.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/get.sh b/test/get.sh index 458cbf3f..8446ce1c 100755 --- a/test/get.sh +++ b/test/get.sh @@ -335,6 +335,26 @@ it_falls_back_to_deep_clone_of_submodule_if_ref_not_found() { grep "Reached depth threshold 128, falling back to deep clone..." <$TMPDIR/stderr } +it_fails_if_the_ref_cannot_be_found_while_deepening_a_submodule() { + local repo_with_submodule_info=$(init_repo_with_submodule) + local main_repo=${repo_with_submodule_info%,*} + local submodule_repo=${repo_with_submodule_info#*,} + local submodule_name=${submodule_repo##*/} + local submodule_last_commit_id=$(git -C "$submodule_repo" rev-parse HEAD) + + git -C "$submodule_repo" reset --hard HEAD^ >/dev/null + + local dest=$TMPDIR/destination + + output=$(get_uri_with_submodules_all "file://$main_repo" 1 $dest 2>&1) \ + && exit_code=$? || exit_code=$? + + echo $output $exit_code + test "${exit_code}" \!= 0 + echo "${output}" | grep "Reached max depth of the origin repo while deepening the shallow clone, it's a deep clone now" + echo "${output}" | grep "fatal: reference is not a tree: $submodule_last_commit_id" +} + # the submodule incremental deepening depends on overwriting the update method # of the submodule, so we should test if it's properly restored it_preserves_the_submodule_update_method() { @@ -710,6 +730,7 @@ run it_falls_back_to_deep_clone_if_ref_not_found run it_does_not_enter_an_infinite_loop_if_the_ref_cannot_be_found_and_depth_is_set run it_honors_the_depth_flag_for_submodules run it_falls_back_to_deep_clone_of_submodule_if_ref_not_found +run it_fails_if_the_ref_cannot_be_found_while_deepening_a_submodule run it_preserves_the_submodule_update_method run it_honors_the_parameter_flags_for_submodules run it_can_get_and_set_git_config From ad553ecb6aa971840fb6be0b805a50616d2b2480 Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Fri, 7 Dec 2018 12:02:41 +0100 Subject: [PATCH 10/12] submodule deepening: actually check the ref out Previously it did not check out the correct commit ref of the submodule. --- ...w_clone_until_ref_is_found_then_check_out} | 2 ++ assets/in | 22 ++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) rename assets/{deepen_shallow_clone_until_ref_is_found => deepen_shallow_clone_until_ref_is_found_then_check_out} (98%) diff --git a/assets/deepen_shallow_clone_until_ref_is_found b/assets/deepen_shallow_clone_until_ref_is_found_then_check_out similarity index 98% rename from assets/deepen_shallow_clone_until_ref_is_found rename to assets/deepen_shallow_clone_until_ref_is_found_then_check_out index 97c37ee4..236ab8c3 100755 --- a/assets/deepen_shallow_clone_until_ref_is_found +++ b/assets/deepen_shallow_clone_until_ref_is_found_then_check_out @@ -47,3 +47,5 @@ while ! git checkout -q "$ref" &>/dev/null; do echo "Deepening the shallow clone to depth ${depth}..." git fetch --depth "$depth" origin done + +git checkout -q "$ref" diff --git a/assets/in b/assets/in index 186bf0dd..76846592 100755 --- a/assets/in +++ b/assets/in @@ -75,11 +75,11 @@ git fetch origin refs/notes/*:refs/notes/* if [ "$depth" -gt 0 ]; then concourse_git_resource__depth="$depth" \ - "$bin_dir"/deepen_shallow_clone_until_ref_is_found "$ref" + "$bin_dir"/deepen_shallow_clone_until_ref_is_found_then_check_out "$ref" +else + git checkout -q "$ref" fi -git checkout -q $ref - invalid_key() { echo "Invalid GPG key in: ${commit_verification_keys}" exit 2 @@ -136,8 +136,8 @@ if [ "$submodules" != "none" ]; then git submodule init $submodules fi - if [ "$depth" -gt 0 ]; then - for submodule in $submodules; do + for submodule in $submodules; do + if [ "$depth" -gt 0 ]; then # remember submodule update config update_conf_was_set=0 if update_conf="$(git config --get "submodule.${submodule}.update")"; then @@ -145,19 +145,21 @@ if [ "$submodules" != "none" ]; then fi # temporarily set to our shallow clone deepening shell script - git config "submodule.${submodule}.update" "!$bin_dir"/deepen_shallow_clone_until_ref_is_found + git config "submodule.${submodule}.update" "!$bin_dir"/deepen_shallow_clone_until_ref_is_found_then_check_out + fi - concourse_git_resource__depth="$depth" \ - git submodule update --no-fetch $depthflag $submodule_parameters $submodule + concourse_git_resource__depth="$depth" \ + git submodule update --no-fetch $depthflag $submodule_parameters $submodule + if [ "$depth" -gt 0 ]; then # restore submodule update config if [ "$update_conf_was_set" != 0 ]; then git config "submodule.${submodule}.update" "$update_conf" else git config --unset "submodule.${submodule}.update" fi - done - fi + fi + done fi if [ "$disable_git_lfs" != "true" ]; then From 6f013044179aa990b04b594d339c1638da6d3213 Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Fri, 7 Dec 2018 13:18:24 +0100 Subject: [PATCH 11/12] pass depth as arg not envvar when deepening shallow clone IMHO it's more straightforward this way. --- ...deepen_shallow_clone_until_ref_is_found_then_check_out | 6 ++---- assets/in | 8 +++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/assets/deepen_shallow_clone_until_ref_is_found_then_check_out b/assets/deepen_shallow_clone_until_ref_is_found_then_check_out index 236ab8c3..b1131902 100755 --- a/assets/deepen_shallow_clone_until_ref_is_found_then_check_out +++ b/assets/deepen_shallow_clone_until_ref_is_found_then_check_out @@ -5,9 +5,8 @@ set -e readonly max_depth=128 -readonly ref="$1" - -# the concourse_git_resource__depth variable is exported by the 'in' script +declare depth="$1" +readonly ref="$2" # A shallow clone may not contain the Git commit $ref: # 1. The depth of the shallow clone is measured backwards from the latest @@ -21,7 +20,6 @@ readonly ref="$1" # the max depth of the repo, or give up after a given depth and resort to deep # clone. -depth="$concourse_git_resource__depth" git_dir="$(git rev-parse --git-dir)" readonly git_dir diff --git a/assets/in b/assets/in index 76846592..4c36d4b0 100755 --- a/assets/in +++ b/assets/in @@ -74,8 +74,7 @@ cd $destination git fetch origin refs/notes/*:refs/notes/* if [ "$depth" -gt 0 ]; then - concourse_git_resource__depth="$depth" \ - "$bin_dir"/deepen_shallow_clone_until_ref_is_found_then_check_out "$ref" + "$bin_dir"/deepen_shallow_clone_until_ref_is_found_then_check_out "$depth" "$ref" else git checkout -q "$ref" fi @@ -145,11 +144,10 @@ if [ "$submodules" != "none" ]; then fi # temporarily set to our shallow clone deepening shell script - git config "submodule.${submodule}.update" "!$bin_dir"/deepen_shallow_clone_until_ref_is_found_then_check_out + git config "submodule.${submodule}.update" "!$bin_dir/deepen_shallow_clone_until_ref_is_found_then_check_out $depth" fi - concourse_git_resource__depth="$depth" \ - git submodule update --no-fetch $depthflag $submodule_parameters $submodule + git submodule update --no-fetch $depthflag $submodule_parameters $submodule if [ "$depth" -gt 0 ]; then # restore submodule update config From 8d1487acec1a54efb867026eb95a1989babc6f83 Mon Sep 17 00:00:00 2001 From: Norbert Buchmueller Date: Sat, 8 Dec 2018 09:56:16 +0100 Subject: [PATCH 12/12] fix typo in test name I could not help fixing it. :-) --- test/get.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/get.sh b/test/get.sh index 8446ce1c..d8ae2fd2 100755 --- a/test/get.sh +++ b/test/get.sh @@ -145,7 +145,7 @@ it_returns_list_of_tags_in_metadata() { " } -it_can_use_submodlues_without_perl_warning() { +it_can_use_submodules_without_perl_warning() { local repo=$(init_repo_with_submodule | cut -d "," -f1) local dest=$TMPDIR/destination @@ -723,7 +723,7 @@ run it_omits_empty_branch_in_metadata run it_returns_branch_in_metadata run it_omits_empty_tags_in_metadata run it_returns_list_of_tags_in_metadata -run it_can_use_submodlues_without_perl_warning +run it_can_use_submodules_without_perl_warning run it_honors_the_depth_flag run it_can_get_from_url_at_depth_at_ref run it_falls_back_to_deep_clone_if_ref_not_found