{"thread":{"id":"59940","subject":"[PATCH] MyFirstObjectWalk: include necessary header files","startedAt":"2023-07-01T08:28:58Z","lastAt":"2023-07-01T08:28:58Z","messageCount":1,"participants":["Vinayak Dev"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"479084","messageId":"20230701082842.7952-1-vinayakdev.sci@gmail.com","threadId":"59940","inReplyTo":null,"subject":"[PATCH] MyFirstObjectWalk: include necessary header files","fromName":"Vinayak Dev","fromEmail":"vinayakdev.sci@gmail.com","sentAt":"2023-07-01T08:28:42Z","receivedAt":"2023-07-01T08:28:58Z","isPatch":true,"sender":{"key":"vinayakdev.sci@gmail.com","avatar":"https://avatars.githubusercontent.com/u/104419489?v=4"},"body":"\nIn Documentation/MyFirstObjectWalk.txt, the functions\ntrace_printf() and oid_to_hex() are used to enable trace\noutput and get object ids as strings respectively. However,\nthe files \"trace.h\" and \"hex.h\" are not included, which\nproduces an error when the code from the tutorial is compiled,\nwith the compiler complaining that the functions are not defined\nbefore usage. Therefore, add includes for \"trace.h\" and \"hex.h\"\nin the tutorial.\n\nSigned-off-by: Vinayak Dev <vinayakdev.sci@gmail.com>\n---\n Documentation/MyFirstObjectWalk.txt | 18 ++++++++++++------\n 1 file changed, 12 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/MyFirstObjectWalk.txt b/Documentation/MyFirstObjectWalk.txt\nindex eee513e86f..bb99e2bb6e 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@@ -805,6 +807,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: a9e066fa63149291a55f383cfa113d8bdbdaa6b3\n-- \n2.41.0\n\n"}]}