initialcommit-com/git-sim

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

polisherm opened this issue · 3 comments

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.)

@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!

@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.

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