Skip to content

Commit

Permalink
Add test to make sure unmodified files don't show up in get_unstaged_…
Browse files Browse the repository at this point in the history
…changes.
  • Loading branch information
jelmer committed May 24, 2014
1 parent 7f2cede commit ad51cea
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions dulwich/tests/test_porcelain.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,25 +534,27 @@ def test_get_unstaged_changes(self):
"""Unit test for get_unstaged_changes."""

# Commit a dummy file then modify it
filename_commit = 'foo'
fullpath = os.path.join(self.repo.path, filename_commit)
with open(fullpath, 'w') as f:
foo1_fullpath = os.path.join(self.repo.path, 'foo1')
with open(foo1_fullpath, 'w') as f:
f.write('origstuff')

foo2_fullpath = os.path.join(self.repo.path, 'foo2')
with open(foo2_fullpath, 'w') as f:
f.write('origstuff')

porcelain.add(repo=self.repo.path, paths=[filename_commit])
porcelain.add(repo=self.repo.path, paths=['foo1', 'foo2'])
porcelain.commit(repo=self.repo.path, message='test status',
author='', committer='')

with open(fullpath, 'w') as f:
with open(foo1_fullpath, 'w') as f:
f.write('newstuff')

# modify access and modify time of path
os.utime(fullpath, (0, 0))
os.utime(foo1_fullpath, (0, 0))

changes = porcelain.get_unstaged_changes(self.repo.path)

self.assertEquals(list(changes), [filename_commit])
self.assertEquals(list(changes), ['foo1'])

def test_get_tree_changes_add(self):
"""Unit test for get_tree_changes add."""
Expand Down

0 comments on commit ad51cea

Please sign in to comment.