From: John Mulligan Date: Fri, 21 Mar 2025 18:28:25 +0000 (-0400) Subject: script/build-with-container: cache git branch result X-Git-Tag: testing/wip-jcollin-testing-20250823.034751-tentacle~5^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b9d6ac6cca6beecf6e72b56b3fe7bf62ca952b1a;p=ceph-ci.git script/build-with-container: cache git branch result Cache the branch we got from the git command as it is highly unlikely to change during the script execution and if it does -- we mostly don't care anyway. Signed-off-by: John Mulligan (cherry picked from commit e562aa086197c2950c9ebb9f8f112e88e1e6e666) --- diff --git a/src/script/build-with-container.py b/src/script/build-with-container.py index 112fd6528ab..3ac94ff886c 100755 --- a/src/script/build-with-container.py +++ b/src/script/build-with-container.py @@ -249,6 +249,9 @@ def _git_command(ctx, args): return cmd +# Assume that the git version will not be changing after the 1st time +# the command is run. +@functools.cache def _git_current_branch(ctx): cmd = _git_command(ctx, ["rev-parse", "--abbrev-ref", "HEAD"]) res = _run(cmd, check=True, capture_output=True)