Skip to content

Conversation

@norbertbuchmueller
Copy link
Contributor

The fix for deepening submodules in #212 introduced two bugs:

This PR fixes those (plus an unrelated ancient bug in a test) and improves the tests of checking out submodules.

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.
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` 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.
if [ "$depth" -gt "$max_depth" ]; then
echo "Reached depth threshold ${max_depth}, falling back to deep clone..."
git fetch --unshallow origin

This comment was marked as spam.

This comment was marked as spam.

# 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

This comment was marked as spam.

This comment was marked as spam.

assets/in Outdated
"$bin_dir"/deepen_shallow_clone_until_ref_is_found "$ref"
fi

git checkout -q $ref

This comment was marked as spam.

This comment was marked as spam.

if [ "$depth" -gt 0 ]; then
for submodule in $submodules; do
# remember submodule update config
update_conf_was_set=0

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@vito
Copy link
Member

vito commented Dec 3, 2018

@norbertbuchmueller Thanks for following up on this! Do you have a chance to review the above feedback? (And thanks for the review, @ndmckinley!)

@norbertbuchmueller
Copy link
Contributor Author

@ndmckinley Thank you very much for the review! If you could have another look to verify my fixes that would be really great.

@vito Sorry about the long delay.

Copy link

@nat-henderson nat-henderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a maintainer, but this looks right to me. @vito, right?

git_dir="$(git rev-parse --git-dir)"
readonly git_dir

while ! git checkout -q "$ref" &>/dev/null; do

This comment was marked as spam.

if [ "$depth" -gt 0 ]; then
for submodule in $submodules; do
# remember submodule update config
update_conf_was_set=0

This comment was marked as spam.

@vito
Copy link
Member

vito commented Dec 11, 2018

@ndmckinley Thanks for reviewing! I think this is good to go too, so I'll merge this in to fix those bugs and ship a new version so y'all can test it out. Happy to review any further PRs!

@norbertbuchmueller thanks again!

@vito vito merged commit 3193e49 into concourse:master Dec 11, 2018
@norbertbuchmueller
Copy link
Contributor Author

@ndmckinley Thanks for the review!

I'll merge this in to fix those bugs and ship a new version so y'all can test it out.

Thanks @vito! Looking forward to try the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants