threads / patch / 63094

patchdir.h: remove duplicate forward declaration of struct repository

Subject: [PATCH] dir.h: remove duplicate forward declaration of struct repository

## tl;dr

2 messages between Mar 11, 2025 and Mar 11, 2025. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Abhijeetsingh Meena via GitGitGadget· Mar 11, 2025, 14:59 UTC · lore
From: Abhijeetsingh Meena <abhijeet040403@gmail.com>

The `struct repository;` forward declaration appears twice in `dir.h`: once at line 10 and again at line 46. This duplication is unnecessary and likely unintentional.

Removing the second declaration has no impact on compilation, as verified by a clean build.

Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
---
    Remove duplicate forward declaration of struct repository
    
    
    Summary
    =======
    
    While exploring how Git searches for .gitignore files and manages
    ignored files, I came across dir.h. While reading through the file, I
    noticed that struct repository; was forward-declared twice. This
    duplication appears unnecessary, and removing the second declaration
    compiles cleanly.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1879%2FEthan0456%2Fcleanup%2Fdeduplicate-repo-fwd-decl-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1879/Ethan0456/cleanup/deduplicate-repo-fwd-decl-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1879
 dir.h | 1 -
 1 file changed, 1 deletion(-)
Show changes to dir.h +0 −1
diff --git a/dir.h b/dir.h
index a3a2f00f5d9..e659c47ad77 100644
--- a/dir.h
+++ b/dir.h
@@ -43,7 +43,6 @@ struct repository;
  *
  */
 
-struct repository;
 
 struct dir_entry {
 	unsigned int len;

base-commit: ef8ce8f3d4344fd3af049c17eeba5cd20d98b69f
-- 
gitgitgadget
Junio C Hamano· Mar 11, 2025, 22:13 UTC · re: Abhijeetsingh Meena via GitGitGadget · lore

Re: [PATCH] dir.h: remove duplicate forward declaration of struct repository

"Abhijeetsingh Meena via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 11 quoted lines
> From: Abhijeetsingh Meena <abhijeet040403@gmail.com>
>
> The `struct repository;` forward declaration appears twice in `dir.h`:
> once at line 10 and again at line 46. This duplication is unnecessary
> and likely unintentional.
>
> Removing the second declaration has no impact on compilation, as verified
> by a clean build.
>
> Signed-off-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
> ---
Thanks.  Will apply.
Show 17 quoted lines
>  dir.h | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/dir.h b/dir.h
> index a3a2f00f5d9..e659c47ad77 100644
> --- a/dir.h
> +++ b/dir.h
> @@ -43,7 +43,6 @@ struct repository;
>   *
>   */
>  
> -struct repository;
>  
>  struct dir_entry {
>  	unsigned int len;
>
> base-commit: ef8ce8f3d4344fd3af049c17eeba5cd20d98b69f

← back to recent threads