The documentation previously omitted the UNUSED macro, which often led to confusion for new contributors when they encountered compiler warnings related to unused parameters. This commit adds a brief explanation to help clarify its purpose and common usage in the Git codebase. Additionally, the function signature for cmd_psuh has been updated to include the struct repository *repo argument, align it with standard practices. Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@xxxxxxxxx> --- Documentation/MyFirstContribution.adoc | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc index ef190d8748..f4320d8869 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 will use the UNUSED macro to make sure we don't recieve compiler warnings +for unused arguments from the function cmd_psuh. + +---- +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 @@ -150,7 +158,7 @@ declaration for `cmd_pull`, and add a new line for `psuh` immediately before it, in order to keep the declarations alphabetically sorted: ---- -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); ---- Be sure to `#include "builtin.h"` in your `psuh.c`. You'll also need to @@ -166,7 +174,8 @@ Throughout the tutorial, we will mark strings for translation as necessary; you should also do so when writing your user-facing commands in the future. ---- -int cmd_psuh(int argc, const char **argv, const char *prefix) +int cmd_psuh(int argc UNUSED, const char **argv UNUSED, + const char *prefix UNUSED, struct repository *repo UNUSED) { printf(_("Pony saying hello goes here.\n")); return 0; @@ -279,8 +288,9 @@ on the reference implementation linked at the top of this document. It's probably useful to do at least something besides printing out a string. Let's start by having a look at everything we get. -Modify your `cmd_psuh` implementation to dump the args you're passed, keeping -existing `printf()` calls in place: +Modify your `cmd_psuh` implementation to dump the args you're passed, +keeping existing `printf()` calls in place; because the args are now +used, remove the `UNUSED` macro from them: ---- int i; -- 2.49.GIT