-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix: only add .git if no parent contains one #80
Conversation
} | ||
|
||
fmt.Println("Generated", pdk.Name, "plugin scaffold at", dir) | ||
|
||
return nil | ||
} | ||
|
||
func hasGitRepoInParents(dir string, depth int) bool { | ||
parent := filepath.Dir(dir) | ||
if depth == 0 || parent == "" || parent == "." || parent == dir { |
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 think if parent parent == "/"
we probably also want to return false 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.
Likely pedantic, but is it possible there is a .git repo there?
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.
oh yeah maybe in docker
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.
hah I really don't know, so if you think we should return false here too I'm ok with it -- was just thinking it could be possible although pretty unrealistic?
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.
no i think you're right - i was missing that parent == dir
ensures that the recursion will stop at /
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.
Nice! Also tested go install
which seems to work still
No description provided.