Support Git submodules.#50
Closed
serhalp wants to merge 1 commit into
Closed
Conversation
When the Git repo being installed or the current working directory is a Git submodule inside another Git repo, be aware of it and treat it as a self-contained Git repo, ignoring the container repo entirely. Essentially, this means that we don't assume there is a ".git" directory in this repo. If we find a ".git" _file_, this means it's a submodule, so we parse the single-line file which indicates the path to its ".git"-ish directory, tucked away somewhere inside the container repo. Then everything works as expected.
Owner
|
interesting, i'll have to think about this one |
nlf
requested changes
Sep 15, 2016
| // This is a git submodule inside another git repo! | ||
| // Resolve the path to its ".git"-ish directory. | ||
| root = start; | ||
| gitFile = Fs.readFileSync(gitDir, { encoding: 'utf8' }); |
Owner
There was a problem hiding this comment.
need a var here or this is a global leak
| // Resolve the path to its ".git"-ish directory. | ||
| root = start; | ||
| gitFile = Fs.readFileSync(gitDir, { encoding: 'utf8' }); | ||
| matches = gitFile.split('\n')[0].match(/^gitdir: (.+)$/); |
Owner
There was a problem hiding this comment.
likewise need a var here. also do we really need to split on newlines? why not just use the regex?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi, we've been using this fork for six months here in several repos, but I just haven't had the bandwidth to write tests for it, so I've been holding off on opening a PR. Would you be interested in merging this as is? Thanks.
When the Git repo being installed or the current working directory is a Git submodule inside another Git repo, be aware of it and treat it as a self-contained Git repo, ignoring the container repo entirely.
Essentially, this means that we don't assume there is a
.gitdirectory in this repo. If we find a.gitfile, this means it's a submodule, so we parse the single-line file which indicates the path to its.git-ish directory, tucked away somewhere inside the container repo. Then everything works as expected.