Skip to content

Support Git submodules.#50

Closed
serhalp wants to merge 1 commit into
nlf:masterfrom
goodeggs:support-submodules
Closed

Support Git submodules.#50
serhalp wants to merge 1 commit into
nlf:masterfrom
goodeggs:support-submodules

Conversation

@serhalp
Copy link
Copy Markdown

@serhalp serhalp commented Jul 27, 2016

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 .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.

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.
@nlf
Copy link
Copy Markdown
Owner

nlf commented Aug 1, 2016

interesting, i'll have to think about this one

Comment thread lib/utils.js
// 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' });
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

need a var here or this is a global leak

Comment thread lib/utils.js
// Resolve the path to its ".git"-ish directory.
root = start;
gitFile = Fs.readFileSync(gitDir, { encoding: 'utf8' });
matches = gitFile.split('\n')[0].match(/^gitdir: (.+)$/);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

likewise need a var here. also do we really need to split on newlines? why not just use the regex?

@serhalp serhalp closed this Jul 21, 2021
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.

2 participants