Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more pythonic way to find 'fatal' in string

use 'in' instead of find.
  • Loading branch information...
commit aca152237bfe4b7e54a5c2cfe9b88d76793da400 1 parent 50615c9
@olivierverdier authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 gitstatus.py
View
4 gitstatus.py
@@ -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()]
Please sign in to comment.
Something went wrong with that request. Please try again.