public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] docs: include "trace.h" in MyFirstObjectWalk.txt
@ 2023-06-29 18:52 Vinayak Dev
  2023-06-29 21:13 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Vinayak Dev @ 2023-06-29 18:52 UTC (permalink / raw)
  To: nasamuffin; +Cc: git, Vinayak Dev

In Documentation/MyFirstObjectWalk.txt, the function
trace_printf() is used to enable trace output.
However, the file "trace.h" is not included, which
produces an error when the code from the tutorial is
compiled, with the compiler complaining that the 
function is not defined before usage. Therefore, add
an include for "trace.h" in the tutorial.

Signed-off-by: Vinayak Dev <vinayakdev.sci@gmail.com>
---
 Documentation/MyFirstObjectWalk.txt | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/Documentation/MyFirstObjectWalk.txt b/Documentation/MyFirstObjectWalk.txt
index eee513e86f..c3a23eb100 100644
--- a/Documentation/MyFirstObjectWalk.txt
+++ b/Documentation/MyFirstObjectWalk.txt
@@ -41,6 +41,7 @@ Open up a new file `builtin/walken.c` and set up the command handler:
  */
 
 #include "builtin.h"
+#include "trace.h"
 
 int cmd_walken(int argc, const char **argv, const char *prefix)
 {
@@ -49,12 +50,13 @@ int cmd_walken(int argc, const char **argv, const char *prefix)
 }
 ----
 
-NOTE: `trace_printf()` differs from `printf()` in that it can be turned on or
-off at runtime. For the purposes of this tutorial, we will write `walken` as
-though it is intended for use as a "plumbing" command: that is, a command which
-is used primarily in scripts, rather than interactively by humans (a "porcelain"
-command). So we will send our debug output to `trace_printf()` instead. When
-running, enable trace output by setting the environment variable `GIT_TRACE`.
+NOTE: `trace_printf()`, defined in `trace.h`, differs from `printf()` in
+that it can be turned on or off at runtime. For the purposes of this
+tutorial, we will write `walken` as though it is intended for use as
+a "plumbing" command: that is, a command which is used primarily in
+scripts, rather than interactively by humans (a "porcelain" command).
+So we will send our debug output to `trace_printf()` instead.
+When running, enable trace output by setting the environment variable `GIT_TRACE`.
 
 Add usage text and `-h` handling, like all subcommands should consistently do
 (our test suite will notice and complain if you fail to do so).

base-commit: a9e066fa63149291a55f383cfa113d8bdbdaa6b3
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-30 16:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-29 18:52 [PATCH] docs: include "trace.h" in MyFirstObjectWalk.txt Vinayak Dev
2023-06-29 21:13 ` Junio C Hamano
2023-06-30  6:09   ` Vinayak Dev
2023-06-30 16:25     ` Junio C Hamano
2023-06-30 16:50       ` Vinayak Dev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox