From ad51ceaa24cf108b237b890d0489ae63551a074d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sat, 24 May 2014 16:34:25 +0200 Subject: [PATCH] Add test to make sure unmodified files don't show up in get_unstaged_changes. --- dulwich/tests/test_porcelain.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dulwich/tests/test_porcelain.py b/dulwich/tests/test_porcelain.py index fc6fdc14e..d182cd3c9 100644 --- a/dulwich/tests/test_porcelain.py +++ b/dulwich/tests/test_porcelain.py @@ -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."""