git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] repository: BUG when is_bare_cfg is not initialized

From
John Cai via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 6, 2024, 20:48 UTC
Message-ID
<749ba7f52086f2b444a9e073c431d7d4f4c7204e.1730926082.git.gitgitgadget@gmail.com>
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
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 11 in “Remove is_bare_repository_cfg global state”
  1. 0/3 Remove is_bare_repository_cfg global stateJohn Cai via GitGitGadget, Nov 6, 2024
  2. 1/3 git: remove is_bare_repository_cfg global variableJohn Cai via GitGitGadget, Nov 6, 2024
  3. Junio C HamanoNov 7, 2024
  4. shejialuoNov 7, 2024
  5. Junio C HamanoNov 8, 2024
  6. shejialuoNov 16, 2024
  7. 2/3 setup: initialize is_bare_cfgJohn Cai via GitGitGadget, Nov 6, 2024
  8. Junio C HamanoNov 7, 2024
  9. 3/3 repository: BUG when is_bare_cfg is not initializedJohn Cai via GitGitGadget, Nov 6, 2024
  10. Junio C HamanoNov 26, 2024
  11. (RFH Windows breakage) Re: [PATCH 0/3] Remove is_bare_repository_cfg global stateJunio C Hamano, Dec 11, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.