summaryrefslogtreecommitdiff
path: root/git/test/test_index.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/test/test_index.py')
-rw-r--r--git/test/test_index.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/git/test/test_index.py b/git/test/test_index.py
index 63f99f10..8124ec16 100644
--- a/git/test/test_index.py
+++ b/git/test/test_index.py
@@ -44,8 +44,11 @@ from git.index.typ import (
BaseIndexEntry,
IndexEntry
)
+from gitdb.test.lib import with_rw_directory
from git.index.fun import hook_path
+import git
+
class TestIndex(TestBase):
@@ -765,3 +768,15 @@ class TestIndex(TestBase):
except InvalidGitRepositoryError:
asserted = True
assert asserted, "Adding using a filename is not correctly asserted."
+
+ @with_rw_directory
+ def test_index_add_corruption(self, rw_dir):
+ # Test for https://github.com/gitpython-developers/GitPython/issues/265
+ repo = git.Repo.clone_from("git://pkgs.fedoraproject.org/GitPython", rw_dir)
+ assert not repo.is_dirty()
+ file_path = os.path.join(rw_dir, "GitPython.spec")
+ open(file_path, 'wb').close()
+ assert repo.is_dirty()
+ repo.index.add(['0001-GPG-signature-support-on-commit-object.patch', 'GitPython.spec', '.gitignore', 'sources'])
+ repo.git.commit(m="committing file")
+ assert not repo.is_dirty()