From a5e607e8aa62ca3778f1026c27a927ee5c79749b Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 2 Mar 2015 14:19:05 +0100 Subject: fix(iter-commit): ambiguous argument error In repositories like > git branch -a * test > ls test `repo.iter_commits` failed due to an ambigous argument (`'git rev-list test`). Now this cannot happen anymore. fixes #264 --- git/test/test_commit.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'git/test/test_commit.py') diff --git a/git/test/test_commit.py b/git/test/test_commit.py index 1f0f8c56..3e958edf 100644 --- a/git/test/test_commit.py +++ b/git/test/test_commit.py @@ -19,15 +19,19 @@ from git import ( Actor, ) from gitdb import IStream +from gitdb.test.lib import with_rw_directory from git.compat import ( string_types, text_type ) +from git import Repo +from git.repo.fun import touch from io import BytesIO import time import sys import re +import os def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False): @@ -219,6 +223,15 @@ class TestCommit(TestBase): for sha1, commit in zip(expected_ids, commits): assert_equal(sha1, commit.hexsha) + @with_rw_directory + def test_ambiguous_arg_iteration(self, rw_dir): + rw_repo = Repo.init(os.path.join(rw_dir, 'test_ambiguous_arg')) + path = os.path.join(rw_repo.working_tree_dir, 'master') + touch(path) + rw_repo.index.add([path]) + rw_repo.index.commit('initial commit') + list(rw_repo.iter_commits(rw_repo.head.ref)) # should fail unless bug is fixed + def test_count(self): assert self.rorepo.tag('refs/tags/0.1.5').commit.count() == 143 -- cgit v1.2.1