[llvm] [PPC][lit] Catch and ignore any exception running 'git'. (PR #92020)

Will Dietz via llvm-commits llvm-commits at lists.llvm.org
Mon May 13 13:03:19 PDT 2024


https://github.com/dtzSiFive created https://github.com/llvm/llvm-project/pull/92020

specifically, OSError for difficulties executing
(e.g., no such file or directory).

Fixes building in environment where git isn't available.

>From e148cf3c8c9e271967ef26ae22e7e6af5b1eca83 Mon Sep 17 00:00:00 2001
From: Will Dietz <w at wdtz.org>
Date: Thu, 9 May 2024 08:20:10 -0500
Subject: [PATCH] [PPC][lit] Catch and ignore any exception running 'git'.

specifically, OSError for difficulties executing
(e.g., no such file or directory).
---
 llvm/test/CodeGen/PowerPC/lit.local.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/test/CodeGen/PowerPC/lit.local.cfg b/llvm/test/CodeGen/PowerPC/lit.local.cfg
index 4cc802afef4a0..0cebf1b7b22a3 100644
--- a/llvm/test/CodeGen/PowerPC/lit.local.cfg
+++ b/llvm/test/CodeGen/PowerPC/lit.local.cfg
@@ -9,7 +9,7 @@ def get_revision(repo_path):
     cmd = ['git', '-C', repo_path, 'rev-parse', 'HEAD']
     try:
         return subprocess.run(cmd, stdout=subprocess.PIPE, check=True).stdout.decode()
-    except subprocess.CalledProcessError:
+    except:
         print("An error occurred retrieving the git revision.")
         return None
 



More information about the llvm-commits mailing list