Skip to content

Turn the git submodules to shallow by default#2183

Merged
cameronvoell merged 1 commit intodevelopfrom
try/shallow-submodules
Apr 24, 2020
Merged

Turn the git submodules to shallow by default#2183
cameronvoell merged 1 commit intodevelopfrom
try/shallow-submodules

Conversation

@hypest
Copy link
Copy Markdown
Contributor

@hypest hypest commented Apr 24, 2020

Fixes #2182

WPAndroid side PR: TBD

Our current theory is that the submodules are large enough and JitPack is not cloning then shallowly so, this PR marks the submodules as shallow by default in an attempt to minimize the size of their casual cloning.

The typical way we pull the submodules is by issuing git submodule update --init --recursive. The same command can still be used and it will pull a shallow copy of the submodules.

If you need to pull the whole history instead, the initial pull after a fresh clone can be: git submodule update --no-recommend-shallow --init --recursive

To test A

  1. Prepare for a fresh clone of the repo by going into a folder that doesn't have the repo clone yet
  2. Issue git clone --single-branch --branch try/shallow-submodules git@github.com:wordpress-mobile/gutenberg-mobile.git to pull the repo. Wait until that finishes.
  3. cd gutenberg-mobile to go into the clone
  4. Issue git submodule update --init --recursive and wait until it finishes
  5. cd gutenberg to go into the Gutenberg submodule
  6. Issue git rev-parse --is-shallow-repository to verify it's a shallow clone. It should return true.
  7. Issue git fetch --unshallow to pull the whole submodule history, to verify that it can be done.
  8. Do steps 5 and 6 for the other submodule (jetpack) too, to verify that that one is shallow too and it can be unshallowed.

To test B

  1. Prepare for a fresh clone of the repo by going into a folder that doesn't have the repo clone yet
  2. Issue git clone --single-branch --branch try/shallow-submodules git@github.com:wordpress-mobile/gutenberg-mobile.git to pull the repo. Wait until that finishes.
  3. cd gutenberg-mobile to go into the clone
  4. Issue git submodule update --init --recursive --no-recommend-shallow and wait until it finishes
  5. cd gutenberg to go into the Gutenberg submodule
  6. Issue git rev-parse --is-shallow-repository to verify it's a not shallow clone. It should return false.
  7. Do the same for the other submodule (jetpack) too, to verify that that one is not shallow too.

PR submission checklist:

  • I have considered adding unit tests where possible. No unit testing applicable.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@hypest
Copy link
Copy Markdown
Contributor Author

hypest commented Apr 24, 2020

Updated the description with the git clone option to clone the particular branch, to avoid pulling the full submodules from develop.

Copy link
Copy Markdown
Contributor

@cameronvoell cameronvoell left a comment

Choose a reason for hiding this comment

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

Test A and B both worked for me :shipit:

@cameronvoell cameronvoell merged commit 5fbf118 into develop Apr 24, 2020
@hypest hypest deleted the try/shallow-submodules branch April 24, 2020 20:45
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.

JitPack build fails with "Git clone took longer than 180 s"

2 participants