Thread (3 messages) 3 messages, 3 authors, 2024-10-10

Re: [PATCH v5 3/6] set-head: better output for --auto

From: Ramsay Jones <hidden>
Date: 2024-10-10 16:57:15


On 10/10/2024 16:57, Junio C Hamano wrote:
Junio C Hamano [off-list ref] writes:
quoted
Bence Ferdinandy [off-list ref] writes:
quoted
+static void report_auto(const char *remote, const char *head_name,
+			struct strbuf *buf_prev) {
+	struct strbuf buf_prefix = STRBUF_INIT;
+	const char *prev_head;
I think we need to initialize prev_head to NULL.
quoted
+	strbuf_addf(&buf_prefix, "refs/remotes/%s/", remote);
+	skip_prefix(buf_prev->buf, buf_prefix.buf, &prev_head);
If the symref was not pointing into the "refs/remotes/<remote>/"
hierarchy previously, skip_prefix() comes back without touching
prev_head (i.e. not starting with the prefix does not clear it).
The two uninitialized prev_head were also noticed by compilers in
multiple jobs at GitHub CI.

https://github.com/git/git/actions/runs/11265515664
Heh, I was just about to send a patch to fix up these two warnings
(errors with -Werror), so that I could build 'seen'. However, it
seems to be well in hand, so I won't bother! :)

ATB,
Ramsay Jones

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help