From e8991e80eefecb5e2efc3128d22600ee8158f434 Mon Sep 17 00:00:00 2001 From: herr kaste Date: Thu, 15 Aug 2024 11:05:14 +0200 Subject: [PATCH 1/2] Fix interpreting `slow_repo` state Fixes #1939 That's an obvious bug due to a obviously wrong interpretation of a variable. `supports_ahead_behind` actually means `compute_ahead_and_behind` and that computation should be done if `slow_repo` is in `(False, None)` state. --- core/git_mixins/branches.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/git_mixins/branches.py b/core/git_mixins/branches.py index e223f116c..7ecd3598e 100644 --- a/core/git_mixins/branches.py +++ b/core/git_mixins/branches.py @@ -186,7 +186,7 @@ def run_commit_graph_write(): slow_repo = self.current_state().get("slow_repo", None) supports_ahead_behind = ( self.git_version >= FOR_EACH_REF_SUPPORTS_AHEAD_BEHIND - and slow_repo is not False + and slow_repo is not True ) probe_speed = slow_repo is None and supports_ahead_behind return get_branches__(probe_speed, supports_ahead_behind) From 0d188e91d0f549c344fd9577a617cb609c7d7c8a Mon Sep 17 00:00:00 2001 From: herr kaste Date: Thu, 15 Aug 2024 11:14:32 +0200 Subject: [PATCH 2/2] Clarify variable names --- core/git_mixins/branches.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/git_mixins/branches.py b/core/git_mixins/branches.py index 7ecd3598e..498039ef2 100644 --- a/core/git_mixins/branches.py +++ b/core/git_mixins/branches.py @@ -184,12 +184,12 @@ def run_commit_graph_write(): return branches slow_repo = self.current_state().get("slow_repo", None) - supports_ahead_behind = ( + compute_ahead_behind = ( self.git_version >= FOR_EACH_REF_SUPPORTS_AHEAD_BEHIND - and slow_repo is not True + and not slow_repo ) - probe_speed = slow_repo is None and supports_ahead_behind - return get_branches__(probe_speed, supports_ahead_behind) + probe_speed = compute_ahead_behind and slow_repo is None + return get_branches__(probe_speed, compute_ahead_behind) def _cache_branches(self, branches, refs): # type: (List[Branch], Sequence[str]) -> None