From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
Phillip Wood <phillip.wood123@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [GSoC PATCH v4] add -p: show user's hunk decision when selecting hunks
Date: Mon, 5 Jan 2026 20:35:33 +0100 [thread overview]
Message-ID: <aVwShWyoGBq4BcGR@szeder.dev> (raw)
In-Reply-To: <aVpI36nPuZAEchuM@Adekunles-MacBook-Air.local>
On Sun, Jan 04, 2026 at 12:02:55PM +0100, Abraham Samuel Adekunle wrote:
> diff --git a/add-patch.c b/add-patch.c
> index 173a53241e..bc7a340d21 100644
> --- a/add-patch.c
> +++ b/add-patch.c
> @@ -1448,6 +1448,7 @@ static int patch_update_file(struct add_p_state *s,
> ssize_t i, undecided_previous, undecided_next, rendered_hunk_index = -1;
> struct hunk *hunk;
> char ch;
> + const char *hunk_use_decision;
'hunk_use_decision' is defined here, but is left uninitialized.
> struct child_process cp = CHILD_PROCESS_INIT;
> int colored = !!s->colored.len, quit = 0, use_pager = 0;
> enum prompt_mode_type prompt_mode_type;
> @@ -1564,8 +1565,17 @@ static int patch_update_file(struct add_p_state *s,
> (uintmax_t)(file_diff->hunk_nr
> ? file_diff->hunk_nr
> : 1));
> + if (file_diff->hunk_nr) {
> + if (hunk->use == USE_HUNK)
> + hunk_use_decision = _(" (previous decision: use) ");
> + else if (hunk->use == SKIP_HUNK)
> + hunk_use_decision = _(" (previous decision: skip) ");
> + else
> + hunk_use_decision = " ";
'hunk_use_decision' is set here, but only if 'file_diff->hunk_nr' is
non-zero.
> +`
> + }
Nit: unnecessary empty line before the closing brace.
> printf(_(s->mode->prompt_mode[prompt_mode_type]),
> - s->buf.buf);
> + hunk_use_decision, s->buf.buf);
So 'hunk_use_decision' is used uninitialized here if
'file_diff->hunk_nr' is zero.
> if (*s->s.reset_color_interactive)
> fputs(s->s.reset_color_interactive, stdout);
> fflush(stdout);
next prev parent reply other threads:[~2026-01-05 19:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-30 15:06 [PATCH] add -p: show hunk selection state when selecting hunks Abraham Samuel Adekunle
2025-11-30 18:32 ` Junio C Hamano
2025-12-01 10:01 ` Abraham Samuel Adekunle
2026-01-01 21:04 ` [GSoC PATCH v2] add -p: show user's hunk decision " Abraham Samuel Adekunle
2026-01-01 22:54 ` Junio C Hamano
2026-01-02 7:20 ` Samuel Abraham
2026-01-02 18:51 ` [GSoC PATCH v3] " Abraham Samuel Adekunle
2026-01-04 6:03 ` Junio C Hamano
2026-01-04 10:36 ` Samuel Abraham
2026-01-04 11:02 ` [GSoC PATCH v4] " Abraham Samuel Adekunle
2026-01-05 19:35 ` SZEDER Gábor [this message]
2026-01-05 21:52 ` Samuel Abraham
2026-01-06 11:05 ` [GSoC PATCH v5] " Abraham Samuel Adekunle
2026-01-06 11:08 ` Kristoffer Haugsbakk
2026-01-06 11:46 ` Samuel Abraham
2026-01-06 12:01 ` [GSoC PATCH v6] " Abraham Samuel Adekunle
2026-01-06 16:10 ` Phillip Wood
2026-01-06 19:01 ` Ben Knoble
2026-01-07 0:13 ` Junio C Hamano
2026-01-06 22:02 ` Samuel Abraham
2026-01-06 22:19 ` Samuel Abraham
2026-01-07 8:49 ` Samuel Abraham
2026-01-08 15:07 ` [GSoC PATCH v7] " Abraham Samuel Adekunle
2026-01-11 3:57 ` Junio C Hamano
2026-01-11 11:04 ` Samuel Abraham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aVwShWyoGBq4BcGR@szeder.dev \
--to=szeder.dev@gmail.com \
--cc=abrahamadekunle50@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood123@gmail.com \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.