| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 630d030 commit a5e607e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -189,9 +189,12 @@ def iter_items(cls, repo, rev, paths='', **kwargs): | |||
| 189 | 189 | if 'pretty' in kwargs: | |
| 190 | 190 | raise ValueError("--pretty cannot be used as parsing expects single sha's only") | |
| 191 | 191 | # END handle pretty | |
| 192 | - args = list() | ||
| 192 | + | ||
| 193 | + # use -- in any case, to prevent possibility of ambiguous arguments | ||
| 194 | + # see https://github.com/gitpython-developers/GitPython/issues/264 | ||
| 195 | + args = ['--'] | ||
| 193 | 196 | if paths: | |
| 194 | - args.extend(('--', paths)) | ||
| 197 | + args.extend((paths, )) | ||
| 195 | 198 | # END if paths | |
| 196 | 199 | ||
| 197 | 200 | proc = repo.git.rev_list(rev, args, as_process=True, **kwargs) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,15 +19,19 @@ | |||
| 19 | 19 | Actor, | |
| 20 | 20 | ) | |
| 21 | 21 | from gitdb import IStream | |
| 22 | + from gitdb.test.lib import with_rw_directory | ||
| 22 | 23 | from git.compat import ( | |
| 23 | 24 | string_types, | |
| 24 | 25 | text_type | |
| 25 | 26 | ) | |
| 27 | + from git import Repo | ||
| 28 | + from git.repo.fun import touch | ||
| 26 | 29 | ||
| 27 | 30 | from io import BytesIO | |
| 28 | 31 | import time | |
| 29 | 32 | import sys | |
| 30 | 33 | import re | |
| 34 | + import os | ||
| 31 | 35 | ||
| 32 | 36 | ||
| 33 | 37 | def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False): | |
@@ -219,6 +223,15 @@ def test_rev_list_bisect_all(self): | |||
| 219 | 223 | for sha1, commit in zip(expected_ids, commits): | |
| 220 | 224 | assert_equal(sha1, commit.hexsha) | |
| 221 | 225 | ||
| 226 | + @with_rw_directory | ||
| 227 | + def test_ambiguous_arg_iteration(self, rw_dir): | ||
| 228 | + rw_repo = Repo.init(os.path.join(rw_dir, 'test_ambiguous_arg')) | ||
| 229 | + path = os.path.join(rw_repo.working_tree_dir, 'master') | ||
| 230 | + touch(path) | ||
| 231 | + rw_repo.index.add([path]) | ||
| 232 | + rw_repo.index.commit('initial commit') | ||
| 233 | + list(rw_repo.iter_commits(rw_repo.head.ref)) # should fail unless bug is fixed | ||
| 234 | + | ||
| 222 | 235 | def test_count(self): | |
| 223 | 236 | assert self.rorepo.tag('refs/tags/0.1.5').commit.count() == 143 | |
| 224 | 237 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments