# [PATCH] builtin/init-db.c: fix a sparse warning

2 messages from 2020-08-28 to 2020-08-28. Participants: Ramsay Jones, Eric Sunshine.
Thread: https://gitlist.dev/t/54155

## Ramsay Jones, 2020-08-28 20:46

Subject: [PATCH] builtin/init-db.c: fix a sparse warning
Message-ID: <8d4b4011-b8a2-c0e0-a3f2-28c7bbec040b@ramsayjones.plus.com>
URL: https://gitlist.dev/e/8d4b4011-b8a2-c0e0-a3f2-28c7bbec040b%40ramsayjones.plus.com

```

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

Hi Eric,

If you need to re-roll your 'es/worktree-repair' branch, could you
please squash this into the relevant patch (commit 44a466ca7f (init:
make --separate-git-dir work from within linked worktree, 27-08-2020)).

Thanks!

ATB,
Ramsay Jones

 builtin/init-db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/init-db.c b/builtin/init-db.c
index 6a94d20a2e..cd3e760541 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -661,7 +661,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 			if (chdir(mainwt.buf) < 0)
 				die_errno(_("cannot chdir to %s"), mainwt.buf);
 			strbuf_release(&mainwt);
-			git_dir = strbuf_detach(&sb, 0);
+			git_dir = strbuf_detach(&sb, NULL);
 		}
 		strbuf_release(&sb);
 	}
-- 
2.28.0

```

## Eric Sunshine, 2020-08-28 22:20

Subject: Re: [PATCH] builtin/init-db.c: fix a sparse warning
Message-ID: <CAPig+cQxjYA_LdbaGYOCACPSn=DhpFA-+5tb76BxnveT66w45A@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcQxjYA_LdbaGYOCACPSn%3DDhpFA-%2B5tb76BxnveT66w45A%40mail.gmail.com
In-Reply-To: <8d4b4011-b8a2-c0e0-a3f2-28c7bbec040b@ramsayjones.plus.com>

```
On Fri, Aug 28, 2020 at 4:47 PM Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
> If you need to re-roll your 'es/worktree-repair' branch, could you
> please squash this into the relevant patch (commit 44a466ca7f (init:
> make --separate-git-dir work from within linked worktree, 27-08-2020)).
>
> -                       git_dir = strbuf_detach(&sb, 0);
> +                       git_dir = strbuf_detach(&sb, NULL);

Thanks. I misremembered the purpose of the second argument, thinking
that it was a size hint which would be passed along to strbuf_init().

```
