summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordd <dd@wx.tnyzeq.icu>2024-10-10 07:19:46 +0200
committerdd <dd@wx.tnyzeq.icu>2024-10-10 07:19:46 +0200
commit9b246d48ad69017049ecf2df52fe7c6870e49a0c (patch)
treecb62938dc7b9c35d0bacafaf1d353b33493b94e1
parent0a891ce7fa50bced2315ddeea883b4607fd5b30b (diff)
downloadvyos-jenkins-9b246d48ad69017049ecf2df52fe7c6870e49a0c.tar.gz
vyos-jenkins-9b246d48ad69017049ecf2df52fe7c6870e49a0c.zip
fixed circinus git not to fai when invalid commit is referenced
-rw-r--r--new/lib/git.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/new/lib/git.py b/new/lib/git.py
index 37bb1a9..9e9f441 100644
--- a/new/lib/git.py
+++ b/new/lib/git.py
@@ -1,7 +1,7 @@
import os.path
import re
-from lib.helpers import execute, quote_all
+from lib.helpers import execute, quote_all, ProcessException
class Git:
@@ -24,7 +24,12 @@ class Git:
return execute("git -C %s rev-parse HEAD" % quote_all(self.repo_path)).strip()
def get_changed_files(self, ref1, ref2):
- return execute("git diff --name-only %s %s" % quote_all(ref1, ref2)).strip()
+ try:
+ return execute("git diff --name-only %s %s" % quote_all(ref1, ref2)).strip()
+ except ProcessException as e:
+ if e.exit_code == 1 and "Could not access" in e.output:
+ return "" # ignore non-existing commits (caused by repo changed or force-push)
+ raise
def resolve_changes(self, change_patterns, previous_hash):
if not self.exists():