Git Mailing List Archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: add necessary headers to Documentation/MFOW.txt
@ 2023-07-02 15:14 Vinayak Dev
  2023-07-05  6:12 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Vinayak Dev @ 2023-07-02 15:14 UTC (permalink / raw)
  To: gitster; +Cc: git, Vinayak Dev

From: Vinayak Dev <vinayakdev.sci@gmail.com>

The tutorial in Documentation/MyFirstObjectWalk.txt
contains the functions trace_printf(), oid_to_hex(),
and pp_commit_easy(), and struct oidset, which are used
without any hint of where they are defined. When the provided 
code is compiled, the compiler returns an error, stating that 
the functions and the struct are used before declaration. Therefore,include
necessary header files (the ones which have no mentions in the tutorial).

Signed-off-by: Vinayak Dev <vinayakdev.sci@gmail.com>
---
I sent a patch to the mailing list previously, but today I noticed that
the CI builds for the branch on my fork were failing. I turns out that
the tutorial required addition of more files than I had noticed.
I am really, really sorry for this mistake, but I am sure that the tutorial 
is fixed now. The CI builds now pass perfectly.


 Documentation/MyFirstObjectWalk.txt | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/Documentation/MyFirstObjectWalk.txt b/Documentation/MyFirstObjectWalk.txt
index 200e628e30..c68cdb11b9 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).
@@ -341,6 +343,10 @@ the walk loop below the `prepare_revision_walk()` call within your
 `walken_commit_walk()`:
 
 ----
+#include "pretty.h"
+
+...
+
 static void walken_commit_walk(struct rev_info *rev)
 {
 	struct commit *commit;
@@ -754,6 +760,10 @@ reachable objects are walked in order to populate the list.
 First, add the `struct oidset` and related items we will use to iterate it:
 
 ----
+#include "oidset.h"
+
+...
+
 static void walken_object_walk(
 	...
 
@@ -805,6 +815,10 @@ just walks of commits. First, we'll make our handlers chattier - modify
 go:
 
 ----
+#include "hex.h"
+
+...
+
 static void walken_show_commit(struct commit *cmt, void *buf)
 {
 	trace_printf("commit: %s\n", oid_to_hex(&cmt->object.oid));

base-commit: 9748a6820043d5815bee770ffa51647e0adc2cf0
-- 
2.41.0


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

* Re: [PATCH] docs: add necessary headers to Documentation/MFOW.txt
  2023-07-02 15:14 [PATCH] docs: add necessary headers to Documentation/MFOW.txt Vinayak Dev
@ 2023-07-05  6:12 ` Junio C Hamano
  2023-07-05  7:16   ` Vinayak Dev
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2023-07-05  6:12 UTC (permalink / raw)
  To: Vinayak Dev; +Cc: git

Vinayak Dev <vinayakdev.sci@gmail.com> writes:

> I sent a patch to the mailing list previously, but today I noticed that
> the CI builds for the branch on my fork were failing. I turns out that
> the tutorial required addition of more files than I had noticed.
> I am really, really sorry for this mistake, but I am sure that the tutorial 
> is fixed now. The CI builds now pass perfectly.

That is OK.  So the other one turned out to be a work-in-progress,
and this is the final version, right?

Thanks for working on this.  Will queue.

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

* Re: [PATCH] docs: add necessary headers to Documentation/MFOW.txt
  2023-07-05  6:12 ` Junio C Hamano
@ 2023-07-05  7:16   ` Vinayak Dev
  0 siblings, 0 replies; 3+ messages in thread
From: Vinayak Dev @ 2023-07-05  7:16 UTC (permalink / raw)
  To: Junio C Hamano, Emily Shaffer; +Cc: git

On Wed, 5 Jul 2023 at 11:42, Junio C Hamano <gitster@pobox.com> wrote:
> That is OK.  So the other one turned out to be a work-in-progress,
> and this is the final version, right?

Yes, I included all the files that did not have any mentions in the tutorial.
This should work perfectly fine. But the repository to which the tutorial points
still contains stale code. It might require a re-write, so I will cc Emily too.

> Thanks for working on this.  Will queue.

Thanks a lot!

Have a good day!
Vinayak

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

end of thread, other threads:[~2023-07-05  7:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-02 15:14 [PATCH] docs: add necessary headers to Documentation/MFOW.txt Vinayak Dev
2023-07-05  6:12 ` Junio C Hamano
2023-07-05  7:16   ` Vinayak Dev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).