This commit is contained in:
Kovid Goyal 2020-09-02 10:55:10 +05:30
parent 27f483dce4
commit 59dc40a22b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -81,15 +81,12 @@ def require_git_master(branch='master'):
def require_clean_git(): def require_clean_git():
c = subprocess.check_call c = subprocess.check_call
p = subprocess.Popen p = subprocess.Popen
with open(os.devnull, 'wb') as null: c('git rev-parse --verify HEAD'.split(), stdout=subprocess.DEVNULL)
c('git rev-parse --verify HEAD'.split(), stdout=null) c('git update-index -q --ignore-submodules --refresh'.split())
c('git update-index -q --ignore-submodules --refresh'.split()) if p('git diff-files --quiet --ignore-submodules'.split()).wait() != 0:
if p('git diff-files --quiet --ignore-submodules'.split()).wait() != 0: raise SystemExit('You have unstaged changes in your working tree')
print('You have unstaged changes in your working tree', file=sys.stderr) if p('git diff-index --cached --quiet --ignore-submodules HEAD --'.split()).wait() != 0:
raise SystemExit(1) raise SystemExit('Your git index contains uncommitted changes')
if p('git diff-index --cached --quiet --ignore-submodules HEAD --'.split()).wait() != 0:
print('Your git index contains uncommitted changes', file=sys.stderr)
raise SystemExit(1)
def initialize_constants(): def initialize_constants():