Subject: [PATCH 4/3] index-pack: work around false positive use of uninitialized variable

From: Junio C Hamano <[email-masked]>
Date: Wed, 04 Dec 2024 13:46:50 +0900

The base_name variable in this function is given a value if cmd.args
array is not empty (i.e., if we run the pack-objects command), and
the function returns when cmd.args is empty before hitting a call to
free(base_name) near the end of the function, so to a human reader,
it can be seen that the variable is not used uninitialized, but to a
semi-intelligent compiler it is not so clear.

Squelch a false positive by a meaningless NULL initialization.

Signed-off-by: Junio C Hamano <[email-masked]>
---

 * Tentatively queued to unblock CI.  There may be breakages due to
   other topics in flight, but at least this one is easy to resolve
   (hopefully---I haven't pushed it out).

   https://github.com/git/git/actions/runs/12152173257

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

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 1594f2b81d..8e600a58bf 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1803,7 +1803,7 @@ static void repack_local_links(void)
 	struct strbuf line = STRBUF_INIT;
 	struct oidset_iter iter;
 	struct object_id *oid;
-	char *base_name;
+	char *base_name = NULL;
 
 	if (!oidset_size(&outgoing_links))
 		return;
-- 
2.47.1-574-g3b2d6bb55a