Skip to content
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 go mod repo to run only on current git project #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DariaKunoichi
Copy link

Use git ls-files to ignore submodules

Use git ls-files to ignore submodules
Copy link
Owner

@TekWizely TekWizely left a comment

Choose a reason for hiding this comment

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

Greetings @DariaKunoichi and thanks for taking the time to make a PR !

so I'm a bit torn, and stuck trying to decide between "only git-tracked files should be considered" and "let's exclude sub-modules"

I'm leaning toward the latter, as it feels more inclusive.

In researching, modern sub-modules keep a .git file (not directory) as a gitlink to the tracked git folder off of the repo root.

Older sub-modules could still contain a .git folder.

My idea is to exclude sub-folders that have their own .git file/folder.

Starting from this SO post:

I learned about pruning with find and was able to devise this construct:

find . -type d \( -name .git -prune \) -o \( -name vendor -prune \) -o \( -not -path . -exec [ -e '{}/.git' ] \; -prune \) -o \( -exec [ -f '{}/go.mod' ] \; -print \)

This seems to work well in my local, but I'm interested in your thoughts ?

NOTE: Additionally, the cmd-repo-pkg script will need a version of the solution we end up with.

Thanks again, I look forward to further discussion on this matter.

-TW

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