aboutsummaryrefslogtreecommitdiff
path: root/tests/28_test_gbp_git_repository_commit_dir.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/28_test_gbp_git_repository_commit_dir.py')
-rw-r--r--tests/28_test_gbp_git_repository_commit_dir.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/28_test_gbp_git_repository_commit_dir.py b/tests/28_test_gbp_git_repository_commit_dir.py
new file mode 100644
index 0000000..67d4750
--- /dev/null
+++ b/tests/28_test_gbp_git_repository_commit_dir.py
@@ -0,0 +1,42 @@
+# vim: set fileencoding=utf-8 :
+
+import os
+
+from . testutils import DebianGitTestRepo
+from gbp.git.repository import GitRepositoryError
+
+
+class TestGitRepositoryCommitDir(DebianGitTestRepo):
+ def setUp(self):
+ DebianGitTestRepo.setUp(self)
+ self.content = os.path.join(str(self.tmpdir), 'new')
+ os.mkdir(self.content)
+ with open(os.path.join(self.content, 'file1'), 'w') as f:
+ f.write('content1')
+
+ def test_simple(self):
+ self.repo.commit_dir(self.content,
+ 'new content',
+ 'master',
+ create_missing_branch=True)
+ self.assertEquals(self.repo.show('master:file1'), 'content1')
+
+ def test_long_reflog(self):
+ """Make sure we fail on onverly long msg resulting in an
+ overly long reflog enry"""
+ with self.assertRaises(GitRepositoryError):
+ self.repo.commit_dir(self.content,
+ 'foo' * 100000,
+ 'master',
+ create_missing_branch=True)
+
+ def test_long_msg_854333(self):
+ """Make sure we shorten the reflog entry properly"""
+ self.repo.commit_dir(self.content,
+ 'foo\n' * 100000,
+ 'master',
+ create_missing_branch=True)
+ self.assertEquals(self.repo.show('master:file1'), 'content1')
+ out, dummy, ret = self.repo._git_inout('reflog', [])
+ self.assertEquals(ret, 0)
+ self.assertIn('HEAD@{0}: gbp: foo\n', out)