Skip to content

Commit

Permalink
more pythonic way to find 'fatal' in string
Browse files Browse the repository at this point in the history
use 'in' instead of find.
  • Loading branch information
olivierverdier committed Jun 14, 2012
1 parent 50615c9 commit aca1522
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gitstatus.py
Expand Up @@ -14,14 +14,14 @@

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

if error_string.find('fatal: Not a git repository') != -1:
if 'fatal: Not a git repository' in error_string:
sys.exit(0)

branch = branch.strip()[11:]

res, err = Popen(['git','diff','--name-status'], stdout=PIPE, stderr=PIPE).communicate()
err_string = err.decode('utf-8')
if err_string.find('fatal') != -1:
if 'fatal' in err_string:
sys.exit(0)
changed_files = [namestat[0] for namestat in res.splitlines()]
staged_files = [namestat[0] for namestat in Popen(['git','diff', '--staged','--name-status'], stdout=PIPE).communicate()[0].splitlines()]
Expand Down

0 comments on commit aca1522

Please sign in to comment.