From 4d7aacb5f243aed4426914982506518126772f01 Mon Sep 17 00:00:00 2001 From: Saurabh Misra Date: Fri, 21 Mar 2025 10:43:48 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Speed=20up=20method=20`Rep?= =?UTF-8?q?ository.is=5Fgit=5Frepo`=20by=2072,270%=20(#2381)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here is the optimized version of the `Repository` class. Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com> Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> --- src/crewai/cli/git.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/crewai/cli/git.py b/src/crewai/cli/git.py index 94c3648b0..58836e733 100644 --- a/src/crewai/cli/git.py +++ b/src/crewai/cli/git.py @@ -1,4 +1,5 @@ import subprocess +from functools import lru_cache class Repository: @@ -35,6 +36,7 @@ class Repository: encoding="utf-8", ).strip() + @lru_cache(maxsize=None) def is_git_repo(self) -> bool: """Check if the current directory is a git repository.""" try: