# [PATCH] [Outreachy] patch-ids: fix const correctness

6 messages from 2025-10-09 to 2025-10-10. Participants: Okhuomon Ajayi, Kristoffer Haugsbakk, Agatha Isabelle, Junio C Hamano.
Thread: https://gitlist.dev/t/64287

## Okhuomon Ajayi, 2025-10-09 21:44

Subject: [PATCH] [Outreachy] patch-ids: fix const correctness
Message-ID: <20251009214445.1190274-1-okhuomonajayi54@gmail.com>
URL: https://gitlist.dev/e/20251009214445.1190274-1-okhuomonajayi54%40gmail.com

```
Fix const correctness warning in patch_id_neq() in patch-ids.c.
---
 patch-ids.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/patch-ids.c b/patch-ids.c
index a5683b462c..4a72c2cbe6 100644
--- a/patch-ids.c
+++ b/patch-ids.c
@@ -42,7 +42,7 @@ static int patch_id_neq(const void *cmpfn_data,
 			const void *keydata UNUSED)
 {
 	/* NEEDSWORK: const correctness? */
-	struct diff_options *opt = (void *)cmpfn_data;
+	const struct diff_options *opt = (void *)cmpfn_data;
 	struct patch_id *a, *b;
 
 	a = container_of(eptr, struct patch_id, ent);
-- 
2.43.0


```

## Kristoffer Haugsbakk, 2025-10-09 21:46

Subject: Re: [PATCH] [Outreachy] patch-ids: fix const correctness
Message-ID: <a299c0ea-8eeb-4a21-9924-ebd7c6f6e0bd@app.fastmail.com>
URL: https://gitlist.dev/e/a299c0ea-8eeb-4a21-9924-ebd7c6f6e0bd%40app.fastmail.com
In-Reply-To: <20251009214445.1190274-1-okhuomonajayi54@gmail.com>

```
On Thu, Oct 9, 2025, at 23:44, Okhuomon Ajayi wrote:
> Fix const correctness warning in patch_id_neq() in patch-ids.c.
> ---
>  patch-ids.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/patch-ids.c b/patch-ids.c
> index a5683b462c..4a72c2cbe6 100644
> --- a/patch-ids.c
> +++ b/patch-ids.c
> @@ -42,7 +42,7 @@ static int patch_id_neq(const void *cmpfn_data,
>  			const void *keydata UNUSED)
>  {
>  	/* NEEDSWORK: const correctness? */
> -	struct diff_options *opt = (void *)cmpfn_data;
> +	const struct diff_options *opt = (void *)cmpfn_data;
>  	struct patch_id *a, *b;
> 
>  	a = container_of(eptr, struct patch_id, ent);
> -- 
> 2.43.0

Can’t the comment be removed now, though? If the cmit msg. says “Fix”.

```

## Okhuomon Ajayi, 2025-10-09 21:57

Subject: [PATCH] [Outreachy] patch-ids: fix const correctness
Message-ID: <20251009215737.1196464-1-okhuomonajayi54@gmail.com>
URL: https://gitlist.dev/e/20251009215737.1196464-1-okhuomonajayi54%40gmail.com
In-Reply-To: <20251009214445.1190274-1-okhuomonajayi54@gmail.com>

```
Fix const correctness warning in patch_id_neq() in patch-ids.c.

Changes in v2:
- Removed NEEDSWORK comment
---
 patch-ids.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/patch-ids.c b/patch-ids.c
index a5683b462c..b6b808332f 100644
--- a/patch-ids.c
+++ b/patch-ids.c
@@ -41,8 +41,8 @@ static int patch_id_neq(const void *cmpfn_data,
 			const struct hashmap_entry *entry_or_key,
 			const void *keydata UNUSED)
 {
-	/* NEEDSWORK: const correctness? */
-	struct diff_options *opt = (void *)cmpfn_data;
+	
+	const struct diff_options *opt = (void *)cmpfn_data;
 	struct patch_id *a, *b;
 
 	a = container_of(eptr, struct patch_id, ent);
-- 
2.43.0


```

## Agatha Isabelle, 2025-10-09 23:49

Subject: Re: [PATCH] [Outreachy] patch-ids: fix const correctness
Message-ID: <6n5vp3vkmk6gota27baejwu2mkuqppy65efsiimvjqnhjjqecz@uud5yaetl5l2>
URL: https://gitlist.dev/e/6n5vp3vkmk6gota27baejwu2mkuqppy65efsiimvjqnhjjqecz%40uud5yaetl5l2
In-Reply-To: <20251009215737.1196464-1-okhuomonajayi54@gmail.com>

```
Hello!

Nice patch!

One detail I would add, though, I think the correct way to submit a v2
patch is to prefix it with the `[PATCH v2]` prefix.

See:
https://git-scm.com/docs/SubmittingPatches
https://git-scm.com/docs/MyFirstContribution

On Thu, Oct 09, 2025 at 10:57:20PM +0100, Okhuomon Ajayi wrote:
> Fix const correctness warning in patch_id_neq() in patch-ids.c.
> 

Before the changes, I think there must be the `Signed-off-by:` line.

> Changes in v2:
> - Removed NEEDSWORK comment

And this part of the message, the changelog, I think it's supposed to be
in the email message but not as part of the commit log.

> ---
>  patch-ids.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/patch-ids.c b/patch-ids.c
> index a5683b462c..b6b808332f 100644
> --- a/patch-ids.c
> +++ b/patch-ids.c
> @@ -41,8 +41,8 @@ static int patch_id_neq(const void *cmpfn_data,
>  			const struct hashmap_entry *entry_or_key,
>  			const void *keydata UNUSED)
>  {
> -	/* NEEDSWORK: const correctness? */
> -	struct diff_options *opt = (void *)cmpfn_data;
> +	
> +	const struct diff_options *opt = (void *)cmpfn_data;
>  	struct patch_id *a, *b;
>  
>  	a = container_of(eptr, struct patch_id, ent);
> -- 
> 2.43.0
> 

I hope it was helpful.

Best,
Ágatha Isabelle

```

## Okhuomon Ajayi, 2025-10-10 00:13

Subject: Re: [PATCH] [Outreachy] patch-ids: fix const correctness
Message-ID: <CAFpMFfAvSrm=LGdCkuui2aZoZW5+cq=8Hk1pug=1GB=ZRreuiQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAFpMFfAvSrm%3DLGdCkuui2aZoZW5%2Bcq%3D8Hk1pug%3D1GB%3DZRreuiQ%40mail.gmail.com
In-Reply-To: <6n5vp3vkmk6gota27baejwu2mkuqppy65efsiimvjqnhjjqecz@uud5yaetl5l2>

```
Thank you Agatha

On Fri, Oct 10, 2025 at 12:49 AM Agatha Isabelle <code@agatha.dev> wrote:
>
> Hello!
>
> Nice patch!
>
> One detail I would add, though, I think the correct way to submit a v2
> patch is to prefix it with the `[PATCH v2]` prefix.
>
> See:
> https://git-scm.com/docs/SubmittingPatches
> https://git-scm.com/docs/MyFirstContribution
>
> On Thu, Oct 09, 2025 at 10:57:20PM +0100, Okhuomon Ajayi wrote:
> > Fix const correctness warning in patch_id_neq() in patch-ids.c.
> >
>
> Before the changes, I think there must be the `Signed-off-by:` line.
>
> > Changes in v2:
> > - Removed NEEDSWORK comment
>
> And this part of the message, the changelog, I think it's supposed to be
> in the email message but not as part of the commit log.
>
> > ---
> >  patch-ids.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/patch-ids.c b/patch-ids.c
> > index a5683b462c..b6b808332f 100644
> > --- a/patch-ids.c
> > +++ b/patch-ids.c
> > @@ -41,8 +41,8 @@ static int patch_id_neq(const void *cmpfn_data,
> >                       const struct hashmap_entry *entry_or_key,
> >                       const void *keydata UNUSED)
> >  {
> > -     /* NEEDSWORK: const correctness? */
> > -     struct diff_options *opt = (void *)cmpfn_data;
> > +
> > +     const struct diff_options *opt = (void *)cmpfn_data;
> >       struct patch_id *a, *b;
> >
> >       a = container_of(eptr, struct patch_id, ent);
> > --
> > 2.43.0
> >
>
> I hope it was helpful.
>
> Best,
> Ágatha Isabelle

```

## Junio C Hamano, 2025-10-10 00:45

Subject: Re: [PATCH] [Outreachy] patch-ids: fix const correctness
Message-ID: <xmqqwm53bn47.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqwm53bn47.fsf%40gitster.g
In-Reply-To: <a299c0ea-8eeb-4a21-9924-ebd7c6f6e0bd@app.fastmail.com>

```
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:

> On Thu, Oct 9, 2025, at 23:44, Okhuomon Ajayi wrote:
>> Fix const correctness warning in patch_id_neq() in patch-ids.c.
>> ---
>>  patch-ids.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/patch-ids.c b/patch-ids.c
>> index a5683b462c..4a72c2cbe6 100644
>> --- a/patch-ids.c
>> +++ b/patch-ids.c
>> @@ -42,7 +42,7 @@ static int patch_id_neq(const void *cmpfn_data,
>>  			const void *keydata UNUSED)
>>  {
>>  	/* NEEDSWORK: const correctness? */
>> -	struct diff_options *opt = (void *)cmpfn_data;
>> +	const struct diff_options *opt = (void *)cmpfn_data;
>>  	struct patch_id *a, *b;
>> 
>>  	a = container_of(eptr, struct patch_id, ent);
>> -- 
>> 2.43.0
>
> Can’t the comment be removed now, though? If the cmit msg. says “Fix”.

And the proposed commit log message should describe what the problem
is, why it matters, and how the updated code is better than the
current state of the code.

```
