From: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
To: git@vger.kernel.org
Cc: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Subject: [GSoC PATCH 1/2] MyFirstContribution: use struct repository in examples
Date: Thu, 29 May 2025 16:20:35 -0300 [thread overview]
Message-ID: <20250529192036.75408-2-lucasseikioshiro@gmail.com> (raw)
In-Reply-To: <20250529192036.75408-1-lucasseikioshiro@gmail.com>
Add the parameter `struct repository *repo` to the cmd_walken function.
Since commit 9b1cb50, all the cmd_* have the `repo` parameter and new
commands must follow this convention, so the documentation should also
be changed.
Also change the `git_config` calls to `repo_config`, also passing the
`repo` parameter.
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
---
Documentation/MyFirstObjectWalk.adoc | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/Documentation/MyFirstObjectWalk.adoc b/Documentation/MyFirstObjectWalk.adoc
index f03753dfc0..29d26abb47 100644
--- a/Documentation/MyFirstObjectWalk.adoc
+++ b/Documentation/MyFirstObjectWalk.adoc
@@ -43,7 +43,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)
+int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo)
{
trace_printf(_("cmd_walken incoming...\n"));
return 0;
@@ -86,7 +86,7 @@ int cmd_walken(int argc, const char **argv, const char *prefix)
Also add the relevant line in `builtin.h` near `cmd_version()`:
----
-int cmd_walken(int argc, const char **argv, const char *prefix);
+int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo);
----
Include the command in `git.c` in `commands[]` near the entry for `version`,
@@ -193,7 +193,7 @@ initialization functions.
Next, we should have a look at any relevant configuration settings (i.e.,
settings readable and settable from `git config`). This is done by providing a
-callback to `git_config()`; within that callback, you can also invoke methods
+callback to `repo_config()`; within that callback, you can also invoke methods
from other components you may need that need to intercept these options. Your
callback will be invoked once per each configuration value which Git knows about
(global, local, worktree, etc.).
@@ -221,14 +221,14 @@ static int git_walken_config(const char *var, const char *value,
}
----
-Make sure to invoke `git_config()` with it in your `cmd_walken()`:
+Make sure to invoke `repo_config()` with it in your `cmd_walken()`:
----
-int cmd_walken(int argc, const char **argv, const char *prefix)
+int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo)
{
...
- git_config(git_walken_config, NULL);
+ repo_config(repo, git_walken_config, NULL);
...
}
@@ -250,14 +250,14 @@ We'll also need to include the `revision.h` header:
...
-int cmd_walken(int argc, const char **argv, const char *prefix)
+int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo)
{
/* This can go wherever you like in your declarations.*/
struct rev_info rev;
...
/* This should go after the git_config() call. */
- repo_init_revisions(the_repository, &rev, prefix);
+ repo_init_revisions(repo, the_repository, &rev, prefix);
...
}
@@ -305,7 +305,7 @@ Then let's invoke `final_rev_info_setup()` after the call to
`repo_init_revisions()`:
----
-int cmd_walken(int argc, const char **argv, const char *prefix)
+int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo)
{
...
--
2.39.5 (Apple Git-154)
next prev parent reply other threads:[~2025-05-29 19:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 19:20 [GSoC PATCH 0/2] Update MyFirstObjectWalk with struct repository and meson Lucas Seiki Oshiro
2025-05-29 19:20 ` Lucas Seiki Oshiro [this message]
2025-05-29 19:57 ` [GSoC PATCH 1/2] MyFirstContribution: use struct repository in examples Karthik Nayak
2025-05-29 19:20 ` [GSoC PATCH 2/2] MyFirstContribution: add walken.c to meson.build Lucas Seiki Oshiro
2025-05-29 20:02 ` Karthik Nayak
2025-05-30 8:00 ` Patrick Steinhardt
2025-05-29 20:06 ` [GSoC PATCH 0/2] Update MyFirstObjectWalk with struct repository and meson Karthik Nayak
2025-06-02 20:50 ` [GSoC PATCH v2 0/2] MyFirstObjectWalk: update " Lucas Seiki Oshiro
2025-06-02 20:50 ` [GSoC PATCH v2 1/2] MyFirstContribution: use struct repository in examples Lucas Seiki Oshiro
2025-06-02 20:50 ` [GSoC PATCH v2 2/2] MyFirstContribution: add walken.c to meson.build Lucas Seiki Oshiro
2025-06-03 6:08 ` [GSoC PATCH v2 0/2] MyFirstObjectWalk: update with struct repository and meson Patrick Steinhardt
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=20250529192036.75408-2-lucasseikioshiro@gmail.com \
--to=lucasseikioshiro@gmail.com \
--cc=git@vger.kernel.org \
/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).