SubmoduleCollection.Add() using clone #1232
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I see two other pull requests for the same feature (#482 and #684) that haven't been updated in 18 months, so I thought I would give it a try since I need this functionality for a project to convert from another source control system.
SubmoduleCollection.Add(url, subdir) acts like the command line 'git submodule add url subdir'.
It calls git_submodule_add_setup, then deletes the directory created by that and clones
into the same directory and calls git_submodule_add_finalize. The end result is that the
.gitmodules file and the 'file' for the submodule directory are staged and ready to commit.