Skip to content

Commit 3f7d756

Browse files
Use "--" to disambiguate Git arguments in a few more places; resolves #218
Co-Authored-By: Matthew Hoffman <[email protected]>
1 parent 5e6970d commit 3f7d756

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mike/git_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def make_when(timestamp=None):
6262

6363

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

8686

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

165165

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

173173

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

0 commit comments

Comments
 (0)