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

Possible new feature (a new commit query) if not implemented yet #991

Open
leos313 opened this issue Feb 27, 2020 · 2 comments
Open

Possible new feature (a new commit query) if not implemented yet #991

leos313 opened this issue Feb 27, 2020 · 2 comments

Comments

@leos313
Copy link

@leos313 leos313 commented Feb 27, 2020

When executing the following:

string=git.diff('HEAD~1')

it raises an exception when there are no previous commits. It could be a nice feature to have a kind of query that checks if the wanted commit exists (before executing instructions as reported).

I know it is possible to use a try and exception (and it is what I do in my code at line 99). However, I think it is still a nice feature to have.

I am writing this issue following the suggestion of @Byron in this closed issue.

Besides, if there are suggestions or advice to implement a script (using your API) for analyzing your own git repo and reporting the info in a meaningful way, please do not hesitate to write it down here. I am trying to implement it (for fun) in this little project.

@dongs0104
Copy link
Contributor

@dongs0104 dongs0104 commented Mar 18, 2020

this problem also related issues: #993 PR: #999
I think your 'HEAD' is dangling refs, so refs can not found your repo.

@Byron Byron added wont fix and removed help wanted labels Mar 21, 2020
@Byron
Copy link
Member

@Byron Byron commented Mar 21, 2020

Having looked at it just now, I can only agree with @dongs0104 . However, as the code above calls git directly, this also means that git itself is unable to diff when the head is dangling.

For this issue it means it can be closed as GitPython is probably never going to catch git command failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.