git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John Cai via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: John Cai <johncai86@gmail.com>, John Cai <jcai@gitlab.com>
Subject: [PATCH 3/3] repository: BUG when is_bare_cfg is not initialized
Date: Wed, 06 Nov 2024 20:48:02 +0000	[thread overview]
Message-ID: <749ba7f52086f2b444a9e073c431d7d4f4c7204e.1730926082.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1826.git.git.1730926082.gitgitgadget@gmail.com>

From: John Cai <jcai@gitlab.com>

The is_bare_cfg member of the repository struct should be properly
initiated when setting up a repository. BUG when repo_is_bare() sees
that the flag has not been set.

Signed-off-by: John Cai <johncai86@gmail.com>
---
 repository.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/repository.c b/repository.c
index 96608058b61..cd1d59ea1b9 100644
--- a/repository.c
+++ b/repository.c
@@ -464,5 +464,7 @@ int repo_hold_locked_index(struct repository *repo,
 int repo_is_bare(struct repository *repo)
 {
 	/* if core.bare is not 'false', let's see if there is a work tree */
+	if (repo->is_bare_cfg < 0 )
+		BUG("is_bare_cfg unspecified");
 	return repo->is_bare_cfg && !repo_get_work_tree(repo);
 }
-- 
gitgitgadget

  parent reply	other threads:[~2024-11-06 20:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 20:47 [PATCH 0/3] Remove is_bare_repository_cfg global state John Cai via GitGitGadget
2024-11-06 20:48 ` [PATCH 1/3] git: remove is_bare_repository_cfg global variable John Cai via GitGitGadget
2024-11-07  5:46   ` Junio C Hamano
2024-11-07 16:04     ` shejialuo
2024-11-08  1:24       ` Junio C Hamano
2024-11-16 12:09         ` shejialuo
2024-11-06 20:48 ` [PATCH 2/3] setup: initialize is_bare_cfg John Cai via GitGitGadget
2024-11-07  6:25   ` Junio C Hamano
2024-11-06 20:48 ` John Cai via GitGitGadget [this message]
2024-11-26  8:08 ` [PATCH 0/3] Remove is_bare_repository_cfg global state Junio C Hamano
2024-12-11 23:09 ` (RFH Windows breakage) " Junio C Hamano

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=749ba7f52086f2b444a9e073c431d7d4f4c7204e.1730926082.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jcai@gitlab.com \
    --cc=johncai86@gmail.com \
    /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 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).