]> git.scottworley.com Git - pinch/commitdiff
Verify old rev is an ancestor of new rev
authorScott Worley <scottworley@scottworley.com>
Fri, 10 Apr 2020 04:44:56 +0000 (21:44 -0700)
committerScott Worley <scottworley@scottworley.com>
Fri, 10 Apr 2020 04:44:56 +0000 (21:44 -0700)
pinch.py

index 80e631b9b4001574693887a13a40b022969ff333..774f5f108ae9ed23b94b1a2bfb97005c6ed3da93 100644 (file)
--- a/pinch.py
+++ b/pinch.py
@@ -278,6 +278,17 @@ def git_fetch(v: Verification, channel: Channel) -> None:
                               channel.git_ref])
     v.result(process.returncode == 0)
 
+    if hasattr(channel, 'old_git_revision'):
+        v.status('Verifying rev is an ancestor of previous rev %s' % channel.old_git_revision)
+        process = subprocess.run(['git',
+                                  '-C',
+                                  channel.git_cachedir,
+                                  'merge-base',
+                                  '--is-ancestor',
+                                  channel.old_git_revision,
+                                  channel.git_revision])
+        v.result(process.returncode == 0)
+
 
 def compare_tarball_and_git(
         v: Verification,