Skip to content

Warn when working tree is empty on non-bare repos #1375

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

Conversation

HerrMuellerluedenscheid
Copy link

When loading an empty repo by accident and iterating through commits lead to suprprising results. It should be warned while loading the non-bare repo that this does not appear to be a repo.

@HerrMuellerluedenscheid
Copy link
Author

Can even be considered to raise an exception here.

Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

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

I think it would be interesting to explore how GitPython reacts if the working tree dir is None even though the repo isn't bare. Because that seems like it's a bug as the working tree dir should be set even if it's empty.

In other words, non-bare repositories that are empty, i.e. a .git/ directory in an otherwise empty directory, should not lead to surprises except for being empty.

Note that the main branch might not be born yet on empty repositories, which is something the caller always has to be aware of independently.

Independently of all that, it would definitely help this PR along if there would be more substance to the encountered issues in the form of 'expected - actual' comparisons.

@Byron
Copy link
Member

Byron commented Jan 7, 2022

Since this PR has been waiting for changes for a while now I think it's fair to close it for now.
Thanks a lot for the contribution, and when there is time to respond to the change request we can certainly find a way to get it merged, too.

@Byron Byron closed this Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants