# [PATCH] refs: fix duplicated word in comment

5 messages from 2025-04-04 to 2025-04-09. Participants: Christian Fredrik Johnsen via GitGitGadget, Martin Ågren, Junio C Hamano.
Thread: https://gitlist.dev/t/63255

## Christian Fredrik Johnsen via GitGitGadget, 2025-04-04 18:39

Subject: [PATCH] refs: fix duplicated word in comment
Message-ID: <pull.1940.git.git.1743791986754.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1940.git.git.1743791986754.gitgitgadget%40gmail.com

```
From: Christian Fredrik Johnsen <christian@johnsen.no>

Fix a typo in a comment in refs.c: "checking checking" → "checking".
Signed-off-by: Christian Fredrik Johnsen <christian@johnsen.no>
---
    refs: fix duplicated word in comment

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1940%2FChristianFredrikJohnsen%2Fmaster-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1940/ChristianFredrikJohnsen/master-v1
Pull-Request: https://github.com/git/git/pull/1940

 refs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/refs.c b/refs.c
index f0fe77bd7cf..5c0fd545965 100644
--- a/refs.c
+++ b/refs.c
@@ -2549,7 +2549,7 @@ int refs_verify_refnames_available(struct ref_store *refs,
 
 			/*
 			 * If we've already seen the directory we don't need to
-			 * process it again. Skip it to avoid checking checking
+			 * process it again. Skip it to avoid checking
 			 * common prefixes like "refs/heads/" repeatedly.
 			 */
 			if (!strset_add(&dirnames, dirname.buf))

base-commit: 5b97a56fa0e7d580dc8865b73107407c9b3f0eff
-- 
gitgitgadget

```

## Martin Ågren, 2025-04-05 10:01

Subject: Re: [PATCH] refs: fix duplicated word in comment
Message-ID: <CAN0heSp9RhH=UMDqLs=Kd57RoseySrFT4sFeXrVV3h7f=daSaw@mail.gmail.com>
URL: https://gitlist.dev/e/CAN0heSp9RhH%3DUMDqLs%3DKd57RoseySrFT4sFeXrVV3h7f%3DdaSaw%40mail.gmail.com
In-Reply-To: <pull.1940.git.git.1743791986754.gitgitgadget@gmail.com>

```
Hi Christian Fredrik,

Thanks for posting a patch.

On Fri, 4 Apr 2025 at 20:39, Christian Fredrik Johnsen via
GitGitGadget <gitgitgadget@gmail.com> wrote:
>
> From: Christian Fredrik Johnsen <christian@johnsen.no>
>
> Fix a typo in a comment in refs.c: "checking checking" → "checking".
> Signed-off-by: Christian Fredrik Johnsen <christian@johnsen.no>

There should be an empty line between the main part of the commit
message and the Signed-off-by trailer.

>                         /*
>                          * If we've already seen the directory we don't need to
> -                        * process it again. Skip it to avoid checking checking
> +                        * process it again. Skip it to avoid checking
>                          * common prefixes like "refs/heads/" repeatedly.
>                          */

Well-spotted. No doubt that this is the correct fix.

Martin

```

## Christian Fredrik Johnsen via GitGitGadget, 2025-04-05 12:57

Subject: [PATCH v2] refs: fix duplicated word in comment
Message-ID: <pull.1940.v2.git.git.1743857867327.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1940.v2.git.git.1743857867327.gitgitgadget%40gmail.com
In-Reply-To: <pull.1940.git.git.1743791986754.gitgitgadget@gmail.com>

```
From: Christian Fredrik Johnsen <christian@johnsen.no>

Fix a typo in a comment in refs.c: "checking checking" → "checking".

Signed-off-by: Christian Fredrik Johnsen <christian@johnsen.no>
---
    refs: fix duplicated word in comment
    
    cc: Martin Ågren martin.agren@gmail.com
    
    Changes since v1:
    
     * Add a blank line in the commit message to separate commit body from
       Signed-off-by: footer
     * Moved the word common from line 2553 to 2552, to make the comment be
       similar in style to other comments in refs.c. (Usually the last
       comment line is somewhat shorter than the first ones).

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1940%2FChristianFredrikJohnsen%2Fmaster-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1940/ChristianFredrikJohnsen/master-v2
Pull-Request: https://github.com/git/git/pull/1940

Range-diff vs v1:

 1:  327563ce3fd ! 1:  029c23cf027 refs: fix duplicated word in comment
     @@ Commit message
          refs: fix duplicated word in comment
      
          Fix a typo in a comment in refs.c: "checking checking" → "checking".
     +
          Signed-off-by: Christian Fredrik Johnsen <christian@johnsen.no>
      
       ## refs.c ##
     @@ refs.c: int refs_verify_refnames_available(struct ref_store *refs,
       			/*
       			 * If we've already seen the directory we don't need to
      -			 * process it again. Skip it to avoid checking checking
     -+			 * process it again. Skip it to avoid checking
     - 			 * common prefixes like "refs/heads/" repeatedly.
     +-			 * common prefixes like "refs/heads/" repeatedly.
     ++			 * process it again. Skip it to avoid checking common
     ++			 * prefixes like "refs/heads/" repeatedly.
       			 */
       			if (!strset_add(&dirnames, dirname.buf))
     + 				continue;


 refs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/refs.c b/refs.c
index f0fe77bd7cf..1fb270c5782 100644
--- a/refs.c
+++ b/refs.c
@@ -2549,8 +2549,8 @@ int refs_verify_refnames_available(struct ref_store *refs,
 
 			/*
 			 * If we've already seen the directory we don't need to
-			 * process it again. Skip it to avoid checking checking
-			 * common prefixes like "refs/heads/" repeatedly.
+			 * process it again. Skip it to avoid checking common
+			 * prefixes like "refs/heads/" repeatedly.
 			 */
 			if (!strset_add(&dirnames, dirname.buf))
 				continue;

base-commit: 5b97a56fa0e7d580dc8865b73107407c9b3f0eff
-- 
gitgitgadget

```

## Martin Ågren, 2025-04-07 18:43

Subject: Re: [PATCH v2] refs: fix duplicated word in comment
Message-ID: <CAN0heSoh4SuQcYHVVniO1BYH_C4O-BeF4kKxDg3uQPzpotLA1A@mail.gmail.com>
URL: https://gitlist.dev/e/CAN0heSoh4SuQcYHVVniO1BYH_C4O-BeF4kKxDg3uQPzpotLA1A%40mail.gmail.com
In-Reply-To: <pull.1940.v2.git.git.1743857867327.gitgitgadget@gmail.com>

```
On Sat, 5 Apr 2025 at 14:58, Christian Fredrik Johnsen via
GitGitGadget <gitgitgadget@gmail.com> wrote:
>
> From: Christian Fredrik Johnsen <christian@johnsen.no>
>
> Fix a typo in a comment in refs.c: "checking checking" → "checking".
>
> Signed-off-by: Christian Fredrik Johnsen <christian@johnsen.no>

This addresses my comment on v1.

>     Changes since v1:
>
>      * Add a blank line in the commit message to separate commit body from
>        Signed-off-by: footer
>      * Moved the word common from line 2553 to 2552, to make the comment be
>        similar in style to other comments in refs.c. (Usually the last
>        comment line is somewhat shorter than the first ones).

>                         /*
>                          * If we've already seen the directory we don't need to
> -                        * process it again. Skip it to avoid checking checking
> -                        * common prefixes like "refs/heads/" repeatedly.
> +                        * process it again. Skip it to avoid checking common
> +                        * prefixes like "refs/heads/" repeatedly.
>                          */
>                         if (!strset_add(&dirnames, dirname.buf))
>                                 continue;

Ok. In general, there's some trade-off to be made between "make a small change
at the top of a twenty-line comment and rewrap the whole thing causing more
churn than necessary and create more room for conflicts with other topics" and
"make the change and live with slightly less beautiful wrapping". In this
particular case, the blast radius is small. `git show --word-diff` confirms
that you simply removed the duplicate word and moved "common" (or "*").

FWIW, this patch looks good to me.

Martin

```

## Junio C Hamano, 2025-04-09 16:22

Subject: Re: [PATCH v2] refs: fix duplicated word in comment
Message-ID: <xmqqbjt5s3t5.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqbjt5s3t5.fsf%40gitster.g
In-Reply-To: <CAN0heSoh4SuQcYHVVniO1BYH_C4O-BeF4kKxDg3uQPzpotLA1A@mail.gmail.com>

```
Martin Ågren <martin.agren@gmail.com> writes:

> Ok. In general, there's some trade-off to be made between "make a small change
> at the top of a twenty-line comment and rewrap the whole thing causing more
> churn than necessary and create more room for conflicts with other topics" and
> "make the change and live with slightly less beautiful wrapping".

Nice to see this choice spelled out.

> In this
> particular case, the blast radius is small. `git show --word-diff` confirms
> that you simply removed the duplicate word and moved "common" (or "*").
>
> FWIW, this patch looks good to me.
>
> Martin

Thanks, both.
Will queue.

```
