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

Unified Diff: infra/libs/git2/test/repo_test.py

Issue 424423004: Push pending tag and synthesized commit in a single git push operation. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 6 years, 5 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 | « infra/libs/git2/test/ref_test.py ('k') | infra/services/gnumbd/gnumbd.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/libs/git2/test/repo_test.py
diff --git a/infra/libs/git2/test/repo_test.py b/infra/libs/git2/test/repo_test.py
index d0c5b4b3d33f3a047129f8359119084215c56259..87a808015d1d17b55cae4fed2a69b0d18b824bd9 100644
--- a/infra/libs/git2/test/repo_test.py
+++ b/infra/libs/git2/test/repo_test.py
@@ -97,3 +97,23 @@ class TestRepo(test_util.TestBasis):
r = self.mkRepo()
self.assertEqual(r['refs/heads/branch_Z'].commit.hsh,
'c9813df312aae7cadb91b0d4eb89ad1a4d1b22c9')
+
+ def testNonFastForward(self):
+ r = self.mkRepo()
+ O = r['refs/heads/branch_O']
+ D = r.get_commit(self.repo['D'])
+ with self.assertRaises(git2.CalledProcessError):
+ r.fast_forward_push({O: D})
+ self.assertEqual(
+ self.repo.git('rev-parse', 'branch_O').stdout.strip(),
+ self.repo['O'])
+
+ def testFastForward(self):
+ r = self.mkRepo()
+ O = r['refs/heads/branch_O']
+ S = r.get_commit(self.repo['S'])
+ self.capture_stdio(r.fast_forward_push, {O: S})
+ self.assertEqual(O.commit.hsh, self.repo['S'])
+ self.assertEqual(
+ self.repo.git('rev-parse', 'branch_O').stdout.strip(),
+ self.repo['S'])
« no previous file with comments | « infra/libs/git2/test/ref_test.py ('k') | infra/services/gnumbd/gnumbd.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698