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

feature request: ignore certain subdirectories when running gita add -a . #204

Closed
abeluck opened this issue Dec 20, 2021 · 3 comments
Closed

Comments

@abeluck
Copy link

abeluck commented Dec 20, 2021

We use gita to automatically checkout a large tree of repos. We commit the gita config csvs and freeze file to our meta repo to share them across the the team. This works really well.

However some repos have submodules, and these submodules are picked up by gita add -a. This isn't ideal as we don't want gita to manage/checkout these repos.

Would it be possible to add a flag to gita add -a to ignore .git dirs that are submodules? Or, as an alternative, would it be possible to specify an ignore file with wildcard paths that gita should ignore? The latter might be easier (and more flexible) than implementing parsing of .gitmodules files.

@nosarthur
Copy link
Owner

It seems easy to add an option to skip submodules (as well as worktree repos). Normal git repos have their .git as folders, but submodule and worktree repos have .git as files with the following content. Thus we can check for .git/modules/ in the .git file.

The ignore file seems to require more work to implement. I imagine we need to read patterns from a file then match all of them say using re to each repo path. Let me know if you have a better implementation in mind.

  • submodule
gitdir: ../../.git/modules/lib/ugfx
  • worktree
gitdir: /home/abcd/working/witch/.git/worktrees/witch-openwitchrc2b

#152

@nosarthur
Copy link
Owner

I implemented the logic in my previous comment. Please test with 0.16.0

gita add -s (s for skipping submodules, or --skip-submodule)

Let me know how it goes. It won't work if your submodule repo has .git as a directory. In that case, I will need to something else

@nosarthur
Copy link
Owner

@abeluck Please feel free to reopen if it doesn't work

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

No branches or pull requests

2 participants