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

If there are branches whose names include slash(/) in local, KeyError will occur on any operations. #41

Closed
polisherm opened this issue Jan 29, 2023 · 3 comments

Comments

@polisherm
Copy link

polisherm commented Jan 29, 2023

A git branch name can include slash symbol(/).
e.g) feature/feature-A

However, git-sim throws KeyError if the branches's name include slash.
There is the reason most likely in following lines.

# Use forward slash to check if branch is local or remote tracking
# and draw the branch label if its hexsha matches the current commit
if (
"/" not in branch # local branch
and commit.hexsha == self.repo.heads[branch].commit.hexsha
) or (
"/" in branch # remote tracking branch
and commit.hexsha == remote_tracking_branches[branch]
):

This if-statement conditional branch is insufficient.
If possible, could you consider other means of determining whether a branch is a remote branch or not?
I also try to explore the way. (I am not familiar with Python and Git, so it is perhaps difficult for me to make Pull Request about this issue.)

@initialcommit-io
Copy link
Contributor

@k1997y Yes you're right. I will use the supported GitPython calls to determine if the branch is local or remote, instead of this slash test. I will push a fix for this soon. Thanks for finding and reporting this bug!

@initialcommit-io
Copy link
Contributor

@k1997y Just pushed a fix for this in new version 0.1.8. Please update using:

$ pip install git-sim --upgrade

And let me know if it works now! I will close this for now but feel free to reopen if any issues.

@polisherm
Copy link
Author

@initialcommit-io
Thank you for your very quick response and fixing!!
I expect you to make this product better, Thank you very much.

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