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

Added check for special case when user is in .git directory #1354

Conversation

thegalah
Copy link
Contributor

No description provided.

Copy link
Member

@derekbekoe derekbekoe left a comment

Choose a reason for hiding this comment

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

Unless there's something I'm missing, I suspect the _is_inside_git_directory method doesn't work as intended.

is_inside_git_dir = check_output(['git', 'rev-parse', '--is-inside-git-dir'])
except OSError:
raise CLIError('Git is not currently installed.')
return is_inside_git_dir.decode('utf-8').strip()
Copy link
Member

Choose a reason for hiding this comment

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

I just tried the command you run and got the following:

$ git rev-parse --is-inside-git-dir
false
$ cd .git
$ git rev-parse --is-inside-git-dir
true
$ 

So the git command returns a string.

This method should return a boolean rather than a string.
i.e. you could have something like:

git_result = is_inside_git_dir.decode('utf-8').strip()
if git_result == 'false':
    return False
elif git_result == 'true':
    return True
else:
    raise CLIError(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added this fix

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

Successfully merging this pull request may close these issues.

5 participants