From: "John Cai via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Eric Sunshine <sunshine@sunshineco.com>, John Cai <johncai86@gmail.com>
Subject: [PATCH v2 0/2] fix up example code in MyFirstObjectWalk tutorial
Date: Fri, 29 Oct 2021 17:58:14 +0000 [thread overview]
Message-ID: <pull.1063.v2.git.1635530296.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1063.git.1635343531.gitgitgadget@gmail.com>
MyFirstObjectWalk tutorial was missing directives to add some header files.
Also fixes some initialization code.
Changes since v1:
* added back ticks to header file names
* wrapped overly long lines
John Cai (2):
docs: fix places that break compilation in MyFirstObjectWalk
docs: add headers in MyFirstObjectWalk
Documentation/MyFirstObjectWalk.txt | 31 ++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
base-commit: e9e5ba39a78c8f5057262d49e261b42a8660d5b9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1063%2Fjohn-cai%2Fjc-fix-my-first-object-walk-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1063/john-cai/jc-fix-my-first-object-walk-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1063
Range-diff vs v1:
1: 6c95f11f110 ! 1: 5c9deaf0bcc docs: fix places that break compliation in MyFirstObjectWalk
@@ Metadata
Author: John Cai <johncai86@gmail.com>
## Commit message ##
- docs: fix places that break compliation in MyFirstObjectWalk
+ docs: fix places that break compilation in MyFirstObjectWalk
Two errors in the example code caused compilation failures due to
- a missing semi-colon as well as initialization with an empty struct.
+ a missing semicolon as well as initialization with an empty struct.
This commit fixes that to make the MyFirstObjectWalk tutorial easier to
follow.
Signed-off-by: John Cai <johncai86@gmail.com>
## Documentation/MyFirstObjectWalk.txt ##
+@@ Documentation/MyFirstObjectWalk.txt: 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).
++We'll need to include the `parse-options.h` header.
+
+ ----
+ int cmd_walken(int argc, const char **argv, const char *prefix)
@@ Documentation/MyFirstObjectWalk.txt: int cmd_walken(int argc, const char **argv, const char *prefix)
const char * const walken_usage[] = {
N_("git walken"),
@@ Documentation/MyFirstObjectWalk.txt: int cmd_walken(int argc, const char **argv,
struct option options[] = {
OPT_END()
};
+@@ Documentation/MyFirstObjectWalk.txt: Similarly to the default values, we don't have anything to do here yet
+ ourselves; however, we should call `git_default_config()` if we aren't calling
+ any other existing config callbacks.
+
+-Add a new function to `builtin/walken.c`:
++Add a new function to `builtin/walken.c`.
++We'll also need to include the `config.h` header:
+
+ ----
+ static int git_walken_config(const char *var, const char *value, void *cb)
+@@ Documentation/MyFirstObjectWalk.txt: typically done by calling `repo_init_revisions()` with the repository you intend
+ to target, as well as the `prefix` argument of `cmd_walken` and your `rev_info`
+ struct.
+
+-Add the `struct rev_info` and the `repo_init_revisions()` call:
++Add the `struct rev_info` and the `repo_init_revisions()` call.
++We'll also need to include the `revision.h` header:
++
+ ----
+ int cmd_walken(int argc, const char **argv, const char *prefix)
+ {
+@@ Documentation/MyFirstObjectWalk.txt: static void walken_object_walk(struct rev_info *rev)
+ ----
+
+ Let's start by calling just the unfiltered walk and reporting our counts.
+-Complete your implementation of `walken_object_walk()`:
++Complete your implementation of `walken_object_walk()`.
++We'll also need to include the `list-objects.h` header.
+
+ ----
+ traverse_commit_list(rev, walken_show_commit, walken_show_object, NULL);
@@ Documentation/MyFirstObjectWalk.txt: First, we'll need to `#include "list-objects-filter-options.h"` and set up the
----
static void walken_object_walk(struct rev_info *rev)
2: 33cd9b2e8a6 ! 2: 7268f00c11f docs: add headers in MyFirstObjectWalk
@@ Commit message
Signed-off-by: John Cai <johncai86@gmail.com>
## Documentation/MyFirstObjectWalk.txt ##
-@@ Documentation/MyFirstObjectWalk.txt: 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).
-+(our test suite will notice and complain if you fail to do so). We'll need to include
-+the "parse-options.h" header.
+@@ Documentation/MyFirstObjectWalk.txt: 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"
@@ Documentation/MyFirstObjectWalk.txt: command). So we will send our debug output
int cmd_walken(int argc, const char **argv, const char *prefix)
{
const char * const walken_usage[] = {
-@@ Documentation/MyFirstObjectWalk.txt: Similarly to the default values, we don't have anything to do here yet
- ourselves; however, we should call `git_default_config()` if we aren't calling
- any other existing config callbacks.
-
--Add a new function to `builtin/walken.c`:
-+Add a new function to `builtin/walken.c`. We'll also need to include the "config.h" header:
+@@ Documentation/MyFirstObjectWalk.txt: Add a new function to `builtin/walken.c`.
+ We'll also need to include the `config.h` header:
----
+#include "config.h"
@@ Documentation/MyFirstObjectWalk.txt: Similarly to the default values, we don't h
static int git_walken_config(const char *var, const char *value, void *cb)
{
/*
-@@ Documentation/MyFirstObjectWalk.txt: typically done by calling `repo_init_revisions()` with the repository you intend
- to target, as well as the `prefix` argument of `cmd_walken` and your `rev_info`
- struct.
+@@ Documentation/MyFirstObjectWalk.txt: Add the `struct rev_info` and the `repo_init_revisions()` call.
+ We'll also need to include the `revision.h` header:
--Add the `struct rev_info` and the `repo_init_revisions()` call:
-+Add the `struct rev_info` and the `repo_init_revisions()` call. We'll also need to include
-+the "revision.h" header:
-+
----
+#include "revision.h"
+
@@ Documentation/MyFirstObjectWalk.txt: typically done by calling `repo_init_revisi
int cmd_walken(int argc, const char **argv, const char *prefix)
{
/* This can go wherever you like in your declarations.*/
-@@ Documentation/MyFirstObjectWalk.txt: static void walken_object_walk(struct rev_info *rev)
- ----
-
- Let's start by calling just the unfiltered walk and reporting our counts.
--Complete your implementation of `walken_object_walk()`:
-+Complete your implementation of `walken_object_walk()`. We'll also need to
-+include the "list-objects.h" header.
+@@ Documentation/MyFirstObjectWalk.txt: Complete your implementation of `walken_object_walk()`.
+ We'll also need to include the `list-objects.h` header.
----
+#include "list-objects.h"
--
gitgitgadget
next prev 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 ` John Cai via GitGitGadget [this message]
2021-10-29 17:58 ` [PATCH v2 1/2] docs: fix places that break compilation " John Cai via GitGitGadget
2021-10-29 18:04 ` Eric Sunshine
2021-10-29 17:58 ` [PATCH v2 2/2] docs: add headers " John Cai via GitGitGadget
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=pull.1063.v2.git.1635530296.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.