diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | CHANGES | 32 | ||||
-rw-r--r-- | doc/tutorial.txt | 24 | ||||
-rw-r--r-- | lib/git/commit.py | 30 | ||||
-rw-r--r-- | lib/git/diff.py | 72 | ||||
-rw-r--r-- | lib/git/repo.py | 48 | ||||
-rw-r--r-- | test/fixtures/diff_rename | 12 | ||||
-rw-r--r-- | test/git/test_commit.py | 39 | ||||
-rw-r--r-- | test/git/test_diff.py | 14 | ||||
-rw-r--r-- | test/git/test_repo.py | 16 |
10 files changed, 186 insertions, 102 deletions
@@ -5,3 +5,4 @@ David Aguilar <davvid _at_ gmail.com> Jelmer Vernooij <jelmer _at_ samba.org> Steve Frécinaux <code _at_ istique.net> Kai Lautaportti <kai _at_ lautaportti.fi> +Paul Sowden <paul _at_ idontsmoke.co.uk> @@ -2,6 +2,38 @@ CHANGES ======= +0.1.6 +===== + +General +------- +* Removed ambiguity between paths and treeishs. When calling commands that + accept treeish and path arguments and there is a path with the same name as + a treeish git cowardly refuses to pick one and asks for the command to use + the unambiguous syntax where '--' seperates the treeish from the paths. + +* ``Repo.commits``, ``Repo.commits_between``, ``Reop.commits_since``, + ``Repo.commit_count``, ``Repo.commit``, ``Commit.count`` and + ``Commit.find_all`` all now optionally take a path argument which + constrains the lookup by path. This changes the order of the positional + arguments in ``Repo.commits`` and ``Repo.commits_since``. + + +Commit +------ +* ``Commit.message`` now contains the full commit message (rather than just + the first line) and a new property ``Commit.summary`` contains the first + line of the commit message. + +Diff +---- +* The diff parser is now far faster and also addresses a bug where + sometimes b_mode was not set. + +* Added support for parsing rename info to the diff parser. Addition of new + properties ``Diff.renamed``, ``Diff.rename_from``, and ``Diff.rename_to``. + + 0.1.5 ===== diff --git a/doc/tutorial.txt b/doc/tutorial.txt index 26cdf1af..9a9a6258 100644 --- a/doc/tutorial.txt +++ b/doc/tutorial.txt @@ -13,9 +13,9 @@ The first step is to create a ``Repo`` object to represent your repository. >>> from git import * >>> repo = Repo("/Users/mtrier/Development/git-python") - -In the above example, the directory ``/Users/mtrier/Development/git-python`` -is my working repository and contains the ``.git`` directory. You can also + +In the above example, the directory ``/Users/mtrier/Development/git-python`` +is my working repository and contains the ``.git`` directory. You can also initialize GitPython with a bare repository. >>> repo = Repo.create("/var/git/git-python.git") @@ -42,14 +42,14 @@ for commits beginning at a different branch, commit, tag, etc. You can specify the maximum number of commits to return. - >>> repo.commits('master', 100) - + >>> repo.commits('master', max_count=100) + If you need paging, you can specify a number of commits to skip. - >>> repo.commits('master', 10, 20) + >>> repo.commits('master', max_count=10, skip=20) The above will return commits 21-30 from the commit list. - + The Commit object ***************** @@ -79,7 +79,7 @@ Commit objects contain information about a specific commit. (2008, 5, 7, 5, 0, 56, 2, 128, 0) >>> head.message - 'cleaned up a lot of test information. Fixed escaping so it works with + 'cleaned up a lot of test information. Fixed escaping so it works with subprocess.' Note: date time is represented in a `struct_time`_ format. Conversion to @@ -183,10 +183,10 @@ You can also get a blob directly from the repo if you know its name. What Else? ********** -There is more stuff in there, like the ability to tar or gzip repos, stats, -log, blame, and probably a few other things. Additionally calls to the git -instance are handled through a ``__getattr__`` construct, which makes -available any git commands directly, with a nice conversion of Python dicts +There is more stuff in there, like the ability to tar or gzip repos, stats, +log, blame, and probably a few other things. Additionally calls to the git +instance are handled through a ``__getattr__`` construct, which makes +available any git commands directly, with a nice conversion of Python dicts to command line parameters. Check the unit tests, they're pretty exhaustive. diff --git a/lib/git/commit.py b/lib/git/commit.py index 057530a6..091cf78c 100644 --- a/lib/git/commit.py +++ b/lib/git/commit.py @@ -41,7 +41,7 @@ class Commit(LazyMixin): is the committed DateTime ``message`` - is the first line of the commit message + is the commit message ``parents`` is the list of the parents of the commit @@ -81,8 +81,12 @@ class Commit(LazyMixin): def id_abbrev(self): return self.id[0:7] + @property + def summary(self): + return self.message.split('\n', 1)[0] + @classmethod - def count(cls, repo, ref): + def count(cls, repo, ref, path=''): """ Count the number of commits reachable from this ref @@ -92,13 +96,16 @@ class Commit(LazyMixin): ``ref`` is the ref from which to begin (SHA1 or name) + ``path`` + is an optinal path + Returns int """ - return len(repo.git.rev_list(ref).strip().splitlines()) + return len(repo.git.rev_list(ref, '--', path).strip().splitlines()) @classmethod - def find_all(cls, repo, ref, **kwargs): + def find_all(cls, repo, ref, path='', **kwargs): """ Find all commits matching the given criteria. ``repo`` @@ -107,6 +114,9 @@ class Commit(LazyMixin): ``ref`` is the ref from which to begin (SHA1 or name) + ``path`` + is an optinal path + ``options`` is a Hash of optional arguments to git where ``max_count`` is the maximum number of commits to fetch @@ -118,7 +128,7 @@ class Commit(LazyMixin): options = {'pretty': 'raw'} options.update(kwargs) - output = repo.git.rev_list(ref, **options) + output = repo.git.rev_list(ref, '--', path, **options) return cls.list_from_string(repo, output) @classmethod @@ -153,7 +163,7 @@ class Commit(LazyMixin): while lines and lines[0].startswith(' '): messages.append(lines.pop(0).strip()) - message = messages and messages[0] or '' + message = '\n'.join(messages) commits.append(Commit(repo, id=id, parents=parents, tree=tree, author=author, authored_date=authored_date, committer=committer, committed_date=committed_date, message=message)) @@ -194,13 +204,13 @@ class Commit(LazyMixin): if b: paths.insert(0, b) paths.insert(0, a) - text = repo.git.diff(full_index=True, *paths) + text = repo.git.diff('-M', full_index=True, *paths) return diff.Diff.list_from_string(repo, text) @property def diffs(self): if not self.parents: - d = self.repo.git.show(self.id, full_index=True, pretty='raw') + d = self.repo.git.show(self.id, '-M', full_index=True, pretty='raw') if re.search(r'diff --git a', d): if not re.search(r'^diff --git a', d): p = re.compile(r'.+?(diff --git a)', re.MULTILINE | re.DOTALL) @@ -214,14 +224,14 @@ class Commit(LazyMixin): @property def stats(self): if not self.parents: - text = self.repo.git.diff(self.id, numstat=True) + text = self.repo.git.diff(self.id, '--', numstat=True) text2 = "" for line in text.splitlines(): (insertions, deletions, filename) = line.split("\t") text2 += "%s\t%s\t%s\n" % (deletions, insertions, filename) text = text2 else: - text = self.repo.git.diff(self.parents[0].id, self.id, numstat=True) + text = self.repo.git.diff(self.parents[0].id, self.id, '--', numstat=True) return stats.Stats.list_from_string(self.repo, text) def __str__(self): diff --git a/lib/git/diff.py b/lib/git/diff.py index 51315fe3..7a6770c4 100644 --- a/lib/git/diff.py +++ b/lib/git/diff.py @@ -12,7 +12,9 @@ class Diff(object): A Diff contains diff information between two commits. """ - def __init__(self, repo, a_path, b_path, a_commit, b_commit, a_mode, b_mode, new_file, deleted_file, diff): + def __init__(self, repo, a_path, b_path, a_commit, b_commit, a_mode, + b_mode, new_file, deleted_file, rename_from, + rename_to, diff): self.repo = repo self.a_path = a_path self.b_path = b_path @@ -30,56 +32,40 @@ class Diff(object): self.b_mode = b_mode self.new_file = new_file self.deleted_file = deleted_file + self.rename_from = rename_from + self.rename_to = rename_to + self.renamed = rename_from != rename_to self.diff = diff @classmethod def list_from_string(cls, repo, text): - lines = text.splitlines() - a_mode = None - b_mode = None diffs = [] - while lines: - m = re.search(r'^diff --git a/(\S+) b/(\S+)$', lines.pop(0)) - if m: - a_path, b_path = m.groups() - if re.search(r'^old mode', lines[0]): - m = re.search(r'^old mode (\d+)', lines.pop(0)) - if m: - a_mode, = m.groups() - m = re.search(r'^new mode (\d+)', lines.pop(0)) - if m: - b_mode, = m.groups() - if re.search(r'^diff --git', lines[0]): - diffs.append(Diff(repo, a_path, b_path, None, None, a_mode, b_mode, False, False, None)) - continue - new_file = False - deleted_file = False + diff_header = re.compile(r""" + #^diff[ ]--git + [ ]a/(?P<a_path>\S+)[ ]b/(?P<b_path>\S+)\n + (?:^similarity[ ]index[ ](?P<similarity_index>\d+)%\n + ^rename[ ]from[ ](?P<rename_from>\S+)\n + ^rename[ ]to[ ](?P<rename_to>\S+)(?:\n|$))? + (?:^old[ ]mode[ ](?P<old_mode>\d+)\n + ^new[ ]mode[ ](?P<new_mode>\d+)(?:\n|$))? + (?:^new[ ]file[ ]mode[ ](?P<new_file_mode>.+)(?:\n|$))? + (?:^deleted[ ]file[ ]mode[ ](?P<deleted_file_mode>.+)(?:\n|$))? + (?:^index[ ](?P<a_commit>[0-9A-Fa-f]+) + \.\.(?P<b_commit>[0-9A-Fa-f]+)[ ]?(?P<b_mode>.+)?(?:\n|$))? + """, re.VERBOSE | re.MULTILINE).match - if re.search(r'^new file', lines[0]): - m = re.search(r'^new file mode (.+)', lines.pop(0)) - if m: - b_mode, = m.groups() - a_mode = None - new_file = True - elif re.search(r'^deleted file', lines[0]): - m = re.search(r'^deleted file mode (.+)$', lines.pop(0)) - if m: - a_mode, = m.groups() - b_mode = None - deleted_file = True + for diff in ('\n' + text).split('\ndiff --git')[1:]: + header = diff_header(diff) - m = re.search(r'^index ([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+) ?(.+)?$', lines.pop(0)) - if m: - a_commit, b_commit, b_mode = m.groups() - if b_mode: - b_mode = b_mode.strip() + a_path, b_path, similarity_index, rename_from, rename_to, \ + old_mode, new_mode, new_file_mode, deleted_file_mode, \ + a_commit, b_commit, b_mode = header.groups() + new_file, deleted_file = bool(new_file_mode), bool(deleted_file_mode) - diff_lines = [] - while lines and not re.search(r'^diff', lines[0]): - diff_lines.append(lines.pop(0)) - - diff = "\n".join(diff_lines) - diffs.append(Diff(repo, a_path, b_path, a_commit, b_commit, a_mode, b_mode, new_file, deleted_file, diff)) + diffs.append(Diff(repo, a_path, b_path, a_commit, b_commit, + old_mode or deleted_file_mode, new_mode or new_file_mode or b_mode, + new_file, deleted_file, rename_from, rename_to, diff[header.end():])) return diffs + diff --git a/lib/git/repo.py b/lib/git/repo.py index 093fdf0e..2d0fb973 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -100,13 +100,16 @@ class Repo(object): """ return Tag.find_all(self) - def commits(self, start='master', max_count=10, skip=0): + def commits(self, start='master', path='', max_count=10, skip=0): """ A list of Commit objects representing the history of a given ref/commit ``start`` is the branch/commit name (default 'master') + ``path`` + is an optional path + ``max_count`` is the maximum number of commits to return (default 10) @@ -119,9 +122,9 @@ class Repo(object): options = {'max_count': max_count, 'skip': skip} - return Commit.find_all(self, start, **options) + return Commit.find_all(self, start, path, **options) - def commits_between(self, frm, to): + def commits_between(self, frm, to, path = ''): """ The Commits objects that are reachable via ``to`` but not via ``frm`` Commits are returned in chronological order. @@ -132,12 +135,15 @@ class Repo(object): ``to`` is the branch/commit name of the older item + ``path`` + is an optinal path + Returns ``git.Commit[]`` """ - return Commit.find_all(self, "%s..%s" % (frm, to)).reverse() + return Commit.find_all(self, "%s..%s" % (frm, to), path).reverse() - def commits_since(self, start='master', since='1970-01-01'): + def commits_since(self, start='master', path='', since='1970-01-01'): """ The Commits objects that are newer than the specified date. Commits are returned in chronological order. @@ -145,6 +151,9 @@ class Repo(object): ``start`` is the branch/commit name (default 'master') + ``path`` + is an optinal path + ``since`` is a string represeting a date/time @@ -153,33 +162,39 @@ class Repo(object): """ options = {'since': since} - return Commit.find_all(self, start, **options) + return Commit.find_all(self, start, path, **options) - def commit_count(self, start='master'): + def commit_count(self, start='master', path=''): """ The number of commits reachable by the given branch/commit ``start`` is the branch/commit name (default 'master') + ``path`` + is an optinal path + Returns int """ - return Commit.count(self, start) + return Commit.count(self, start, path) - def commit(self, id): + def commit(self, id, path = ''): """ The Commit object for the specified id ``id`` is the SHA1 identifier of the commit + ``path`` + is an optinal path + Returns git.Commit """ options = {'max_count': 1} - commits = Commit.find_all(self, id, **options) + commits = Commit.find_all(self, id, path, **options) if not commits: raise ValueError, 'Invalid identifier %s' % id @@ -192,8 +207,8 @@ class Repo(object): Returns ``git.Commit[]`` """ - repo_refs = self.git.rev_list(ref).strip().splitlines() - other_repo_refs = other_repo.git.rev_list(other_ref).strip().splitlines() + repo_refs = self.git.rev_list(ref, '--').strip().splitlines() + other_repo_refs = other_repo.git.rev_list(other_ref, '--').strip().splitlines() diff_refs = list(set(other_repo_refs) - set(repo_refs)) return map(lambda ref: Commit.find_all(other_repo, ref, max_count=1)[0], diff_refs) @@ -236,10 +251,9 @@ class Repo(object): """ options = {'pretty': 'raw'} options.update(kwargs) + arg = [commit, '--'] if path: - arg = [commit, '--', path] - else: - arg = [commit] + arg.append(path) commits = self.git.log(*arg, **options) return Commit.list_from_string(self, commits) @@ -450,13 +464,13 @@ class Repo(object): # always consired to be clean. return False - return len(self.git.diff('HEAD').strip()) > 0 + return len(self.git.diff('HEAD', '--').strip()) > 0 @property def active_branch(self): """ The name of the currently active branch. - + Returns str (the branch name) """ diff --git a/test/fixtures/diff_rename b/test/fixtures/diff_rename new file mode 100644 index 00000000..13abae0e --- /dev/null +++ b/test/fixtures/diff_rename @@ -0,0 +1,12 @@ +commit 2524c44334a8ba6b2ab8f3f0a478f04c5b073cc8 +tree e126e7b4203dadf083f5eb8e2f34c255b51d8bee +parent d789e23b9ea8d90221d13c46f7c228d729385f92 +author Michael Trier <mtrier@gmail.com> 1229389391 -0500 +committer Michael Trier <mtrier@gmail.com> 1229389391 -0500 + + Renamed AUTHORS to CONTRIBUTORS because it's cooler. + +diff --git a/AUTHORS b/CONTRIBUTORS +similarity index 100% +rename from AUTHORS +rename to CONTRIBUTORS diff --git a/test/git/test_commit.py b/test/git/test_commit.py index e9336f2c..da7236c8 100644 --- a/test/git/test_commit.py +++ b/test/git/test_commit.py @@ -22,7 +22,7 @@ class TestCommit(object): assert_equal("tom@mojombo.com", commit.author.email) assert_true(git.called) - assert_equal(git.call_args, (('rev_list', '4c8124ffcf4039d292442eeccabdeca5af5c5017'), {'pretty': 'raw', 'max_count': 1})) + assert_equal(git.call_args, (('rev_list', '4c8124ffcf4039d292442eeccabdeca5af5c5017', '--', ''), {'pretty': 'raw', 'max_count': 1})) @patch_object(Git, '_call_process') def test_id_abbrev(self, git): @@ -52,7 +52,23 @@ class TestCommit(object): assert_equal(True, diffs[5].new_file) assert_true(git.called) - assert_equal(git.call_args, (('diff', 'master'), {'full_index': True})) + assert_equal(git.call_args, (('diff', '-M', 'master'), {'full_index': True})) + + @patch_object(Git, '_call_process') + def test_diff_with_rename(self, git): + git.return_value = fixture('diff_rename') + + diffs = Commit.diff(self.repo, 'rename') + + assert_equal(1, len(diffs)) + + diff = diffs[0] + assert_true(diff.renamed) + assert_equal(diff.rename_from, 'AUTHORS') + assert_equal(diff.rename_to, 'CONTRIBUTORS') + + assert_true(git.called) + assert_equal(git.call_args, (('diff', '-M', 'rename'), {'full_index': True})) @patch_object(Git, '_call_process') def test_diff_with_two_commits(self, git): @@ -63,7 +79,7 @@ class TestCommit(object): assert_equal(3, len(diffs)) assert_true(git.called) - assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5'), {'full_index': True})) + assert_equal(git.call_args, (('diff', '-M', '59ddc32', '13d27d5'), {'full_index': True})) @patch_object(Git, '_call_process') def test_diff_with_files(self, git): @@ -75,7 +91,7 @@ class TestCommit(object): assert_equal('lib/grit/diff.rb', diffs[0].a_path) assert_true(git.called) - assert_equal(git.call_args, (('diff', '59ddc32', '--', 'lib'), {'full_index': True})) + assert_equal(git.call_args, (('diff', '-M', '59ddc32', '--', 'lib'), {'full_index': True})) @patch_object(Git, '_call_process') def test_diff_with_two_commits_and_files(self, git): @@ -87,7 +103,7 @@ class TestCommit(object): assert_equal('lib/grit/commit.rb', diffs[0].a_path) assert_true(git.called) - assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5', '--', 'lib'), {'full_index': True})) + assert_equal(git.call_args, (('diff', '-M', '59ddc32', '13d27d5', '--', 'lib'), {'full_index': True})) @patch_object(Git, '_call_process') def test_diffs(self, git): @@ -113,7 +129,8 @@ class TestCommit(object): assert_equal(True, diffs[5].new_file) assert_true(git.called) - assert_equal(git.call_args, (('diff', '038af8c329ef7c1bae4568b98bd5c58510465493', + assert_equal(git.call_args, (('diff', '-M', + '038af8c329ef7c1bae4568b98bd5c58510465493', '91169e1f5fa4de2eaea3f176461f5dc784796769', ), {'full_index': True})) @@ -130,7 +147,7 @@ class TestCommit(object): assert_equal('History.txt', diffs[0].a_path) assert_equal('History.txt', diffs[0].b_path) assert_equal(None, diffs[0].a_commit) - assert_equal(None, diffs[0].b_mode) + assert_equal('100644', diffs[0].b_mode) assert_equal('81d2c27608b352814cbe979a6acd678d30219678', diffs[0].b_commit.id) assert_equal(True, diffs[0].new_file) assert_equal(False, diffs[0].deleted_file) @@ -142,7 +159,7 @@ class TestCommit(object): assert_equal(True, diffs[5].new_file) assert_true(git.called) - assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'full_index': True, 'pretty': 'raw'})) + assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3', '-M'), {'full_index': True, 'pretty': 'raw'})) @patch_object(Git, '_call_process') def test_diffs_on_initial_import_with_empty_commit(self, git): @@ -154,7 +171,7 @@ class TestCommit(object): assert_equal([], diffs) assert_true(git.called) - assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'full_index': True, 'pretty': 'raw'})) + assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3', '-M'), {'full_index': True, 'pretty': 'raw'})) @patch_object(Git, '_call_process') def test_diffs_with_mode_only_change(self, git): @@ -169,7 +186,7 @@ class TestCommit(object): assert_equal('100755', diffs[0].b_mode) assert_true(git.called) - assert_equal(git.call_args, (('show', '91169e1f5fa4de2eaea3f176461f5dc784796769'), {'full_index': True, 'pretty': 'raw'})) + assert_equal(git.call_args, (('show', '91169e1f5fa4de2eaea3f176461f5dc784796769', '-M'), {'full_index': True, 'pretty': 'raw'})) @patch_object(Git, '_call_process') def test_stats(self, git): @@ -184,7 +201,7 @@ class TestCommit(object): assert_equal(["a.txt", "b.txt"], keys) assert_true(git.called) - assert_equal(git.call_args, (('diff', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'numstat': True})) + assert_equal(git.call_args, (('diff', '634396b2f541a9f2d58b00be1a07f0c358b999b3', '--'), {'numstat': True})) @patch_object(Git, '_call_process') def test_rev_list_bisect_all(self, git): diff --git a/test/git/test_diff.py b/test/git/test_diff.py index 9b7e9c73..94ac03e0 100644 --- a/test/git/test_diff.py +++ b/test/git/test_diff.py @@ -10,9 +10,21 @@ from git import * class TestDiff(object): def setup(self): self.repo = Repo(GIT_REPO) - + def test_list_from_string_new_mode(self): output = fixture('diff_new_mode') diffs = Diff.list_from_string(self.repo, output) assert_equal(1, len(diffs)) assert_equal(10, len(diffs[0].diff.splitlines())) + + def test_diff_with_rename(self): + output = fixture('diff_rename') + diffs = Diff.list_from_string(self.repo, output) + + assert_equal(1, len(diffs)) + + diff = diffs[0] + assert_true(diff.renamed) + assert_equal(diff.rename_from, 'AUTHORS') + assert_equal(diff.rename_to, 'CONTRIBUTORS') + diff --git a/test/git/test_repo.py b/test/git/test_repo.py index 79c2dd8c..8b767744 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -48,7 +48,7 @@ class TestRepo(object): def test_commits(self, git): git.return_value = fixture('rev_list') - commits = self.repo.commits('master', 10) + commits = self.repo.commits('master', max_count=10) c = commits[0] assert_equal('4c8124ffcf4039d292442eeccabdeca5af5c5017', c.id) @@ -67,10 +67,10 @@ class TestRepo(object): c = commits[2] assert_equal(["6e64c55896aabb9a7d8e9f8f296f426d21a78c2c", "7f874954efb9ba35210445be456c74e037ba6af2"], map(lambda p: p.id, c.parents)) - assert_equal("Merge branch 'site'", c.message) + assert_equal("Merge branch 'site'", c.summary) assert_true(git.called) - assert_equal(git.call_args, (('rev_list', 'master'), {'skip': 0, 'pretty': 'raw', 'max_count': 10})) + assert_equal(git.call_args, (('rev_list', 'master', '--', ''), {'skip': 0, 'pretty': 'raw', 'max_count': 10})) @patch_object(Git, '_call_process') def test_commit_count(self, git): @@ -79,7 +79,7 @@ class TestRepo(object): assert_equal(655, self.repo.commit_count('master')) assert_true(git.called) - assert_equal(git.call_args, (('rev_list', 'master'), {})) + assert_equal(git.call_args, (('rev_list', 'master', '--', ''), {})) @patch_object(Git, '_call_process') def test_commit(self, git): @@ -90,7 +90,7 @@ class TestRepo(object): assert_equal("4c8124ffcf4039d292442eeccabdeca5af5c5017", commit.id) assert_true(git.called) - assert_equal(git.call_args, (('rev_list', '4c8124ffcf4039d292442eeccabdeca5af5c5017'), {'pretty': 'raw', 'max_count': 1})) + assert_equal(git.call_args, (('rev_list', '4c8124ffcf4039d292442eeccabdeca5af5c5017', '--', ''), {'pretty': 'raw', 'max_count': 1})) @patch_object(Git, '_call_process') def test_tree(self, git): @@ -269,7 +269,7 @@ class TestRepo(object): assert_equal('ab25fd8483882c3bda8a458ad2965d2248654335', self.repo.log()[-1].id) assert_true(git.called) assert_equal(git.call_count, 2) - assert_equal(git.call_args, (('log', 'master'), {'pretty': 'raw'})) + assert_equal(git.call_args, (('log', 'master', '--'), {'pretty': 'raw'})) @patch_object(Git, '_call_process') def test_log_with_path_and_options(self, git): @@ -314,14 +314,14 @@ class TestRepo(object): self.repo.bare = False git.return_value = '' assert_false(self.repo.is_dirty) - assert_equal(git.call_args, (('diff', 'HEAD'), {})) + assert_equal(git.call_args, (('diff', 'HEAD', '--'), {})) @patch_object(Git, '_call_process') def test_is_dirty_with_dirty_working_dir(self, git): self.repo.bare = False git.return_value = '''-aaa\n+bbb''' assert_true(self.repo.is_dirty) - assert_equal(git.call_args, (('diff', 'HEAD'), {})) + assert_equal(git.call_args, (('diff', 'HEAD', '--'), {})) @patch_object(Git, '_call_process') def test_active_branch(self, git): |