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

don't use error message but check returncode of the command #119

Closed
wants to merge 1 commit into from
Closed

don't use error message but check returncode of the command #119

wants to merge 1 commit into from

Conversation

Segaja
Copy link

@Segaja Segaja commented Apr 12, 2018

using return code to find out if a folder is under git version control.

@Felixoid
Copy link

Hello @olivierverdier
Could you please merge this to fix annoying prompt in each folder on the shell?

error_string = error.decode('utf-8')

if 'fatal: Not a git repository' in error_string:
if 0 != gitsym.returncode:

Choose a reason for hiding this comment

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

this change broke prompt like (:de68074|✔) on detached HEAD

Choose a reason for hiding this comment

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

If you'll add if isgit.returncode != 0:, then this code could be deleted

@@ -10,9 +10,7 @@
gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)

Choose a reason for hiding this comment

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

There is most quick way to get info are we in git repo or not

isgit = Popen(['git', 'name-rev'], stdout=PIPE, stderr=PIPE)
_, _ = isgit.communicate()                                  
if isgit.returncode != 0:                                   
    sys.exit(0)                                             

IMO it should be right after import sys

@Segaja
Copy link
Author

Segaja commented Apr 28, 2018

The problem is that the git symbolic-ref HEAD command also found the branch name and that is used later. so either I have to add another command to run or figure out how to do this with one command without breaking detached heads.

@Segaja Segaja closed this by deleting the head repository Dec 7, 2023
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

Successfully merging this pull request may close these issues.

2 participants