mirror of
https://github.com/git/git.git
synced 2024-10-28 04:49:43 +01:00
Merge branch 'ps/leakfixes-part-5'
Even more leak fixes. * ps/leakfixes-part-5: transport: fix leaking negotiation tips transport: fix leaking arguments when fetching from bundle builtin/fetch: fix leaking transaction with `--atomic` remote: fix leaking peer ref when expanding refmap remote: fix leaks when matching refspecs remote: fix leaking config strings builtin/fetch-pack: fix leaking refs sideband: fix leaks when configuring sideband colors builtin/send-pack: fix leaking refspecs transport: fix leaking OID arrays in git:// transport data t/helper: fix leaking multi-pack-indices in "read-midx" builtin/repack: fix leaks when computing packs to repack midx-write: fix leaking hashfile on error cases builtin/archive: fix leaking `OPT_FILENAME()` value builtin/upload-archive: fix leaking args passed to `write_archive()` builtin/merge-tree: fix leaking `-X` strategy options pretty: fix leaking key/value separator buffer pretty: fix memory leaks when parsing pretty formats convert: fix leaks when resetting attributes mailinfo: fix leaking header data
This commit is contained in:
commit
8c1c63d525
41 changed files with 237 additions and 73 deletions
10
archive.c
10
archive.c
|
@ -736,6 +736,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
|
||||||
struct pretty_print_describe_status describe_status = {0};
|
struct pretty_print_describe_status describe_status = {0};
|
||||||
struct pretty_print_context ctx = {0};
|
struct pretty_print_context ctx = {0};
|
||||||
struct archiver_args args;
|
struct archiver_args args;
|
||||||
|
const char **argv_copy;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
|
git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
|
||||||
|
@ -749,6 +750,14 @@ int write_archive(int argc, const char **argv, const char *prefix,
|
||||||
args.repo = repo;
|
args.repo = repo;
|
||||||
args.prefix = prefix;
|
args.prefix = prefix;
|
||||||
string_list_init_dup(&args.extra_files);
|
string_list_init_dup(&args.extra_files);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* `parse_archive_args()` modifies contents of `argv`, which is what we
|
||||||
|
* want. Our callers may not want it though, so we create a copy here.
|
||||||
|
*/
|
||||||
|
DUP_ARRAY(argv_copy, argv, argc);
|
||||||
|
argv = argv_copy;
|
||||||
|
|
||||||
argc = parse_archive_args(argc, argv, &ar, &args, name_hint, remote);
|
argc = parse_archive_args(argc, argv, &ar, &args, name_hint, remote);
|
||||||
if (!startup_info->have_repository) {
|
if (!startup_info->have_repository) {
|
||||||
/*
|
/*
|
||||||
|
@ -767,6 +776,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
|
||||||
string_list_clear_func(&args.extra_files, extra_file_info_clear);
|
string_list_clear_func(&args.extra_files, extra_file_info_clear);
|
||||||
free(args.refname);
|
free(args.refname);
|
||||||
clear_pathspec(&args.pathspec);
|
clear_pathspec(&args.pathspec);
|
||||||
|
free(argv_copy);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,13 +100,16 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
|
||||||
if (output)
|
if (output)
|
||||||
create_output_file(output);
|
create_output_file(output);
|
||||||
|
|
||||||
if (remote)
|
if (remote) {
|
||||||
return run_remote_archiver(argc, argv, remote, exec, output);
|
ret = run_remote_archiver(argc, argv, remote, exec, output);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
|
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
|
||||||
|
|
||||||
ret = write_archive(argc, argv, prefix, the_repository, output, 0);
|
ret = write_archive(argc, argv, prefix, the_repository, output, 0);
|
||||||
|
|
||||||
|
out:
|
||||||
free(output);
|
free(output);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,9 @@ static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix)
|
||||||
&extra_index_pack_args, 0) ||
|
&extra_index_pack_args, 0) ||
|
||||||
list_bundle_refs(&header, argc, argv);
|
list_bundle_refs(&header, argc, argv);
|
||||||
bundle_header_release(&header);
|
bundle_header_release(&header);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
strvec_clear(&extra_index_pack_args);
|
||||||
free(bundle_file);
|
free(bundle_file);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ static void add_sought_entry(struct ref ***sought, int *nr, int *alloc,
|
||||||
int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
|
int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
struct ref *ref = NULL;
|
struct ref *fetched_refs = NULL, *remote_refs = NULL;
|
||||||
const char *dest = NULL;
|
const char *dest = NULL;
|
||||||
struct ref **sought = NULL;
|
struct ref **sought = NULL;
|
||||||
int nr_sought = 0, alloc_sought = 0;
|
int nr_sought = 0, alloc_sought = 0;
|
||||||
|
@ -228,19 +228,20 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
|
||||||
version = discover_version(&reader);
|
version = discover_version(&reader);
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case protocol_v2:
|
case protocol_v2:
|
||||||
get_remote_refs(fd[1], &reader, &ref, 0, NULL, NULL,
|
get_remote_refs(fd[1], &reader, &remote_refs, 0, NULL, NULL,
|
||||||
args.stateless_rpc);
|
args.stateless_rpc);
|
||||||
break;
|
break;
|
||||||
case protocol_v1:
|
case protocol_v1:
|
||||||
case protocol_v0:
|
case protocol_v0:
|
||||||
get_remote_heads(&reader, &ref, 0, NULL, &shallow);
|
get_remote_heads(&reader, &remote_refs, 0, NULL, &shallow);
|
||||||
break;
|
break;
|
||||||
case protocol_unknown_version:
|
case protocol_unknown_version:
|
||||||
BUG("unknown protocol version");
|
BUG("unknown protocol version");
|
||||||
}
|
}
|
||||||
|
|
||||||
ref = fetch_pack(&args, fd, ref, sought, nr_sought,
|
fetched_refs = fetch_pack(&args, fd, remote_refs, sought, nr_sought,
|
||||||
&shallow, pack_lockfiles_ptr, version);
|
&shallow, pack_lockfiles_ptr, version);
|
||||||
|
|
||||||
if (pack_lockfiles.nr) {
|
if (pack_lockfiles.nr) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -260,7 +261,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
|
||||||
if (finish_connect(conn))
|
if (finish_connect(conn))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
ret = !ref;
|
ret = !fetched_refs;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the heads to pull were given, we should have consumed
|
* If the heads to pull were given, we should have consumed
|
||||||
|
@ -270,11 +271,14 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
|
||||||
*/
|
*/
|
||||||
ret |= report_unmatched_refs(sought, nr_sought);
|
ret |= report_unmatched_refs(sought, nr_sought);
|
||||||
|
|
||||||
while (ref) {
|
for (struct ref *ref = fetched_refs; ref; ref = ref->next)
|
||||||
printf("%s %s\n",
|
printf("%s %s\n",
|
||||||
oid_to_hex(&ref->old_oid), ref->name);
|
oid_to_hex(&ref->old_oid), ref->name);
|
||||||
ref = ref->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nr_sought; i++)
|
||||||
|
free_one_ref(sought[i]);
|
||||||
|
free(sought);
|
||||||
|
free_refs(fetched_refs);
|
||||||
|
free_refs(remote_refs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1731,11 +1731,8 @@ static int do_fetch(struct transport *transport,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
retcode = ref_transaction_commit(transaction, &err);
|
retcode = ref_transaction_commit(transaction, &err);
|
||||||
if (retcode) {
|
if (retcode)
|
||||||
ref_transaction_free(transaction);
|
|
||||||
transaction = NULL;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
commit_fetch_head(&fetch_head);
|
commit_fetch_head(&fetch_head);
|
||||||
|
@ -1803,8 +1800,11 @@ static int do_fetch(struct transport *transport,
|
||||||
if (transaction && ref_transaction_abort(transaction, &err) &&
|
if (transaction && ref_transaction_abort(transaction, &err) &&
|
||||||
err.len)
|
err.len)
|
||||||
error("%s", err.buf);
|
error("%s", err.buf);
|
||||||
|
transaction = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (transaction)
|
||||||
|
ref_transaction_free(transaction);
|
||||||
display_state_release(&display_state);
|
display_state_release(&display_state);
|
||||||
close_fetch_head(&fetch_head);
|
close_fetch_head(&fetch_head);
|
||||||
strbuf_release(&err);
|
strbuf_release(&err);
|
||||||
|
|
|
@ -533,6 +533,7 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
|
||||||
int expected_remaining_argc;
|
int expected_remaining_argc;
|
||||||
int original_argc;
|
int original_argc;
|
||||||
const char *merge_base = NULL;
|
const char *merge_base = NULL;
|
||||||
|
int ret;
|
||||||
|
|
||||||
const char * const merge_tree_usage[] = {
|
const char * const merge_tree_usage[] = {
|
||||||
N_("git merge-tree [--write-tree] [<options>] <branch1> <branch2>"),
|
N_("git merge-tree [--write-tree] [<options>] <branch1> <branch2>"),
|
||||||
|
@ -625,7 +626,9 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
|
||||||
strbuf_list_free(split);
|
strbuf_list_free(split);
|
||||||
}
|
}
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
return 0;
|
|
||||||
|
ret = 0;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out which mode to use */
|
/* Figure out which mode to use */
|
||||||
|
@ -664,7 +667,11 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
/* Do the relevant type of merge */
|
/* Do the relevant type of merge */
|
||||||
if (o.mode == MODE_REAL)
|
if (o.mode == MODE_REAL)
|
||||||
return real_merge(&o, merge_base, argv[0], argv[1], prefix);
|
ret = real_merge(&o, merge_base, argv[0], argv[1], prefix);
|
||||||
else
|
else
|
||||||
return trivial_merge(argv[0], argv[1], argv[2]);
|
ret = trivial_merge(argv[0], argv[1], argv[2]);
|
||||||
|
|
||||||
|
out:
|
||||||
|
strvec_clear(&xopts);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -732,14 +732,23 @@ static void midx_included_packs(struct string_list *include,
|
||||||
struct pack_geometry *geometry)
|
struct pack_geometry *geometry)
|
||||||
{
|
{
|
||||||
struct string_list_item *item;
|
struct string_list_item *item;
|
||||||
|
struct strbuf buf = STRBUF_INIT;
|
||||||
|
|
||||||
|
for_each_string_list_item(item, &existing->kept_packs) {
|
||||||
|
strbuf_reset(&buf);
|
||||||
|
strbuf_addf(&buf, "%s.idx", item->string);
|
||||||
|
string_list_insert(include, buf.buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
for_each_string_list_item(item, names) {
|
||||||
|
strbuf_reset(&buf);
|
||||||
|
strbuf_addf(&buf, "pack-%s.idx", item->string);
|
||||||
|
string_list_insert(include, buf.buf);
|
||||||
|
}
|
||||||
|
|
||||||
for_each_string_list_item(item, &existing->kept_packs)
|
|
||||||
string_list_insert(include, xstrfmt("%s.idx", item->string));
|
|
||||||
for_each_string_list_item(item, names)
|
|
||||||
string_list_insert(include, xstrfmt("pack-%s.idx", item->string));
|
|
||||||
if (geometry->split_factor) {
|
if (geometry->split_factor) {
|
||||||
struct strbuf buf = STRBUF_INIT;
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i = geometry->split; i < geometry->pack_nr; i++) {
|
for (i = geometry->split; i < geometry->pack_nr; i++) {
|
||||||
struct packed_git *p = geometry->pack[i];
|
struct packed_git *p = geometry->pack[i];
|
||||||
|
|
||||||
|
@ -754,17 +763,21 @@ static void midx_included_packs(struct string_list *include,
|
||||||
if (!p->pack_local)
|
if (!p->pack_local)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
strbuf_reset(&buf);
|
||||||
strbuf_addstr(&buf, pack_basename(p));
|
strbuf_addstr(&buf, pack_basename(p));
|
||||||
strbuf_strip_suffix(&buf, ".pack");
|
strbuf_strip_suffix(&buf, ".pack");
|
||||||
strbuf_addstr(&buf, ".idx");
|
strbuf_addstr(&buf, ".idx");
|
||||||
|
|
||||||
string_list_insert(include, strbuf_detach(&buf, NULL));
|
string_list_insert(include, buf.buf);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for_each_string_list_item(item, &existing->non_kept_packs) {
|
for_each_string_list_item(item, &existing->non_kept_packs) {
|
||||||
if (pack_is_marked_for_deletion(item))
|
if (pack_is_marked_for_deletion(item))
|
||||||
continue;
|
continue;
|
||||||
string_list_insert(include, xstrfmt("%s.idx", item->string));
|
|
||||||
|
strbuf_reset(&buf);
|
||||||
|
strbuf_addf(&buf, "%s.idx", item->string);
|
||||||
|
string_list_insert(include, buf.buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,8 +797,13 @@ static void midx_included_packs(struct string_list *include,
|
||||||
*/
|
*/
|
||||||
if (pack_is_marked_for_deletion(item))
|
if (pack_is_marked_for_deletion(item))
|
||||||
continue;
|
continue;
|
||||||
string_list_insert(include, xstrfmt("%s.idx", item->string));
|
|
||||||
|
strbuf_reset(&buf);
|
||||||
|
strbuf_addf(&buf, "%s.idx", item->string);
|
||||||
|
string_list_insert(include, buf.buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strbuf_release(&buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int write_midx_included_packs(struct string_list *include,
|
static int write_midx_included_packs(struct string_list *include,
|
||||||
|
@ -1476,7 +1494,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
||||||
mark_packs_for_deletion(&existing, &names);
|
mark_packs_for_deletion(&existing, &names);
|
||||||
|
|
||||||
if (write_midx) {
|
if (write_midx) {
|
||||||
struct string_list include = STRING_LIST_INIT_NODUP;
|
struct string_list include = STRING_LIST_INIT_DUP;
|
||||||
midx_included_packs(&include, &existing, &names, &geometry);
|
midx_included_packs(&include, &existing, &names, &geometry);
|
||||||
|
|
||||||
ret = write_midx_included_packs(&include, &geometry, &names,
|
ret = write_midx_included_packs(&include, &geometry, &names,
|
||||||
|
|
|
@ -338,5 +338,6 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
free_refs(remote_refs);
|
free_refs(remote_refs);
|
||||||
free_refs(local_refs);
|
free_refs(local_refs);
|
||||||
|
refspec_clear(&rs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
struct strvec sent_argv = STRVEC_INIT;
|
struct strvec sent_argv = STRVEC_INIT;
|
||||||
const char *arg_cmd = "argument ";
|
const char *arg_cmd = "argument ";
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (argc != 2 || !strcmp(argv[1], "-h"))
|
if (argc != 2 || !strcmp(argv[1], "-h"))
|
||||||
usage(upload_archive_usage);
|
usage(upload_archive_usage);
|
||||||
|
@ -46,8 +47,11 @@ int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parse all options sent by the client */
|
/* parse all options sent by the client */
|
||||||
return write_archive(sent_argv.nr, sent_argv.v, prefix,
|
ret = write_archive(sent_argv.nr, sent_argv.v, prefix,
|
||||||
the_repository, NULL, 1);
|
the_repository, NULL, 1);
|
||||||
|
|
||||||
|
strvec_clear(&sent_argv);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((format (printf, 1, 2)))
|
__attribute__((format (printf, 1, 2)))
|
||||||
|
|
4
bundle.c
4
bundle.c
|
@ -644,10 +644,8 @@ int unbundle(struct repository *r, struct bundle_header *header,
|
||||||
if (flags & VERIFY_BUNDLE_FSCK)
|
if (flags & VERIFY_BUNDLE_FSCK)
|
||||||
strvec_push(&ip.args, "--fsck-objects");
|
strvec_push(&ip.args, "--fsck-objects");
|
||||||
|
|
||||||
if (extra_index_pack_args) {
|
if (extra_index_pack_args)
|
||||||
strvec_pushv(&ip.args, extra_index_pack_args->v);
|
strvec_pushv(&ip.args, extra_index_pack_args->v);
|
||||||
strvec_clear(extra_index_pack_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
ip.in = bundle_fd;
|
ip.in = bundle_fd;
|
||||||
ip.no_stdout = 1;
|
ip.no_stdout = 1;
|
||||||
|
|
|
@ -1371,6 +1371,9 @@ void reset_parsed_attributes(void)
|
||||||
for (drv = user_convert; drv; drv = next) {
|
for (drv = user_convert; drv; drv = next) {
|
||||||
next = drv->next;
|
next = drv->next;
|
||||||
free((void *)drv->name);
|
free((void *)drv->name);
|
||||||
|
free((void *)drv->smudge);
|
||||||
|
free((void *)drv->clean);
|
||||||
|
free((void *)drv->process);
|
||||||
free(drv);
|
free(drv);
|
||||||
}
|
}
|
||||||
user_convert = NULL;
|
user_convert = NULL;
|
||||||
|
|
17
mailinfo.c
17
mailinfo.c
|
@ -1292,8 +1292,21 @@ void clear_mailinfo(struct mailinfo *mi)
|
||||||
strbuf_release(&mi->inbody_header_accum);
|
strbuf_release(&mi->inbody_header_accum);
|
||||||
free(mi->message_id);
|
free(mi->message_id);
|
||||||
|
|
||||||
strbuf_list_free(mi->p_hdr_data);
|
for (size_t i = 0; header[i]; i++) {
|
||||||
strbuf_list_free(mi->s_hdr_data);
|
if (!mi->p_hdr_data[i])
|
||||||
|
continue;
|
||||||
|
strbuf_release(mi->p_hdr_data[i]);
|
||||||
|
free(mi->p_hdr_data[i]);
|
||||||
|
}
|
||||||
|
free(mi->p_hdr_data);
|
||||||
|
|
||||||
|
for (size_t i = 0; header[i]; i++) {
|
||||||
|
if (!mi->s_hdr_data[i])
|
||||||
|
continue;
|
||||||
|
strbuf_release(mi->s_hdr_data[i]);
|
||||||
|
free(mi->s_hdr_data[i]);
|
||||||
|
}
|
||||||
|
free(mi->s_hdr_data);
|
||||||
|
|
||||||
while (mi->content < mi->content_top) {
|
while (mi->content < mi->content_top) {
|
||||||
free(*(mi->content_top));
|
free(*(mi->content_top));
|
||||||
|
|
24
midx-write.c
24
midx-write.c
|
@ -1306,6 +1306,18 @@ static int write_midx_internal(const char *object_dir,
|
||||||
pack_name_concat_len += MIDX_CHUNK_ALIGNMENT -
|
pack_name_concat_len += MIDX_CHUNK_ALIGNMENT -
|
||||||
(pack_name_concat_len % MIDX_CHUNK_ALIGNMENT);
|
(pack_name_concat_len % MIDX_CHUNK_ALIGNMENT);
|
||||||
|
|
||||||
|
if (ctx.nr - dropped_packs == 0) {
|
||||||
|
error(_("no pack files to index."));
|
||||||
|
result = 1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ctx.entries_nr) {
|
||||||
|
if (flags & MIDX_WRITE_BITMAP)
|
||||||
|
warning(_("refusing to write multi-pack .bitmap without any objects"));
|
||||||
|
flags &= ~(MIDX_WRITE_REV_INDEX | MIDX_WRITE_BITMAP);
|
||||||
|
}
|
||||||
|
|
||||||
if (ctx.incremental) {
|
if (ctx.incremental) {
|
||||||
struct strbuf lock_name = STRBUF_INIT;
|
struct strbuf lock_name = STRBUF_INIT;
|
||||||
|
|
||||||
|
@ -1331,18 +1343,6 @@ static int write_midx_internal(const char *object_dir,
|
||||||
f = hashfd(get_lock_file_fd(&lk), get_lock_file_path(&lk));
|
f = hashfd(get_lock_file_fd(&lk), get_lock_file_path(&lk));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.nr - dropped_packs == 0) {
|
|
||||||
error(_("no pack files to index."));
|
|
||||||
result = 1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ctx.entries_nr) {
|
|
||||||
if (flags & MIDX_WRITE_BITMAP)
|
|
||||||
warning(_("refusing to write multi-pack .bitmap without any objects"));
|
|
||||||
flags &= ~(MIDX_WRITE_REV_INDEX | MIDX_WRITE_BITMAP);
|
|
||||||
}
|
|
||||||
|
|
||||||
cf = init_chunkfile(f);
|
cf = init_chunkfile(f);
|
||||||
|
|
||||||
add_chunk(cf, MIDX_CHUNKID_PACKNAMES, pack_name_concat_len,
|
add_chunk(cf, MIDX_CHUNKID_PACKNAMES, pack_name_concat_len,
|
||||||
|
|
13
pretty.c
13
pretty.c
|
@ -63,7 +63,7 @@ static int git_pretty_formats_config(const char *var, const char *value,
|
||||||
void *cb UNUSED)
|
void *cb UNUSED)
|
||||||
{
|
{
|
||||||
struct cmt_fmt_map *commit_format = NULL;
|
struct cmt_fmt_map *commit_format = NULL;
|
||||||
const char *name;
|
const char *name, *stripped;
|
||||||
char *fmt;
|
char *fmt;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -90,15 +90,21 @@ static int git_pretty_formats_config(const char *var, const char *value,
|
||||||
commit_formats_len++;
|
commit_formats_len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free((char *)commit_format->name);
|
||||||
commit_format->name = xstrdup(name);
|
commit_format->name = xstrdup(name);
|
||||||
commit_format->format = CMIT_FMT_USERFORMAT;
|
commit_format->format = CMIT_FMT_USERFORMAT;
|
||||||
if (git_config_string(&fmt, var, value))
|
if (git_config_string(&fmt, var, value))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (skip_prefix(fmt, "format:", &commit_format->user_format)) {
|
free((char *)commit_format->user_format);
|
||||||
|
if (skip_prefix(fmt, "format:", &stripped)) {
|
||||||
commit_format->is_tformat = 0;
|
commit_format->is_tformat = 0;
|
||||||
} else if (skip_prefix(fmt, "tformat:", &commit_format->user_format)) {
|
commit_format->user_format = xstrdup(stripped);
|
||||||
|
free(fmt);
|
||||||
|
} else if (skip_prefix(fmt, "tformat:", &stripped)) {
|
||||||
commit_format->is_tformat = 1;
|
commit_format->is_tformat = 1;
|
||||||
|
commit_format->user_format = xstrdup(stripped);
|
||||||
|
free(fmt);
|
||||||
} else if (strchr(fmt, '%')) {
|
} else if (strchr(fmt, '%')) {
|
||||||
commit_format->is_tformat = 1;
|
commit_format->is_tformat = 1;
|
||||||
commit_format->user_format = fmt;
|
commit_format->user_format = fmt;
|
||||||
|
@ -1770,6 +1776,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
|
||||||
}
|
}
|
||||||
trailer_out:
|
trailer_out:
|
||||||
string_list_clear(&filter_list, 0);
|
string_list_clear(&filter_list, 0);
|
||||||
|
strbuf_release(&kvsepbuf);
|
||||||
strbuf_release(&sepbuf);
|
strbuf_release(&sepbuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
85
remote.c
85
remote.c
|
@ -243,6 +243,17 @@ static struct branch *make_branch(struct remote_state *remote_state,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void branch_release(struct branch *branch)
|
||||||
|
{
|
||||||
|
free((char *)branch->name);
|
||||||
|
free((char *)branch->refname);
|
||||||
|
free(branch->remote_name);
|
||||||
|
free(branch->pushremote_name);
|
||||||
|
for (int i = 0; i < branch->merge_nr; i++)
|
||||||
|
refspec_item_clear(branch->merge[i]);
|
||||||
|
free(branch->merge);
|
||||||
|
}
|
||||||
|
|
||||||
static struct rewrite *make_rewrite(struct rewrites *r,
|
static struct rewrite *make_rewrite(struct rewrites *r,
|
||||||
const char *base, size_t len)
|
const char *base, size_t len)
|
||||||
{
|
{
|
||||||
|
@ -263,6 +274,14 @@ static struct rewrite *make_rewrite(struct rewrites *r,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rewrites_release(struct rewrites *r)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < r->rewrite_nr; i++)
|
||||||
|
free((char *)r->rewrite[i]->base);
|
||||||
|
free(r->rewrite);
|
||||||
|
memset(r, 0, sizeof(*r));
|
||||||
|
}
|
||||||
|
|
||||||
static void add_instead_of(struct rewrite *rewrite, const char *instead_of)
|
static void add_instead_of(struct rewrite *rewrite, const char *instead_of)
|
||||||
{
|
{
|
||||||
ALLOC_GROW(rewrite->instead_of, rewrite->instead_of_nr + 1, rewrite->instead_of_alloc);
|
ALLOC_GROW(rewrite->instead_of, rewrite->instead_of_nr + 1, rewrite->instead_of_alloc);
|
||||||
|
@ -373,8 +392,10 @@ static int handle_config(const char *key, const char *value,
|
||||||
return -1;
|
return -1;
|
||||||
branch = make_branch(remote_state, name, namelen);
|
branch = make_branch(remote_state, name, namelen);
|
||||||
if (!strcmp(subkey, "remote")) {
|
if (!strcmp(subkey, "remote")) {
|
||||||
|
FREE_AND_NULL(branch->remote_name);
|
||||||
return git_config_string(&branch->remote_name, key, value);
|
return git_config_string(&branch->remote_name, key, value);
|
||||||
} else if (!strcmp(subkey, "pushremote")) {
|
} else if (!strcmp(subkey, "pushremote")) {
|
||||||
|
FREE_AND_NULL(branch->pushremote_name);
|
||||||
return git_config_string(&branch->pushremote_name, key, value);
|
return git_config_string(&branch->pushremote_name, key, value);
|
||||||
} else if (!strcmp(subkey, "merge")) {
|
} else if (!strcmp(subkey, "merge")) {
|
||||||
if (!value)
|
if (!value)
|
||||||
|
@ -406,9 +427,11 @@ static int handle_config(const char *key, const char *value,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Handle remote.* variables */
|
/* Handle remote.* variables */
|
||||||
if (!name && !strcmp(subkey, "pushdefault"))
|
if (!name && !strcmp(subkey, "pushdefault")) {
|
||||||
|
FREE_AND_NULL(remote_state->pushremote_name);
|
||||||
return git_config_string(&remote_state->pushremote_name, key,
|
return git_config_string(&remote_state->pushremote_name, key,
|
||||||
value);
|
value);
|
||||||
|
}
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -475,12 +498,15 @@ static int handle_config(const char *key, const char *value,
|
||||||
else if (!strcmp(value, "--tags"))
|
else if (!strcmp(value, "--tags"))
|
||||||
remote->fetch_tags = 2;
|
remote->fetch_tags = 2;
|
||||||
} else if (!strcmp(subkey, "proxy")) {
|
} else if (!strcmp(subkey, "proxy")) {
|
||||||
|
FREE_AND_NULL(remote->http_proxy);
|
||||||
return git_config_string(&remote->http_proxy,
|
return git_config_string(&remote->http_proxy,
|
||||||
key, value);
|
key, value);
|
||||||
} else if (!strcmp(subkey, "proxyauthmethod")) {
|
} else if (!strcmp(subkey, "proxyauthmethod")) {
|
||||||
|
FREE_AND_NULL(remote->http_proxy_authmethod);
|
||||||
return git_config_string(&remote->http_proxy_authmethod,
|
return git_config_string(&remote->http_proxy_authmethod,
|
||||||
key, value);
|
key, value);
|
||||||
} else if (!strcmp(subkey, "vcs")) {
|
} else if (!strcmp(subkey, "vcs")) {
|
||||||
|
FREE_AND_NULL(remote->foreign_vcs);
|
||||||
return git_config_string(&remote->foreign_vcs, key, value);
|
return git_config_string(&remote->foreign_vcs, key, value);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1318,18 +1344,21 @@ static int match_explicit(struct ref *src, struct ref *dst,
|
||||||
struct ref ***dst_tail,
|
struct ref ***dst_tail,
|
||||||
struct refspec_item *rs)
|
struct refspec_item *rs)
|
||||||
{
|
{
|
||||||
struct ref *matched_src, *matched_dst;
|
struct ref *matched_src = NULL, *matched_dst = NULL;
|
||||||
int allocated_src;
|
int allocated_src = 0, ret;
|
||||||
|
|
||||||
const char *dst_value = rs->dst;
|
const char *dst_value = rs->dst;
|
||||||
char *dst_guess;
|
char *dst_guess;
|
||||||
|
|
||||||
if (rs->pattern || rs->matching || rs->negative)
|
if (rs->pattern || rs->matching || rs->negative) {
|
||||||
return 0;
|
ret = 0;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
matched_src = matched_dst = NULL;
|
if (match_explicit_lhs(src, rs, &matched_src, &allocated_src) < 0) {
|
||||||
if (match_explicit_lhs(src, rs, &matched_src, &allocated_src) < 0)
|
ret = -1;
|
||||||
return -1;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!dst_value) {
|
if (!dst_value) {
|
||||||
int flag;
|
int flag;
|
||||||
|
@ -1368,18 +1397,30 @@ static int match_explicit(struct ref *src, struct ref *dst,
|
||||||
dst_value);
|
dst_value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!matched_dst)
|
|
||||||
return -1;
|
if (!matched_dst) {
|
||||||
if (matched_dst->peer_ref)
|
ret = -1;
|
||||||
return error(_("dst ref %s receives from more than one src"),
|
goto out;
|
||||||
matched_dst->name);
|
}
|
||||||
else {
|
|
||||||
|
if (matched_dst->peer_ref) {
|
||||||
|
ret = error(_("dst ref %s receives from more than one src"),
|
||||||
|
matched_dst->name);
|
||||||
|
goto out;
|
||||||
|
} else {
|
||||||
matched_dst->peer_ref = allocated_src ?
|
matched_dst->peer_ref = allocated_src ?
|
||||||
matched_src :
|
matched_src :
|
||||||
copy_ref(matched_src);
|
copy_ref(matched_src);
|
||||||
matched_dst->force = rs->force;
|
matched_dst->force = rs->force;
|
||||||
|
matched_src = NULL;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (allocated_src)
|
||||||
|
free_one_ref(matched_src);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int match_explicit_refs(struct ref *src, struct ref *dst,
|
static int match_explicit_refs(struct ref *src, struct ref *dst,
|
||||||
|
@ -2040,6 +2081,8 @@ static struct ref *get_expanded_map(const struct ref *remote_refs,
|
||||||
!ignore_symref_update(expn_name, &scratch)) {
|
!ignore_symref_update(expn_name, &scratch)) {
|
||||||
struct ref *cpy = copy_ref(ref);
|
struct ref *cpy = copy_ref(ref);
|
||||||
|
|
||||||
|
if (cpy->peer_ref)
|
||||||
|
free_one_ref(cpy->peer_ref);
|
||||||
cpy->peer_ref = alloc_ref(expn_name);
|
cpy->peer_ref = alloc_ref(expn_name);
|
||||||
if (refspec->force)
|
if (refspec->force)
|
||||||
cpy->peer_ref->force = 1;
|
cpy->peer_ref->force = 1;
|
||||||
|
@ -2797,16 +2840,26 @@ struct remote_state *remote_state_new(void)
|
||||||
|
|
||||||
void remote_state_clear(struct remote_state *remote_state)
|
void remote_state_clear(struct remote_state *remote_state)
|
||||||
{
|
{
|
||||||
|
struct hashmap_iter iter;
|
||||||
|
struct branch *b;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < remote_state->remotes_nr; i++)
|
for (i = 0; i < remote_state->remotes_nr; i++)
|
||||||
remote_clear(remote_state->remotes[i]);
|
remote_clear(remote_state->remotes[i]);
|
||||||
FREE_AND_NULL(remote_state->remotes);
|
FREE_AND_NULL(remote_state->remotes);
|
||||||
|
FREE_AND_NULL(remote_state->pushremote_name);
|
||||||
remote_state->remotes_alloc = 0;
|
remote_state->remotes_alloc = 0;
|
||||||
remote_state->remotes_nr = 0;
|
remote_state->remotes_nr = 0;
|
||||||
|
|
||||||
|
rewrites_release(&remote_state->rewrites);
|
||||||
|
rewrites_release(&remote_state->rewrites_push);
|
||||||
|
|
||||||
hashmap_clear_and_free(&remote_state->remotes_hash, struct remote, ent);
|
hashmap_clear_and_free(&remote_state->remotes_hash, struct remote, ent);
|
||||||
hashmap_clear_and_free(&remote_state->branches_hash, struct remote, ent);
|
hashmap_for_each_entry(&remote_state->branches_hash, &iter, b, ent) {
|
||||||
|
branch_release(b);
|
||||||
|
free(b);
|
||||||
|
}
|
||||||
|
hashmap_clear(&remote_state->branches_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
15
sideband.c
15
sideband.c
|
@ -32,28 +32,27 @@ static int use_sideband_colors(void)
|
||||||
|
|
||||||
const char *key = "color.remote";
|
const char *key = "color.remote";
|
||||||
struct strbuf sb = STRBUF_INIT;
|
struct strbuf sb = STRBUF_INIT;
|
||||||
char *value;
|
const char *value;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (use_sideband_colors_cached >= 0)
|
if (use_sideband_colors_cached >= 0)
|
||||||
return use_sideband_colors_cached;
|
return use_sideband_colors_cached;
|
||||||
|
|
||||||
if (!git_config_get_string(key, &value)) {
|
if (!git_config_get_string_tmp(key, &value))
|
||||||
use_sideband_colors_cached = git_config_colorbool(key, value);
|
use_sideband_colors_cached = git_config_colorbool(key, value);
|
||||||
} else if (!git_config_get_string("color.ui", &value)) {
|
else if (!git_config_get_string_tmp("color.ui", &value))
|
||||||
use_sideband_colors_cached = git_config_colorbool("color.ui", value);
|
use_sideband_colors_cached = git_config_colorbool("color.ui", value);
|
||||||
} else {
|
else
|
||||||
use_sideband_colors_cached = GIT_COLOR_AUTO;
|
use_sideband_colors_cached = GIT_COLOR_AUTO;
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(keywords); i++) {
|
for (i = 0; i < ARRAY_SIZE(keywords); i++) {
|
||||||
strbuf_reset(&sb);
|
strbuf_reset(&sb);
|
||||||
strbuf_addf(&sb, "%s.%s", key, keywords[i].keyword);
|
strbuf_addf(&sb, "%s.%s", key, keywords[i].keyword);
|
||||||
if (git_config_get_string(sb.buf, &value))
|
if (git_config_get_string_tmp(sb.buf, &value))
|
||||||
continue;
|
|
||||||
if (color_parse(value, keywords[i].color))
|
|
||||||
continue;
|
continue;
|
||||||
|
color_parse(value, keywords[i].color);
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_release(&sb);
|
strbuf_release(&sb);
|
||||||
return use_sideband_colors_cached;
|
return use_sideband_colors_cached;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,8 @@ static int read_midx_checksum(const char *object_dir)
|
||||||
if (!m)
|
if (!m)
|
||||||
return 1;
|
return 1;
|
||||||
printf("%s\n", hash_to_hex(get_midx_checksum(m)));
|
printf("%s\n", hash_to_hex(get_midx_checksum(m)));
|
||||||
|
|
||||||
|
close_midx(m);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,10 +104,12 @@ static int read_midx_preferred_pack(const char *object_dir)
|
||||||
|
|
||||||
if (midx_preferred_pack(midx, &preferred_pack) < 0) {
|
if (midx_preferred_pack(midx, &preferred_pack) < 0) {
|
||||||
warning(_("could not determine MIDX preferred pack"));
|
warning(_("could not determine MIDX preferred pack"));
|
||||||
|
close_midx(midx);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s\n", midx->pack_names[preferred_pack]);
|
printf("%s\n", midx->pack_names[preferred_pack]);
|
||||||
|
close_midx(midx);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,8 +126,10 @@ static int read_midx_bitmapped_packs(const char *object_dir)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (i = 0; i < midx->num_packs + midx->num_packs_in_base; i++) {
|
for (i = 0; i < midx->num_packs + midx->num_packs_in_base; i++) {
|
||||||
if (nth_bitmapped_pack(the_repository, midx, &pack, i) < 0)
|
if (nth_bitmapped_pack(the_repository, midx, &pack, i) < 0) {
|
||||||
|
close_midx(midx);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
printf("%s\n", pack_basename(pack.p));
|
printf("%s\n", pack_basename(pack.p));
|
||||||
printf(" bitmap_pos: %"PRIuMAX"\n", (uintmax_t)pack.bitmap_pos);
|
printf(" bitmap_pos: %"PRIuMAX"\n", (uintmax_t)pack.bitmap_pos);
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='git am running'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup: messages' '
|
test_expect_success 'setup: messages' '
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
test_description='Test pretty formats'
|
test_description='Test pretty formats'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# Tested non-UTF-8 encoding
|
# Tested non-UTF-8 encoding
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='git merge-tree --write-tree'
|
test_description='git merge-tree --write-tree'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# This test is ort-specific
|
# This test is ort-specific
|
||||||
|
|
|
@ -25,6 +25,7 @@ commit id embedding:
|
||||||
'
|
'
|
||||||
|
|
||||||
TEST_CREATE_REPO_NO_TEMPLATE=1
|
TEST_CREATE_REPO_NO_TEMPLATE=1
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
SUBSTFORMAT=%H%n
|
SUBSTFORMAT=%H%n
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
test_description='git archive --format=zip test'
|
test_description='git archive --format=zip test'
|
||||||
|
|
||||||
TEST_CREATE_REPO_NO_TEMPLATE=1
|
TEST_CREATE_REPO_NO_TEMPLATE=1
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
SUBSTFORMAT=%H%n
|
SUBSTFORMAT=%H%n
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
test_description='git mailinfo and git mailsplit test'
|
test_description='git mailinfo and git mailsplit test'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
DATA="$TEST_DIRECTORY/t5100"
|
DATA="$TEST_DIRECTORY/t5100"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='multi-pack-indexes'
|
test_description='multi-pack-indexes'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-chunk.sh
|
. "$TEST_DIRECTORY"/lib-chunk.sh
|
||||||
. "$TEST_DIRECTORY"/lib-midx.sh
|
. "$TEST_DIRECTORY"/lib-midx.sh
|
||||||
|
|
|
@ -9,6 +9,7 @@ test_description='See why rewinding head breaks send-pack
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
cnt=64
|
cnt=64
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
test_description='Test the update hook infrastructure.'
|
test_description='Test the update hook infrastructure.'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='send-pack --stdin tests'
|
test_description='send-pack --stdin tests'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
create_ref () {
|
create_ref () {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='remote messages are colorized on the client'
|
test_description='remote messages are colorized on the client'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='fetch/push involving alternates'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
count_objects () {
|
count_objects () {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='git remote porcelain-ish'
|
test_description='git remote porcelain-ish'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
setup_repository () {
|
setup_repository () {
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='Per branch config variables affects "git fetch".
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-bundle.sh
|
. "$TEST_DIRECTORY"/lib-bundle.sh
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='push to a repository that borrows from elsewhere'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='fetch handles conflicting refspecs correctly'
|
test_description='fetch handles conflicting refspecs correctly'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
D=$(pwd)
|
D=$(pwd)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#
|
#
|
||||||
test_description='Test git push porcelain output'
|
test_description='Test git push porcelain output'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# Create commits in <repo> and assign each commit's oid to shell variables
|
# Create commits in <repo> and assign each commit's oid to shell variables
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='"git fetch/pull --set-upstream" basic tests.'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
check_config () {
|
check_config () {
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='git fetch output format'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'fetch with invalid output format configuration' '
|
test_expect_success 'fetch with invalid output format configuration' '
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='upload-pack ref-in-want'
|
test_description='upload-pack ref-in-want'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
get_actual_refs () {
|
get_actual_refs () {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='test disabling of git-over-http in clone/fetch'
|
test_description='test disabling of git-over-http in clone/fetch'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY/lib-proto-disable.sh"
|
. "$TEST_DIRECTORY/lib-proto-disable.sh"
|
||||||
. "$TEST_DIRECTORY/lib-httpd.sh"
|
. "$TEST_DIRECTORY/lib-httpd.sh"
|
||||||
|
|
|
@ -7,6 +7,7 @@ test_description='Tests replace refs functionality'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY/lib-gpg.sh"
|
. "$TEST_DIRECTORY/lib-gpg.sh"
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='git repack works correctly'
|
test_description='git repack works correctly'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
objdir=.git/objects
|
objdir=.git/objects
|
||||||
|
|
|
@ -189,6 +189,8 @@ static int fetch_refs_from_bundle(struct transport *transport,
|
||||||
&extra_index_pack_args,
|
&extra_index_pack_args,
|
||||||
fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0);
|
fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0);
|
||||||
transport->hash_algo = data->header.hash_algo;
|
transport->hash_algo = data->header.hash_algo;
|
||||||
|
|
||||||
|
strvec_clear(&extra_index_pack_args);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,7 +947,13 @@ static int disconnect_git(struct transport *transport)
|
||||||
finish_connect(data->conn);
|
finish_connect(data->conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->options.negotiation_tips) {
|
||||||
|
oid_array_clear(data->options.negotiation_tips);
|
||||||
|
free(data->options.negotiation_tips);
|
||||||
|
}
|
||||||
list_objects_filter_release(&data->options.filter_options);
|
list_objects_filter_release(&data->options.filter_options);
|
||||||
|
oid_array_clear(&data->extra_have);
|
||||||
|
oid_array_clear(&data->shallow);
|
||||||
free(data);
|
free(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue