Skip to content

Commit

Permalink
Use "--" to disambiguate Git arguments in a few more places; resolves #…
Browse files Browse the repository at this point in the history
…218

Co-Authored-By: Matthew Hoffman <matthew@protopia.ai>
  • Loading branch information
jimporter and ringohoffman committed May 30, 2024
1 parent 5e6970d commit 3f7d756
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mike/git_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def make_when(timestamp=None):


def get_config(key, encoding='utf-8'):
cmd = ['git', 'config', key]
cmd = ['git', 'config', '--', key]
p = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE, encoding=encoding)
if p.returncode != 0:
raise GitError('error getting config {!r}'.format(key), p.stderr)
Expand All @@ -85,7 +85,7 @@ def get_latest_commit(rev, *, short=False):


def count_reachable(rev):
cmd = ['git', 'rev-list', '--count', rev]
cmd = ['git', 'rev-list', '--count', rev, '--']
p = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE, universal_newlines=True)
if p.returncode == 0:
return int(p.stdout.strip())
Expand Down Expand Up @@ -164,15 +164,15 @@ def push_branch(remote, branch):


def delete_branch(branch):
cmd = ['git', 'branch', '--delete', '--force', branch]
cmd = ['git', 'branch', '--delete', '--force', '--', branch]
p = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE, universal_newlines=True)
if p.returncode != 0:
raise GitError('unable to delete branch {}'.format(branch),
p.stderr)


def is_commit_empty(rev):
cmd = ['git', 'log', '-1', '--format=', '--name-only', rev]
cmd = ['git', 'log', '-1', '--format=', '--name-only', rev, '--']
p = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE, universal_newlines=True)
if p.returncode == 0:
return not p.stdout
Expand Down

0 comments on commit 3f7d756

Please sign in to comment.