Skip to content

Commit aaafb67

Browse files
committed
Merge branch 'kn/pass-repo-to-builtin-sub-sub-commands' into kn/midx-wo-the-repository
* kn/pass-repo-to-builtin-sub-sub-commands: builtin: pass repository to sub commands Git 2.47.1 Makefile(s): avoid recipe prefix in conditional statements doc: switch links to https doc: update links to current pages The eleventh batch pack-objects: only perform verbatim reuse on the preferred pack t5332-multi-pack-reuse.sh: demonstrate duplicate packing failure test-lib: move malloc-debug setup after $PATH setup builtin/difftool: intialize some hashmap variables refspec: store raw refspecs inside refspec_item refspec: drop separate raw_nr count fetch: adjust refspec->raw_nr when filtering prefetch refspecs test-lib: check malloc debug LD_PRELOAD before using
2 parents 33833ed + 6f33d8e commit aaafb67

29 files changed

+406
-279
lines changed

Documentation/RelNotes/2.47.1.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ Fixes since Git 2.47
2424
* A "git fetch" from the superproject going down to a submodule used
2525
a wrong remote when the default remote names are set differently
2626
between them.
27+
28+
* The "gitk" project tree has been synchronized again with its new
29+
maintainer, Johannes Sixt.
30+
31+
Also contains minor documentation updates and code clean-ups.

Documentation/RelNotes/2.48.0.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,20 @@ Fixes since v2.47
145145
repository. Work it around by including these objects in the
146146
referring promisor pack at the receiving end of the fetch.
147147

148+
* Avoid build/test breakage on a system without working malloc debug
149+
support dynamic library.
150+
(merge 72ad6dc368 jk/test-malloc-debug-check later to maint).
151+
152+
* Double-free fix.
153+
(merge fe17a25905 jk/fetch-prefetch-double-free-fix later to maint).
154+
155+
* Use of some uninitialized variables in "git difftool" has been
156+
corrected.
157+
158+
* Object reuse code based on multi-pack-index sent an unwanted copy
159+
of object.
160+
(merge e199290592 tb/multi-pack-reuse-dupfix later to maint).
161+
148162
* Other code cleanup, docfix, build fix, etc.
149163
(merge 1164e270b5 jk/output-prefix-cleanup later to maint).
150164
(merge f36b8cbaef jh/config-unset-doc-fix later to maint).

builtin/bisect.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,15 +1312,17 @@ static int bisect_run(struct bisect_terms *terms, int argc, const char **argv)
13121312
return res;
13131313
}
13141314

1315-
static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNUSED)
1315+
static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNUSED,
1316+
struct repository *repo UNUSED)
13161317
{
13171318
if (argc > 1)
13181319
return error(_("'%s' requires either no argument or a commit"),
13191320
"git bisect reset");
13201321
return bisect_reset(argc ? argv[0] : NULL);
13211322
}
13221323

1323-
static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNUSED)
1324+
static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNUSED,
1325+
struct repository *repo UNUSED)
13241326
{
13251327
int res;
13261328
struct bisect_terms terms = { 0 };
@@ -1333,7 +1335,8 @@ static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNU
13331335
return res;
13341336
}
13351337

1336-
static int cmd_bisect__start(int argc, const char **argv, const char *prefix UNUSED)
1338+
static int cmd_bisect__start(int argc, const char **argv, const char *prefix UNUSED,
1339+
struct repository *repo UNUSED)
13371340
{
13381341
int res;
13391342
struct bisect_terms terms = { 0 };
@@ -1344,7 +1347,8 @@ static int cmd_bisect__start(int argc, const char **argv, const char *prefix UNU
13441347
return res;
13451348
}
13461349

1347-
static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *prefix)
1350+
static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *prefix,
1351+
struct repository *repo UNUSED)
13481352
{
13491353
int res;
13501354
struct bisect_terms terms = { 0 };
@@ -1358,12 +1362,15 @@ static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *pref
13581362
return res;
13591363
}
13601364

1361-
static int cmd_bisect__log(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED)
1365+
static int cmd_bisect__log(int argc UNUSED, const char **argv UNUSED,
1366+
const char *prefix UNUSED,
1367+
struct repository *repo UNUSED)
13621368
{
13631369
return bisect_log();
13641370
}
13651371

1366-
static int cmd_bisect__replay(int argc, const char **argv, const char *prefix UNUSED)
1372+
static int cmd_bisect__replay(int argc, const char **argv, const char *prefix UNUSED,
1373+
struct repository *repo UNUSED)
13671374
{
13681375
int res;
13691376
struct bisect_terms terms = { 0 };
@@ -1376,7 +1383,8 @@ static int cmd_bisect__replay(int argc, const char **argv, const char *prefix UN
13761383
return res;
13771384
}
13781385

1379-
static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUSED)
1386+
static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUSED,
1387+
struct repository *repo UNUSED)
13801388
{
13811389
int res;
13821390
struct bisect_terms terms = { 0 };
@@ -1388,7 +1396,8 @@ static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUS
13881396
return res;
13891397
}
13901398

1391-
static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix UNUSED)
1399+
static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix UNUSED,
1400+
struct repository *repo UNUSED)
13921401
{
13931402
int res;
13941403
struct bisect_terms terms = { 0 };
@@ -1399,7 +1408,8 @@ static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix
13991408
return res;
14001409
}
14011410

1402-
static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSED)
1411+
static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSED,
1412+
struct repository *repo UNUSED)
14031413
{
14041414
int res;
14051415
struct bisect_terms terms = { 0 };
@@ -1415,7 +1425,7 @@ static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSE
14151425
int cmd_bisect(int argc,
14161426
const char **argv,
14171427
const char *prefix,
1418-
struct repository *repo UNUSED)
1428+
struct repository *repo)
14191429
{
14201430
int res = 0;
14211431
parse_opt_subcommand_fn *fn = NULL;
@@ -1451,7 +1461,7 @@ int cmd_bisect(int argc,
14511461
} else {
14521462
argc--;
14531463
argv++;
1454-
res = fn(argc, argv, prefix);
1464+
res = fn(argc, argv, prefix, repo);
14551465
}
14561466

14571467
return is_bisect_success(res) ? 0 : -res;

builtin/bundle.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ static int parse_options_cmd_bundle(int argc,
6767
return argc;
6868
}
6969

70-
static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
70+
static int cmd_bundle_create(int argc, const char **argv, const char *prefix,
71+
struct repository *repo UNUSED) {
7172
struct strvec pack_opts = STRVEC_INIT;
7273
int version = -1;
7374
int ret;
@@ -123,7 +124,8 @@ static int open_bundle(const char *path, struct bundle_header *header,
123124
return read_bundle_header(path, header);
124125
}
125126

126-
static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
127+
static int cmd_bundle_verify(int argc, const char **argv, const char *prefix,
128+
struct repository *repo UNUSED) {
127129
struct bundle_header header = BUNDLE_HEADER_INIT;
128130
int bundle_fd = -1;
129131
int quiet = 0;
@@ -164,7 +166,8 @@ static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
164166
return ret;
165167
}
166168

167-
static int cmd_bundle_list_heads(int argc, const char **argv, const char *prefix) {
169+
static int cmd_bundle_list_heads(int argc, const char **argv, const char *prefix,
170+
struct repository *repo UNUSED) {
168171
struct bundle_header header = BUNDLE_HEADER_INIT;
169172
int bundle_fd = -1;
170173
int ret;
@@ -189,7 +192,8 @@ static int cmd_bundle_list_heads(int argc, const char **argv, const char *prefix
189192
return ret;
190193
}
191194

192-
static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix) {
195+
static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix,
196+
struct repository *repo UNUSED) {
193197
struct bundle_header header = BUNDLE_HEADER_INIT;
194198
int bundle_fd = -1;
195199
int ret;
@@ -231,7 +235,7 @@ static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix)
231235
int cmd_bundle(int argc,
232236
const char **argv,
233237
const char *prefix,
234-
struct repository *repo UNUSED)
238+
struct repository *repo)
235239
{
236240
parse_opt_subcommand_fn *fn = NULL;
237241
struct option options[] = {
@@ -247,5 +251,5 @@ int cmd_bundle(int argc,
247251

248252
packet_trace_identity("bundle");
249253

250-
return !!fn(argc, argv, prefix);
254+
return !!fn(argc, argv, prefix, repo);
251255
}

builtin/commit-graph.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ static struct option *add_common_options(struct option *to)
6262
return parse_options_concat(common_opts, to);
6363
}
6464

65-
static int graph_verify(int argc, const char **argv, const char *prefix)
65+
static int graph_verify(int argc, const char **argv, const char *prefix,
66+
struct repository *repo UNUSED)
6667
{
6768
struct commit_graph *graph = NULL;
6869
struct object_directory *odb = NULL;
@@ -214,7 +215,8 @@ static int git_commit_graph_write_config(const char *var, const char *value,
214215
return 0;
215216
}
216217

217-
static int graph_write(int argc, const char **argv, const char *prefix)
218+
static int graph_write(int argc, const char **argv, const char *prefix,
219+
struct repository *repo UNUSED)
218220
{
219221
struct string_list pack_indexes = STRING_LIST_INIT_DUP;
220222
struct strbuf buf = STRBUF_INIT;
@@ -333,7 +335,7 @@ static int graph_write(int argc, const char **argv, const char *prefix)
333335
int cmd_commit_graph(int argc,
334336
const char **argv,
335337
const char *prefix,
336-
struct repository *repo UNUSED)
338+
struct repository *repo)
337339
{
338340
parse_opt_subcommand_fn *fn = NULL;
339341
struct option builtin_commit_graph_options[] = {
@@ -352,5 +354,5 @@ int cmd_commit_graph(int argc,
352354
builtin_commit_graph_usage, 0);
353355
FREE_AND_NULL(options);
354356

355-
return fn(argc, argv, prefix);
357+
return fn(argc, argv, prefix, repo);
356358
}

builtin/config.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,8 @@ static void display_options_init(struct config_display_options *opts)
826826
}
827827
}
828828

829-
static int cmd_config_list(int argc, const char **argv, const char *prefix)
829+
static int cmd_config_list(int argc, const char **argv, const char *prefix,
830+
struct repository *repo UNUSED)
830831
{
831832
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
832833
struct config_display_options display_opts = CONFIG_DISPLAY_OPTIONS_INIT;
@@ -861,7 +862,8 @@ static int cmd_config_list(int argc, const char **argv, const char *prefix)
861862
return 0;
862863
}
863864

864-
static int cmd_config_get(int argc, const char **argv, const char *prefix)
865+
static int cmd_config_get(int argc, const char **argv, const char *prefix,
866+
struct repository *repo UNUSED)
865867
{
866868
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
867869
struct config_display_options display_opts = CONFIG_DISPLAY_OPTIONS_INIT;
@@ -915,7 +917,8 @@ static int cmd_config_get(int argc, const char **argv, const char *prefix)
915917
return ret;
916918
}
917919

918-
static int cmd_config_set(int argc, const char **argv, const char *prefix)
920+
static int cmd_config_set(int argc, const char **argv, const char *prefix,
921+
struct repository *repo UNUSED)
919922
{
920923
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
921924
const char *value_pattern = NULL, *comment_arg = NULL;
@@ -973,7 +976,8 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix)
973976
return ret;
974977
}
975978

976-
static int cmd_config_unset(int argc, const char **argv, const char *prefix)
979+
static int cmd_config_unset(int argc, const char **argv, const char *prefix,
980+
struct repository *repo UNUSED)
977981
{
978982
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
979983
const char *value_pattern = NULL;
@@ -1010,7 +1014,8 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix)
10101014
return ret;
10111015
}
10121016

1013-
static int cmd_config_rename_section(int argc, const char **argv, const char *prefix)
1017+
static int cmd_config_rename_section(int argc, const char **argv, const char *prefix,
1018+
struct repository *repo UNUSED)
10141019
{
10151020
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
10161021
struct option opts[] = {
@@ -1039,7 +1044,8 @@ static int cmd_config_rename_section(int argc, const char **argv, const char *pr
10391044
return ret;
10401045
}
10411046

1042-
static int cmd_config_remove_section(int argc, const char **argv, const char *prefix)
1047+
static int cmd_config_remove_section(int argc, const char **argv, const char *prefix,
1048+
struct repository *repo UNUSED)
10431049
{
10441050
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
10451051
struct option opts[] = {
@@ -1099,7 +1105,8 @@ static int show_editor(struct config_location_options *opts)
10991105
return 0;
11001106
}
11011107

1102-
static int cmd_config_edit(int argc, const char **argv, const char *prefix)
1108+
static int cmd_config_edit(int argc, const char **argv, const char *prefix,
1109+
struct repository *repo UNUSED)
11031110
{
11041111
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
11051112
struct option opts[] = {
@@ -1395,7 +1402,7 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
13951402
int cmd_config(int argc,
13961403
const char **argv,
13971404
const char *prefix,
1398-
struct repository *repo UNUSED)
1405+
struct repository *repo)
13991406
{
14001407
parse_opt_subcommand_fn *subcommand = NULL;
14011408
struct option subcommand_opts[] = {
@@ -1422,7 +1429,7 @@ int cmd_config(int argc,
14221429
if (subcommand) {
14231430
argc = parse_options(argc, argv, prefix, subcommand_opts, builtin_config_usage,
14241431
PARSE_OPT_SUBCOMMAND_OPTIONAL|PARSE_OPT_KEEP_UNKNOWN_OPT);
1425-
return subcommand(argc, argv, prefix);
1432+
return subcommand(argc, argv, prefix, repo);
14261433
}
14271434

14281435
return cmd_config_actions(argc, argv, prefix);

builtin/difftool.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
376376
struct checkout lstate, rstate;
377377
int err = 0;
378378
struct child_process cmd = CHILD_PROCESS_INIT;
379-
struct hashmap wt_modified, tmp_modified;
379+
struct hashmap wt_modified = HASHMAP_INIT(path_entry_cmp, NULL);
380+
struct hashmap tmp_modified = HASHMAP_INIT(path_entry_cmp, NULL);
380381
int indices_loaded = 0;
381382

382383
workdir = repo_get_work_tree(the_repository);
@@ -601,9 +602,6 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
601602
* in the common case of --symlinks and the difftool updating
602603
* files through the symlink.
603604
*/
604-
hashmap_init(&wt_modified, path_entry_cmp, NULL, wtindex.cache_nr);
605-
hashmap_init(&tmp_modified, path_entry_cmp, NULL, wtindex.cache_nr);
606-
607605
for (i = 0; i < wtindex.cache_nr; i++) {
608606
struct hashmap_entry dummy;
609607
const char *name = wtindex.cache[i]->name;

builtin/fetch.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,14 +454,10 @@ static void filter_prefetch_refspec(struct refspec *rs)
454454
ref_namespace[NAMESPACE_TAGS].ref))) {
455455
int j;
456456

457-
free(rs->items[i].src);
458-
free(rs->items[i].dst);
459-
free(rs->raw[i]);
457+
refspec_item_clear(&rs->items[i]);
460458

461-
for (j = i + 1; j < rs->nr; j++) {
459+
for (j = i + 1; j < rs->nr; j++)
462460
rs->items[j - 1] = rs->items[j];
463-
rs->raw[j - 1] = rs->raw[j];
464-
}
465461
rs->nr--;
466462
i--;
467463
continue;

0 commit comments

Comments
 (0)