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

[PATCH] builtin/worktree.c: fix a sparse '0 as NULL pointer' warning

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Jun 9, 2020, 23:52 UTC
Message-ID
<89e22af5-227f-7a38-372a-af2fe7d42be2@ramsayjones.plus.com>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Eric,

If you need to re-roll your 'es/worktree-duplicate-paths' branch, could you please squash this into the relevant patch (commit 71806ee9e8 (worktree: prune linked worktree referencing main worktree path, 2020-06-08)).

Note that this is based on top of the 'pu' branch, and Junio has a fixup patch (commit 4b01d684fe (SQUASH??? -Werror=main, 2020-06-08)) which also changes this line of code (s/main/main_path/).

Thanks!

ATB, Ramsay Jones

 builtin/worktree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 7762333228..2d8540bdae 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -199,7 +199,7 @@ static void prune_worktrees(void)
 	strbuf_add_absolute_path(&main_path, get_git_common_dir());
 	/* massage main worktree absolute path to match 'gitdir' content */
 	strbuf_strip_suffix(&main_path, "/.");
-	string_list_append(&kept, strbuf_detach(&main_path, 0));
+	string_list_append(&kept, strbuf_detach(&main_path, NULL));
 	prune_dups(&kept);
 	string_list_clear(&kept, 1);
 
-- 
2.27.0
Next: Eric Sunshine
Message 1 of 2 in “builtin/worktree.c: fix a sparse '0 as NULL pointer' warning”
  1. builtin/worktree.c: fix a sparse '0 as NULL pointer' warningRamsay Jones, Jun 9, 2020
  2. Eric SunshineJun 10, 2020

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.