Skip to content

Commit

Permalink
Use git diff --cached
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffrey JOUNT committed Sep 13, 2023
1 parent 79bd61b commit 932a926
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ def run_command(args):
subprocess.check_call(args)

def check_version_to_commit():
return subprocess.check_output(['git', 'diff', 'roc/version.go']) != b''
cmd = ['git', 'diff', '--cached', 'roc/version.go']
return subprocess.check_output(cmd) != b''

def commit_change(version, force):
run_command(['git', 'add', 'roc/version.go'])
if not check_version_to_commit():
print('--- Version did not change, nothing to commit')
return
run_command(['git', 'add', 'roc/version.go'])
run_command(['git', 'commit', '-m', f'Release {version}'])

def create_tag(tag, force):
Expand Down

0 comments on commit 932a926

Please sign in to comment.