builtin: add a repository parameter for builtin functions
In order to reduce the usage of the global the_repository, add a parameter to builtin functions that will get passed a repository variable. This commit uses UNUSED on most of the builtin functions, as subsequent commits will modify the actual builtins to pass the repository parameter down. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
John Cai committed
Sep 13, 2024 at 21:16 UTC
9b1cb5070ffb581798763eaee85cec10da969e90
127 files changed
+703
-296
builtin.h
+139
-138
@@ -10,6 +10,7 @@
10
#define USE_THE_REPOSITORY_VARIABLE
11
12
#include "git-compat-util.h"
13
+#include "repository.h"
14
15
/*
16
* builtin API
@@ -122,143 +123,143 @@ int is_builtin(const char *s);
123
BUG("unexpected prefix in builtin: %s", (prefix)); \
124
} while (0)
125
125
-int cmd_add(int argc, const char **argv, const char *prefix);
126
-int cmd_am(int argc, const char **argv, const char *prefix);
127
-int cmd_annotate(int argc, const char **argv, const char *prefix);
128
-int cmd_apply(int argc, const char **argv, const char *prefix);
129
-int cmd_archive(int argc, const char **argv, const char *prefix);
130
-int cmd_bisect(int argc, const char **argv, const char *prefix);
131
-int cmd_blame(int argc, const char **argv, const char *prefix);
132
-int cmd_branch(int argc, const char **argv, const char *prefix);
133
-int cmd_bugreport(int argc, const char **argv, const char *prefix);
134
-int cmd_bundle(int argc, const char **argv, const char *prefix);
135
-int cmd_cat_file(int argc, const char **argv, const char *prefix);
136
-int cmd_checkout(int argc, const char **argv, const char *prefix);
137
-int cmd_checkout__worker(int argc, const char **argv, const char *prefix);
138
-int cmd_checkout_index(int argc, const char **argv, const char *prefix);
139
-int cmd_check_attr(int argc, const char **argv, const char *prefix);
140
-int cmd_check_ignore(int argc, const char **argv, const char *prefix);
141
-int cmd_check_mailmap(int argc, const char **argv, const char *prefix);
142
-int cmd_check_ref_format(int argc, const char **argv, const char *prefix);
143
-int cmd_cherry(int argc, const char **argv, const char *prefix);
144
-int cmd_cherry_pick(int argc, const char **argv, const char *prefix);
145
-int cmd_clone(int argc, const char **argv, const char *prefix);
146
-int cmd_clean(int argc, const char **argv, const char *prefix);
147
-int cmd_column(int argc, const char **argv, const char *prefix);
148
-int cmd_commit(int argc, const char **argv, const char *prefix);
149
-int cmd_commit_graph(int argc, const char **argv, const char *prefix);
150
-int cmd_commit_tree(int argc, const char **argv, const char *prefix);
151
-int cmd_config(int argc, const char **argv, const char *prefix);
152
-int cmd_count_objects(int argc, const char **argv, const char *prefix);
153
-int cmd_credential(int argc, const char **argv, const char *prefix);
154
-int cmd_credential_cache(int argc, const char **argv, const char *prefix);
155
-int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix);
156
-int cmd_credential_store(int argc, const char **argv, const char *prefix);
157
-int cmd_describe(int argc, const char **argv, const char *prefix);
158
-int cmd_diagnose(int argc, const char **argv, const char *prefix);
159
-int cmd_diff_files(int argc, const char **argv, const char *prefix);
160
-int cmd_diff_index(int argc, const char **argv, const char *prefix);
161
-int cmd_diff(int argc, const char **argv, const char *prefix);
162
-int cmd_diff_tree(int argc, const char **argv, const char *prefix);
163
-int cmd_difftool(int argc, const char **argv, const char *prefix);
164
-int cmd_env__helper(int argc, const char **argv, const char *prefix);
165
-int cmd_fast_export(int argc, const char **argv, const char *prefix);
166
-int cmd_fast_import(int argc, const char **argv, const char *prefix);
167
-int cmd_fetch(int argc, const char **argv, const char *prefix);
168
-int cmd_fetch_pack(int argc, const char **argv, const char *prefix);
169
-int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix);
170
-int cmd_for_each_ref(int argc, const char **argv, const char *prefix);
171
-int cmd_for_each_repo(int argc, const char **argv, const char *prefix);
172
-int cmd_format_patch(int argc, const char **argv, const char *prefix);
173
-int cmd_fsck(int argc, const char **argv, const char *prefix);
174
-int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix);
175
-int cmd_gc(int argc, const char **argv, const char *prefix);
176
-int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix);
177
-int cmd_grep(int argc, const char **argv, const char *prefix);
178
-int cmd_hash_object(int argc, const char **argv, const char *prefix);
179
-int cmd_help(int argc, const char **argv, const char *prefix);
180
-int cmd_hook(int argc, const char **argv, const char *prefix);
181
-int cmd_index_pack(int argc, const char **argv, const char *prefix);
182
-int cmd_init_db(int argc, const char **argv, const char *prefix);
183
-int cmd_interpret_trailers(int argc, const char **argv, const char *prefix);
184
-int cmd_log(int argc, const char **argv, const char *prefix);
185
-int cmd_log_reflog(int argc, const char **argv, const char *prefix);
186
-int cmd_ls_files(int argc, const char **argv, const char *prefix);
187
-int cmd_ls_tree(int argc, const char **argv, const char *prefix);
188
-int cmd_ls_remote(int argc, const char **argv, const char *prefix);
189
-int cmd_mailinfo(int argc, const char **argv, const char *prefix);
190
-int cmd_mailsplit(int argc, const char **argv, const char *prefix);
191
-int cmd_maintenance(int argc, const char **argv, const char *prefix);
192
-int cmd_merge(int argc, const char **argv, const char *prefix);
193
-int cmd_merge_base(int argc, const char **argv, const char *prefix);
194
-int cmd_merge_index(int argc, const char **argv, const char *prefix);
195
-int cmd_merge_ours(int argc, const char **argv, const char *prefix);
196
-int cmd_merge_file(int argc, const char **argv, const char *prefix);
197
-int cmd_merge_recursive(int argc, const char **argv, const char *prefix);
198
-int cmd_merge_tree(int argc, const char **argv, const char *prefix);
199
-int cmd_mktag(int argc, const char **argv, const char *prefix);
200
-int cmd_mktree(int argc, const char **argv, const char *prefix);
201
-int cmd_multi_pack_index(int argc, const char **argv, const char *prefix);
202
-int cmd_mv(int argc, const char **argv, const char *prefix);
203
-int cmd_name_rev(int argc, const char **argv, const char *prefix);
204
-int cmd_notes(int argc, const char **argv, const char *prefix);
205
-int cmd_pack_objects(int argc, const char **argv, const char *prefix);
206
-int cmd_pack_redundant(int argc, const char **argv, const char *prefix);
207
-int cmd_patch_id(int argc, const char **argv, const char *prefix);
208
-int cmd_prune(int argc, const char **argv, const char *prefix);
209
-int cmd_prune_packed(int argc, const char **argv, const char *prefix);
210
-int cmd_pull(int argc, const char **argv, const char *prefix);
211
-int cmd_push(int argc, const char **argv, const char *prefix);
212
-int cmd_range_diff(int argc, const char **argv, const char *prefix);
213
-int cmd_read_tree(int argc, const char **argv, const char *prefix);
214
-int cmd_rebase(int argc, const char **argv, const char *prefix);
215
-int cmd_rebase__interactive(int argc, const char **argv, const char *prefix);
216
-int cmd_receive_pack(int argc, const char **argv, const char *prefix);
217
-int cmd_reflog(int argc, const char **argv, const char *prefix);
218
-int cmd_refs(int argc, const char **argv, const char *prefix);
219
-int cmd_remote(int argc, const char **argv, const char *prefix);
220
-int cmd_remote_ext(int argc, const char **argv, const char *prefix);
221
-int cmd_remote_fd(int argc, const char **argv, const char *prefix);
222
-int cmd_repack(int argc, const char **argv, const char *prefix);
223
-int cmd_replay(int argc, const char **argv, const char *prefix);
224
-int cmd_rerere(int argc, const char **argv, const char *prefix);
225
-int cmd_reset(int argc, const char **argv, const char *prefix);
226
-int cmd_restore(int argc, const char **argv, const char *prefix);
227
-int cmd_rev_list(int argc, const char **argv, const char *prefix);
228
-int cmd_rev_parse(int argc, const char **argv, const char *prefix);
229
-int cmd_revert(int argc, const char **argv, const char *prefix);
230
-int cmd_rm(int argc, const char **argv, const char *prefix);
231
-int cmd_send_pack(int argc, const char **argv, const char *prefix);
232
-int cmd_shortlog(int argc, const char **argv, const char *prefix);
233
-int cmd_show(int argc, const char **argv, const char *prefix);
234
-int cmd_show_branch(int argc, const char **argv, const char *prefix);
235
-int cmd_show_index(int argc, const char **argv, const char *prefix);
236
-int cmd_sparse_checkout(int argc, const char **argv, const char *prefix);
237
-int cmd_status(int argc, const char **argv, const char *prefix);
238
-int cmd_stash(int argc, const char **argv, const char *prefix);
239
-int cmd_stripspace(int argc, const char **argv, const char *prefix);
240
-int cmd_submodule__helper(int argc, const char **argv, const char *prefix);
241
-int cmd_switch(int argc, const char **argv, const char *prefix);
242
-int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
243
-int cmd_tag(int argc, const char **argv, const char *prefix);
244
-int cmd_unpack_file(int argc, const char **argv, const char *prefix);
245
-int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
246
-int cmd_update_index(int argc, const char **argv, const char *prefix);
247
-int cmd_update_ref(int argc, const char **argv, const char *prefix);
248
-int cmd_update_server_info(int argc, const char **argv, const char *prefix);
249
-int cmd_upload_archive(int argc, const char **argv, const char *prefix);
250
-int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix);
251
-int cmd_upload_pack(int argc, const char **argv, const char *prefix);
252
-int cmd_var(int argc, const char **argv, const char *prefix);
253
-int cmd_verify_commit(int argc, const char **argv, const char *prefix);
254
-int cmd_verify_tag(int argc, const char **argv, const char *prefix);
255
-int cmd_version(int argc, const char **argv, const char *prefix);
256
-int cmd_whatchanged(int argc, const char **argv, const char *prefix);
257
-int cmd_worktree(int argc, const char **argv, const char *prefix);
258
-int cmd_write_tree(int argc, const char **argv, const char *prefix);
259
-int cmd_verify_pack(int argc, const char **argv, const char *prefix);
260
-int cmd_show_ref(int argc, const char **argv, const char *prefix);
261
-int cmd_pack_refs(int argc, const char **argv, const char *prefix);
262
-int cmd_replace(int argc, const char **argv, const char *prefix);
126
+int cmd_add(int argc, const char **argv, const char *prefix, struct repository *repo);
127
+int cmd_am(int argc, const char **argv, const char *prefix, struct repository *repo);
128
+int cmd_annotate(int argc, const char **argv, const char *prefix, struct repository *repo);
129
+int cmd_apply(int argc, const char **argv, const char *prefix, struct repository *repo);
130
+int cmd_archive(int argc, const char **argv, const char *prefix, struct repository *repo);
131
+int cmd_bisect(int argc, const char **argv, const char *prefix, struct repository *repo);
132
+int cmd_blame(int argc, const char **argv, const char *prefix, struct repository *repo);
133
+int cmd_branch(int argc, const char **argv, const char *prefix, struct repository *repo);
134
+int cmd_bugreport(int argc, const char **argv, const char *prefix, struct repository *repo);
135
+int cmd_bundle(int argc, const char **argv, const char *prefix, struct repository *repo);
136
+int cmd_cat_file(int argc, const char **argv, const char *prefix, struct repository *repo);
137
+int cmd_checkout(int argc, const char **argv, const char *prefix, struct repository *repo);
138
+int cmd_checkout__worker(int argc, const char **argv, const char *prefix, struct repository *repo);
139
+int cmd_checkout_index(int argc, const char **argv, const char *prefix, struct repository *repo);
140
+int cmd_check_attr(int argc, const char **argv, const char *prefix, struct repository *repo);
141
+int cmd_check_ignore(int argc, const char **argv, const char *prefix, struct repository *repo);
142
+int cmd_check_mailmap(int argc, const char **argv, const char *prefix, struct repository *repo);
143
+int cmd_check_ref_format(int argc, const char **argv, const char *prefix, struct repository *repo);
144
+int cmd_cherry(int argc, const char **argv, const char *prefix, struct repository *repo);
145
+int cmd_cherry_pick(int argc, const char **argv, const char *prefix, struct repository *repo);
146
+int cmd_clone(int argc, const char **argv, const char *prefix, struct repository *repo);
147
+int cmd_clean(int argc, const char **argv, const char *prefix, struct repository *repo);
148
+int cmd_column(int argc, const char **argv, const char *prefix, struct repository *repo);
149
+int cmd_commit(int argc, const char **argv, const char *prefix, struct repository *repo);
150
+int cmd_commit_graph(int argc, const char **argv, const char *prefix, struct repository *repo);
151
+int cmd_commit_tree(int argc, const char **argv, const char *prefix, struct repository *repo);
152
+int cmd_config(int argc, const char **argv, const char *prefix, struct repository *repo);
153
+int cmd_count_objects(int argc, const char **argv, const char *prefix, struct repository *repo);
154
+int cmd_credential(int argc, const char **argv, const char *prefix, struct repository *repo);
155
+int cmd_credential_cache(int argc, const char **argv, const char *prefix, struct repository *repo);
156
+int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix, struct repository *repo);
157
+int cmd_credential_store(int argc, const char **argv, const char *prefix, struct repository *repo);
158
+int cmd_describe(int argc, const char **argv, const char *prefix, struct repository *repo);
159
+int cmd_diagnose(int argc, const char **argv, const char *prefix, struct repository *repo);
160
+int cmd_diff_files(int argc, const char **argv, const char *prefix, struct repository *repo);
161
+int cmd_diff_index(int argc, const char **argv, const char *prefix, struct repository *repo);
162
+int cmd_diff(int argc, const char **argv, const char *prefix, struct repository *repo);
163
+int cmd_diff_tree(int argc, const char **argv, const char *prefix, struct repository *repo);
164
+int cmd_difftool(int argc, const char **argv, const char *prefix, struct repository *repo);
165
+int cmd_env__helper(int argc, const char **argv, const char *prefix, struct repository *repo);
166
+int cmd_fast_export(int argc, const char **argv, const char *prefix, struct repository *repo);
167
+int cmd_fast_import(int argc, const char **argv, const char *prefix, struct repository *repo);
168
+int cmd_fetch(int argc, const char **argv, const char *prefix, struct repository *repo);
169
+int cmd_fetch_pack(int argc, const char **argv, const char *prefix, struct repository *repo);
170
+int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix, struct repository *repo);
171
+int cmd_for_each_ref(int argc, const char **argv, const char *prefix, struct repository *repo);
172
+int cmd_for_each_repo(int argc, const char **argv, const char *prefix, struct repository *repo);
173
+int cmd_format_patch(int argc, const char **argv, const char *prefix, struct repository *repo);
174
+int cmd_fsck(int argc, const char **argv, const char *prefix, struct repository *repo);
175
+int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix, struct repository *repo);
176
+int cmd_gc(int argc, const char **argv, const char *prefix, struct repository *repo);
177
+int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix, struct repository *repo);
178
+int cmd_grep(int argc, const char **argv, const char *prefix, struct repository *repo);
179
+int cmd_hash_object(int argc, const char **argv, const char *prefix, struct repository *repo);
180
+int cmd_help(int argc, const char **argv, const char *prefix, struct repository *repo);
181
+int cmd_hook(int argc, const char **argv, const char *prefix, struct repository *repo);
182
+int cmd_index_pack(int argc, const char **argv, const char *prefix, struct repository *repo);
183
+int cmd_init_db(int argc, const char **argv, const char *prefix, struct repository *repo);
184
+int cmd_interpret_trailers(int argc, const char **argv, const char *prefix, struct repository *repo);
185
+int cmd_log_reflog(int argc, const char **argv, const char *prefix, struct repository *repo);
186
+int cmd_log(int argc, const char **argv, const char *prefix, struct repository *repo);
187
+int cmd_ls_files(int argc, const char **argv, const char *prefix, struct repository *repo);
188
+int cmd_ls_tree(int argc, const char **argv, const char *prefix, struct repository *repo);
189
+int cmd_ls_remote(int argc, const char **argv, const char *prefix, struct repository *repo);
190
+int cmd_mailinfo(int argc, const char **argv, const char *prefix, struct repository *repo);
191
+int cmd_mailsplit(int argc, const char **argv, const char *prefix, struct repository *repo);
192
+int cmd_maintenance(int argc, const char **argv, const char *prefix, struct repository *repo);
193
+int cmd_merge(int argc, const char **argv, const char *prefix, struct repository *repo);
194
+int cmd_merge_base(int argc, const char **argv, const char *prefix, struct repository *repo);
195
+int cmd_merge_index(int argc, const char **argv, const char *prefix, struct repository *repo);
196
+int cmd_merge_ours(int argc, const char **argv, const char *prefix, struct repository *repo);
197
+int cmd_merge_file(int argc, const char **argv, const char *prefix, struct repository *repo);
198
+int cmd_merge_recursive(int argc, const char **argv, const char *prefix, struct repository *repo);
199
+int cmd_merge_tree(int argc, const char **argv, const char *prefix, struct repository *repo);
200
+int cmd_mktag(int argc, const char **argv, const char *prefix, struct repository *repo);
201
+int cmd_mktree(int argc, const char **argv, const char *prefix, struct repository *repo);
202
+int cmd_multi_pack_index(int argc, const char **argv, const char *prefix, struct repository *repo);
203
+int cmd_mv(int argc, const char **argv, const char *prefix, struct repository *repo);
204
+int cmd_name_rev(int argc, const char **argv, const char *prefix, struct repository *repo);
205
+int cmd_notes(int argc, const char **argv, const char *prefix, struct repository *repo);
206
+int cmd_pack_objects(int argc, const char **argv, const char *prefix, struct repository *repo);
207
+int cmd_pack_redundant(int argc, const char **argv, const char *prefix, struct repository *repo);
208
+int cmd_patch_id(int argc, const char **argv, const char *prefix, struct repository *repo);
209
+int cmd_prune(int argc, const char **argv, const char *prefix, struct repository *repo);
210
+int cmd_prune_packed(int argc, const char **argv, const char *prefix, struct repository *repo);
211
+int cmd_pull(int argc, const char **argv, const char *prefix, struct repository *repo);
212
+int cmd_push(int argc, const char **argv, const char *prefix, struct repository *repo);
213
+int cmd_range_diff(int argc, const char **argv, const char *prefix, struct repository *repo);
214
+int cmd_read_tree(int argc, const char **argv, const char *prefix, struct repository *repo);
215
+int cmd_rebase(int argc, const char **argv, const char *prefix, struct repository *repo);
216
+int cmd_rebase__interactive(int argc, const char **argv, const char *prefix, struct repository *repo);
217
+int cmd_receive_pack(int argc, const char **argv, const char *prefix, struct repository *repo);
218
+int cmd_reflog(int argc, const char **argv, const char *prefix, struct repository *repo);
219
+int cmd_refs(int argc, const char **argv, const char *prefix, struct repository *repo);
220
+int cmd_remote(int argc, const char **argv, const char *prefix, struct repository *repo);
221
+int cmd_remote_ext(int argc, const char **argv, const char *prefix, struct repository *repo);
222
+int cmd_remote_fd(int argc, const char **argv, const char *prefix, struct repository *repo);
223
+int cmd_repack(int argc, const char **argv, const char *prefix, struct repository *repo);
224
+int cmd_replay(int argc, const char **argv, const char *prefix, struct repository *repo);
225
+int cmd_rerere(int argc, const char **argv, const char *prefix, struct repository *repo);
226
+int cmd_reset(int argc, const char **argv, const char *prefix, struct repository *repo);
227
+int cmd_restore(int argc, const char **argv, const char *prefix, struct repository *repo);
228
+int cmd_rev_list(int argc, const char **argv, const char *prefix, struct repository *repo);
229
+int cmd_rev_parse(int argc, const char **argv, const char *prefix, struct repository *repo);
230
+int cmd_revert(int argc, const char **argv, const char *prefix, struct repository *repo);
231
+int cmd_rm(int argc, const char **argv, const char *prefix, struct repository *repo);
232
+int cmd_send_pack(int argc, const char **argv, const char *prefix, struct repository *repo);
233
+int cmd_shortlog(int argc, const char **argv, const char *prefix, struct repository *repo);
234
+int cmd_show(int argc, const char **argv, const char *prefix, struct repository *repo);
235
+int cmd_show_branch(int argc, const char **argv, const char *prefix, struct repository *repo);
236
+int cmd_show_index(int argc, const char **argv, const char *prefix, struct repository *repo);
237
+int cmd_sparse_checkout(int argc, const char **argv, const char *prefix, struct repository *repo);
238
+int cmd_status(int argc, const char **argv, const char *prefix, struct repository *repo);
239
+int cmd_stash(int argc, const char **argv, const char *prefix, struct repository *repo);
240
+int cmd_stripspace(int argc, const char **argv, const char *prefix, struct repository *repo);
241
+int cmd_submodule__helper(int argc, const char **argv, const char *prefix, struct repository *repo);
242
+int cmd_switch(int argc, const char **argv, const char *prefix, struct repository *repo);
243
+int cmd_symbolic_ref(int argc, const char **argv, const char *prefix, struct repository *repo);
244
+int cmd_tag(int argc, const char **argv, const char *prefix, struct repository *repo);
245
+int cmd_unpack_file(int argc, const char **argv, const char *prefix, struct repository *repo);
246
+int cmd_unpack_objects(int argc, const char **argv, const char *prefix, struct repository *repo);
247
+int cmd_update_index(int argc, const char **argv, const char *prefix, struct repository *repo);
248
+int cmd_update_ref(int argc, const char **argv, const char *prefix, struct repository *repo);
249
+int cmd_update_server_info(int argc, const char **argv, const char *prefix, struct repository *repo);
250
+int cmd_upload_archive(int argc, const char **argv, const char *prefix, struct repository *repo);
251
+int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix, struct repository *repo);
252
+int cmd_upload_pack(int argc, const char **argv, const char *prefix, struct repository *repo);
253
+int cmd_var(int argc, const char **argv, const char *prefix, struct repository *repo);
254
+int cmd_verify_commit(int argc, const char **argv, const char *prefix, struct repository *repo);
255
+int cmd_verify_tag(int argc, const char **argv, const char *prefix, struct repository *repo);
256
+int cmd_version(int argc, const char **argv, const char *prefix, struct repository *repo);
257
+int cmd_whatchanged(int argc, const char **argv, const char *prefix, struct repository *repo);
258
+int cmd_worktree(int argc, const char **argv, const char *prefix, struct repository *repo);
259
+int cmd_write_tree(int argc, const char **argv, const char *prefix, struct repository *repo);
260
+int cmd_verify_pack(int argc, const char **argv, const char *prefix, struct repository *repo);
261
+int cmd_show_ref(int argc, const char **argv, const char *prefix, struct repository *repo);
262
+int cmd_pack_refs(int argc, const char **argv, const char *prefix, struct repository *repo);
263
+int cmd_replace(int argc, const char **argv, const char *prefix, struct repository *repo);
264
265
#endif
builtin/add.c
+9
-3
@@ -167,7 +167,10 @@ int interactive_add(const char **argv, const char *prefix, int patch)
167
return ret;
168
}
169
170
-static int edit_patch(int argc, const char **argv, const char *prefix)
170
+static int edit_patch(int argc,
171
+ const char **argv,
172
+ const char *prefix,
173
+ struct repository *repo UNUSED)
174
{
175
char *file = git_pathdup("ADD_EDIT.patch");
176
struct child_process child = CHILD_PROCESS_INIT;
@@ -358,7 +361,10 @@ static int add_files(struct dir_struct *dir, int flags)
361
return exit_status;
362
}
363
361
-int cmd_add(int argc, const char **argv, const char *prefix)
364
+int cmd_add(int argc,
365
+ const char **argv,
366
+ const char *prefix,
367
+ struct repository *repo UNUSED)
368
{
369
int exit_status = 0;
370
struct pathspec pathspec;
@@ -387,7 +393,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
393
if (edit_interactive) {
394
if (pathspec_from_file)
395
die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--edit");
390
- return(edit_patch(argc, argv, prefix));
396
+ return(edit_patch(argc, argv, prefix, the_repository));
397
}
398
argc--;
399
argv++;
builtin/am.c
+4
-1
@@ -2298,7 +2298,10 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
2298
return 0;
2299
}
2300
2301
-int cmd_am(int argc, const char **argv, const char *prefix)
2301
+int cmd_am(int argc,
2302
+ const char **argv,
2303
+ const char *prefix,
2304
+ struct repository *repo UNUSED)
2305
{
2306
struct am_state state;
2307
int binary = -1;
builtin/annotate.c
+5
-2
@@ -7,7 +7,10 @@
7
#include "builtin.h"
8
#include "strvec.h"
9
10
-int cmd_annotate(int argc, const char **argv, const char *prefix)
10
+int cmd_annotate(int argc,
11
+ const char **argv,
12
+ const char *prefix,
13
+ struct repository *repo UNUSED)
14
{
15
struct strvec args = STRVEC_INIT;
16
int i;
@@ -18,5 +21,5 @@ int cmd_annotate(int argc, const char **argv, const char *prefix)
21
strvec_push(&args, argv[i]);
22
}
23
21
- return cmd_blame(args.nr, args.v, prefix);
24
+ return cmd_blame(args.nr, args.v, prefix, the_repository);
25
}
builtin/apply.c
+4
-1
@@ -9,7 +9,10 @@ static const char * const apply_usage[] = {
9
NULL
10
};
11
12
-int cmd_apply(int argc, const char **argv, const char *prefix)
12
+int cmd_apply(int argc,
13
+ const char **argv,
14
+ const char *prefix,
15
+ struct repository *repo UNUSED)
16
{
17
int force_apply = 0;
18
int options = 0;
builtin/archive.c
+4
-1
@@ -76,7 +76,10 @@ static int run_remote_archiver(int argc, const char **argv,
76
PARSE_OPT_KEEP_UNKNOWN_OPT | \
77
PARSE_OPT_NO_INTERNAL_HELP )
78
79
-int cmd_archive(int argc, const char **argv, const char *prefix)
79
+int cmd_archive(int argc,
80
+ const char **argv,
81
+ const char *prefix,
82
+ struct repository *repo UNUSED)
83
{
84
const char *exec = "git-upload-archive";
85
char *output = NULL;
builtin/bisect.c
+4
-1
@@ -1411,7 +1411,10 @@ static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSE
1411
return res;
1412
}
1413
1414
-int cmd_bisect(int argc, const char **argv, const char *prefix)
1414
+int cmd_bisect(int argc,
1415
+ const char **argv,
1416
+ const char *prefix,
1417
+ struct repository *repo UNUSED)
1418
{
1419
int res = 0;
1420
parse_opt_subcommand_fn *fn = NULL;
builtin/blame.c
+4
-1
@@ -864,7 +864,10 @@ static void build_ignorelist(struct blame_scoreboard *sb,
864
}
865
}
866
867
-int cmd_blame(int argc, const char **argv, const char *prefix)
867
+int cmd_blame(int argc,
868
+ const char **argv,
869
+ const char *prefix,
870
+ struct repository *repo UNUSED)
871
{
872
struct rev_info revs;
873
char *path = NULL;
builtin/branch.c
+4
-1
@@ -704,7 +704,10 @@ static int edit_branch_description(const char *branch_name)
704
return 0;
705
}
706
707
-int cmd_branch(int argc, const char **argv, const char *prefix)
707
+int cmd_branch(int argc,
708
+ const char **argv,
709
+ const char *prefix,
710
+ struct repository *repo UNUSED)
711
{
712
/* possible actions */
713
int delete = 0, rename = 0, copy = 0, list = 0,
builtin/bugreport.c
+4
-1
@@ -98,7 +98,10 @@ static void get_header(struct strbuf *buf, const char *title)
98
strbuf_addf(buf, "\n\n[%s]\n", title);
99
}
100
101
-int cmd_bugreport(int argc, const char **argv, const char *prefix)
101
+int cmd_bugreport(int argc,
102
+ const char **argv,
103
+ const char *prefix,
104
+ struct repository *repo UNUSED)
105
{
106
struct strbuf buffer = STRBUF_INIT;
107
struct strbuf report_path = STRBUF_INIT;
builtin/bundle.c
+4
-1
@@ -226,7 +226,10 @@ cleanup:
226
return ret;
227
}
228
229
-int cmd_bundle(int argc, const char **argv, const char *prefix)
229
+int cmd_bundle(int argc,
230
+ const char **argv,
231
+ const char *prefix,
232
+ struct repository *repo UNUSED)
233
{
234
parse_opt_subcommand_fn *fn = NULL;
235
struct option options[] = {
builtin/cat-file.c
+5
-2
@@ -191,7 +191,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
191
const char *ls_args[3] = { NULL };
192
ls_args[0] = "ls-tree";
193
ls_args[1] = obj_name;
194
- ret = cmd_ls_tree(2, ls_args, NULL);
194
+ ret = cmd_ls_tree(2, ls_args, NULL, the_repository);
195
goto cleanup;
196
}
197
@@ -923,7 +923,10 @@ static int batch_option_callback(const struct option *opt,
923
return 0;
924
}
925
926
-int cmd_cat_file(int argc, const char **argv, const char *prefix)
926
+int cmd_cat_file(int argc,
927
+ const char **argv,
928
+ const char *prefix,
929
+ struct repository *repo UNUSED)
930
{
931
int opt = 0;
932
int opt_cw = 0;
builtin/check-attr.c
+4
-1
@@ -107,7 +107,10 @@ static NORETURN void error_with_usage(const char *msg)
107
usage_with_options(check_attr_usage, check_attr_options);
108
}
109
110
-int cmd_check_attr(int argc, const char **argv, const char *prefix)
110
+int cmd_check_attr(int argc,
111
+ const char **argv,
112
+ const char *prefix,
113
+ struct repository *repo UNUSED)
114
{
115
struct attr_check *check;
116
struct object_id initialized_oid;
builtin/check-ignore.c
+4
-1
@@ -151,7 +151,10 @@ static int check_ignore_stdin_paths(struct dir_struct *dir, const char *prefix)
151
return num_ignored;
152
}
153
154
-int cmd_check_ignore(int argc, const char **argv, const char *prefix)
154
+int cmd_check_ignore(int argc,
155
+ const char **argv,
156
+ const char *prefix,
157
+ struct repository *repo UNUSED)
158
{
159
int num_ignored;
160
struct dir_struct dir = DIR_INIT;
builtin/check-mailmap.c
+4
-1
@@ -40,7 +40,10 @@ static void check_mailmap(struct string_list *mailmap, const char *contact)
40
printf("<%.*s>\n", (int)maillen, mail);
41
}
42
43
-int cmd_check_mailmap(int argc, const char **argv, const char *prefix)
43
+int cmd_check_mailmap(int argc,
44
+ const char **argv,
45
+ const char *prefix,
46
+ struct repository *repo UNUSED)
47
{
48
int i;
49
struct string_list mailmap = STRING_LIST_INIT_NODUP;
builtin/check-ref-format.c
+4
-1
@@ -51,7 +51,10 @@ static int check_ref_format_branch(const char *arg)
51
return 0;
52
}
53
54
-int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
54
+int cmd_check_ref_format(int argc,
55
+ const char **argv,
56
+ const char *prefix,
57
+ struct repository *repo UNUSED)
58
{
59
int i;
60
int normalize = 0;
builtin/checkout--worker.c
+4
-1
@@ -113,7 +113,10 @@ static const char * const checkout_worker_usage[] = {
113
NULL
114
};
115
116
-int cmd_checkout__worker(int argc, const char **argv, const char *prefix)
116
+int cmd_checkout__worker(int argc,
117
+ const char **argv,
118
+ const char *prefix,
119
+ struct repository *repo UNUSED)
120
{
121
struct checkout state = CHECKOUT_INIT;
122
struct option checkout_worker_options[] = {
builtin/checkout-index.c
+4
-1
@@ -208,7 +208,10 @@ static int option_parse_stage(const struct option *opt,
208
return 0;
209
}
210
211
-int cmd_checkout_index(int argc, const char **argv, const char *prefix)
211
+int cmd_checkout_index(int argc,
212
+ const char **argv,
213
+ const char *prefix,
214
+ struct repository *repo UNUSED)
215
{
216
int i;
217
struct lock_file lock_file = LOCK_INIT;
builtin/checkout.c
+12
-3
@@ -1953,7 +1953,10 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
1953
return ret;
1954
}
1955
1956
-int cmd_checkout(int argc, const char **argv, const char *prefix)
1956
+int cmd_checkout(int argc,
1957
+ const char **argv,
1958
+ const char *prefix,
1959
+ struct repository *repo UNUSED)
1960
{
1961
struct checkout_opts opts = CHECKOUT_OPTS_INIT;
1962
struct option *options;
@@ -2000,7 +2003,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
2003
checkout_usage);
2004
}
2005
2003
-int cmd_switch(int argc, const char **argv, const char *prefix)
2006
+int cmd_switch(int argc,
2007
+ const char **argv,
2008
+ const char *prefix,
2009
+ struct repository *repo UNUSED)
2010
{
2011
struct checkout_opts opts = CHECKOUT_OPTS_INIT;
2012
struct option *options = NULL;
@@ -2036,7 +2042,10 @@ int cmd_switch(int argc, const char **argv, const char *prefix)
2042
switch_branch_usage);
2043
}
2044
2039
-int cmd_restore(int argc, const char **argv, const char *prefix)
2045
+int cmd_restore(int argc,
2046
+ const char **argv,
2047
+ const char *prefix,
2048
+ struct repository *repo UNUSED)
2049
{
2050
struct checkout_opts opts = CHECKOUT_OPTS_INIT;
2051
struct option *options;
builtin/clean.c
+4
-1
@@ -915,7 +915,10 @@ static void correct_untracked_entries(struct dir_struct *dir)
915
dir->nr = dst;
916
}
917
918
-int cmd_clean(int argc, const char **argv, const char *prefix)
918
+int cmd_clean(int argc,
919
+ const char **argv,
920
+ const char *prefix,
921
+ struct repository *repo UNUSED)
922
{
923
int i, res;
924
int dry_run = 0, remove_directories = 0, quiet = 0, ignored = 0;
builtin/clone.c
+4
-1
@@ -956,7 +956,10 @@ static int path_exists(const char *path)
956
return !stat(path, &sb);
957
}
958
959
-int cmd_clone(int argc, const char **argv, const char *prefix)
959
+int cmd_clone(int argc,
960
+ const char **argv,
961
+ const char *prefix,
962
+ struct repository *repository UNUSED)
963
{
964
int is_bundle = 0, is_local;
965
int reject_shallow = 0;
builtin/column.c
+4
-1
@@ -18,7 +18,10 @@ static int column_config(const char *var, const char *value,
18
return git_column_config(var, value, cb, &colopts);
19
}
20
21
-int cmd_column(int argc, const char **argv, const char *prefix)
21
+int cmd_column(int argc,
22
+ const char **argv,
23
+ const char *prefix,
24
+ struct repository *repo UNUSED)
25
{
26
struct string_list list = STRING_LIST_INIT_DUP;
27
struct strbuf sb = STRBUF_INIT;
builtin/commit-graph.c
+4
-1
@@ -331,7 +331,10 @@ cleanup:
331
return result;
332
}
333
334
-int cmd_commit_graph(int argc, const char **argv, const char *prefix)
334
+int cmd_commit_graph(int argc,
335
+ const char **argv,
336
+ const char *prefix,
337
+ struct repository *repo UNUSED)
338
{
339
parse_opt_subcommand_fn *fn = NULL;
340
struct option builtin_commit_graph_options[] = {
builtin/commit-tree.c
+4
-1
@@ -90,7 +90,10 @@ static int parse_file_arg_callback(const struct option *opt,
90
return 0;
91
}
92
93
-int cmd_commit_tree(int argc, const char **argv, const char *prefix)
93
+int cmd_commit_tree(int argc,
94
+ const char **argv,
95
+ const char *prefix,
96
+ struct repository *repo UNUSED)
97
{
98
static struct strbuf buffer = STRBUF_INIT;
99
struct commit_list *parents = NULL;
builtin/commit.c
+8
-2
@@ -1502,7 +1502,10 @@ static int git_status_config(const char *k, const char *v,
1502
return git_diff_ui_config(k, v, ctx, NULL);
1503
}
1504
1505
-int cmd_status(int argc, const char **argv, const char *prefix)
1505
+int cmd_status(int argc,
1506
+const char **argv,
1507
+const char *prefix,
1508
+struct repository *repo UNUSED)
1509
{
1510
static int no_renames = -1;
1511
static const char *rename_score_arg = (const char *)-1;
@@ -1641,7 +1644,10 @@ static int git_commit_config(const char *k, const char *v,
1644
return git_status_config(k, v, ctx, s);
1645
}
1646
1644
-int cmd_commit(int argc, const char **argv, const char *prefix)
1647
+int cmd_commit(int argc,
1648
+ const char **argv,
1649
+ const char *prefix,
1650
+ struct repository *repo UNUSED)
1651
{
1652
static struct wt_status s;
1653
static struct option builtin_commit_options[] = {
builtin/config.c
+4
-1
@@ -1392,7 +1392,10 @@ out:
1392
return ret;
1393
}
1394
1395
-int cmd_config(int argc, const char **argv, const char *prefix)
1395
+int cmd_config(int argc,
1396
+ const char **argv,
1397
+ const char *prefix,
1398
+ struct repository *repo UNUSED)
1399
{
1400
parse_opt_subcommand_fn *subcommand = NULL;
1401
struct option subcommand_opts[] = {
builtin/count-objects.c
+4
-1
@@ -95,7 +95,10 @@ static char const * const count_objects_usage[] = {
95
NULL
96
};
97
98
-int cmd_count_objects(int argc, const char **argv, const char *prefix)
98
+int cmd_count_objects(int argc,
99
+ const char **argv,
100
+ const char *prefix,
101
+ struct repository *repo UNUSED)
102
{
103
int human_readable = 0;
104
struct option opts[] = {
builtin/credential-cache--daemon.c
+8
-2
@@ -287,7 +287,10 @@ static void init_socket_directory(const char *path)
287
free(path_copy);
288
}
289
290
-int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
290
+int cmd_credential_cache_daemon(int argc,
291
+ const char **argv,
292
+ const char *prefix,
293
+ struct repository *repo UNUSED)
294
{
295
struct tempfile *socket_file;
296
const char *socket_path;
@@ -330,7 +333,10 @@ int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
333
334
#else
335
333
-int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
336
+int cmd_credential_cache_daemon(int argc,
337
+const char **argv,
338
+const char *prefix,
339
+struct repository *repo UNUSED)
340
{
341
const char * const usage[] = {
342
"git credential-cache--daemon [--debug] <socket-path>",
builtin/credential-cache.c
+4
-1
@@ -137,7 +137,10 @@ static void announce_capabilities(void)
137
credential_announce_capabilities(&c, stdout);
138
}
139
140
-int cmd_credential_cache(int argc, const char **argv, const char *prefix)
140
+int cmd_credential_cache(int argc,
141
+ const char **argv,
142
+ const char *prefix,
143
+ struct repository *repo UNUSED)
144
{
145
const char *socket_path_arg = NULL;
146
char *socket_path;
builtin/credential-store.c
+4
-1
@@ -170,7 +170,10 @@ static void lookup_credential(const struct string_list *fns, struct credential *
170
return; /* Found credential */
171
}
172
173
-int cmd_credential_store(int argc, const char **argv, const char *prefix)
173
+int cmd_credential_store(int argc,
174
+ const char **argv,
175
+ const char *prefix,
176
+ struct repository *repo UNUSED)
177
{
178
const char * const usage[] = {
179
"git credential-store [<options>] <action>",
builtin/credential.c
+4
-1
@@ -6,7 +6,10 @@
6
static const char usage_msg[] =
7
"git credential (fill|approve|reject)";
8
9
-int cmd_credential(int argc, const char **argv, const char *prefix UNUSED)
9
+int cmd_credential(int argc,
10
+ const char **argv,
11
+ const char *prefix UNUSED,
12
+ struct repository *repo UNUSED)
13
{
14
const char *op;
15
struct credential c = CREDENTIAL_INIT;
builtin/describe.c
+5
-2
@@ -571,7 +571,10 @@ static int option_parse_exact_match(const struct option *opt, const char *arg,
571
return 0;
572
}
573
574
-int cmd_describe(int argc, const char **argv, const char *prefix)
574
+int cmd_describe(int argc,
575
+ const char **argv,
576
+ const char *prefix,
577
+ struct repository *repo UNUSED )
578
{
579
int contains = 0;
580
struct option options[] = {
@@ -650,7 +653,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
653
argv_copy[i] = args.v[i];
654
argv_copy[args.nr] = NULL;
655
653
- ret = cmd_name_rev(args.nr, argv_copy, prefix);
656
+ ret = cmd_name_rev(args.nr, argv_copy, prefix, the_repository);
657
658
strvec_clear(&args);
659
free(argv_copy);
builtin/diagnose.c
+4
-1
@@ -11,7 +11,10 @@ static const char * const diagnose_usage[] = {
11
NULL
12
};
13
14
-int cmd_diagnose(int argc, const char **argv, const char *prefix)
14
+int cmd_diagnose(int argc,
15
+ const char **argv,
16
+ const char *prefix,
17
+ struct repository *repo UNUSED)
18
{
19
struct strbuf zip_path = STRBUF_INIT;
20
time_t now = time(NULL);
builtin/diff-files.c
+4
-1
@@ -17,7 +17,10 @@ static const char diff_files_usage[] =
17
"\n"
18
COMMON_DIFF_OPTIONS_HELP;
19
20
-int cmd_diff_files(int argc, const char **argv, const char *prefix)
20
+int cmd_diff_files(int argc,
21
+ const char **argv,
22
+ const char *prefix,
23
+ struct repository *repo UNUSED)
24
{
25
struct rev_info rev;
26
int result;
builtin/diff-index.c
+4
-1
@@ -14,7 +14,10 @@ static const char diff_cache_usage[] =
14
"\n"
15
COMMON_DIFF_OPTIONS_HELP;
16
17
-int cmd_diff_index(int argc, const char **argv, const char *prefix)
17
+int cmd_diff_index(int argc,
18
+ const char **argv,
19
+ const char *prefix,
20
+ struct repository *repo UNUSED)
21
{
22
struct rev_info rev;
23
unsigned int option = 0;
builtin/diff-tree.c
+4
-1
@@ -108,7 +108,10 @@ static void diff_tree_tweak_rev(struct rev_info *rev)
108
}
109
}
110
111
-int cmd_diff_tree(int argc, const char **argv, const char *prefix)
111
+int cmd_diff_tree(int argc,
112
+ const char **argv,
113
+ const char *prefix,
114
+ struct repository *repo UNUSED)
115
{
116
char line[1000];
117
struct object *tree1, *tree2;
builtin/diff.c
+4
-1
@@ -393,7 +393,10 @@ static void symdiff_release(struct symdiff *sdiff)
393
bitmap_free(sdiff->skip);
394
}
395
396
-int cmd_diff(int argc, const char **argv, const char *prefix)
396
+int cmd_diff(int argc,
397
+ const char **argv,
398
+ const char *prefix,
399
+ struct repository *repo UNUSED)
400
{
401
int i;
402
struct rev_info rev;
builtin/difftool.c
+4
-1
@@ -690,7 +690,10 @@ static int run_file_diff(int prompt, const char *prefix,
690
return run_command(child);
691
}
692
693
-int cmd_difftool(int argc, const char **argv, const char *prefix)
693
+int cmd_difftool(int argc,
694
+ const char **argv,
695
+ const char *prefix,
696
+ struct repository *repo UNUSED)
697
{
698
int use_gui_tool = -1, dir_diff = 0, prompt = -1, symlinks = 0,
699
tool_help = 0, no_index = 0;
builtin/fast-export.c
+4
-1
@@ -1180,7 +1180,10 @@ static int parse_opt_anonymize_map(const struct option *opt,
1180
return 0;
1181
}
1182
1183
-int cmd_fast_export(int argc, const char **argv, const char *prefix)
1183
+int cmd_fast_export(int argc,
1184
+ const char **argv,
1185
+ const char *prefix,
1186
+ struct repository *repo UNUSED)
1187
{
1188
struct rev_info revs;
1189
struct commit *commit;
builtin/fast-import.c
+4
-1
@@ -3537,7 +3537,10 @@ static void parse_argv(void)
3537
build_mark_map(&sub_marks_from, &sub_marks_to);
3538
}
3539
3540
-int cmd_fast_import(int argc, const char **argv, const char *prefix)
3540
+int cmd_fast_import(int argc,
3541
+ const char **argv,
3542
+ const char *prefix,
3543
+ struct repository *repo UNUSED)
3544
{
3545
unsigned int i;
3546
builtin/fetch-pack.c
+4
-1
@@ -43,7 +43,10 @@ static void add_sought_entry(struct ref ***sought, int *nr, int *alloc,
43
(*sought)[*nr - 1] = ref;
44
}
45
46
-int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
46
+int cmd_fetch_pack(int argc,
47
+ const char **argv,
48
+ const char *prefix UNUSED,
49
+ struct repository *repo UNUSED)
50
{
51
int i, ret;
52
struct ref *ref = NULL;
builtin/fetch.c
+4
-1
@@ -2138,7 +2138,10 @@ static int fetch_one(struct remote *remote, int argc, const char **argv,
2138
return exit_code;
2139
}
2140
2141
-int cmd_fetch(int argc, const char **argv, const char *prefix)
2141
+int cmd_fetch(int argc,
2142
+ const char **argv,
2143
+ const char *prefix,
2144
+ struct repository *repo UNUSED)
2145
{
2146
struct fetch_config config = {
2147
.display_format = DISPLAY_FORMAT_FULL,
builtin/fmt-merge-msg.c
+4
-1
@@ -9,7 +9,10 @@ static const char * const fmt_merge_msg_usage[] = {
9
NULL
10
};
11
12
-int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
12
+int cmd_fmt_merge_msg(int argc,
13
+ const char **argv,
14
+ const char *prefix,
15
+ struct repository *repo UNUSED)
16
{
17
char *inpath = NULL;
18
const char *message = NULL;
builtin/for-each-ref.c
+4
-1
@@ -16,7 +16,10 @@ static char const * const for_each_ref_usage[] = {
16
NULL
17
};
18
19
-int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
19
+int cmd_for_each_ref(int argc,
20
+ const char **argv,
21
+ const char *prefix,
22
+ struct repository *repo UNUSED)
23
{
24
struct ref_sorting *sorting;
25
struct string_list sorting_options = STRING_LIST_INIT_DUP;
builtin/for-each-repo.c
+4
-1
@@ -29,7 +29,10 @@ static int run_command_on_repo(const char *path, int argc, const char ** argv)
29
return run_command(&child);
30
}
31
32
-int cmd_for_each_repo(int argc, const char **argv, const char *prefix)
32
+int cmd_for_each_repo(int argc,
33
+ const char **argv,
34
+ const char *prefix,
35
+ struct repository *repo UNUSED)
36
{
37
static const char *config_key = NULL;
38
int keep_going = 0;
builtin/fsck.c
+4
-1
@@ -925,7 +925,10 @@ static struct option fsck_opts[] = {
925
OPT_END(),
926
};
927
928
-int cmd_fsck(int argc, const char **argv, const char *prefix)
928
+int cmd_fsck(int argc,
929
+ const char **argv,
930
+ const char *prefix,
931
+ struct repository *repo UNUSED)
932
{
933
int i;
934
struct object_directory *odb;
builtin/fsmonitor--daemon.c
+5
-2
@@ -1521,7 +1521,10 @@ static int try_to_start_background_daemon(void)
1521
}
1522
}
1523
1524
-int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix)
1524
+int cmd_fsmonitor__daemon(int argc,
1525
+ const char **argv,
1526
+ const char *prefix,
1527
+ struct repository *repo UNUSED)
1528
{
1529
const char *subcmd;
1530
enum fsmonitor_reason reason;
@@ -1584,7 +1587,7 @@ int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix)
1587
}
1588
1589
#else
1587
-int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix UNUSED)
1590
+int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED)
1591
{
1592
struct option options[] = {
1593
OPT_END()
builtin/gc.c
+8
-2
@@ -657,7 +657,10 @@ static void gc_before_repack(struct maintenance_run_opts *opts,
657
}
658
}
659
660
-int cmd_gc(int argc, const char **argv, const char *prefix)
660
+int cmd_gc(int argc,
661
+const char **argv,
662
+const char *prefix,
663
+struct repository *repo UNUSED)
664
{
665
int aggressive = 0;
666
int quiet = 0;
@@ -2890,7 +2893,10 @@ static const char * const builtin_maintenance_usage[] = {
2893
NULL,
2894
};
2895
2893
-int cmd_maintenance(int argc, const char **argv, const char *prefix)
2896
+int cmd_maintenance(int argc,
2897
+ const char **argv,
2898
+ const char *prefix,
2899
+ struct repository *repo UNUSED)
2900
{
2901
parse_opt_subcommand_fn *fn = NULL;
2902
struct option builtin_maintenance_options[] = {
builtin/get-tar-commit-id.c
+4
-1
@@ -12,7 +12,10 @@ static const char builtin_get_tar_commit_id_usage[] =
12
#define RECORDSIZE (512)
13
#define HEADERSIZE (2 * RECORDSIZE)
14
15
-int cmd_get_tar_commit_id(int argc, const char **argv UNUSED, const char *prefix)
15
+int cmd_get_tar_commit_id(int argc,
16
+ const char **argv UNUSED,
17
+ const char *prefix,
18
+ struct repository *repo UNUSED)
19
{
20
char buffer[HEADERSIZE];
21
struct ustar_header *header = (struct ustar_header *)buffer;
builtin/grep.c
+4
-1
@@ -888,7 +888,10 @@ static int pattern_callback(const struct option *opt, const char *arg,
888
return 0;
889
}
890
891
-int cmd_grep(int argc, const char **argv, const char *prefix)
891
+int cmd_grep(int argc,
892
+ const char **argv,
893
+ const char *prefix,
894
+ struct repository *repo UNUSED)
895
{
896
int hit = 0;
897
int cached = 0, untracked = 0, opt_exclude = -1;
builtin/hash-object.c
+4
-1
@@ -84,7 +84,10 @@ static void hash_stdin_paths(const char *type, int no_filters, unsigned flags,
84
strbuf_release(&unquoted);
85
}
86
87
-int cmd_hash_object(int argc, const char **argv, const char *prefix)
87
+int cmd_hash_object(int argc,
88
+ const char **argv,
89
+ const char *prefix,
90
+ struct repository *repo UNUSED)
91
{
92
static const char * const hash_object_usage[] = {
93
N_("git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
builtin/help.c
+4
-1
@@ -631,7 +631,10 @@ static void opt_mode_usage(int argc, const char *opt_mode,
631
no_help_format(opt_mode, fmt);
632
}
633
634
-int cmd_help(int argc, const char **argv, const char *prefix)
634
+int cmd_help(int argc,
635
+ const char **argv,
636
+ const char *prefix,
637
+ struct repository *repo UNUSED)
638
{
639
int nongit;
640
enum help_format parsed_help_format;
builtin/hook.c
+4
-1
@@ -66,7 +66,10 @@ usage:
66
usage_with_options(builtin_hook_run_usage, run_options);
67
}
68
69
-int cmd_hook(int argc, const char **argv, const char *prefix)
69
+int cmd_hook(int argc,
70
+ const char **argv,
71
+ const char *prefix,
72
+ struct repository *repo UNUSED)
73
{
74
parse_opt_subcommand_fn *fn = NULL;
75
struct option builtin_hook_options[] = {
builtin/index-pack.c
+4
-1
@@ -1718,7 +1718,10 @@ static void show_pack_info(int stat_only)
1718
free(chain_histogram);
1719
}
1720
1721
-int cmd_index_pack(int argc, const char **argv, const char *prefix)
1721
+int cmd_index_pack(int argc,
1722
+ const char **argv,
1723
+ const char *prefix,
1724
+ struct repository *repo UNUSED)
1725
{
1726
int i, fix_thin_pack = 0, verify = 0, stat_only = 0, rev_index;
1727
const char *curr_index;
builtin/init-db.c
+4
-1
@@ -70,7 +70,10 @@ static const char *const init_db_usage[] = {
70
* On the other hand, it might just make lookup slower and messier. You
71
* be the judge. The default case is to have one DB per managed directory.
72
*/
73
-int cmd_init_db(int argc, const char **argv, const char *prefix)
73
+int cmd_init_db(int argc,
74
+ const char **argv,
75
+ const char *prefix,
76
+ struct repository *repo UNUSED)
77
{
78
const char *git_dir;
79
const char *real_git_dir = NULL;
builtin/interpret-trailers.c
+4
-1
@@ -188,7 +188,10 @@ static void interpret_trailers(const struct process_trailer_options *opts,
188
strbuf_release(&sb);
189
}
190
191
-int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
191
+int cmd_interpret_trailers(int argc,
192
+ const char **argv,
193
+ const char *prefix,
194
+ struct repository *repo UNUSED)
195
{
196
struct process_trailer_options opts = PROCESS_TRAILER_OPTIONS_INIT;
197
LIST_HEAD(trailers);
builtin/log.c
+24
-6
@@ -637,7 +637,10 @@ static int git_log_config(const char *var, const char *value,
637
return git_diff_ui_config(var, value, ctx, cb);
638
}
639
640
-int cmd_whatchanged(int argc, const char **argv, const char *prefix)
640
+int cmd_whatchanged(int argc,
641
+ const char **argv,
642
+ const char *prefix,
643
+ struct repository *repo UNUSED)
644
{
645
struct log_config cfg;
646
struct rev_info rev;
@@ -758,7 +761,10 @@ static void show_setup_revisions_tweak(struct rev_info *rev)
761
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
762
}
763
761
-int cmd_show(int argc, const char **argv, const char *prefix)
764
+int cmd_show(int argc,
765
+ const char **argv,
766
+ const char *prefix,
767
+ struct repository *repo UNUSED)
768
{
769
struct log_config cfg;
770
struct rev_info rev;
@@ -874,7 +880,10 @@ int cmd_show(int argc, const char **argv, const char *prefix)
880
/*
881
* This is equivalent to "git log -g --abbrev-commit --pretty=oneline"
882
*/
877
-int cmd_log_reflog(int argc, const char **argv, const char *prefix)
883
+int cmd_log_reflog(int argc,
884
+ const char **argv,
885
+ const char *prefix,
886
+ struct repository *repo UNUSED)
887
{
888
struct log_config cfg;
889
struct rev_info rev;
@@ -916,7 +925,10 @@ static void log_setup_revisions_tweak(struct rev_info *rev)
925
diff_merges_default_to_first_parent(rev);
926
}
927
919
-int cmd_log(int argc, const char **argv, const char *prefix)
928
+int cmd_log(int argc,
929
+ const char **argv,
930
+ const char *prefix,
931
+ struct repository *repo UNUSED)
932
{
933
struct log_config cfg;
934
struct rev_info rev;
@@ -1986,7 +1998,10 @@ static void infer_range_diff_ranges(struct strbuf *r1,
1998
}
1999
}
2000
1989
-int cmd_format_patch(int argc, const char **argv, const char *prefix)
2001
+int cmd_format_patch(int argc,
2002
+ const char **argv,
2003
+ const char *prefix,
2004
+ struct repository *repo UNUSED)
2005
{
2006
struct format_config cfg;
2007
struct commit *commit;
@@ -2619,7 +2634,10 @@ static void print_commit(char sign, struct commit *commit, int verbose,
2634
}
2635
}
2636
2622
-int cmd_cherry(int argc, const char **argv, const char *prefix)
2637
+int cmd_cherry(int argc,
2638
+ const char **argv,
2639
+ const char *prefix,
2640
+ struct repository *repo UNUSED)
2641
{
2642
struct rev_info revs;
2643
struct patch_ids ids;
builtin/ls-files.c
+4
-1
@@ -561,7 +561,10 @@ static int option_parse_exclude_standard(const struct option *opt,
561
return 0;
562
}
563
564
-int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
564
+int cmd_ls_files(int argc,
565
+ const char **argv,
566
+ const char *cmd_prefix,
567
+ struct repository *repo UNUSED)
568
{
569
int require_work_tree = 0, show_tag = 0, i;
570
char *max_prefix;
builtin/ls-remote.c
+4
-1
@@ -37,7 +37,10 @@ static int tail_match(const struct strvec *pattern, const char *path)
37
return 0;
38
}
39
40
-int cmd_ls_remote(int argc, const char **argv, const char *prefix)
40
+int cmd_ls_remote(int argc,
41
+ const char **argv,
42
+ const char *prefix,
43
+ struct repository *repo UNUSED)
44
{
45
const char *dest = NULL;
46
unsigned flags = 0;
builtin/ls-tree.c
+4
-1
@@ -329,7 +329,10 @@ static struct ls_tree_cmdmode_to_fmt ls_tree_cmdmode_format[] = {
329
},
330
};
331
332
-int cmd_ls_tree(int argc, const char **argv, const char *prefix)
332
+int cmd_ls_tree(int argc,
333
+ const char **argv,
334
+ const char *prefix,
335
+ struct repository *repo UNUSED)
336
{
337
struct object_id oid;
338
struct tree *tree;
builtin/mailinfo.c
+4
-1
@@ -48,7 +48,10 @@ static int parse_opt_quoted_cr(const struct option *opt, const char *arg, int un
48
return 0;
49
}
50
51
-int cmd_mailinfo(int argc, const char **argv, const char *prefix)
51
+int cmd_mailinfo(int argc,
52
+ const char **argv,
53
+ const char *prefix,
54
+ struct repository *repo UNUSED)
55
{
56
struct metainfo_charset meta_charset;
57
struct mailinfo mi;
builtin/mailsplit.c
+4
-1
@@ -269,7 +269,10 @@ out:
269
return ret;
270
}
271
272
-int cmd_mailsplit(int argc, const char **argv, const char *prefix)
272
+int cmd_mailsplit(int argc,
273
+ const char **argv,
274
+ const char *prefix,
275
+ struct repository *repo UNUSED)
276
{
277
int nr = 0, nr_prec = 4, num = 0;
278
int allow_bare = 0;
builtin/merge-base.c
+4
-1
@@ -143,7 +143,10 @@ static int handle_fork_point(int argc, const char **argv)
143
return 0;
144
}
145
146
-int cmd_merge_base(int argc, const char **argv, const char *prefix)
146
+int cmd_merge_base(int argc,
147
+ const char **argv,
148
+ const char *prefix,
149
+ struct repository *repo UNUSED)
150
{
151
struct commit **rev;
152
int rev_nr = 0;
builtin/merge-file.c
+4
-1
@@ -53,7 +53,10 @@ static int diff_algorithm_cb(const struct option *opt,
53
return 0;
54
}
55
56
-int cmd_merge_file(int argc, const char **argv, const char *prefix)
56
+int cmd_merge_file(int argc,
57
+ const char **argv,
58
+ const char *prefix,
59
+ struct repository *repo UNUSED)
60
{
61
const char *names[3] = { 0 };
62
mmfile_t mmfs[3] = { 0 };
builtin/merge-index.c
+4
-1
@@ -73,7 +73,10 @@ static void merge_all(void)
73
}
74
}
75
76
-int cmd_merge_index(int argc, const char **argv, const char *prefix UNUSED)
76
+int cmd_merge_index(int argc,
77
+ const char **argv,
78
+ const char *prefix UNUSED,
79
+ struct repository *repo UNUSED)
80
{
81
int i, force_file = 0;
82
builtin/merge-ours.c
+4
-1
@@ -15,7 +15,10 @@
15
static const char builtin_merge_ours_usage[] =
16
"git merge-ours <base>... -- HEAD <remote>...";
17
18
-int cmd_merge_ours(int argc, const char **argv, const char *prefix UNUSED)
18
+int cmd_merge_ours(int argc,
19
+ const char **argv,
20
+ const char *prefix UNUSED,
21
+ struct repository *repo UNUSED)
22
{
23
if (argc == 2 && !strcmp(argv[1], "-h"))
24
usage(builtin_merge_ours_usage);
builtin/merge-recursive.c
+4
-1
@@ -21,7 +21,10 @@ static char *better_branch_name(const char *branch)
21
return xstrdup(name ? name : branch);
22
}
23
24
-int cmd_merge_recursive(int argc, const char **argv, const char *prefix UNUSED)
24
+int cmd_merge_recursive(int argc,
25
+ const char **argv,
26
+ const char *prefix UNUSED,
27
+ struct repository *repo UNUSED)
28
{
29
struct object_id bases[21];
30
unsigned bases_count = 0;
builtin/merge-tree.c
+4
-1
@@ -526,7 +526,10 @@ static int real_merge(struct merge_tree_options *o,
526
return !result.clean; /* result.clean < 0 handled above */
527
}
528
529
-int cmd_merge_tree(int argc, const char **argv, const char *prefix)
529
+int cmd_merge_tree(int argc,
530
+ const char **argv,
531
+ const char *prefix,
532
+ struct repository *repo UNUSED)
533
{
534
struct merge_tree_options o = { .show_messages = -1 };
535
struct strvec xopts = STRVEC_INIT;
builtin/merge.c
+6
-3
@@ -1275,7 +1275,10 @@ static int merging_a_throwaway_tag(struct commit *commit)
1275
return is_throwaway_tag;
1276
}
1277
1278
-int cmd_merge(int argc, const char **argv, const char *prefix)
1278
+int cmd_merge(int argc,
1279
+ const char **argv,
1280
+ const char *prefix,
1281
+ struct repository *repo UNUSED)
1282
{
1283
struct object_id result_tree, stash, head_oid;
1284
struct commit *head_commit;
@@ -1347,7 +1350,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1350
REF_NO_DEREF);
1351
1352
/* Invoke 'git reset --merge' */
1350
- ret = cmd_reset(nargc, nargv, prefix);
1353
+ ret = cmd_reset(nargc, nargv, prefix, the_repository);
1354
1355
if (!is_null_oid(&stash_oid)) {
1356
oid_to_hex_r(stash_oid_hex, &stash_oid);
@@ -1379,7 +1382,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1382
die(_("There is no merge in progress (MERGE_HEAD missing)."));
1383
1384
/* Invoke 'git commit' */
1382
- ret = cmd_commit(nargc, nargv, prefix);
1385
+ ret = cmd_commit(nargc, nargv, prefix, the_repository);
1386
goto done;
1387
}
1388
builtin/mktag.c
+4
-1
@@ -71,7 +71,10 @@ static int verify_object_in_tag(struct object_id *tagged_oid, int *tagged_type)
71
return ret;
72
}
73
74
-int cmd_mktag(int argc, const char **argv, const char *prefix)
74
+int cmd_mktag(int argc,
75
+ const char **argv,
76
+ const char *prefix,
77
+ struct repository *repo UNUSED)
78
{
79
static struct option builtin_mktag_options[] = {
80
OPT_BOOL(0, "strict", &option_strict,
builtin/mktree.c
+5
-1
@@ -150,7 +150,10 @@ static void mktree_line(char *buf, int nul_term_line, int allow_missing)
150
free(to_free);
151
}
152
153
-int cmd_mktree(int ac, const char **av, const char *prefix)
153
+int cmd_mktree(int ac,
154
+ const char **av,
155
+ const char *prefix,
156
+ struct repository *repo UNUSED)
157
{
158
struct strbuf sb = STRBUF_INIT;
159
struct object_id oid;
@@ -199,5 +202,6 @@ int cmd_mktree(int ac, const char **av, const char *prefix)
202
used=0; /* reset tree entry buffer for re-use in batch mode */
203
}
204
strbuf_release(&sb);
205
+
206
return 0;
207
}
builtin/multi-pack-index.c
+4
-2
@@ -267,8 +267,10 @@ static int cmd_multi_pack_index_repack(int argc, const char **argv,
267
(size_t)opts.batch_size, opts.flags);
268
}
269
270
-int cmd_multi_pack_index(int argc, const char **argv,
271
- const char *prefix)
270
+int cmd_multi_pack_index(int argc,
271
+ const char **argv,
272
+ const char *prefix,
273
+ struct repository *repo UNUSED)
274
{
275
int res;
276
parse_opt_subcommand_fn *fn = NULL;
builtin/mv.c
+4
-1
@@ -178,7 +178,10 @@ static void remove_empty_src_dirs(const char **src_dir, size_t src_dir_nr)
178
strbuf_release(&a_src_dir);
179
}
180
181
-int cmd_mv(int argc, const char **argv, const char *prefix)
181
+int cmd_mv(int argc,
182
+ const char **argv,
183
+ const char *prefix,
184
+ struct repository *repo UNUSED)
185
{
186
int i, flags, gitmodules_modified = 0;
187
int verbose = 0, show_only = 0, force = 0, ignore_errors = 0, ignore_sparse = 0;
builtin/name-rev.c
+4
-1
@@ -558,7 +558,10 @@ static void name_rev_line(char *p, struct name_ref_data *data)
558
strbuf_release(&buf);
559
}
560
561
-int cmd_name_rev(int argc, const char **argv, const char *prefix)
561
+int cmd_name_rev(int argc,
562
+ const char **argv,
563
+ const char *prefix,
564
+ struct repository *repo UNUSED)
565
{
566
struct mem_pool string_pool;
567
struct object_array revs = OBJECT_ARRAY_INIT;
builtin/notes.c
+4
-1
@@ -1096,7 +1096,10 @@ static int get_ref(int argc, const char **argv, const char *prefix)
1096
return 0;
1097
}
1098
1099
-int cmd_notes(int argc, const char **argv, const char *prefix)
1099
+int cmd_notes(int argc,
1100
+ const char **argv,
1101
+ const char *prefix,
1102
+ struct repository *repo UNUSED)
1103
{
1104
const char *override_notes_ref = NULL;
1105
parse_opt_subcommand_fn *fn = NULL;
builtin/pack-objects.c
+4
-1
@@ -4284,7 +4284,10 @@ static int option_parse_cruft_expiration(const struct option *opt UNUSED,
4284
return 0;
4285
}
4286
4287
-int cmd_pack_objects(int argc, const char **argv, const char *prefix)
4287
+int cmd_pack_objects(int argc,
4288
+ const char **argv,
4289
+ const char *prefix,
4290
+ struct repository *repo UNUSED)
4291
{
4292
int use_internal_rev_list = 0;
4293
int shallow = 0;
builtin/pack-redundant.c
+2
-5
@@ -561,11 +561,8 @@ static void load_all(void)
561
}
562
}
563
564
-int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED)
565
-{
566
- int i;
567
- int i_still_use_this = 0;
568
- struct pack_list *min = NULL, *red, *pl;
564
+int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) {
565
+ int i; int i_still_use_this = 0; struct pack_list *min = NULL, *red, *pl;
566
struct llist *ignore;
567
struct object_id *oid;
568
char buf[GIT_MAX_HEXSZ + 2]; /* hex hash + \n + \0 */
builtin/pack-refs.c
+4
-1
@@ -11,7 +11,10 @@ static char const * const pack_refs_usage[] = {
11
NULL
12
};
13
14
-int cmd_pack_refs(int argc, const char **argv, const char *prefix)
14
+int cmd_pack_refs(int argc,
15
+ const char **argv,
16
+ const char *prefix,
17
+ struct repository *repo UNUSED)
18
{
19
struct ref_exclusions excludes = REF_EXCLUSIONS_INIT;
20
struct string_list included_refs = STRING_LIST_INIT_NODUP;
builtin/patch-id.c
+4
-1
@@ -260,7 +260,10 @@ static int git_patch_id_config(const char *var, const char *value,
260
return git_default_config(var, value, ctx, cb);
261
}
262
263
-int cmd_patch_id(int argc, const char **argv, const char *prefix)
263
+int cmd_patch_id(int argc,
264
+ const char **argv,
265
+ const char *prefix,
266
+ struct repository *repo UNUSED)
267
{
268
/* if nothing is set, default to unstable */
269
struct patch_id_opts config = {0, 0};
builtin/prune-packed.c
+4
-1
@@ -8,7 +8,10 @@ static const char * const prune_packed_usage[] = {
8
NULL
9
};
10
11
-int cmd_prune_packed(int argc, const char **argv, const char *prefix)
11
+int cmd_prune_packed(int argc,
12
+ const char **argv,
13
+ const char *prefix,
14
+ struct repository *repo UNUSED)
15
{
16
int opts = isatty(2) ? PRUNE_PACKED_VERBOSE : 0;
17
const struct option prune_packed_options[] = {
builtin/prune.c
+4
-1
@@ -147,7 +147,10 @@ static void remove_temporary_files(const char *path)
147
closedir(dir);
148
}
149
150
-int cmd_prune(int argc, const char **argv, const char *prefix)
150
+int cmd_prune(int argc,
151
+ const char **argv,
152
+ const char *prefix,
153
+ struct repository *repo UNUSED)
154
{
155
struct rev_info revs;
156
int exclude_promisor_objects = 0;
builtin/pull.c
+4
-1
@@ -977,7 +977,10 @@ static void show_advice_pull_non_ff(void)
977
"invocation.\n"));
978
}
979
980
-int cmd_pull(int argc, const char **argv, const char *prefix)
980
+int cmd_pull(int argc,
981
+ const char **argv,
982
+ const char *prefix,
983
+ struct repository *repository UNUSED)
984
{
985
const char *repo, **refspecs;
986
struct oid_array merge_heads = OID_ARRAY_INIT;
builtin/push.c
+4
-1
@@ -546,7 +546,10 @@ static int git_push_config(const char *k, const char *v,
546
return git_default_config(k, v, ctx, NULL);
547
}
548
549
-int cmd_push(int argc, const char **argv, const char *prefix)
549
+int cmd_push(int argc,
550
+ const char **argv,
551
+ const char *prefix,
552
+ struct repository *repository UNUSED)
553
{
554
int flags = 0;
555
int tags = 0;
builtin/range-diff.c
+4
-1
@@ -13,7 +13,10 @@ N_("git range-diff [<options>] <base> <old-tip> <new-tip>"),
13
NULL
14
};
15
16
-int cmd_range_diff(int argc, const char **argv, const char *prefix)
16
+int cmd_range_diff(int argc,
17
+ const char **argv,
18
+ const char *prefix,
19
+ struct repository *repo UNUSED)
20
{
21
struct diff_options diffopt = { NULL };
22
struct strvec other_arg = STRVEC_INIT;
builtin/read-tree.c
+4
-1
@@ -108,7 +108,10 @@ static int git_read_tree_config(const char *var, const char *value,
108
return git_default_config(var, value, ctx, cb);
109
}
110
111
-int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
111
+int cmd_read_tree(int argc,
112
+ const char **argv,
113
+ const char *cmd_prefix,
114
+ struct repository *repo UNUSED)
115
{
116
int i, stage = 0;
117
struct object_id oid;
builtin/rebase.c
+4
-1
@@ -1063,7 +1063,10 @@ static int check_exec_cmd(const char *cmd)
1063
return 0;
1064
}
1065
1066
-int cmd_rebase(int argc, const char **argv, const char *prefix)
1066
+int cmd_rebase(int argc,
1067
+ const char **argv,
1068
+ const char *prefix,
1069
+ struct repository *repo UNUSED)
1070
{
1071
struct rebase_options options = REBASE_OPTIONS_INIT;
1072
const char *branch_name;
builtin/receive-pack.c
+4
-1
@@ -2480,7 +2480,10 @@ static int delete_only(struct command *commands)
2480
return 1;
2481
}
2482
2483
-int cmd_receive_pack(int argc, const char **argv, const char *prefix)
2483
+int cmd_receive_pack(int argc,
2484
+ const char **argv,
2485
+ const char *prefix,
2486
+ struct repository *repo UNUSED)
2487
{
2488
int advertise_refs = 0;
2489
struct command *commands;
builtin/reflog.c
+6
-3
@@ -244,7 +244,7 @@ static int cmd_reflog_show(int argc, const char **argv, const char *prefix)
244
PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0 |
245
PARSE_OPT_KEEP_UNKNOWN_OPT);
246
247
- return cmd_log_reflog(argc, argv, prefix);
247
+ return cmd_log_reflog(argc, argv, prefix, the_repository);
248
}
249
250
static int show_reflog(const char *refname, void *cb_data UNUSED)
@@ -447,7 +447,10 @@ static int cmd_reflog_exists(int argc, const char **argv, const char *prefix)
447
* main "reflog"
448
*/
449
450
-int cmd_reflog(int argc, const char **argv, const char *prefix)
450
+int cmd_reflog(int argc,
451
+ const char **argv,
452
+ const char *prefix,
453
+ struct repository *repository)
454
{
455
parse_opt_subcommand_fn *fn = NULL;
456
struct option options[] = {
@@ -466,5 +469,5 @@ int cmd_reflog(int argc, const char **argv, const char *prefix)
469
if (fn)
470
return fn(argc - 1, argv + 1, prefix);
471
else
469
- return cmd_log_reflog(argc, argv, prefix);
472
+ return cmd_log_reflog(argc, argv, prefix, repository);
473
}
builtin/refs.c
+4
-1
@@ -90,7 +90,10 @@ static int cmd_refs_verify(int argc, const char **argv, const char *prefix)
90
return ret;
91
}
92
93
-int cmd_refs(int argc, const char **argv, const char *prefix)
93
+int cmd_refs(int argc,
94
+ const char **argv,
95
+ const char *prefix,
96
+ struct repository *repo UNUSED)
97
{
98
const char * const refs_usage[] = {
99
REFS_MIGRATE_USAGE,
builtin/remote-ext.c
+4
-1
@@ -195,7 +195,10 @@ static int command_loop(const char *child)
195
}
196
}
197
198
-int cmd_remote_ext(int argc, const char **argv, const char *prefix)
198
+int cmd_remote_ext(int argc,
199
+ const char **argv,
200
+ const char *prefix,
201
+ struct repository *repo UNUSED)
202
{
203
BUG_ON_NON_EMPTY_PREFIX(prefix);
204
builtin/remote-fd.c
+4
-1
@@ -53,7 +53,10 @@ static void command_loop(int input_fd, int output_fd)
53
}
54
}
55
56
-int cmd_remote_fd(int argc, const char **argv, const char *prefix)
56
+int cmd_remote_fd(int argc,
57
+ const char **argv,
58
+ const char *prefix,
59
+ struct repository *repo UNUSED)
60
{
61
int input_fd = -1;
62
int output_fd = -1;
builtin/remote.c
+4
-1
@@ -1754,7 +1754,10 @@ out:
1754
return 0;
1755
}
1756
1757
-int cmd_remote(int argc, const char **argv, const char *prefix)
1757
+int cmd_remote(int argc,
1758
+ const char **argv,
1759
+ const char *prefix,
1760
+ struct repository *repo UNUSED)
1761
{
1762
parse_opt_subcommand_fn *fn = NULL;
1763
struct option options[] = {
builtin/repack.c
+4
-1
@@ -1116,7 +1116,10 @@ static const char *find_pack_prefix(const char *packdir, const char *packtmp)
1116
return pack_prefix;
1117
}
1118
1119
-int cmd_repack(int argc, const char **argv, const char *prefix)
1119
+int cmd_repack(int argc,
1120
+ const char **argv,
1121
+ const char *prefix,
1122
+ struct repository *repo UNUSED)
1123
{
1124
struct child_process cmd = CHILD_PROCESS_INIT;
1125
struct string_list_item *item;
builtin/replace.c
+4
-1
@@ -545,7 +545,10 @@ static int convert_graft_file(int force)
545
return -1;
546
}
547
548
-int cmd_replace(int argc, const char **argv, const char *prefix)
548
+int cmd_replace(int argc,
549
+ const char **argv,
550
+ const char *prefix,
551
+ struct repository *repo UNUSED)
552
{
553
int force = 0;
554
int raw = 0;
builtin/replay.c
+4
-1
@@ -274,7 +274,10 @@ static struct commit *pick_regular_commit(struct commit *pickme,
274
return create_commit(result->tree, pickme, replayed_base);
275
}
276
277
-int cmd_replay(int argc, const char **argv, const char *prefix)
277
+int cmd_replay(int argc,
278
+ const char **argv,
279
+ const char *prefix,
280
+ struct repository *repo UNUSED)
281
{
282
const char *advance_name_opt = NULL;
283
char *advance_name = NULL;
builtin/rerere.c
+4
-1
@@ -48,7 +48,10 @@ static int diff_two(const char *file1, const char *label1,
48
return ret;
49
}
50
51
-int cmd_rerere(int argc, const char **argv, const char *prefix)
51
+int cmd_rerere(int argc,
52
+ const char **argv,
53
+ const char *prefix,
54
+ struct repository *repo UNUSED)
55
{
56
struct string_list merge_rr = STRING_LIST_INIT_DUP;
57
int i, autoupdate = -1, flags = 0;
builtin/reset.c
+4
-1
@@ -330,7 +330,10 @@ static int git_reset_config(const char *var, const char *value,
330
return git_default_config(var, value, ctx, cb);
331
}
332
333
-int cmd_reset(int argc, const char **argv, const char *prefix)
333
+int cmd_reset(int argc,
334
+ const char **argv,
335
+ const char *prefix,
336
+ struct repository *repo UNUSED)
337
{
338
int reset_type = NONE, update_ref_status = 0, quiet = 0;
339
int no_refresh = 0;
builtin/rev-list.c
+4
-1
@@ -513,7 +513,10 @@ static int try_bitmap_disk_usage(struct rev_info *revs,
513
return 0;
514
}
515
516
-int cmd_rev_list(int argc, const char **argv, const char *prefix)
516
+int cmd_rev_list(int argc,
517
+ const char **argv,
518
+ const char *prefix,
519
+ struct repository *repo UNUSED)
520
{
521
struct rev_info revs;
522
struct rev_list_info info;
builtin/rev-parse.c
+4
-1
@@ -688,7 +688,10 @@ static void print_path(const char *path, const char *prefix, enum format_type fo
688
free(cwd);
689
}
690
691
-int cmd_rev_parse(int argc, const char **argv, const char *prefix)
691
+int cmd_rev_parse(int argc,
692
+ const char **argv,
693
+ const char *prefix,
694
+ struct repository *repo UNUSED)
695
{
696
int i, as_is = 0, verify = 0, quiet = 0, revs_count = 0, type = 0;
697
const struct git_hash_algo *output_algo = NULL;
builtin/revert.c
+8
-2
@@ -261,7 +261,10 @@ static int run_sequencer(int argc, const char **argv, const char *prefix,
261
return sequencer_pick_revisions(the_repository, opts);
262
}
263
264
-int cmd_revert(int argc, const char **argv, const char *prefix)
264
+int cmd_revert(int argc,
265
+ const char **argv,
266
+ const char *prefix,
267
+ struct repository *repo UNUSED)
268
{
269
struct replay_opts opts = REPLAY_OPTS_INIT;
270
int res;
@@ -275,7 +278,10 @@ int cmd_revert(int argc, const char **argv, const char *prefix)
278
return res;
279
}
280
278
-int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
281
+int cmd_cherry_pick(int argc,
282
+const char **argv,
283
+const char *prefix,
284
+struct repository *repo UNUSED)
285
{
286
struct replay_opts opts = REPLAY_OPTS_INIT;
287
int res;
builtin/rm.c
+4
-1
@@ -261,7 +261,10 @@ static struct option builtin_rm_options[] = {
261
OPT_END(),
262
};
263
264
-int cmd_rm(int argc, const char **argv, const char *prefix)
264
+int cmd_rm(int argc,
265
+ const char **argv,
266
+ const char *prefix,
267
+ struct repository *repo UNUSED)
268
{
269
struct lock_file lock_file = LOCK_INIT;
270
int i, ret = 0;
builtin/send-pack.c
+4
-1
@@ -147,7 +147,10 @@ static int send_pack_config(const char *k, const char *v,
147
return git_default_config(k, v, ctx, cb);
148
}
149
150
-int cmd_send_pack(int argc, const char **argv, const char *prefix)
150
+int cmd_send_pack(int argc,
151
+ const char **argv,
152
+ const char *prefix,
153
+ struct repository *repo UNUSED)
154
{
155
struct refspec rs = REFSPEC_INIT_PUSH;
156
const char *remote_name = NULL;
builtin/shortlog.c
+4
-1
@@ -378,7 +378,10 @@ void shortlog_finish_setup(struct shortlog *log)
378
string_list_sort(&log->trailers);
379
}
380
381
-int cmd_shortlog(int argc, const char **argv, const char *prefix)
381
+int cmd_shortlog(int argc,
382
+ const char **argv,
383
+ const char *prefix,
384
+ struct repository *repo UNUSED)
385
{
386
struct shortlog log = { STRING_LIST_INIT_NODUP };
387
struct rev_info rev;
builtin/show-branch.c
+4
-1
@@ -632,7 +632,10 @@ static int parse_reflog_param(const struct option *opt, const char *arg,
632
return 0;
633
}
634
635
-int cmd_show_branch(int ac, const char **av, const char *prefix)
635
+int cmd_show_branch(int ac,
636
+ const char **av,
637
+ const char *prefix,
638
+ struct repository *repo UNUSED)
639
{
640
struct commit *rev[MAX_REVS], *commit;
641
char *reflog_msg[MAX_REVS] = {0};
builtin/show-index.c
+4
-1
@@ -11,7 +11,10 @@ static const char *const show_index_usage[] = {
11
NULL
12
};
13
14
-int cmd_show_index(int argc, const char **argv, const char *prefix)
14
+int cmd_show_index(int argc,
15
+ const char **argv,
16
+ const char *prefix,
17
+ struct repository *repo UNUSED)
18
{
19
int i;
20
unsigned nr;
builtin/show-ref.c
+4
-1
@@ -287,7 +287,10 @@ static int exclude_existing_callback(const struct option *opt, const char *arg,
287
return 0;
288
}
289
290
-int cmd_show_ref(int argc, const char **argv, const char *prefix)
290
+int cmd_show_ref(int argc,
291
+const char **argv,
292
+const char *prefix,
293
+struct repository *repo UNUSED)
294
{
295
struct exclude_existing_options exclude_existing_opts = {0};
296
struct patterns_options patterns_opts = {0};
builtin/sparse-checkout.c
+4
-1
@@ -1030,7 +1030,10 @@ static int sparse_checkout_check_rules(int argc, const char **argv, const char *
1030
return ret;
1031
}
1032
1033
-int cmd_sparse_checkout(int argc, const char **argv, const char *prefix)
1033
+int cmd_sparse_checkout(int argc,
1034
+ const char **argv,
1035
+ const char *prefix,
1036
+ struct repository *repo UNUSED)
1037
{
1038
parse_opt_subcommand_fn *fn = NULL;
1039
struct option builtin_sparse_checkout_options[] = {
builtin/stash.c
+4
-1
@@ -1871,7 +1871,10 @@ static int save_stash(int argc, const char **argv, const char *prefix)
1871
return ret;
1872
}
1873
1874
-int cmd_stash(int argc, const char **argv, const char *prefix)
1874
+int cmd_stash(int argc,
1875
+ const char **argv,
1876
+ const char *prefix,
1877
+ struct repository *repo UNUSED)
1878
{
1879
pid_t pid = getpid();
1880
const char *index_file;
builtin/stripspace.c
+4
-1
@@ -29,7 +29,10 @@ enum stripspace_mode {
29
COMMENT_LINES
30
};
31
32
-int cmd_stripspace(int argc, const char **argv, const char *prefix)
32
+int cmd_stripspace(int argc,
33
+ const char **argv,
34
+ const char *prefix,
35
+ struct repository *repo UNUSED)
36
{
37
struct strbuf buf = STRBUF_INIT;
38
enum stripspace_mode mode = STRIP_DEFAULT;
builtin/submodule--helper.c
+4
-1
@@ -3528,7 +3528,10 @@ cleanup:
3528
return ret;
3529
}
3530
3531
-int cmd_submodule__helper(int argc, const char **argv, const char *prefix)
3531
+int cmd_submodule__helper(int argc,
3532
+ const char **argv,
3533
+ const char *prefix,
3534
+ struct repository *repo UNUSED)
3535
{
3536
parse_opt_subcommand_fn *fn = NULL;
3537
const char *const usage[] = {
builtin/symbolic-ref.c
+4
-1
@@ -41,7 +41,10 @@ static int check_symref(const char *HEAD, int quiet, int shorten, int recurse, i
41
return 0;
42
}
43
44
-int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
44
+int cmd_symbolic_ref(int argc,
45
+ const char **argv,
46
+ const char *prefix,
47
+ struct repository *repo UNUSED)
48
{
49
int quiet = 0, delete = 0, shorten = 0, recurse = 1, ret = 0;
50
const char *msg = NULL;
builtin/tag.c
+4
-1
@@ -457,7 +457,10 @@ static int strbuf_check_tag_ref(struct strbuf *sb, const char *name)
457
return check_refname_format(sb->buf, 0);
458
}
459
460
-int cmd_tag(int argc, const char **argv, const char *prefix)
460
+int cmd_tag(int argc,
461
+ const char **argv,
462
+ const char *prefix,
463
+ struct repository *repo UNUSED)
464
{
465
struct strbuf buf = STRBUF_INIT;
466
struct strbuf ref = STRBUF_INIT;
builtin/unpack-file.c
+4
-1
@@ -25,7 +25,10 @@ static char *create_temp_file(struct object_id *oid)
25
return path;
26
}
27
28
-int cmd_unpack_file(int argc, const char **argv, const char *prefix UNUSED)
28
+int cmd_unpack_file(int argc,
29
+ const char **argv,
30
+ const char *prefix UNUSED,
31
+ struct repository *repo UNUSED)
32
{
33
struct object_id oid;
34
builtin/unpack-objects.c
+4
-1
@@ -601,7 +601,10 @@ static void unpack_all(void)
601
die("unresolved deltas left after unpacking");
602
}
603
604
-int cmd_unpack_objects(int argc, const char **argv, const char *prefix UNUSED)
604
+int cmd_unpack_objects(int argc,
605
+ const char **argv,
606
+ const char *prefix UNUSED,
607
+ struct repository *repo UNUSED)
608
{
609
int i;
610
struct object_id oid;
builtin/update-index.c
+4
-1
@@ -917,7 +917,10 @@ static enum parse_opt_result reupdate_callback(
917
return 0;
918
}
919
920
-int cmd_update_index(int argc, const char **argv, const char *prefix)
920
+int cmd_update_index(int argc,
921
+ const char **argv,
922
+ const char *prefix,
923
+ struct repository *repo UNUSED)
924
{
925
int newfd, entries, has_errors = 0, nul_term_line = 0;
926
enum uc_mode untracked_cache = UC_UNSPECIFIED;
builtin/update-ref.c
+4
-1
@@ -713,7 +713,10 @@ static void update_refs_stdin(void)
713
strbuf_release(&input);
714
}
715
716
-int cmd_update_ref(int argc, const char **argv, const char *prefix)
716
+int cmd_update_ref(int argc,
717
+ const char **argv,
718
+ const char *prefix,
719
+ struct repository *repo UNUSED)
720
{
721
const char *refname, *oldval;
722
struct object_id oid, oldoid;
builtin/update-server-info.c
+4
-1
@@ -9,7 +9,10 @@ static const char * const update_server_info_usage[] = {
9
NULL
10
};
11
12
-int cmd_update_server_info(int argc, const char **argv, const char *prefix)
12
+int cmd_update_server_info(int argc,
13
+ const char **argv,
14
+ const char *prefix,
15
+ struct repository *repo UNUSED)
16
{
17
int force = 0;
18
struct option options[] = {
builtin/upload-archive.c
+8
-2
@@ -18,7 +18,10 @@ static const char deadchild[] =
18
19
#define MAX_ARGS (64)
20
21
-int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix)
21
+int cmd_upload_archive_writer(int argc,
22
+ const char **argv,
23
+ const char *prefix,
24
+ struct repository *repo UNUSED)
25
{
26
struct strvec sent_argv = STRVEC_INIT;
27
const char *arg_cmd = "argument ";
@@ -76,7 +79,10 @@ static ssize_t process_input(int child_fd, int band)
79
return sz;
80
}
81
79
-int cmd_upload_archive(int argc, const char **argv, const char *prefix)
82
+int cmd_upload_archive(int argc,
83
+const char **argv,
84
+const char *prefix,
85
+struct repository *repo UNUSED)
86
{
87
struct child_process writer = CHILD_PROCESS_INIT;
88
builtin/upload-pack.c
+4
-1
@@ -17,7 +17,10 @@ static const char * const upload_pack_usage[] = {
17
NULL
18
};
19
20
-int cmd_upload_pack(int argc, const char **argv, const char *prefix)
20
+int cmd_upload_pack(int argc,
21
+ const char **argv,
22
+ const char *prefix,
23
+ struct repository *repo UNUSED)
24
{
25
const char *dir;
26
int strict = 0;
builtin/var.c
+4
-1
@@ -210,7 +210,10 @@ static int show_config(const char *var, const char *value,
210
return git_default_config(var, value, ctx, cb);
211
}
212
213
-int cmd_var(int argc, const char **argv, const char *prefix UNUSED)
213
+int cmd_var(int argc,
214
+ const char **argv,
215
+ const char *prefix UNUSED,
216
+ struct repository *repo UNUSED)
217
{
218
const struct git_var *git_var;
219
char *val;
builtin/verify-commit.c
+4
-1
@@ -51,7 +51,10 @@ static int verify_commit(const char *name, unsigned flags)
51
return run_gpg_verify((struct commit *)obj, flags);
52
}
53
54
-int cmd_verify_commit(int argc, const char **argv, const char *prefix)
54
+int cmd_verify_commit(int argc,
55
+ const char **argv,
56
+ const char *prefix,
57
+ struct repository *repo UNUSED)
58
{
59
int i = 1, verbose = 0, had_error = 0;
60
unsigned flags = 0;
builtin/verify-pack.c
+4
-1
@@ -61,7 +61,10 @@ static const char * const verify_pack_usage[] = {
61
NULL
62
};
63
64
-int cmd_verify_pack(int argc, const char **argv, const char *prefix)
64
+int cmd_verify_pack(int argc,
65
+ const char **argv,
66
+ const char *prefix,
67
+ struct repository *repo UNUSED)
68
{
69
int err = 0;
70
unsigned int flags = 0;
builtin/verify-tag.c
+4
-1
@@ -19,7 +19,10 @@ static const char * const verify_tag_usage[] = {
19
NULL
20
};
21
22
-int cmd_verify_tag(int argc, const char **argv, const char *prefix)
22
+int cmd_verify_tag(int argc,
23
+ const char **argv,
24
+ const char *prefix,
25
+ struct repository *repo UNUSED)
26
{
27
int i = 1, verbose = 0, had_error = 0;
28
unsigned flags = 0;
builtin/worktree.c
+4
-1
@@ -1392,7 +1392,10 @@ static int repair(int ac, const char **av, const char *prefix)
1392
return rc;
1393
}
1394
1395
-int cmd_worktree(int ac, const char **av, const char *prefix)
1395
+int cmd_worktree(int ac,
1396
+ const char **av,
1397
+ const char *prefix,
1398
+ struct repository *repo UNUSED)
1399
{
1400
parse_opt_subcommand_fn *fn = NULL;
1401
struct option options[] = {
builtin/write-tree.c
+4
-1
@@ -19,7 +19,10 @@ static const char * const write_tree_usage[] = {
19
NULL
20
};
21
22
-int cmd_write_tree(int argc, const char **argv, const char *cmd_prefix)
22
+int cmd_write_tree(int argc,
23
+ const char **argv,
24
+ const char *cmd_prefix,
25
+ struct repository *repo UNUSED)
26
{
27
int flags = 0, ret;
28
const char *tree_prefix = NULL;
git.c
+6
-6
@@ -31,7 +31,7 @@
31
32
struct cmd_struct {
33
const char *cmd;
34
- int (*fn)(int, const char **, const char *);
34
+ int (*fn)(int, const char **, const char *, struct repository *);
35
unsigned int option;
36
};
37
@@ -441,7 +441,7 @@ static int handle_alias(int *argcp, const char ***argv)
441
return ret;
442
}
443
444
-static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
444
+static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct repository *repo)
445
{
446
int status, help;
447
struct stat st;
@@ -479,9 +479,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
479
trace_argv_printf(argv, "trace: built-in: git");
480
trace2_cmd_name(p->cmd);
481
482
- validate_cache_entries(the_repository->index);
483
- status = p->fn(argc, argv, prefix);
484
- validate_cache_entries(the_repository->index);
482
+ validate_cache_entries(repo->index);
483
+ status = p->fn(argc, argv, prefix, (p->option & RUN_SETUP)? repo : NULL);
484
+ validate_cache_entries(repo->index);
485
486
if (status)
487
return status;
@@ -736,7 +736,7 @@ static void handle_builtin(int argc, const char **argv)
736
737
builtin = get_builtin(cmd);
738
if (builtin)
739
- exit(run_builtin(builtin, argc, argv));
739
+ exit(run_builtin(builtin, argc, argv, the_repository));
740
strvec_clear(&args);
741
}
742
help.c
+2
-1
@@ -16,6 +16,7 @@
16
#include "parse-options.h"
17
#include "prompt.h"
18
#include "fsmonitor-ipc.h"
19
+#include "repository.h"
20
21
#ifndef NO_CURL
22
#include "git-curl-compat.h" /* For LIBCURL_VERSION only */
@@ -775,7 +776,7 @@ void get_version_info(struct strbuf *buf, int show_build_options)
776
}
777
}
778
778
-int cmd_version(int argc, const char **argv, const char *prefix)
779
+int cmd_version(int argc, const char **argv, const char *prefix, struct repository *repository UNUSED)
780
{
781
struct strbuf buf = STRBUF_INIT;
782
int build_options = 0;