Subject: Re: [PATCH 2/4] Docs: Correct cmd_psuh and Explain UNUSED macro

From: Emily Shaffer <[email-masked]>
Date: Fri, 16 May 2025 11:08:55 -0700

On Wed, Apr 16, 2025 at 11:44:48AM +0530, K Jayatheerth wrote:
> 
> The `cmd_psuh` function signature in the documentation,
> was missing the `struct repository *repo` argument,
> which is standard for built-in commands.
> This commit corrects the signature to include the `repo` argument.
> 
> Additionally, this commit adds an explanation,
> for using the `UNUSED` macro to prevent compiler warnings.
> 
> This helps new contributors understand,
> common practices in the Git codebase.

For this commit and others, take another look at the commit message
guidelines in
https://git-scm.com/docs/SubmittingPatches#describe-changes - this
commit message recaps "what" you are doing in the diff, which isn't
necessary because the diff is very simple to look at :) but it only
briefly explains "why". You did a good job explaining why in your cover
letter, IMO - but your cover letter doesn't live in the code base
forever. Your commit message does :)

> 
> Signed-off-by: K Jayatheerth <[email-masked]>
> ---
>  Documentation/MyFirstContribution.adoc | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc
> index ef190d8748..b463d42f63 100644
> --- a/Documentation/MyFirstContribution.adoc
> +++ b/Documentation/MyFirstContribution.adoc
> @@ -142,7 +142,15 @@ command in `builtin/psuh.c`. Create that file, and within it, write the entry
>  point for your command in a function matching the style and signature:
>  
>  ----
> -int cmd_psuh(int argc, const char **argv, const char *prefix)
> +int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)
> +----
> +
> +We also use the UNUSED macro to make sure we don't recieve compiler warnings
> +for unused arguments from the function cmd_psuh.

I think it's a good idea to mention that this is temporary - since you
are removing UNUSED in the very next step.

> +
> +----
> +int cmd_psuh(int argc UNUSED, const char **argv UNUSED, 
> +			const char *prefix UNUSED, struct repository *repo UNUSED)
>  ----
>  
>  We'll also need to add the declaration of psuh; open up `builtin.h`, find the
> -- 
> 2.49.GIT
> 
>