-
-
Notifications
You must be signed in to change notification settings - Fork 920
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Cannot get commits in code, but it works in REPL? #1121
Comments
Further digging has revealed that the problem indeed lies in the fact that, when the hook runs the code, cmd.stdout.readline() just returns a blank... |
To me it looks like My expectation would be that the above works though. |
OK, so I put the same code into a pre-commit hook and that did not fail. So that makes it pretty obvious to me that it is not the shell environment, but rather the state of the repository during the pre-receive hook that is at fault. I have tried the debugging settings, but unfortunately, it seems this particular command does not get debugged properly:
As you can see, some early git commands do get logged but not the one that gives no output... Something else I tried was putting the repo into the pre-receive state by making a pre-receive hook that just looped infintely ( |
Thanks for the heads-up. Since it's something with the way GitPython obtains object information, you could try to instantiate the repository with a different object database implementation. The one implemented in pure python would certainly provide better error messages, maybe it works even. Something I can imagine to be the reason for this issue in the first place is a different run environment, as the |
Well now, using the As for the environment, I did dump |
Thanks again! Please allow me nonetheless to close this issue as answered question due to the discovery of a workaround. Hopefully people will be able to find it when encountering similar issues. In order to reopen, there should be script(s) to make this issue reproducible. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I'm trying to write a pre-receive hook.
When using the repl, I get the following results:
Here is the relevant content of my pre-receive hook file:
However, when I trigger this with a push, this is the result:
I don't get it... How could it work in the REPL but not in code? Could there be some sort of difference in the shell environment that GitPython uses? But if so, what?
The text was updated successfully, but these errors were encountered: