-
Notifications
You must be signed in to change notification settings - Fork 236
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
rpmautospec
-plugin's git repo check is too strict
#1290
Comments
@nphilipp fyi |
@sgallagher fyi |
@dennisklein thank you for reporting this! |
@dennisklein good catch! In fact, we don’t want to have |
@praiskup I lean towards implementing this check in |
@dennisklein Your check is too lenient, though 😉 (but the error message in the plugin is misleading): it works anywhere in the worktree, but it should only continue there if at the root. I guess I’ll just check for the presence of |
true, I didn't realize this aspect.
👍 Thank you! |
Not sure if the mock plugin needs an update? But sounds good. |
I’ve looked into it more closely and it seems like just checking these couple files or directories doesn’t cover all the options how a git work tree can be defined. So to me the question is if we can live with not supporting these corner cases – which we could by delegating this step to |
To my current use case (submodules) it would be acceptable.
This sounds more future-proof as we would not be relying on implementation details of git. |
mock/mock/py/mockbuild/plugins/rpmautospec.py
Lines 61 to 62 in 4b3fb22
This check fails for git submodules and multiple git worktrees (in such cases the
.git
file may not be a directory). Sincerpmautospec
already depends onpygit2
I propose to improve the git repo check withpygit2.discover_repository()
which already supports submodules and worktrees.Test with
python -c "import pygit2; import os; print(pygit2.discover_repository(os.getcwd()))"
Possible implementation:
If
pygit2
as a new dependency is not desired, one could fall back to the return code ofgit rev-parse --git-dir
.The text was updated successfully, but these errors were encountered: