All of lore.kernel.org
 help / color / mirror / Atom feed
From: "AreaZR via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: AreaZR <gfunni234@gmail.com>, Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH] refs: exit early from the loop if it is not a main worktree
Date: Wed, 18 Dec 2024 02:20:45 +0000	[thread overview]
Message-ID: <pull.1848.git.git.1734488445457.gitgitgadget@gmail.com> (raw)

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

             reply	other threads:[~2024-12-18  2:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18  2:20 AreaZR via GitGitGadget [this message]
2024-12-18 13:31 ` [PATCH] refs: exit early from the loop if it is not a main worktree 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1848.git.git.1734488445457.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=doremylover123@gmail.com \
    --cc=gfunni234@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.