Skip to content

Add support for diffing against root commit #408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 19, 2016
Prev Previous commit
Next Next commit
Fix test cases
  • Loading branch information
nvie committed Apr 14, 2016
commit 1875885485e7c78d34fd56b8db69d8b3f0df830c
9 changes: 5 additions & 4 deletions git/test/test_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
Repo,
GitCommandError,
Diff,
DiffIndex
DiffIndex,
NULL_TREE,
)


Expand Down Expand Up @@ -132,13 +133,13 @@ def test_diff_initial_commit(self):
initial_commit = self.rorepo.commit('33ebe7acec14b25c5f84f35a664803fcab2f7781')

# Without creating a patch...
diff_index = initial_commit.diff('root')
diff_index = initial_commit.diff(NULL_TREE)
assert diff_index[0].b_path == 'CHANGES'
assert diff_index[0].new_file
assert diff_index[0].diff == ''

# ...and with creating a patch
diff_index = initial_commit.diff('root', create_patch=True)
diff_index = initial_commit.diff(NULL_TREE, create_patch=True)
assert diff_index[0].b_path == 'CHANGES'
assert diff_index[0].new_file
assert diff_index[0].diff == fixture('diff_initial')
Expand All @@ -164,7 +165,7 @@ def test_diff_interface(self):
diff_item = commit.tree
# END use tree every second item

for other in (None, 'root', commit.Index, commit.parents[0]):
for other in (None, NULL_TREE, commit.Index, commit.parents[0]):
for paths in (None, "CHANGES", ("CHANGES", "lib")):
for create_patch in range(2):
diff_index = diff_item.diff(other=other, paths=paths, create_patch=create_patch)
Expand Down