{"thread":{"id":"59942","subject":"[PATCH] docs: add necessary headers to Documentation/MFOW.txt","startedAt":"2023-07-02T15:15:22Z","lastAt":"2023-07-05T07:16:51Z","messageCount":3,"participants":["Vinayak Dev","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"479093","messageId":"20230702151457.3227-1-vinayakdev.sci@gmail.com","threadId":"59942","inReplyTo":null,"subject":"[PATCH] docs: add necessary headers to Documentation/MFOW.txt","fromName":"Vinayak Dev","fromEmail":"vinayakdev.sci@gmail.com","sentAt":"2023-07-02T15:14:57Z","receivedAt":"2023-07-02T15:15:22Z","isPatch":true,"sender":{"key":"vinayakdev.sci@gmail.com","avatar":"https://avatars.githubusercontent.com/u/104419489?v=4"},"body":"From: Vinayak Dev <vinayakdev.sci@gmail.com>\n\nThe tutorial in Documentation/MyFirstObjectWalk.txt\ncontains the functions trace_printf(), oid_to_hex(),\nand pp_commit_easy(), and struct oidset, which are used\nwithout any hint of where they are defined. When the provided \ncode is compiled, the compiler returns an error, stating that \nthe functions and the struct are used before declaration. Therefore,include\nnecessary header files (the ones which have no mentions in the tutorial).\n\nSigned-off-by: Vinayak Dev <vinayakdev.sci@gmail.com>\n---\nI sent a patch to the mailing list previously, but today I noticed that\nthe CI builds for the branch on my fork were failing. I turns out that\nthe tutorial required addition of more files than I had noticed.\nI am really, really sorry for this mistake, but I am sure that the tutorial \nis fixed now. The CI builds now pass perfectly.\n\n\n Documentation/MyFirstObjectWalk.txt | 26 ++++++++++++++++++++------\n 1 file changed, 20 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/MyFirstObjectWalk.txt b/Documentation/MyFirstObjectWalk.txt\nindex 200e628e30..c68cdb11b9 100644\n--- a/Documentation/MyFirstObjectWalk.txt\n+++ b/Documentation/MyFirstObjectWalk.txt\n@@ -41,6 +41,7 @@ Open up a new file `builtin/walken.c` and set up the command handler:\n  */\n \n #include \"builtin.h\"\n+#include \"trace.h\"\n \n int cmd_walken(int argc, const char **argv, const char *prefix)\n {\n@@ -49,12 +50,13 @@ int cmd_walken(int argc, const char **argv, const char *prefix)\n }\n ----\n \n-NOTE: `trace_printf()` differs from `printf()` in that it can be turned on or\n-off at runtime. For the purposes of this tutorial, we will write `walken` as\n-though it is intended for use as a \"plumbing\" command: that is, a command which\n-is used primarily in scripts, rather than interactively by humans (a \"porcelain\"\n-command). So we will send our debug output to `trace_printf()` instead. When\n-running, enable trace output by setting the environment variable `GIT_TRACE`.\n+NOTE: `trace_printf()`, defined in `trace.h`, differs from `printf()` in\n+that it can be turned on or off at runtime. For the purposes of this\n+tutorial, we will write `walken` as though it is intended for use as\n+a \"plumbing\" command: that is, a command which is used primarily in\n+scripts, rather than interactively by humans (a \"porcelain\" command).\n+So we will send our debug output to `trace_printf()` instead.\n+When running, enable trace output by setting the environment variable `GIT_TRACE`.\n \n Add usage text and `-h` handling, like all subcommands should consistently do\n (our test suite will notice and complain if you fail to do so).\n@@ -341,6 +343,10 @@ the walk loop below the `prepare_revision_walk()` call within your\n `walken_commit_walk()`:\n \n ----\n+#include \"pretty.h\"\n+\n+...\n+\n static void walken_commit_walk(struct rev_info *rev)\n {\n \tstruct commit *commit;\n@@ -754,6 +760,10 @@ reachable objects are walked in order to populate the list.\n First, add the `struct oidset` and related items we will use to iterate it:\n \n ----\n+#include \"oidset.h\"\n+\n+...\n+\n static void walken_object_walk(\n \t...\n \n@@ -805,6 +815,10 @@ just walks of commits. First, we'll make our handlers chattier - modify\n go:\n \n ----\n+#include \"hex.h\"\n+\n+...\n+\n static void walken_show_commit(struct commit *cmt, void *buf)\n {\n \ttrace_printf(\"commit: %s\\n\", oid_to_hex(&cmt->object.oid));\n\nbase-commit: 9748a6820043d5815bee770ffa51647e0adc2cf0\n-- \n2.41.0\n\n"},{"id":"479192","messageId":"xmqqilay3mzg.fsf@gitster.g","threadId":"59942","inReplyTo":"20230702151457.3227-1-vinayakdev.sci@gmail.com","subject":"Re: [PATCH] docs: add necessary headers to Documentation/MFOW.txt","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-07-05T06:12:51Z","receivedAt":"2023-07-05T06:13:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vinayak Dev <vinayakdev.sci@gmail.com> writes:\n\n> I sent a patch to the mailing list previously, but today I noticed that\n> the CI builds for the branch on my fork were failing. I turns out that\n> the tutorial required addition of more files than I had noticed.\n> I am really, really sorry for this mistake, but I am sure that the tutorial \n> is fixed now. The CI builds now pass perfectly.\n\nThat is OK.  So the other one turned out to be a work-in-progress,\nand this is the final version, right?\n\nThanks for working on this.  Will queue.\n"},{"id":"479195","messageId":"CADE8Napg5ps9NywJS_P6wGnGVVCv9eqvEZXKVbZ-wWGZbjzHOQ@mail.gmail.com","threadId":"59942","inReplyTo":"xmqqilay3mzg.fsf@gitster.g","subject":"Re: [PATCH] docs: add necessary headers to Documentation/MFOW.txt","fromName":"Vinayak Dev","fromEmail":"vinayakdev.sci@gmail.com","sentAt":"2023-07-05T07:16:31Z","receivedAt":"2023-07-05T07:16:51Z","isPatch":true,"sender":{"key":"vinayakdev.sci@gmail.com","avatar":"https://avatars.githubusercontent.com/u/104419489?v=4"},"body":"On Wed, 5 Jul 2023 at 11:42, Junio C Hamano <gitster@pobox.com> wrote:\n> That is OK.  So the other one turned out to be a work-in-progress,\n> and this is the final version, right?\n\nYes, I included all the files that did not have any mentions in the tutorial.\nThis should work perfectly fine. But the repository to which the tutorial points\nstill contains stale code. It might require a re-write, so I will cc Emily too.\n\n> Thanks for working on this.  Will queue.\n\nThanks a lot!\n\nHave a good day!\nVinayak\n"}]}