{"thread":{"id":"63140","subject":"[GSOC][PATCH 1/3] Remove outdated mentoring mailing list reference and clarify tutorial prerequisites","startedAt":"2025-03-15T18:15:10Z","lastAt":"2025-03-29T17:43:07Z","messageCount":21,"participants":["K Jayatheerth","JAYATHEERTH K","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"514358","messageId":"20250315181504.65069-1-jayatheerthkulkarni2005@gmail.com","threadId":"63140","inReplyTo":null,"subject":"[GSOC][PATCH 1/3] Remove outdated mentoring mailing list reference and clarify tutorial prerequisites","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-15T18:15:02Z","receivedAt":"2025-03-15T18:15:10Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n---\n Documentation/MyFirstContribution.adoc | 8 +-------\n 1 file changed, 1 insertion(+), 7 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\nindex afcf4b46c1..f7e510e6c1 100644\n--- a/Documentation/MyFirstContribution.adoc\n+++ b/Documentation/MyFirstContribution.adoc\n@@ -13,6 +13,7 @@ the Git tree, sending it for review, and making changes based on comments.\n \n This tutorial assumes you're already fairly familiar with using Git to manage\n source code.  The Git workflow steps will largely remain unexplained.\n+This tutorial also assumes you know/understand C programming language in a good capacity.\n \n [[related-reading]]\n === Related Reading\n@@ -40,13 +41,6 @@ the list by sending an email to <git+subscribe@vger.kernel.org>\n The https://lore.kernel.org/git[archive] of this mailing list is\n available to view in a browser.\n \n-==== https://groups.google.com/forum/#!forum/git-mentoring[git-mentoring@googlegroups.com]\n-\n-This mailing list is targeted to new contributors and was created as a place to\n-post questions and receive answers outside of the public eye of the main list.\n-Veteran contributors who are especially interested in helping mentor newcomers\n-are present on the list. In order to avoid search indexers, group membership is\n-required to view messages; anyone can join and no approval is required.\n \n ==== https://web.libera.chat/#git-devel[#git-devel] on Libera Chat\n \n-- \n2.48.1\n\n"},{"id":"514359","messageId":"20250315181504.65069-2-jayatheerthkulkarni2005@gmail.com","threadId":"63140","inReplyTo":"20250315181504.65069-1-jayatheerthkulkarni2005@gmail.com","subject":"[GSOC][PATCH 2/3] Update function signature and UNUSED to include struct repository and modify builtin.h accordingly","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-15T18:15:03Z","receivedAt":"2025-03-15T18:15:13Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n---\n Documentation/MyFirstContribution.adoc | 20 +++++++++++++++-----\n 1 file changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\nindex f7e510e6c1..34a0336898 100644\n--- a/Documentation/MyFirstContribution.adoc\n+++ b/Documentation/MyFirstContribution.adoc\n@@ -142,9 +142,13 @@ followed by the name of the subcommand, in a source file named after the\n subcommand and contained within `builtin/`. So it makes sense to implement your\n command in `builtin/psuh.c`. Create that file, and within it, write the entry\n point for your command in a function matching the style and signature:\n-\n ----\n-int cmd_psuh(int argc, const char **argv, const char *prefix)\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)\n+----\n+Before proceeding further, we should use the UNUSED macro to suppress warnings about unused parameters in the function.\n+This prevents the compiler from generating warnings when certain parameters are not used within the function body:\n+----\n+int cmd_psuh(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED, struct repository *repo UNUSED)\n ----\n \n We'll also need to add the declaration of psuh; open up `builtin.h`, find the\n@@ -152,7 +156,7 @@ declaration for `cmd_pull`, and add a new line for `psuh` immediately before it,\n in order to keep the declarations alphabetically sorted:\n \n ----\n-int cmd_psuh(int argc, const char **argv, const char *prefix);\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo);\n ----\n \n Be sure to `#include \"builtin.h\"` in your `psuh.c`. You'll also need to\n@@ -168,7 +172,7 @@ Throughout the tutorial, we will mark strings for translation as necessary; you\n should also do so when writing your user-facing commands in the future.\n \n ----\n-int cmd_psuh(int argc, const char **argv, const char *prefix)\n+int cmd_psuh(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED, struct repository *repo UNUSED)\n {\n \tprintf(_(\"Pony saying hello goes here.\\n\"));\n \treturn 0;\n@@ -199,6 +203,9 @@ with the command name, a function pointer to the command implementation, and a\n setup option flag. For now, let's keep mimicking `push`. Find the line where\n `cmd_push` is registered, copy it, and modify it for `cmd_psuh`, placing the new\n line in alphabetical order (immediately before `cmd_pull`).\n+----\n+{ \"psuh\", cmd_psuh, RUN_SETUP}\n+----\n \n The options are documented in `builtin.h` under \"Adding a new built-in.\" Since\n we hope to print some data about the user's current workspace context later,\n@@ -285,6 +292,8 @@ Modify your `cmd_psuh` implementation to dump the args you're passed, keeping\n existing `printf()` calls in place:\n \n ----\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED)\n+{\n \tint i;\n \n \t...\n@@ -298,7 +307,8 @@ existing `printf()` calls in place:\n \n \tprintf(_(\"Your current working directory:\\n<top-level>%s%s\\n\"),\n \t       prefix ? \"/\" : \"\", prefix ? prefix : \"\");\n-\n+\t...\n+}\n ----\n \n Build and try it. As you may expect, there's pretty much just whatever we give\n-- \n2.48.1\n\n"},{"id":"514360","messageId":"20250315181504.65069-3-jayatheerthkulkarni2005@gmail.com","threadId":"63140","inReplyTo":"20250315181504.65069-1-jayatheerthkulkarni2005@gmail.com","subject":"[GSOC][PATCH 3/3] Replace git_config(...) with repo_config(...) for modern Git compatibility","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-15T18:15:04Z","receivedAt":"2025-03-15T18:15:16Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n---\n Documentation/MyFirstContribution.adoc | 57 ++++++++++++++++++--------\n 1 file changed, 39 insertions(+), 18 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\nindex 34a0336898..8f52ebea0c 100644\n--- a/Documentation/MyFirstContribution.adoc\n+++ b/Documentation/MyFirstContribution.adoc\n@@ -316,26 +316,47 @@ on the command line, including the name of our command. (If `prefix` is empty\n for you, try `cd Documentation/ && ../bin-wrappers/git psuh`). That's not so\n helpful. So what other context can we get?\n \n-Add a line to `#include \"config.h\"`. Then, add the following bits to the\n+Add `#include \"config.h\"` and `#include \"repository.h\"`. Then, add the following bits to the\n function body:\n \n ----\n-\tconst char *cfg_name;\n+#include \"builtin.h\"\n+#include \"gettext.h\"\n+#include \"config.h\"\n+#include \"repository.h\"  // Required for repo_config_get_string_tmp()\n \n-...\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)\n+{\n+    const char *cfg_name;\n+\n+    printf(Q_(\"Your args (there is %d):\\n\",\n+              \"Your args (there are %d):\\n\",\n+              argc),\n+           argc);\n+\n+    for (int i = 0; i < argc; i++) {\n+        printf(\"%d: %s\\n\", i, argv[i]);\n+    }\n \n-\tgit_config(git_default_config, NULL);\n-\tif (git_config_get_string_tmp(\"user.name\", &cfg_name) > 0)\n-\t\tprintf(_(\"No name is found in config\\n\"));\n-\telse\n-\t\tprintf(_(\"Your name: %s\\n\"), cfg_name);\n+    printf(_(\"Your current working directory:\\n<top-level>%s%s\\n\"),\n+           prefix ? \"/\" : \"\", prefix ? prefix : \"\");\n+\n+    repo_config(repo, git_default_config, NULL);\n+\n+    if (repo_config_get_string_tmp(repo, \"user.name\", &cfg_name))\n+        printf(_(\"No name is found in config\\n\"));\n+    else\n+        printf(_(\"Your name: %s\\n\"), cfg_name);\n+\n+    return 0;\n+}\n ----\n \n-`git_config()` will grab the configuration from config files known to Git and\n-apply standard precedence rules. `git_config_get_string_tmp()` will look up\n+`repo_config()` will grab the configuration from config files known to Git and\n+apply standard precedence rules. `repo_config_get_string_tmp()` will look up\n a specific key (\"user.name\") and give you the value. There are a number of\n single-key lookup functions like this one; you can see them all (and more info\n-about how to use `git_config()`) in `Documentation/technical/api-config.adoc`.\n+about how to use `repo_config()` ) in `Documentation/git-config.adoc`.\n \n You should see that the name printed matches the one you see when you run:\n \n@@ -383,8 +404,8 @@ prepare it, and print its contents:\n \n ...\n \n-\twt_status_prepare(the_repository, &status);\n-\tgit_config(git_default_config, &status);\n+\twt_status_prepare(repo, &status);\n+\trepo_config(repo, git_default_config, &status);\n \n ...\n \n@@ -1093,11 +1114,11 @@ The one generated for `psuh` from the sample implementation looks like this:\n \n ----\n  Documentation/git-psuh.adoc | 40 +++++++++++++++++++++\n- Makefile                    |  1 +\n- builtin.h                   |  1 +\n- builtin/psuh.c              | 73 ++++++++++++++++++++++++++++++++++++++\n- git.c                       |  1 +\n- t/t9999-psuh-tutorial.sh    | 12 +++++++\n+ Makefile                   |  1 +\n+ builtin.h                  |  1 +\n+ builtin/psuh.c             | 73 ++++++++++++++++++++++++++++++++++++++\n+ git.c                      |  1 +\n+ t/t9999-psuh-tutorial.sh   | 12 +++++++\n  6 files changed, 128 insertions(+)\n  create mode 100644 Documentation/git-psuh.adoc\n  create mode 100644 builtin/psuh.c\n-- \n2.48.1\n\n"},{"id":"514361","messageId":"CA+rGoLemaWouUHnUWxjPwwRzr-x9mOdbYK8cUcjyZY_pj+vHGQ@mail.gmail.com","threadId":"63140","inReplyTo":"20250315181504.65069-3-jayatheerthkulkarni2005@gmail.com","subject":"Re: [GSOC][PATCH 3/3] Replace git_config(...) with repo_config(...) for modern Git compatibility","fromName":"JAYATHEERTH K","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-15T18:21:13Z","receivedAt":"2025-03-15T18:21:25Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"I've sent a pull request completing all the checks [1]\n\nThis has no conflict,\nas asked [2] I've divided these into three patches for ease of understanding\nand I'm expecting feedback.\n\n\n1.https://github.com/git/git/pull/1917\n2.https://public-inbox.org/git/CA+rGoLfrJ-+QVb5=zc=j84sM=MTz3nt8NMYgXVZdfYf70AuDZA@mail.gmail.com/T/#t\n\nThank you,\nJay\n"},{"id":"514439","messageId":"xmqqa59j8gml.fsf@gitster.g","threadId":"63140","inReplyTo":"20250315181504.65069-1-jayatheerthkulkarni2005@gmail.com","subject":"Re: [GSOC][PATCH 1/3] Remove outdated mentoring mailing list reference and clarify tutorial prerequisites","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-03-17T21:57:38Z","receivedAt":"2025-03-17T21:57:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:\n\n> Subject: Re: [GSOC][PATCH 1/3] Remove outdated mentoring mailing list reference and clarify tutorial prerequisites\n\nSubject: [PATCH] MyFirstContribution: the mentoring mailing list is no more\n\n> Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n> ---\n>  Documentation/MyFirstContribution.adoc | 8 +-------\n>  1 file changed, 1 insertion(+), 7 deletions(-)\n>\n> diff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\n> index afcf4b46c1..f7e510e6c1 100644\n> --- a/Documentation/MyFirstContribution.adoc\n> +++ b/Documentation/MyFirstContribution.adoc\n> @@ -13,6 +13,7 @@ the Git tree, sending it for review, and making changes based on comments.\n>  \n>  This tutorial assumes you're already fairly familiar with using Git to manage\n>  source code.  The Git workflow steps will largely remain unexplained.\n> +This tutorial also assumes you know/understand C programming language in a good capacity.\n\nThe lines near this line in the original are already so, but this\nnew line is way overly long.  Can you wrap it at around 70 chars (do\nnot line wrap the first line that is 78-columns wide)?\n\n> @@ -40,13 +41,6 @@ the list by sending an email to <git+subscribe@vger.kernel.org>\n>  The https://lore.kernel.org/git[archive] of this mailing list is\n>  available to view in a browser.\n>  \n> -==== https://groups.google.com/forum/#!forum/git-mentoring[git-mentoring@googlegroups.com]\n> -\n> -This mailing list is targeted to new contributors and was created as a place to\n> -post questions and receive answers outside of the public eye of the main list.\n> -Veteran contributors who are especially interested in helping mentor newcomers\n> -are present on the list. In order to avoid search indexers, group membership is\n> -required to view messages; anyone can join and no approval is required.\n\nNice.  Thanks.\n\n>  \n>  ==== https://web.libera.chat/#git-devel[#git-devel] on Libera Chat\n"},{"id":"514667","messageId":"20250319170244.32912-1-jayatheerthkulkarni2005@gmail.com","threadId":"63140","inReplyTo":"xmqqa59j8gml.fsf@gitster.g","subject":"[GSOC][PATCH v2] Remove outdated mentoring mailing list reference","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-19T17:02:44Z","receivedAt":"2025-03-19T17:03:10Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"and clarify tutorial prerequisites\n\nSigned-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n---\n Documentation/MyFirstContribution.adoc | 8 +-------\n 1 file changed, 1 insertion(+), 7 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\nindex afcf4b46c1..7b856be41e 100644\n--- a/Documentation/MyFirstContribution.adoc\n+++ b/Documentation/MyFirstContribution.adoc\n@@ -13,6 +13,7 @@ the Git tree, sending it for review, and making changes based on comments.\n \n This tutorial assumes you're already fairly familiar with using Git to manage\n source code.  The Git workflow steps will largely remain unexplained.\n+This tutorial also assumes you know/understand C programming.\n \n [[related-reading]]\n === Related Reading\n@@ -40,13 +41,6 @@ the list by sending an email to <git+subscribe@vger.kernel.org>\n The https://lore.kernel.org/git[archive] of this mailing list is\n available to view in a browser.\n \n-==== https://groups.google.com/forum/#!forum/git-mentoring[git-mentoring@googlegroups.com]\n-\n-This mailing list is targeted to new contributors and was created as a place to\n-post questions and receive answers outside of the public eye of the main list.\n-Veteran contributors who are especially interested in helping mentor newcomers\n-are present on the list. In order to avoid search indexers, group membership is\n-required to view messages; anyone can join and no approval is required.\n \n ==== https://web.libera.chat/#git-devel[#git-devel] on Libera Chat\n \n-- \n2.48.1\n\n"},{"id":"514830","messageId":"xmqqa59evffd.fsf@gitster.g","threadId":"63140","inReplyTo":"20250319170244.32912-1-jayatheerthkulkarni2005@gmail.com","subject":"Re: [GSOC][PATCH v2] Remove outdated mentoring mailing list reference","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-03-21T10:36:22Z","receivedAt":"2025-03-21T10:36:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:\n\n> Subject: Re: [GSOC][PATCH v2] Remove outdated mentoring mailing list reference\n\n[Documentation/SubmittingPatches]\n\n    The first line of the commit message should be a short description (50\n    characters is the soft limit, see DISCUSSION in linkgit:git-commit[1]),\n    and should skip the full stop.  It is also conventional in most cases to\n    prefix the first line with \"area: \" where the area is a filename or\n    identifier for the general area of the code being modified, e.g.\n\n    * doc: clarify distinction between sign-off and pgp-signing\n    * githooks.txt: improve the intro section\n\n    If in doubt which identifier to use, run `git log --no-merges` on the\n    files you are modifying to see the current conventions.\n\n> and clarify tutorial prerequisites\n\nDo not do this.  What you have on the e-mail \"Subject:\" line is the\nfirst paragraph (whose definition is block of text delineated by\nblank lines) of the commit log message, and the first paratraph in\nthe body of a patch e-mail is the second paragraph.  You do not\nstart your second paragraph at half-sentence, as if it were a\ncontinuation of an incomplete previous sentence.\n\n"},{"id":"514831","messageId":"20250321143022.5406-1-jayatheerthkulkarni2005@gmail.com","threadId":"63140","inReplyTo":"xmqqa59evffd.fsf@gitster.g","subject":"[[GSOC][PATCH v3] 1/3] docs: drop inactive mentoring list, add C prereq","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-21T14:30:20Z","receivedAt":"2025-03-21T14:30:33Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"The git-mentoring mailing list is no longer active, so remove its reference\nfrom the documentation. Additionally, clarify that this tutorial assumes\nfamiliarity with C programming.\n\nSigned-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n---\n Documentation/MyFirstContribution.adoc | 8 +-------\n 1 file changed, 1 insertion(+), 7 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\nindex afcf4b46c1..7b856be41e 100644\n--- a/Documentation/MyFirstContribution.adoc\n+++ b/Documentation/MyFirstContribution.adoc\n@@ -13,6 +13,7 @@ the Git tree, sending it for review, and making changes based on comments.\n \n This tutorial assumes you're already fairly familiar with using Git to manage\n source code.  The Git workflow steps will largely remain unexplained.\n+This tutorial also assumes you know/understand C programming.\n \n [[related-reading]]\n === Related Reading\n@@ -40,13 +41,6 @@ the list by sending an email to <git+subscribe@vger.kernel.org>\n The https://lore.kernel.org/git[archive] of this mailing list is\n available to view in a browser.\n \n-==== https://groups.google.com/forum/#!forum/git-mentoring[git-mentoring@googlegroups.com]\n-\n-This mailing list is targeted to new contributors and was created as a place to\n-post questions and receive answers outside of the public eye of the main list.\n-Veteran contributors who are especially interested in helping mentor newcomers\n-are present on the list. In order to avoid search indexers, group membership is\n-required to view messages; anyone can join and no approval is required.\n \n ==== https://web.libera.chat/#git-devel[#git-devel] on Libera Chat\n \n-- \n2.48.1\n\n"},{"id":"514832","messageId":"20250321143022.5406-2-jayatheerthkulkarni2005@gmail.com","threadId":"63140","inReplyTo":"20250321143022.5406-1-jayatheerthkulkarni2005@gmail.com","subject":"[[GSOC][PATCH v3] 2/3] docs: update function signature, add UNUSED macro","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-21T14:30:21Z","receivedAt":"2025-03-21T14:30:40Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"Modify function signatures to include struct repository\nfor better compatibility. Also update builtin.h\naccordingly and use UNUSED to prevent warnings.\n\nSigned-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n---\n Documentation/MyFirstContribution.adoc | 20 +++++++++++++++-----\n 1 file changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\nindex 7b856be41e..45efe117ab 100644\n--- a/Documentation/MyFirstContribution.adoc\n+++ b/Documentation/MyFirstContribution.adoc\n@@ -142,9 +142,13 @@ followed by the name of the subcommand, in a source file named after the\n subcommand and contained within `builtin/`. So it makes sense to implement your\n command in `builtin/psuh.c`. Create that file, and within it, write the entry\n point for your command in a function matching the style and signature:\n-\n ----\n-int cmd_psuh(int argc, const char **argv, const char *prefix)\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)\n+----\n+Before proceeding further, we should use the UNUSED macro to suppress warnings about unused parameters in the function.\n+This prevents the compiler from generating warnings when certain parameters are not used within the function body:\n+----\n+int cmd_psuh(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED, struct repository *repo UNUSED)\n ----\n \n We'll also need to add the declaration of psuh; open up `builtin.h`, find the\n@@ -152,7 +156,7 @@ declaration for `cmd_pull`, and add a new line for `psuh` immediately before it,\n in order to keep the declarations alphabetically sorted:\n \n ----\n-int cmd_psuh(int argc, const char **argv, const char *prefix);\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo);\n ----\n \n Be sure to `#include \"builtin.h\"` in your `psuh.c`. You'll also need to\n@@ -168,7 +172,7 @@ Throughout the tutorial, we will mark strings for translation as necessary; you\n should also do so when writing your user-facing commands in the future.\n \n ----\n-int cmd_psuh(int argc, const char **argv, const char *prefix)\n+int cmd_psuh(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED, struct repository *repo UNUSED)\n {\n \tprintf(_(\"Pony saying hello goes here.\\n\"));\n \treturn 0;\n@@ -199,6 +203,9 @@ with the command name, a function pointer to the command implementation, and a\n setup option flag. For now, let's keep mimicking `push`. Find the line where\n `cmd_push` is registered, copy it, and modify it for `cmd_psuh`, placing the new\n line in alphabetical order (immediately before `cmd_pull`).\n+----\n+{ \"psuh\", cmd_psuh, RUN_SETUP}\n+----\n \n The options are documented in `builtin.h` under \"Adding a new built-in.\" Since\n we hope to print some data about the user's current workspace context later,\n@@ -285,6 +292,8 @@ Modify your `cmd_psuh` implementation to dump the args you're passed, keeping\n existing `printf()` calls in place:\n \n ----\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED)\n+{\n \tint i;\n \n \t...\n@@ -298,7 +307,8 @@ existing `printf()` calls in place:\n \n \tprintf(_(\"Your current working directory:\\n<top-level>%s%s\\n\"),\n \t       prefix ? \"/\" : \"\", prefix ? prefix : \"\");\n-\n+\t...\n+}\n ----\n \n Build and try it. As you may expect, there's pretty much just whatever we give\n-- \n2.48.1\n\n"},{"id":"514833","messageId":"20250321143022.5406-3-jayatheerthkulkarni2005@gmail.com","threadId":"63140","inReplyTo":"20250321143022.5406-1-jayatheerthkulkarni2005@gmail.com","subject":"[[GSOC][PATCH v3] 3/3] docs: replace git_config with repo_config","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-21T14:30:22Z","receivedAt":"2025-03-21T14:30:43Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"Refactor config handling by replacing git_config(...)\nwith repo_config(...) for better repository context\nawareness and alignment with modern Git practices.\n\nSigned-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n---\n Documentation/MyFirstContribution.adoc | 57 ++++++++++++++++++--------\n 1 file changed, 39 insertions(+), 18 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\nindex 45efe117ab..3ae85016d4 100644\n--- a/Documentation/MyFirstContribution.adoc\n+++ b/Documentation/MyFirstContribution.adoc\n@@ -316,26 +316,47 @@ on the command line, including the name of our command. (If `prefix` is empty\n for you, try `cd Documentation/ && ../bin-wrappers/git psuh`). That's not so\n helpful. So what other context can we get?\n \n-Add a line to `#include \"config.h\"`. Then, add the following bits to the\n+Add `#include \"config.h\"` and `#include \"repository.h\"`. Then, add the following bits to the\n function body:\n \n ----\n-\tconst char *cfg_name;\n+#include \"builtin.h\"\n+#include \"gettext.h\"\n+#include \"config.h\"\n+#include \"repository.h\"  // Required for repo_config_get_string_tmp()\n \n-...\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)\n+{\n+    const char *cfg_name;\n+\n+    printf(Q_(\"Your args (there is %d):\\n\",\n+              \"Your args (there are %d):\\n\",\n+              argc),\n+           argc);\n+\n+    for (int i = 0; i < argc; i++) {\n+        printf(\"%d: %s\\n\", i, argv[i]);\n+    }\n \n-\tgit_config(git_default_config, NULL);\n-\tif (git_config_get_string_tmp(\"user.name\", &cfg_name) > 0)\n-\t\tprintf(_(\"No name is found in config\\n\"));\n-\telse\n-\t\tprintf(_(\"Your name: %s\\n\"), cfg_name);\n+    printf(_(\"Your current working directory:\\n<top-level>%s%s\\n\"),\n+           prefix ? \"/\" : \"\", prefix ? prefix : \"\");\n+\n+    repo_config(repo, git_default_config, NULL);\n+\n+    if (repo_config_get_string_tmp(repo, \"user.name\", &cfg_name))\n+        printf(_(\"No name is found in config\\n\"));\n+    else\n+        printf(_(\"Your name: %s\\n\"), cfg_name);\n+\n+    return 0;\n+}\n ----\n \n-`git_config()` will grab the configuration from config files known to Git and\n-apply standard precedence rules. `git_config_get_string_tmp()` will look up\n+`repo_config()` will grab the configuration from config files known to Git and\n+apply standard precedence rules. `repo_config_get_string_tmp()` will look up\n a specific key (\"user.name\") and give you the value. There are a number of\n single-key lookup functions like this one; you can see them all (and more info\n-about how to use `git_config()`) in `Documentation/technical/api-config.adoc`.\n+about how to use `repo_config()` ) in `Documentation/git-config.adoc`.\n \n You should see that the name printed matches the one you see when you run:\n \n@@ -383,8 +404,8 @@ prepare it, and print its contents:\n \n ...\n \n-\twt_status_prepare(the_repository, &status);\n-\tgit_config(git_default_config, &status);\n+\twt_status_prepare(repo, &status);\n+\trepo_config(repo, git_default_config, &status);\n \n ...\n \n@@ -1093,11 +1114,11 @@ The one generated for `psuh` from the sample implementation looks like this:\n \n ----\n  Documentation/git-psuh.adoc | 40 +++++++++++++++++++++\n- Makefile                    |  1 +\n- builtin.h                   |  1 +\n- builtin/psuh.c              | 73 ++++++++++++++++++++++++++++++++++++++\n- git.c                       |  1 +\n- t/t9999-psuh-tutorial.sh    | 12 +++++++\n+ Makefile                   |  1 +\n+ builtin.h                  |  1 +\n+ builtin/psuh.c             | 73 ++++++++++++++++++++++++++++++++++++++\n+ git.c                      |  1 +\n+ t/t9999-psuh-tutorial.sh   | 12 +++++++\n  6 files changed, 128 insertions(+)\n  create mode 100644 Documentation/git-psuh.adoc\n  create mode 100644 builtin/psuh.c\n-- \n2.48.1\n\n"},{"id":"514834","messageId":"CA+rGoLeYJEbpC6=mUPuOr=i6pE9w20OeJSOzG0SQPVpBWDbTgQ@mail.gmail.com","threadId":"63140","inReplyTo":"xmqqa59evffd.fsf@gitster.g","subject":"Re: [GSOC][PATCH v2] Remove outdated mentoring mailing list reference","fromName":"JAYATHEERTH K","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-21T14:32:50Z","receivedAt":"2025-03-21T14:33:03Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"On Fri, Mar 21, 2025 at 4:06 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:\n>\n> > Subject: Re: [GSOC][PATCH v2] Remove outdated mentoring mailing list reference\n>\n> [Documentation/SubmittingPatches]\n>\n>     The first line of the commit message should be a short description (50\n>     characters is the soft limit, see DISCUSSION in linkgit:git-commit[1]),\n>     and should skip the full stop.  It is also conventional in most cases to\n>     prefix the first line with \"area: \" where the area is a filename or\n>     identifier for the general area of the code being modified, e.g.\n>\n\nWent through the discussion\n\n>     * doc: clarify distinction between sign-off and pgp-signing\n>     * githooks.txt: improve the intro section\n>\n>     If in doubt which identifier to use, run `git log --no-merges` on the\n>     files you are modifying to see the current conventions.\n>\n> > and clarify tutorial prerequisites\n>\n> Do not do this.  What you have on the e-mail \"Subject:\" line is the\n> first paragraph (whose definition is block of text delineated by\n> blank lines) of the commit log message, and the first paratraph in\n> the body of a patch e-mail is the second paragraph.  You do not\n> start your second paragraph at half-sentence, as if it were a\n> continuation of an incomplete previous sentence.\n>\nThank you for the feedback, I will make sure not to repeat them in the\nfurther patches\n\n-Jay\n"},{"id":"514887","messageId":"xmqqiknzqu2h.fsf@gitster.g","threadId":"63140","inReplyTo":"20250321143022.5406-3-jayatheerthkulkarni2005@gmail.com","subject":"Re: [[GSOC][PATCH v3] 3/3] docs: replace git_config with repo_config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-03-23T22:08:06Z","receivedAt":"2025-03-23T22:08:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:\n\n> Refactor config handling by replacing git_config(...)\n> with repo_config(...) for better repository context\n> awareness and alignment with modern Git practices.\n>\n> Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n> ---\n>  Documentation/MyFirstContribution.adoc | 57 ++++++++++++++++++--------\n>  1 file changed, 39 insertions(+), 18 deletions(-)\n>\n> diff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\n> index 45efe117ab..3ae85016d4 100644\n> --- a/Documentation/MyFirstContribution.adoc\n> +++ b/Documentation/MyFirstContribution.adoc\n> @@ -316,26 +316,47 @@ on the command line, including the name of our command. (If `prefix` is empty\n>  for you, try `cd Documentation/ && ../bin-wrappers/git psuh`). That's not so\n>  helpful. So what other context can we get?\n>  \n> -Add a line to `#include \"config.h\"`. Then, add the following bits to the\n> +Add `#include \"config.h\"` and `#include \"repository.h\"`. Then, add the following bits to the\n>  function body:\n>  \n>  ----\n> -\tconst char *cfg_name;\n> +#include \"builtin.h\"\n> +#include \"gettext.h\"\n> +#include \"config.h\"\n> +#include \"repository.h\"  // Required for repo_config_get_string_tmp()\n\nI do not think we updated Coding Guidelines to allow // comments.\n\n"},{"id":"514888","messageId":"xmqqcye7qu2f.fsf@gitster.g","threadId":"63140","inReplyTo":"20250321143022.5406-2-jayatheerthkulkarni2005@gmail.com","subject":"Re: [[GSOC][PATCH v3] 2/3] docs: update function signature, add UNUSED macro","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-03-23T22:08:08Z","receivedAt":"2025-03-23T22:08:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:\n\n> Modify function signatures to include struct repository\n> for better compatibility. Also update builtin.h\n> accordingly and use UNUSED to prevent warnings.\n\nYou want to be a bit stronger than \"better compatibility\" here\n(besides, it is unclear what you are trying to be compatible).\n\n\n    Since 9b1cb507 (builtin: add a repository parameter for builtin\n    functions, 2024-09-13), a built-in implementation like cmd_psuh\n    is called with a pointer to a \"struct repository\"; adjust the\n    examples to match the current practice.\n\nor something, perhaps?\n\n> Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n> ---\n>  Documentation/MyFirstContribution.adoc | 20 +++++++++++++++-----\n>  1 file changed, 15 insertions(+), 5 deletions(-)\n>\n> diff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\n> index 7b856be41e..45efe117ab 100644\n> --- a/Documentation/MyFirstContribution.adoc\n> +++ b/Documentation/MyFirstContribution.adoc\n> @@ -142,9 +142,13 @@ followed by the name of the subcommand, in a source file named after the\n>  subcommand and contained within `builtin/`. So it makes sense to implement your\n>  command in `builtin/psuh.c`. Create that file, and within it, write the entry\n>  point for your command in a function matching the style and signature:\n> -\n>  ----\n> -int cmd_psuh(int argc, const char **argv, const char *prefix)\n> +int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)\n> +----\n> +Before proceeding further, we should use the UNUSED macro to suppress warnings about unused parameters in the function.\n> +This prevents the compiler from generating warnings when certain parameters are not used within the function body:\n> +----\n> +int cmd_psuh(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED, struct repository *repo UNUSED)\n>  ----\n>  \n>  We'll also need to add the declaration of psuh; open up `builtin.h`, find the\n> @@ -152,7 +156,7 @@ declaration for `cmd_pull`, and add a new line for `psuh` immediately before it,\n>  in order to keep the declarations alphabetically sorted:\n>  \n>  ----\n> -int cmd_psuh(int argc, const char **argv, const char *prefix);\n> +int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo);\n>  ----\n>  \n>  Be sure to `#include \"builtin.h\"` in your `psuh.c`. You'll also need to\n> @@ -168,7 +172,7 @@ Throughout the tutorial, we will mark strings for translation as necessary; you\n>  should also do so when writing your user-facing commands in the future.\n>  \n>  ----\n> -int cmd_psuh(int argc, const char **argv, const char *prefix)\n> +int cmd_psuh(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED, struct repository *repo UNUSED)\n>  {\n>  \tprintf(_(\"Pony saying hello goes here.\\n\"));\n>  \treturn 0;\n> @@ -199,6 +203,9 @@ with the command name, a function pointer to the command implementation, and a\n>  setup option flag. For now, let's keep mimicking `push`. Find the line where\n>  `cmd_push` is registered, copy it, and modify it for `cmd_psuh`, placing the new\n>  line in alphabetical order (immediately before `cmd_pull`).\n> +----\n> +{ \"psuh\", cmd_psuh, RUN_SETUP}\n> +----\n>  \n>  The options are documented in `builtin.h` under \"Adding a new built-in.\" Since\n>  we hope to print some data about the user's current workspace context later,\n> @@ -285,6 +292,8 @@ Modify your `cmd_psuh` implementation to dump the args you're passed, keeping\n>  existing `printf()` calls in place:\n>  \n>  ----\n> +int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED)\n> +{\n>  \tint i;\n>  \n>  \t...\n> @@ -298,7 +307,8 @@ existing `printf()` calls in place:\n>  \n>  \tprintf(_(\"Your current working directory:\\n<top-level>%s%s\\n\"),\n>  \t       prefix ? \"/\" : \"\", prefix ? prefix : \"\");\n> -\n> +\t...\n> +}\n>  ----\n>  \n>  Build and try it. As you may expect, there's pretty much just whatever we give\n"},{"id":"514892","messageId":"CA+rGoLfALoTvQuAzQPx7rqd-Zy+wMiyEbF5Y8_-2Yi-yE-2qpA@mail.gmail.com","threadId":"63140","inReplyTo":"xmqqiknzqu2h.fsf@gitster.g","subject":"Re: [[GSOC][PATCH v3] 3/3] docs: replace git_config with repo_config","fromName":"JAYATHEERTH K","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-24T01:42:09Z","receivedAt":"2025-03-24T01:42:21Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"On Mon, Mar 24, 2025 at 3:38 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:\n>\n> > Refactor config handling by replacing git_config(...)\n> > with repo_config(...) for better repository context\n> > awareness and alignment with modern Git practices.\n> >\n> > Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n> > ---\n> >  Documentation/MyFirstContribution.adoc | 57 ++++++++++++++++++--------\n> >  1 file changed, 39 insertions(+), 18 deletions(-)\n> >\n> > diff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\n> > index 45efe117ab..3ae85016d4 100644\n> > --- a/Documentation/MyFirstContribution.adoc\n> > +++ b/Documentation/MyFirstContribution.adoc\n> > @@ -316,26 +316,47 @@ on the command line, including the name of our command. (If `prefix` is empty\n> >  for you, try `cd Documentation/ && ../bin-wrappers/git psuh`). That's not so\n> >  helpful. So what other context can we get?\n> >\n> > -Add a line to `#include \"config.h\"`. Then, add the following bits to the\n> > +Add `#include \"config.h\"` and `#include \"repository.h\"`. Then, add the following bits to the\n> >  function body:\n> >\n> >  ----\n> > -     const char *cfg_name;\n> > +#include \"builtin.h\"\n> > +#include \"gettext.h\"\n> > +#include \"config.h\"\n> > +#include \"repository.h\"  // Required for repo_config_get_string_tmp()\n>\n> I do not think we updated Coding Guidelines to allow // comments.\n>\nSince this was a tutorial I thought this was helpful, anyways I will\nremove the comments, because I get that this would be bad practice for\nnewbies.\n"},{"id":"514898","messageId":"xmqq34f3qbna.fsf@gitster.g","threadId":"63140","inReplyTo":"CA+rGoLfALoTvQuAzQPx7rqd-Zy+wMiyEbF5Y8_-2Yi-yE-2qpA@mail.gmail.com","subject":"Re: [[GSOC][PATCH v3] 3/3] docs: replace git_config with repo_config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-03-24T04:46:01Z","receivedAt":"2025-03-24T04:46:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com> writes:\n\n>> > +#include \"builtin.h\"\n>> > +#include \"gettext.h\"\n>> > +#include \"config.h\"\n>> > +#include \"repository.h\"  // Required for repo_config_get_string_tmp()\n>>\n>> I do not think we updated Coding Guidelines to allow // comments.\n>>\n> Since this was a tutorial I thought this was helpful, anyways I will\n> remove the comments, because I get that this would be bad practice for\n> newbies.\n\nI meant that I think our guidelines frowns upon\n\n\t#include \"foo.h\" // for bar()\n\nI didn't mean a comment is necessarily bad.  IOW,\n\n\t#include \"foo.h\" /* for bar() */\n\nmay be OK.\n\nBut real programs will evolve and API elements that are used from a\nheader file will change over time, so it may not be a good idea to\nsingle out a function like that in the comment.  It would be much\nbetter to explain _why_ each change is made in the text that\nprecedes the sample code.  E.g.\n\n    Add `#include \"config.h\"` because you want to use X and Y,\n    and `#include \"repository.h\"` because you want to use Z.\n\n    Then, add the following bits to the function body:\n\n     ----\n    #include \"builtin.h\"\n    #include \"gettext.h\"\n    #include \"config.h\"\n    #include \"repository.h\"\n    ...\n    int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)\n    {\n        const char *cfg_name;\n\n        printf(Q_(\"Your args (there is %d):\\n\",\n\n\n\n"},{"id":"514923","messageId":"20250324130343.113629-1-jayatheerthkulkarni2005@gmail.com","threadId":"63140","inReplyTo":"xmqq34f3qbna.fsf@gitster.g","subject":"[[GSOC][PATCH v4] 2/3] docs: update function signature, add UNUSED macro","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-24T13:03:42Z","receivedAt":"2025-03-24T13:03:58Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"Since 9b1cb507 (builtin: add a repository parameter\nfor builtin functions,  2024-09-13), built-in\ncommands now receive a `struct repository *` argument\nfor improved repository context handling.\nUpdate example function signatures in the documentation\nto align with this current convention.\n\nAlso, update `builtin.h` accordingly\nand use the `UNUSED` macro to suppress\nwarnings for unused parameters in example code.\n\nSigned-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n---\n Documentation/MyFirstContribution.adoc | 20 +++++++++++++++-----\n 1 file changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\nindex 7b856be41e..45efe117ab 100644\n--- a/Documentation/MyFirstContribution.adoc\n+++ b/Documentation/MyFirstContribution.adoc\n@@ -142,9 +142,13 @@ followed by the name of the subcommand, in a source file named after the\n subcommand and contained within `builtin/`. So it makes sense to implement your\n command in `builtin/psuh.c`. Create that file, and within it, write the entry\n point for your command in a function matching the style and signature:\n-\n ----\n-int cmd_psuh(int argc, const char **argv, const char *prefix)\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)\n+----\n+Before proceeding further, we should use the UNUSED macro to suppress warnings about unused parameters in the function.\n+This prevents the compiler from generating warnings when certain parameters are not used within the function body:\n+----\n+int cmd_psuh(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED, struct repository *repo UNUSED)\n ----\n \n We'll also need to add the declaration of psuh; open up `builtin.h`, find the\n@@ -152,7 +156,7 @@ declaration for `cmd_pull`, and add a new line for `psuh` immediately before it,\n in order to keep the declarations alphabetically sorted:\n \n ----\n-int cmd_psuh(int argc, const char **argv, const char *prefix);\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo);\n ----\n \n Be sure to `#include \"builtin.h\"` in your `psuh.c`. You'll also need to\n@@ -168,7 +172,7 @@ Throughout the tutorial, we will mark strings for translation as necessary; you\n should also do so when writing your user-facing commands in the future.\n \n ----\n-int cmd_psuh(int argc, const char **argv, const char *prefix)\n+int cmd_psuh(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED, struct repository *repo UNUSED)\n {\n \tprintf(_(\"Pony saying hello goes here.\\n\"));\n \treturn 0;\n@@ -199,6 +203,9 @@ with the command name, a function pointer to the command implementation, and a\n setup option flag. For now, let's keep mimicking `push`. Find the line where\n `cmd_push` is registered, copy it, and modify it for `cmd_psuh`, placing the new\n line in alphabetical order (immediately before `cmd_pull`).\n+----\n+{ \"psuh\", cmd_psuh, RUN_SETUP}\n+----\n \n The options are documented in `builtin.h` under \"Adding a new built-in.\" Since\n we hope to print some data about the user's current workspace context later,\n@@ -285,6 +292,8 @@ Modify your `cmd_psuh` implementation to dump the args you're passed, keeping\n existing `printf()` calls in place:\n \n ----\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED)\n+{\n \tint i;\n \n \t...\n@@ -298,7 +307,8 @@ existing `printf()` calls in place:\n \n \tprintf(_(\"Your current working directory:\\n<top-level>%s%s\\n\"),\n \t       prefix ? \"/\" : \"\", prefix ? prefix : \"\");\n-\n+\t...\n+}\n ----\n \n Build and try it. As you may expect, there's pretty much just whatever we give\n-- \n2.48.1\n\n"},{"id":"514924","messageId":"20250324130343.113629-2-jayatheerthkulkarni2005@gmail.com","threadId":"63140","inReplyTo":"20250324130343.113629-1-jayatheerthkulkarni2005@gmail.com","subject":"[[GSOC][PATCH v4] 3/3] docs: replace git_config with repo_config","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-24T13:03:43Z","receivedAt":"2025-03-24T13:04:02Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"Refactor config handling by replacing git_config(...)\nwith repo_config(...) for better repository context\nawareness and alignment with modern Git practices.\n\nSigned-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>\n---\n Documentation/MyFirstContribution.adoc | 57 ++++++++++++++++++--------\n 1 file changed, 39 insertions(+), 18 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc\nindex 45efe117ab..04c19ac0b2 100644\n--- a/Documentation/MyFirstContribution.adoc\n+++ b/Documentation/MyFirstContribution.adoc\n@@ -316,26 +316,47 @@ on the command line, including the name of our command. (If `prefix` is empty\n for you, try `cd Documentation/ && ../bin-wrappers/git psuh`). That's not so\n helpful. So what other context can we get?\n \n-Add a line to `#include \"config.h\"`. Then, add the following bits to the\n+Add `#include \"config.h\"` and `#include \"repository.h\"`. Then, add the following bits to the\n function body:\n \n ----\n-\tconst char *cfg_name;\n+#include \"builtin.h\"\n+#include \"gettext.h\"\n+#include \"config.h\"\n+#include \"repository.h\"  \n \n-...\n+int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)\n+{\n+    const char *cfg_name;\n+\n+    printf(Q_(\"Your args (there is %d):\\n\",\n+              \"Your args (there are %d):\\n\",\n+              argc),\n+           argc);\n+\n+    for (int i = 0; i < argc; i++) {\n+        printf(\"%d: %s\\n\", i, argv[i]);\n+    }\n \n-\tgit_config(git_default_config, NULL);\n-\tif (git_config_get_string_tmp(\"user.name\", &cfg_name) > 0)\n-\t\tprintf(_(\"No name is found in config\\n\"));\n-\telse\n-\t\tprintf(_(\"Your name: %s\\n\"), cfg_name);\n+    printf(_(\"Your current working directory:\\n<top-level>%s%s\\n\"),\n+           prefix ? \"/\" : \"\", prefix ? prefix : \"\");\n+\n+    repo_config(repo, git_default_config, NULL);\n+\n+    if (repo_config_get_string_tmp(repo, \"user.name\", &cfg_name))\n+        printf(_(\"No name is found in config\\n\"));\n+    else\n+        printf(_(\"Your name: %s\\n\"), cfg_name);\n+\n+    return 0;\n+}\n ----\n \n-`git_config()` will grab the configuration from config files known to Git and\n-apply standard precedence rules. `git_config_get_string_tmp()` will look up\n+`repo_config()` will grab the configuration from config files known to Git and\n+apply standard precedence rules. `repo_config_get_string_tmp()` will look up\n a specific key (\"user.name\") and give you the value. There are a number of\n single-key lookup functions like this one; you can see them all (and more info\n-about how to use `git_config()`) in `Documentation/technical/api-config.adoc`.\n+about how to use `repo_config()` ) in `Documentation/git-config.adoc`.\n \n You should see that the name printed matches the one you see when you run:\n \n@@ -383,8 +404,8 @@ prepare it, and print its contents:\n \n ...\n \n-\twt_status_prepare(the_repository, &status);\n-\tgit_config(git_default_config, &status);\n+\twt_status_prepare(repo, &status);\n+\trepo_config(repo, git_default_config, &status);\n \n ...\n \n@@ -1093,11 +1114,11 @@ The one generated for `psuh` from the sample implementation looks like this:\n \n ----\n  Documentation/git-psuh.adoc | 40 +++++++++++++++++++++\n- Makefile                    |  1 +\n- builtin.h                   |  1 +\n- builtin/psuh.c              | 73 ++++++++++++++++++++++++++++++++++++++\n- git.c                       |  1 +\n- t/t9999-psuh-tutorial.sh    | 12 +++++++\n+ Makefile                   |  1 +\n+ builtin.h                  |  1 +\n+ builtin/psuh.c             | 73 ++++++++++++++++++++++++++++++++++++++\n+ git.c                      |  1 +\n+ t/t9999-psuh-tutorial.sh   | 12 +++++++\n  6 files changed, 128 insertions(+)\n  create mode 100644 Documentation/git-psuh.adoc\n  create mode 100644 builtin/psuh.c\n-- \n2.48.1\n\n"},{"id":"514927","messageId":"CA+rGoLf7R5BmpN1E+AXYhEKz=Th2TcpfDr0NxNma54GR_X_K-Q@mail.gmail.com","threadId":"63140","inReplyTo":"xmqq34f3qbna.fsf@gitster.g","subject":"Re: [[GSOC][PATCH v3] 3/3] docs: replace git_config with repo_config","fromName":"JAYATHEERTH K","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-24T13:10:12Z","receivedAt":"2025-03-24T13:10:24Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"On Mon, Mar 24, 2025 at 10:16 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com> writes:\n>\n> >> > +#include \"builtin.h\"\n> >> > +#include \"gettext.h\"\n> >> > +#include \"config.h\"\n> >> > +#include \"repository.h\"  // Required for repo_config_get_string_tmp()\n> >>\n> >> I do not think we updated Coding Guidelines to allow // comments.\n> >>\n> > Since this was a tutorial I thought this was helpful, anyways I will\n> > remove the comments, because I get that this would be bad practice for\n> > newbies.\n>\n> I meant that I think our guidelines frowns upon\n>\n>         #include \"foo.h\" // for bar()\n>\n> I didn't mean a comment is necessarily bad.  IOW,\n>\n>         #include \"foo.h\" /* for bar() */\n>\n> may be OK.\n>\n> But real programs will evolve and API elements that are used from a\n> header file will change over time, so it may not be a good idea to\n> single out a function like that in the comment.  It would be much\n> better to explain _why_ each change is made in the text that\n> precedes the sample code.  E.g.\n>\n>     Add `#include \"config.h\"` because you want to use X and Y,\n>     and `#include \"repository.h\"` because you want to use Z.\n>\n>     Then, add the following bits to the function body:\n>\n>      ----\n>     #include \"builtin.h\"\n>     #include \"gettext.h\"\n>     #include \"config.h\"\n>     #include \"repository.h\"\n>     ...\n>     int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)\n>     {\n>         const char *cfg_name;\n>\n>         printf(Q_(\"Your args (there is %d):\\n\",\n>\n>\n>\n\nIn the latest patch version I've removed the comments, since we\nalready added a line above saying the user has to include\n`repository.h` I don't think we need to go in depth into that, do let\nme know if that is not the case, looking forward to any more feedback.\n"},{"id":"515067","messageId":"xmqqiknwldob.fsf@gitster.g","threadId":"63140","inReplyTo":"CA+rGoLf7R5BmpN1E+AXYhEKz=Th2TcpfDr0NxNma54GR_X_K-Q@mail.gmail.com","subject":"Re: [[GSOC][PATCH v3] 3/3] docs: replace git_config with repo_config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-03-26T02:37:56Z","receivedAt":"2025-03-26T02:37:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com> writes:\n\n>> ... better to explain _why_ each change is made in the text that\n>> precedes the sample code.  E.g.\n>>\n>>     Add `#include \"config.h\"` because you want to use X and Y,\n>>     and `#include \"repository.h\"` because you want to use Z.\n>>\n>> ...\n> In the latest patch version I've removed the comments, since we\n> already added a line above saying the user has to include\n> `repository.h` I don't think we need to go in depth into that, do let\n> me know if that is not the case, looking forward to any more feedback.\n\nIt's your patch, after all.\n\nBut if the reason why you added the comment was \"this is a tutorial\"\nas you said, I would imagine that it would help readers to say why\na particular header is needed, when the tutorial text tells them\nthat they need to add it.  From a quick look at the patch, it seems\nthat the updated text says what the change did (i.e. add a header),\nwhich is rather obvious in the sample code, without saying why the\naddition is necessary?\n\n"},{"id":"515068","messageId":"CA+rGoLdJucLSe0fMeOEd6aTJP4p7JD7xyrPmWUetNWbQ0CoeyA@mail.gmail.com","threadId":"63140","inReplyTo":"xmqqiknwldob.fsf@gitster.g","subject":"Re: [[GSOC][PATCH v3] 3/3] docs: replace git_config with repo_config","fromName":"JAYATHEERTH K","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-26T03:15:21Z","receivedAt":"2025-03-26T03:15:33Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"On Wed, Mar 26, 2025 at 8:07 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com> writes:\n>\n> >> ... better to explain _why_ each change is made in the text that\n> >> precedes the sample code.  E.g.\n> >>\n> >>     Add `#include \"config.h\"` because you want to use X and Y,\n> >>     and `#include \"repository.h\"` because you want to use Z.\n> >>\n> >> ...\n> > In the latest patch version I've removed the comments, since we\n> > already added a line above saying the user has to include\n> > `repository.h` I don't think we need to go in depth into that, do let\n> > me know if that is not the case, looking forward to any more feedback.\n>\n> It's your patch, after all.\n>\n> But if the reason why you added the comment was \"this is a tutorial\"\n> as you said, I would imagine that it would help readers to say why\n> a particular header is needed, when the tutorial text tells them\n> that they need to add it.  From a quick look at the patch, it seems\n> that the updated text says what the change did (i.e. add a header),\n> which is rather obvious in the sample code, without saying why the\n> addition is necessary?\n>\n\nAgreed, but there will be two things from this point, in the previous\ndocumentation itself the header files didn't have very detailed\nexplanation. If I do a detailed description of the header files in\nthis specific tutorial/patch, the documentation will look\ninconsistent.\n\nI could do three things,\n\n1. If these series of patches do not have any other faults/feedback,\nafter merging them I could start working on a second microproject\n(Adding the details of header files of the whole document\nconsistently).\n\n2. I could present a change in this current patch to improve the\ndetails of the header files and re send the patch.\n\n3. We can just leave this as is.\n\nI'm inclined towards the first idea, as I think this will cover my\nGSOC timeline and also give me some time to work on my proposal and\nfulfill my requirements for GSOC at the same time, and also makes the\ndocumentation good for newbies.\n\nBut I'm willing to work with either of these ideas, or any new method\nyou want to proceed with.\n\n\nI think the prev email was rendered in HTML\nSo I resent this.\n\n\nThank you,\nJay\n"},{"id":"515278","messageId":"CA+rGoLe2bn=NXYChq=v54QzPCaVMNVO-7du7o--iMawcD0jCcg@mail.gmail.com","threadId":"63140","inReplyTo":"CA+rGoLdJucLSe0fMeOEd6aTJP4p7JD7xyrPmWUetNWbQ0CoeyA@mail.gmail.com","subject":"Re: [[GSOC][PATCH v3] 3/3] docs: replace git_config with repo_config","fromName":"JAYATHEERTH K","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2025-03-29T17:42:53Z","receivedAt":"2025-03-29T17:43:07Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"Hey Junio,\n\nI think this email has missed your attention.\nApologies for persisting,\nbut I think it would be helpful to know how to proceed with this.\n\nThank You,\nJay\n"}]}