git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John Cai via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Eric Sunshine <sunshine@sunshineco.com>,
	John Cai <johncai86@gmail.com>, John Cai <johncai86@gmail.com>
Subject: [PATCH v2 2/2] docs: add headers in MyFirstObjectWalk
Date: Fri, 29 Oct 2021 17:58:16 +0000	[thread overview]
Message-ID: <7268f00c11fc0b9ece99f6a2940c124892791768.1635530296.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1063.v2.git.1635530296.gitgitgadget@gmail.com>

From: John Cai <johncai86@gmail.com>

In several places, headers need to be included or else the code won't
compile. Since this is the first object walk, it would be nice to
include them in the tutorial to make it easier to follow.

Signed-off-by: John Cai <johncai86@gmail.com>
---
 Documentation/MyFirstObjectWalk.txt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/MyFirstObjectWalk.txt b/Documentation/MyFirstObjectWalk.txt
index e22615105c0..ca267941f3e 100644
--- a/Documentation/MyFirstObjectWalk.txt
+++ b/Documentation/MyFirstObjectWalk.txt
@@ -61,6 +61,10 @@ Add usage text and `-h` handling, like all subcommands should consistently do
 We'll need to include the `parse-options.h` header.
 
 ----
+#include "parse-options.h"
+
+...
+
 int cmd_walken(int argc, const char **argv, const char *prefix)
 {
 	const char * const walken_usage[] = {
@@ -200,6 +204,10 @@ Add a new function to `builtin/walken.c`.
 We'll also need to include the `config.h` header:
 
 ----
+#include "config.h"
+
+...
+
 static int git_walken_config(const char *var, const char *value, void *cb)
 {
 	/*
@@ -235,6 +243,10 @@ Add the `struct rev_info` and the `repo_init_revisions()` call.
 We'll also need to include the `revision.h` header:
 
 ----
+#include "revision.h"
+
+...
+
 int cmd_walken(int argc, const char **argv, const char *prefix)
 {
 	/* This can go wherever you like in your declarations.*/
@@ -632,6 +644,10 @@ Complete your implementation of `walken_object_walk()`.
 We'll also need to include the `list-objects.h` header.
 
 ----
+#include "list-objects.h"
+
+...
+
 	traverse_commit_list(rev, walken_show_commit, walken_show_object, NULL);
 
 	printf("commits %d\nblobs %d\ntags %d\ntrees %d\n", commit_count,
-- 
gitgitgadget

  parent reply	other threads:[~2021-10-29 17:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27 14:05 [PATCH 0/2] fix up example code in MyFirstObjectWalk tutorial John Cai via GitGitGadget
2021-10-27 14:05 ` [PATCH 1/2] docs: fix places that break compliation in MyFirstObjectWalk John Cai via GitGitGadget
2021-10-27 17:05   ` Eric Sunshine
2021-10-27 14:05 ` [PATCH 2/2] docs: add headers " John Cai via GitGitGadget
2021-10-27 17:09   ` Eric Sunshine
2021-10-27 21:17   ` Junio C Hamano
2021-10-30  7:33   ` Bagas Sanjaya
2021-10-30  7:49     ` Eric Sunshine
2021-10-29 17:58 ` [PATCH v2 0/2] fix up example code in MyFirstObjectWalk tutorial John Cai via GitGitGadget
2021-10-29 17:58   ` [PATCH v2 1/2] docs: fix places that break compilation in MyFirstObjectWalk John Cai via GitGitGadget
2021-10-29 18:04     ` Eric Sunshine
2021-10-29 17:58   ` John Cai via GitGitGadget [this message]
2021-10-29 19:52   ` [PATCH v3 0/2] fix up example code in MyFirstObjectWalk tutorial John Cai via GitGitGadget
2021-10-29 19:52     ` [PATCH v3 1/2] docs: fix places that break compilation in MyFirstObjectWalk John Cai via GitGitGadget
2021-10-29 19:52     ` [PATCH v3 2/2] docs: add headers " John Cai via GitGitGadget
2021-10-29 21:28     ` [PATCH v3 0/2] fix up example code in MyFirstObjectWalk tutorial Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7268f00c11fc0b9ece99f6a2940c124892791768.1635530296.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johncai86@gmail.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).