-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Check for submodules #3661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for submodules #3661
Changes from 2 commits
e31d37f
5723d91
1c94f3d
c1f78ce
f7ab4f0
2de6a7d
fb47f5c
a67f024
301547e
c9a33a4
c4a8262
44c4d93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,10 @@ def repo_exists(self): | |
code, _, _ = self.run('git', 'status', record=False) | ||
return code == 0 | ||
|
||
def submodules_exists(self): | ||
code, out, _ = self.run('git', 'submodule', 'status', record=False) | ||
return code == 0 and bool(out) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command always returns 0, but the output is empty when there isn't submodules, I think is better to rely on git than checking for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figure out There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I test this locally in a repo with 126 submodules and I found this command is too slow and very CPU consuming:
Even in the RTD repository:
I like following the pattern here by using git commands, but this is something that we will want to consider over just checking the existance of the file. @agjohnson what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought I commented here, but I think i got side tracked determining how |
||
|
||
def fetch(self): | ||
code, _, _ = self.run('git', 'fetch', '--tags', '--prune') | ||
if code != 0: | ||
|
@@ -187,9 +191,10 @@ def checkout(self, identifier=None): | |
self.run('git', 'clean', '-d', '-f', '-f') | ||
|
||
# Update submodules | ||
self.run('git', 'submodule', 'sync') | ||
self.run('git', 'submodule', 'update', | ||
'--init', '--recursive', '--force') | ||
if self.submodules_exists(): | ||
self.run('git', 'submodule', 'sync') | ||
self.run('git', 'submodule', 'update', | ||
'--init', '--recursive', '--force') | ||
|
||
return code, out, err | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how to check when there is a submodule, should I create a submodule on other branch on the git repo setup and then check here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I don't think I'm really testing here, I think this command can be only executed inside checkout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I see on the logs that
make_test_git
says there is not git configuration (name and email) when runninglog.info(check_output(['git', 'add', '.'], env=env))
This works on travis?