Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2030)

Unified Diff: tests/git_common_test.py

Issue 1064933004: git-squash-branch: handle empty squashes and dirty trees (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/git_cl_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/git_common_test.py
diff --git a/tests/git_common_test.py b/tests/git_common_test.py
index ee44eb390f87a0c1d05d4bd5709e819772961036..029c823c14d3bf4857cbaa0ba3c2e445fc29d5aa 100755
--- a/tests/git_common_test.py
+++ b/tests/git_common_test.py
@@ -561,10 +561,17 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase,
('root_A', 'root_X'),
])
+ def testIsGitTreeDirty(self):
+ self.assertEquals(False, self.repo.run(self.gc.is_dirty_git_tree, 'foo'))
+ self.repo.open('test.file', 'w').write('test data')
+ self.repo.git('add', 'test.file')
+ self.assertEquals(True, self.repo.run(self.gc.is_dirty_git_tree, 'foo'))
+
def testSquashBranch(self):
self.repo.git('checkout', 'branch_K')
- self.repo.run(self.gc.squash_current_branch, 'cool message')
+ self.assertEquals(True, self.repo.run(self.gc.squash_current_branch,
+ 'cool message'))
lines = ['cool message', '']
for l in 'HIJK':
@@ -580,6 +587,14 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase,
'K'
)
+ def testSquashBranchEmpty(self):
+ self.repo.git('checkout', 'branch_K')
+ self.repo.git('checkout', 'branch_G', '.')
+ self.repo.git('commit', '-m', 'revert all changes no branch')
+ # Should return False since the quash would result in an empty commit
+ stdout = self.repo.capture_stdio(self.gc.squash_current_branch)[0]
+ self.assertEquals(stdout, 'Nothing to commit; squashed branch is empty\n')
+
def testRebase(self):
self.assertSchema("""
A B C D E F G
« no previous file with comments | « tests/git_cl_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698