]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
script/build-with-container: cache git branch result
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 21 Mar 2025 18:28:25 +0000 (14:28 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 12 Jun 2025 13:37:00 +0000 (09:37 -0400)
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 <jmulligan@redhat.com>
src/script/build-with-container.py

index d5d671fbba6cc670d3d1e5dde06d3623b3b0abcb..73c41213d29c9931cdfd543626430e76a990b3d1 100755 (executable)
@@ -234,6 +234,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)