git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] refs: exit early from the loop if it is not a main worktree
@ 2024-12-18  2:20 AreaZR via GitGitGadget
  2024-12-18 13:31 ` shejialuo
  0 siblings, 1 reply; 8+ messages in thread
From: AreaZR via GitGitGadget @ 2024-12-18  2:20 UTC (permalink / raw)
  To: git; +Cc: AreaZR, Seija Kijin

From: Seija Kijin <doremylover123@gmail.com>

The is_main_worktree function just checks for !wt->id,
but the compiler doesn't know this as it is in a different
file, so just exit out early.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
    refs: exit early from the loop if it is not a main worktree
    
    The is_main_worktree function just checks for !wt->id, but the compiler
    doesn't know this as it is in a different file, so just exit out early.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1848%2FAreaZR%2Fexit-early-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1848/AreaZR/exit-early-v1
Pull-Request: https://github.com/git/git/pull/1848

 refs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/refs.c b/refs.c
index 8b713692359..cce63a618d7 100644
--- a/refs.c
+++ b/refs.c
@@ -2791,6 +2791,7 @@ static int has_worktrees(void)
 		if (is_main_worktree(worktrees[i]))
 			continue;
 		ret = 1;
+		break;
 	}
 
 	free_worktrees(worktrees);

base-commit: 063bcebf0c917140ca0e705cbe0fdea127e90086
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-12-27 14:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18  2:20 [PATCH] refs: exit early from the loop if it is not a main worktree AreaZR via GitGitGadget
2024-12-18 13:31 ` shejialuo
2024-12-18 23:52   ` Eric Sunshine
2024-12-19  1:10     ` Junio C Hamano
2024-12-19  5:54       ` Eric Sunshine
2024-12-19  6:12         ` Junio C Hamano
2024-12-27 14:34         ` Patrick Steinhardt
2024-12-27 14:34     ` Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).