Skip to content

how to use git submodule foreach and its variables #886

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

Closed
3nids opened this issue Jun 26, 2019 · 3 comments
Closed

how to use git submodule foreach and its variables #886

3nids opened this issue Jun 26, 2019 · 3 comments

Comments

@3nids
Copy link

3nids commented Jun 26, 2019

Not strictly an issue, but I couldn't find anything in the doc and my understanding of the API is limited. Sorry if it's a stupid question.

I would like to use repo.git.submodule('foreach', …) and get the variables available such as name, sm_path, displaypath, sha1 and toplevel as defined in the git documentation.

@3nids
Copy link
Author

3nids commented Jun 26, 2019

I cross-posted on stack-overflow as it might be nice to leave a trace there as it might be more visible than a bugtracker on github.

@stsewd
Copy link
Contributor

stsewd commented Jun 26, 2019

Sorry If I didn't understood the question, but I think you can do this with

repo = git.Repo('foo/bar')
for sub in repo.submodules:
    pass

https://gitpython.readthedocs.io/en/stable/reference.html#git.repo.base.Repo.submodules

@3nids
Copy link
Author

3nids commented Jun 26, 2019

hmmm...looks like I was overthinking it...
many thanks for your reply

@3nids 3nids closed this as completed Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants