@@ -43,7 +43,7 @@ Open up a new file `builtin/walken.c` and set up the command handler:
43
43
#include "builtin.h"
44
44
#include "trace.h"
45
45
46
- int cmd_walken(int argc, const char **argv, const char *prefix)
46
+ int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo )
47
47
{
48
48
trace_printf(_("cmd_walken incoming...\n"));
49
49
return 0;
@@ -86,7 +86,7 @@ int cmd_walken(int argc, const char **argv, const char *prefix)
86
86
Also add the relevant line in `builtin.h` near `cmd_whatchanged()`:
87
87
88
88
----
89
- int cmd_walken(int argc, const char **argv, const char *prefix);
89
+ int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo );
90
90
----
91
91
92
92
Include the command in `git.c` in `commands[]` near the entry for `whatchanged`,
@@ -96,10 +96,23 @@ maintaining alphabetical ordering:
96
96
{ "walken", cmd_walken, RUN_SETUP },
97
97
----
98
98
99
- Add it to the `Makefile` near the line for `builtin/worktree.o`:
99
+ Add an entry for the new command in the both the Make and Meson build system,
100
+ before the entry for `worktree`:
100
101
102
+ - In the `Makefile`:
101
103
----
104
+ ...
102
105
BUILTIN_OBJS += builtin/walken.o
106
+ ...
107
+ ----
108
+
109
+ - In the `meson.build` file:
110
+ ----
111
+ builtin_sources = [
112
+ ...
113
+ 'builtin/walken.c',
114
+ ...
115
+ ]
103
116
----
104
117
105
118
Build and test out your command, without forgetting to ensure the `DEVELOPER`
@@ -193,7 +206,7 @@ initialization functions.
193
206
194
207
Next, we should have a look at any relevant configuration settings (i.e.,
195
208
settings readable and settable from `git config`). This is done by providing a
196
- callback to `git_config ()`; within that callback, you can also invoke methods
209
+ callback to `repo_config ()`; within that callback, you can also invoke methods
197
210
from other components you may need that need to intercept these options. Your
198
211
callback will be invoked once per each configuration value which Git knows about
199
212
(global, local, worktree, etc.).
@@ -221,14 +234,14 @@ static int git_walken_config(const char *var, const char *value,
221
234
}
222
235
----
223
236
224
- Make sure to invoke `git_config ()` with it in your `cmd_walken()`:
237
+ Make sure to invoke `repo_config ()` with it in your `cmd_walken()`:
225
238
226
239
----
227
- int cmd_walken(int argc, const char **argv, const char *prefix)
240
+ int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo )
228
241
{
229
242
...
230
243
231
- git_config( git_walken_config, NULL);
244
+ repo_config(repo, git_walken_config, NULL);
232
245
233
246
...
234
247
}
@@ -250,14 +263,14 @@ We'll also need to include the `revision.h` header:
250
263
251
264
...
252
265
253
- int cmd_walken(int argc, const char **argv, const char *prefix)
266
+ int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo )
254
267
{
255
268
/* This can go wherever you like in your declarations.*/
256
269
struct rev_info rev;
257
270
...
258
271
259
- /* This should go after the git_config () call. */
260
- repo_init_revisions(the_repository , &rev, prefix);
272
+ /* This should go after the repo_config () call. */
273
+ repo_init_revisions(repo , &rev, prefix);
261
274
262
275
...
263
276
}
@@ -305,7 +318,7 @@ Then let's invoke `final_rev_info_setup()` after the call to
305
318
`repo_init_revisions()`:
306
319
307
320
----
308
- int cmd_walken(int argc, const char **argv, const char *prefix)
321
+ int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo )
309
322
{
310
323
...
311
324
0 commit comments