summaryrefslogtreecommitdiff
path: root/git.py
diff options
context:
space:
mode:
authorAlberto Bertogli <albertito@blitiri.com.ar>2014-12-31 18:01:28 +0100
committerAlberto Bertogli <albertito@blitiri.com.ar>2014-12-31 18:07:38 +0100
commitdf00293a7cd6e3fb11d0c1bf2fbf1c3ad485824c (patch)
treecb440b653c2b7481ffceafc7603071b4ba530ae4 /git.py
parent7898b2becdc9ad35b0d853bc5d46be24a05a6a48 (diff)
downloadgit-arr-fork-df00293a7cd6e3fb11d0c1bf2fbf1c3ad485824c.zip
git: Add '--' to "git rev-list" runs to avoid ambiguous arguments
If there is a branch and a file with the same name, git-arr will fail to generate, as git will complain when running git rev-list. For example, if there is both a file and a branch called "hooks" in the repository, git-arr would fail as follows: === git-arr running: ['git', '--git-dir=/some/repo', 'rev-list', '--max-count=1', '--header', u'hooks']) fatal: ambiguous argument 'hooks': both revision and filename Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' Traceback (most recent call last): File "./git-arr", line 457, in <module> main() File "./git-arr", line 452, in main skip_index = len(opts.only) > 0) File "./git-arr", line 388, in generate branch_mtime = r.commit(bn).committer_date.epoch AttributeError: 'NoneType' object has no attribute 'committer_date' To fix that, this patch appends a "--" as the last argument to rev-list, which indicates that it has completed the revision list, which disambiguates the argument. While at it, a minor typo in a comment is also fixed. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
Diffstat (limited to 'git.py')
-rw-r--r--git.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/git.py b/git.py
index 8aa9eb1..bddca70 100644
--- a/git.py
+++ b/git.py
@@ -253,6 +253,7 @@ class Repo:
cmd.max_count = limit
cmd.arg(ref)
+ cmd.arg('--')
for l in cmd.run():
yield l.rstrip('\n')
@@ -273,6 +274,7 @@ class Repo:
cmd.header = None
cmd.arg(ref)
+ cmd.arg('--')
info_buffer = ''
count = 0