Merge branch 'ps/leakfixes-part-10' into ps/bisect-double-free-fix

* ps/leakfixes-part-10: (27 commits)
  t: remove TEST_PASSES_SANITIZE_LEAK annotations
  test-lib: unconditionally enable leak checking
  t: remove unneeded !SANITIZE_LEAK prerequisites
  t: mark some tests as leak free
  t5601: work around leak sanitizer issue
  git-compat-util: drop now-unused `UNLEAK()` macro
  global: drop `UNLEAK()` annotation
  t/helper: fix leaking commit graph in "read-graph" subcommand
  builtin/branch: fix leaking sorting options
  builtin/init-db: fix leaking directory paths
  builtin/help: fix leaks in `check_git_cmd()`
  help: fix leaking return value from `help_unknown_cmd()`
  help: fix leaking `struct cmdnames`
  help: refactor to not use globals for reading config
  builtin/sparse-checkout: fix leaking sanitized patterns
  split-index: fix memory leak in `move_cache_to_base_index()`
  git: refactor builtin handling to use a `struct strvec`
  git: refactor alias handling to use a `struct strvec`
  strvec: introduce new `strvec_splice()` function
  line-log: fix leak when rewriting commit parents
  ...
maint
Junio C Hamano 2024-11-26 10:21:58 +09:00
commit c6c977e82b
950 changed files with 360 additions and 1248 deletions

View File

@ -28,8 +28,8 @@ static struct oid_array skipped_revs;


static struct object_id *current_bad_oid; static struct object_id *current_bad_oid;


static const char *term_bad; static char *term_bad;
static const char *term_good; static char *term_good;


/* Remember to update object flag allocation in object.h */ /* Remember to update object flag allocation in object.h */
#define COUNTED (1u<<16) #define COUNTED (1u<<16)
@ -442,9 +442,12 @@ void find_bisection(struct commit_list **commit_list, int *reaches,
best->next = NULL; best->next = NULL;
} }
*reaches = weight(best); *reaches = weight(best);
} else {
free_commit_list(*commit_list);
} }
free(weights);
*commit_list = best; *commit_list = best;

free(weights);
clear_commit_weight(&commit_weight); clear_commit_weight(&commit_weight);
} }


@ -456,6 +459,7 @@ static int register_ref(const char *refname, const char *referent UNUSED, const
strbuf_addstr(&good_prefix, "-"); strbuf_addstr(&good_prefix, "-");


if (!strcmp(refname, term_bad)) { if (!strcmp(refname, term_bad)) {
free(current_bad_oid);
current_bad_oid = xmalloc(sizeof(*current_bad_oid)); current_bad_oid = xmalloc(sizeof(*current_bad_oid));
oidcpy(current_bad_oid, oid); oidcpy(current_bad_oid, oid);
} else if (starts_with(refname, good_prefix.buf)) { } else if (starts_with(refname, good_prefix.buf)) {
@ -556,8 +560,11 @@ struct commit_list *filter_skipped(struct commit_list *list,
tried = &list->next; tried = &list->next;
} else { } else {
if (!show_all) { if (!show_all) {
if (!skipped_first || !*skipped_first) if (!skipped_first || !*skipped_first) {
free_commit_list(next);
free_commit_list(filtered);
return list; return list;
}
} else if (skipped_first && !*skipped_first) { } else if (skipped_first && !*skipped_first) {
/* This means we know it's not skipped */ /* This means we know it's not skipped */
*skipped_first = -1; *skipped_first = -1;
@ -613,7 +620,7 @@ static int sqrti(int val)


static struct commit_list *skip_away(struct commit_list *list, int count) static struct commit_list *skip_away(struct commit_list *list, int count)
{ {
struct commit_list *cur, *previous; struct commit_list *cur, *previous, *result = list;
int prn, index, i; int prn, index, i;


prn = get_prn(count); prn = get_prn(count);
@ -625,15 +632,23 @@ static struct commit_list *skip_away(struct commit_list *list, int count)
for (i = 0; cur; cur = cur->next, i++) { for (i = 0; cur; cur = cur->next, i++) {
if (i == index) { if (i == index) {
if (!oideq(&cur->item->object.oid, current_bad_oid)) if (!oideq(&cur->item->object.oid, current_bad_oid))
return cur; result = cur;
if (previous) else if (previous)
return previous; result = previous;
return list; else
result = list;
break;
} }
previous = cur; previous = cur;
} }


return list; for (cur = list; cur != result; ) {
struct commit_list *next = cur->next;
free(cur);
cur = next;
}

return result;
} }


static struct commit_list *managed_skipped(struct commit_list *list, static struct commit_list *managed_skipped(struct commit_list *list,
@ -801,6 +816,8 @@ static enum bisect_error handle_bad_merge_base(void)
"between %s and [%s].\n"), "between %s and [%s].\n"),
bad_hex, term_bad, term_good, bad_hex, good_hex); bad_hex, term_bad, term_good, bad_hex, good_hex);
} }

free(good_hex);
return BISECT_MERGE_BASE_CHECK; return BISECT_MERGE_BASE_CHECK;
} }


@ -848,8 +865,8 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int
rev + 1, &result) < 0) rev + 1, &result) < 0)
exit(128); exit(128);


for (; result; result = result->next) { for (struct commit_list *l = result; l; l = l->next) {
const struct object_id *mb = &result->item->object.oid; const struct object_id *mb = &l->item->object.oid;
if (oideq(mb, current_bad_oid)) { if (oideq(mb, current_bad_oid)) {
res = handle_bad_merge_base(); res = handle_bad_merge_base();
break; break;
@ -985,7 +1002,7 @@ static void show_commit(struct commit *commit)
* We read them and store them to adapt the messages accordingly. * We read them and store them to adapt the messages accordingly.
* Default is bad/good. * Default is bad/good.
*/ */
void read_bisect_terms(const char **read_bad, const char **read_good) void read_bisect_terms(char **read_bad, char **read_good)
{ {
struct strbuf str = STRBUF_INIT; struct strbuf str = STRBUF_INIT;
const char *filename = git_path_bisect_terms(); const char *filename = git_path_bisect_terms();
@ -993,16 +1010,20 @@ void read_bisect_terms(const char **read_bad, const char **read_good)


if (!fp) { if (!fp) {
if (errno == ENOENT) { if (errno == ENOENT) {
*read_bad = "bad"; free(*read_bad);
*read_good = "good"; *read_bad = xstrdup("bad");
free(*read_good);
*read_good = xstrdup("good");
return; return;
} else { } else {
die_errno(_("could not read file '%s'"), filename); die_errno(_("could not read file '%s'"), filename);
} }
} else { } else {
strbuf_getline_lf(&str, fp); strbuf_getline_lf(&str, fp);
free(*read_bad);
*read_bad = strbuf_detach(&str, NULL); *read_bad = strbuf_detach(&str, NULL);
strbuf_getline_lf(&str, fp); strbuf_getline_lf(&str, fp);
free(*read_good);
*read_good = strbuf_detach(&str, NULL); *read_good = strbuf_detach(&str, NULL);
} }
strbuf_release(&str); strbuf_release(&str);
@ -1024,7 +1045,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
{ {
struct strvec rev_argv = STRVEC_INIT; struct strvec rev_argv = STRVEC_INIT;
struct rev_info revs = REV_INFO_INIT; struct rev_info revs = REV_INFO_INIT;
struct commit_list *tried; struct commit_list *tried = NULL;
int reaches = 0, all = 0, nr, steps; int reaches = 0, all = 0, nr, steps;
enum bisect_error res = BISECT_OK; enum bisect_error res = BISECT_OK;
struct object_id *bisect_rev; struct object_id *bisect_rev;
@ -1091,7 +1112,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
if (oideq(bisect_rev, current_bad_oid)) { if (oideq(bisect_rev, current_bad_oid)) {
res = error_if_skipped_commits(tried, current_bad_oid); res = error_if_skipped_commits(tried, current_bad_oid);
if (res) if (res)
return res; goto cleanup;
printf("%s is the first %s commit\n", oid_to_hex(bisect_rev), printf("%s is the first %s commit\n", oid_to_hex(bisect_rev),
term_bad); term_bad);


@ -1125,6 +1146,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)


res = bisect_checkout(bisect_rev, no_checkout); res = bisect_checkout(bisect_rev, no_checkout);
cleanup: cleanup:
free_commit_list(tried);
release_revisions(&revs); release_revisions(&revs);
strvec_clear(&rev_argv); strvec_clear(&rev_argv);
return res; return res;

View File

@ -75,7 +75,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix);


int estimate_bisect_steps(int all); int estimate_bisect_steps(int all);


void read_bisect_terms(const char **bad, const char **good); void read_bisect_terms(char **bad, char **good);


int bisect_clean_state(void); int bisect_clean_state(void);



View File

@ -2931,6 +2931,7 @@ void setup_blame_bloom_data(struct blame_scoreboard *sb)
void cleanup_scoreboard(struct blame_scoreboard *sb) void cleanup_scoreboard(struct blame_scoreboard *sb)
{ {
free(sb->lineno); free(sb->lineno);
free(sb->final_buf);
clear_prio_queue(&sb->commits); clear_prio_queue(&sb->commits);
oidset_clear(&sb->ignore_list); oidset_clear(&sb->ignore_list);



View File

@ -116,7 +116,7 @@ struct blame_scoreboard {
* Used by many functions to obtain contents of the nth line, * Used by many functions to obtain contents of the nth line,
* indexed with scoreboard.lineno[blame_entry.lno]. * indexed with scoreboard.lineno[blame_entry.lno].
*/ */
const char *final_buf; char *final_buf;
unsigned long final_buf_size; unsigned long final_buf_size;


/* linked list of blames */ /* linked list of blames */

View File

@ -1216,12 +1216,6 @@ parse_done:
output_option &= ~(OUTPUT_COLOR_LINE | OUTPUT_SHOW_AGE_WITH_COLOR); output_option &= ~(OUTPUT_COLOR_LINE | OUTPUT_SHOW_AGE_WITH_COLOR);


output(&sb, output_option); output(&sb, output_option);
free((void *)sb.final_buf);
for (ent = sb.ent; ent; ) {
struct blame_entry *e = ent->next;
free(ent);
ent = e;
}


if (show_stats) { if (show_stats) {
printf("num read blob: %d\n", sb.num_read_blob); printf("num read blob: %d\n", sb.num_read_blob);
@ -1230,6 +1224,12 @@ parse_done:
} }


cleanup: cleanup:
for (ent = sb.ent; ent; ) {
struct blame_entry *e = ent->next;
free(ent);
ent = e;
}

free(path); free(path);
cleanup_scoreboard(&sb); cleanup_scoreboard(&sb);
release_revisions(&revs); release_revisions(&revs);

View File

@ -722,6 +722,7 @@ int cmd_branch(int argc,
static struct ref_sorting *sorting; static struct ref_sorting *sorting;
struct string_list sorting_options = STRING_LIST_INIT_DUP; struct string_list sorting_options = STRING_LIST_INIT_DUP;
struct ref_format format = REF_FORMAT_INIT; struct ref_format format = REF_FORMAT_INIT;
int ret;


struct option options[] = { struct option options[] = {
OPT_GROUP(N_("Generic options")), OPT_GROUP(N_("Generic options")),
@ -851,15 +852,15 @@ int cmd_branch(int argc,
if (list) if (list)
setup_auto_pager("branch", 1); setup_auto_pager("branch", 1);


UNLEAK(sorting_options);

if (delete) { if (delete) {
if (!argc) if (!argc)
die(_("branch name required")); die(_("branch name required"));
return delete_branches(argc, argv, delete > 1, filter.kind, quiet); ret = delete_branches(argc, argv, delete > 1, filter.kind, quiet);
goto out;
} else if (show_current) { } else if (show_current) {
print_current_branch_name(); print_current_branch_name();
return 0; ret = 0;
goto out;
} else if (list) { } else if (list) {
/* git branch --list also shows HEAD when it is detached */ /* git branch --list also shows HEAD when it is detached */
if ((filter.kind & FILTER_REFS_BRANCHES) && filter.detached) if ((filter.kind & FILTER_REFS_BRANCHES) && filter.detached)
@ -882,12 +883,13 @@ int cmd_branch(int argc,
ref_sorting_release(sorting); ref_sorting_release(sorting);
ref_filter_clear(&filter); ref_filter_clear(&filter);
ref_format_clear(&format); ref_format_clear(&format);
return 0;
ret = 0;
goto out;
} else if (edit_description) { } else if (edit_description) {
const char *branch_name; const char *branch_name;
struct strbuf branch_ref = STRBUF_INIT; struct strbuf branch_ref = STRBUF_INIT;
struct strbuf buf = STRBUF_INIT; struct strbuf buf = STRBUF_INIT;
int ret = 1; /* assume failure */


if (!argc) { if (!argc) {
if (filter.detached) if (filter.detached)
@ -901,18 +903,22 @@ int cmd_branch(int argc,
} }


strbuf_addf(&branch_ref, "refs/heads/%s", branch_name); strbuf_addf(&branch_ref, "refs/heads/%s", branch_name);
if (!refs_ref_exists(get_main_ref_store(the_repository), branch_ref.buf)) if (!refs_ref_exists(get_main_ref_store(the_repository), branch_ref.buf)) {
error((!argc || branch_checked_out(branch_ref.buf)) error((!argc || branch_checked_out(branch_ref.buf))
? _("no commit on branch '%s' yet") ? _("no commit on branch '%s' yet")
: _("no branch named '%s'"), : _("no branch named '%s'"),
branch_name); branch_name);
else if (!edit_branch_description(branch_name)) ret = 1;
} else if (!edit_branch_description(branch_name)) {
ret = 0; /* happy */ ret = 0; /* happy */
} else {
ret = 1;
}


strbuf_release(&branch_ref); strbuf_release(&branch_ref);
strbuf_release(&buf); strbuf_release(&buf);


return ret; goto out;
} else if (copy || rename) { } else if (copy || rename) {
if (!argc) if (!argc)
die(_("branch name required")); die(_("branch name required"));
@ -1000,12 +1006,17 @@ int cmd_branch(int argc,
create_branches_recursively(the_repository, branch_name, create_branches_recursively(the_repository, branch_name,
start_name, NULL, force, start_name, NULL, force,
reflog, quiet, track, 0); reflog, quiet, track, 0);
return 0; ret = 0;
goto out;
} }
create_branch(the_repository, branch_name, start_name, force, 0, create_branch(the_repository, branch_name, start_name, force, 0,
reflog, quiet, track, 0); reflog, quiet, track, 0);
} else } else
usage_with_options(builtin_branch_usage, options); usage_with_options(builtin_branch_usage, options);


return 0; ret = 0;

out:
string_list_clear(&sorting_options, 0);
return ret;
} }

View File

@ -1586,7 +1586,6 @@ int cmd_clone(int argc,
free(dir); free(dir);
free(path); free(path);
free(repo_to_free); free(repo_to_free);
UNLEAK(repo);
junk_mode = JUNK_LEAVE_ALL; junk_mode = JUNK_LEAVE_ALL;


transport_ls_refs_options_release(&transport_ls_refs_options); transport_ls_refs_options_release(&transport_ls_refs_options);

View File

@ -628,6 +628,5 @@ int cmd_diff(int argc,
release_revisions(&rev); release_revisions(&rev);
object_array_clear(&ent); object_array_clear(&ent);
symdiff_release(&sdiff); symdiff_release(&sdiff);
UNLEAK(blob);
return result; return result;
} }

View File

@ -551,12 +551,12 @@ static void show_html_page(const char *page)
open_html(page_path.buf); open_html(page_path.buf);
} }


static const char *check_git_cmd(const char* cmd) static char *check_git_cmd(const char *cmd)
{ {
char *alias; char *alias;


if (is_git_command(cmd)) if (is_git_command(cmd))
return cmd; return xstrdup(cmd);


alias = alias_lookup(cmd); alias = alias_lookup(cmd);
if (alias) { if (alias) {
@ -589,14 +589,13 @@ static const char *check_git_cmd(const char* cmd)
die(_("bad alias.%s string: %s"), cmd, die(_("bad alias.%s string: %s"), cmd,
split_cmdline_strerror(count)); split_cmdline_strerror(count));
free(argv); free(argv);
UNLEAK(alias);
return alias; return alias;
} }


if (exclude_guides) if (exclude_guides)
return help_unknown_cmd(cmd); return help_unknown_cmd(cmd);


return cmd; return xstrdup(cmd);
} }


static void no_help_format(const char *opt_mode, enum help_format fmt) static void no_help_format(const char *opt_mode, enum help_format fmt)
@ -642,6 +641,7 @@ int cmd_help(int argc,
{ {
int nongit; int nongit;
enum help_format parsed_help_format; enum help_format parsed_help_format;
char *command = NULL;
const char *page; const char *page;


argc = parse_options(argc, argv, prefix, builtin_help_options, argc = parse_options(argc, argv, prefix, builtin_help_options,
@ -713,9 +713,9 @@ int cmd_help(int argc,
if (help_format == HELP_FORMAT_NONE) if (help_format == HELP_FORMAT_NONE)
help_format = parse_help_format(DEFAULT_HELP_FORMAT); help_format = parse_help_format(DEFAULT_HELP_FORMAT);


argv[0] = check_git_cmd(argv[0]); command = check_git_cmd(argv[0]);


page = cmd_to_page(argv[0]); page = cmd_to_page(command);
switch (help_format) { switch (help_format) {
case HELP_FORMAT_NONE: case HELP_FORMAT_NONE:
case HELP_FORMAT_MAN: case HELP_FORMAT_MAN:
@ -729,5 +729,6 @@ int cmd_help(int argc,
break; break;
} }


free(command);
return 0; return 0;
} }

View File

@ -75,10 +75,12 @@ int cmd_init_db(int argc,
const char *prefix, const char *prefix,
struct repository *repo UNUSED) struct repository *repo UNUSED)
{ {
const char *git_dir; char *git_dir;
const char *real_git_dir = NULL; const char *real_git_dir = NULL;
const char *work_tree; char *real_git_dir_to_free = NULL;
char *work_tree = NULL;
const char *template_dir = NULL; const char *template_dir = NULL;
char *template_dir_to_free = NULL;
unsigned int flags = 0; unsigned int flags = 0;
const char *object_format = NULL; const char *object_format = NULL;
const char *ref_format = NULL; const char *ref_format = NULL;
@ -106,6 +108,7 @@ int cmd_init_db(int argc,
N_("specify the reference format to use")), N_("specify the reference format to use")),
OPT_END() OPT_END()
}; };
int ret;


argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0); argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0);


@ -113,12 +116,10 @@ int cmd_init_db(int argc,
die(_("options '%s' and '%s' cannot be used together"), "--separate-git-dir", "--bare"); die(_("options '%s' and '%s' cannot be used together"), "--separate-git-dir", "--bare");


if (real_git_dir && !is_absolute_path(real_git_dir)) if (real_git_dir && !is_absolute_path(real_git_dir))
real_git_dir = real_pathdup(real_git_dir, 1); real_git_dir = real_git_dir_to_free = real_pathdup(real_git_dir, 1);


if (template_dir && *template_dir && !is_absolute_path(template_dir)) { if (template_dir && *template_dir && !is_absolute_path(template_dir))
template_dir = absolute_pathdup(template_dir); template_dir = template_dir_to_free = absolute_pathdup(template_dir);
UNLEAK(template_dir);
}


if (argc == 1) { if (argc == 1) {
int mkdir_tried = 0; int mkdir_tried = 0;
@ -192,7 +193,7 @@ int cmd_init_db(int argc,
* Set up the default .git directory contents * Set up the default .git directory contents
*/ */
if (!git_dir) if (!git_dir)
git_dir = DEFAULT_GIT_DIR_ENVIRONMENT; git_dir = xstrdup(DEFAULT_GIT_DIR_ENVIRONMENT);


/* /*
* When --separate-git-dir is used inside a linked worktree, take * When --separate-git-dir is used inside a linked worktree, take
@ -213,6 +214,7 @@ int cmd_init_db(int argc,
if (chdir(mainwt.buf) < 0) if (chdir(mainwt.buf) < 0)
die_errno(_("cannot chdir to %s"), mainwt.buf); die_errno(_("cannot chdir to %s"), mainwt.buf);
strbuf_release(&mainwt); strbuf_release(&mainwt);
free(git_dir);
git_dir = strbuf_detach(&sb, NULL); git_dir = strbuf_detach(&sb, NULL);
} }
strbuf_release(&sb); strbuf_release(&sb);
@ -245,12 +247,14 @@ int cmd_init_db(int argc,
set_git_work_tree(work_tree); set_git_work_tree(work_tree);
} }


UNLEAK(real_git_dir);
UNLEAK(git_dir);
UNLEAK(work_tree);

flags |= INIT_DB_EXIST_OK; flags |= INIT_DB_EXIST_OK;
return init_db(git_dir, real_git_dir, template_dir, hash_algo, ret = init_db(git_dir, real_git_dir, template_dir, hash_algo,
ref_storage_format, initial_branch, ref_storage_format, initial_branch,
init_shared_repository, flags); init_shared_repository, flags);

free(template_dir_to_free);
free(real_git_dir_to_free);
free(work_tree);
free(git_dir);
return ret;
} }

View File

@ -669,7 +669,7 @@ static void add_patterns_literal(int argc, const char **argv,
add_patterns_from_input(pl, argc, argv, use_stdin ? stdin : NULL); add_patterns_from_input(pl, argc, argv, use_stdin ? stdin : NULL);
} }


static int modify_pattern_list(int argc, const char **argv, int use_stdin, static int modify_pattern_list(struct strvec *args, int use_stdin,
enum modify_type m) enum modify_type m)
{ {
int result; int result;
@ -679,13 +679,13 @@ static int modify_pattern_list(int argc, const char **argv, int use_stdin,
switch (m) { switch (m) {
case ADD: case ADD:
if (core_sparse_checkout_cone) if (core_sparse_checkout_cone)
add_patterns_cone_mode(argc, argv, pl, use_stdin); add_patterns_cone_mode(args->nr, args->v, pl, use_stdin);
else else
add_patterns_literal(argc, argv, pl, use_stdin); add_patterns_literal(args->nr, args->v, pl, use_stdin);
break; break;


case REPLACE: case REPLACE:
add_patterns_from_input(pl, argc, argv, add_patterns_from_input(pl, args->nr, args->v,
use_stdin ? stdin : NULL); use_stdin ? stdin : NULL);
break; break;
} }
@ -706,12 +706,12 @@ static int modify_pattern_list(int argc, const char **argv, int use_stdin,
return result; return result;
} }


static void sanitize_paths(int argc, const char **argv, static void sanitize_paths(struct strvec *args,
const char *prefix, int skip_checks) const char *prefix, int skip_checks)
{ {
int i; int i;


if (!argc) if (!args->nr)
return; return;


if (prefix && *prefix && core_sparse_checkout_cone) { if (prefix && *prefix && core_sparse_checkout_cone) {
@ -721,8 +721,11 @@ static void sanitize_paths(int argc, const char **argv,
*/ */
int prefix_len = strlen(prefix); int prefix_len = strlen(prefix);


for (i = 0; i < argc; i++) for (i = 0; i < args->nr; i++) {
argv[i] = prefix_path(prefix, prefix_len, argv[i]); char *prefixed_path = prefix_path(prefix, prefix_len, args->v[i]);
strvec_replace(args, i, prefixed_path);
free(prefixed_path);
}
} }


if (skip_checks) if (skip_checks)
@ -732,20 +735,20 @@ static void sanitize_paths(int argc, const char **argv,
die(_("please run from the toplevel directory in non-cone mode")); die(_("please run from the toplevel directory in non-cone mode"));


if (core_sparse_checkout_cone) { if (core_sparse_checkout_cone) {
for (i = 0; i < argc; i++) { for (i = 0; i < args->nr; i++) {
if (argv[i][0] == '/') if (args->v[i][0] == '/')
die(_("specify directories rather than patterns (no leading slash)")); die(_("specify directories rather than patterns (no leading slash)"));
if (argv[i][0] == '!') if (args->v[i][0] == '!')
die(_("specify directories rather than patterns. If your directory starts with a '!', pass --skip-checks")); die(_("specify directories rather than patterns. If your directory starts with a '!', pass --skip-checks"));
if (strpbrk(argv[i], "*?[]")) if (strpbrk(args->v[i], "*?[]"))
die(_("specify directories rather than patterns. If your directory really has any of '*?[]\\' in it, pass --skip-checks")); die(_("specify directories rather than patterns. If your directory really has any of '*?[]\\' in it, pass --skip-checks"));
} }
} }


for (i = 0; i < argc; i++) { for (i = 0; i < args->nr; i++) {
struct cache_entry *ce; struct cache_entry *ce;
struct index_state *index = the_repository->index; struct index_state *index = the_repository->index;
int pos = index_name_pos(index, argv[i], strlen(argv[i])); int pos = index_name_pos(index, args->v[i], strlen(args->v[i]));


if (pos < 0) if (pos < 0)
continue; continue;
@ -754,9 +757,9 @@ static void sanitize_paths(int argc, const char **argv,
continue; continue;


if (core_sparse_checkout_cone) if (core_sparse_checkout_cone)
die(_("'%s' is not a directory; to treat it as a directory anyway, rerun with --skip-checks"), argv[i]); die(_("'%s' is not a directory; to treat it as a directory anyway, rerun with --skip-checks"), args->v[i]);
else else
warning(_("pass a leading slash before paths such as '%s' if you want a single file (see NON-CONE PROBLEMS in the git-sparse-checkout manual)."), argv[i]); warning(_("pass a leading slash before paths such as '%s' if you want a single file (see NON-CONE PROBLEMS in the git-sparse-checkout manual)."), args->v[i]);
} }
} }


@ -780,6 +783,8 @@ static int sparse_checkout_add(int argc, const char **argv, const char *prefix)
N_("read patterns from standard in")), N_("read patterns from standard in")),
OPT_END(), OPT_END(),
}; };
struct strvec patterns = STRVEC_INIT;
int ret;


setup_work_tree(); setup_work_tree();
if (!core_apply_sparse_checkout) if (!core_apply_sparse_checkout)
@ -791,9 +796,14 @@ static int sparse_checkout_add(int argc, const char **argv, const char *prefix)
builtin_sparse_checkout_add_options, builtin_sparse_checkout_add_options,
builtin_sparse_checkout_add_usage, 0); builtin_sparse_checkout_add_usage, 0);


sanitize_paths(argc, argv, prefix, add_opts.skip_checks); for (int i = 0; i < argc; i++)
strvec_push(&patterns, argv[i]);
sanitize_paths(&patterns, prefix, add_opts.skip_checks);


return modify_pattern_list(argc, argv, add_opts.use_stdin, ADD); ret = modify_pattern_list(&patterns, add_opts.use_stdin, ADD);

strvec_clear(&patterns);
return ret;
} }


static char const * const builtin_sparse_checkout_set_usage[] = { static char const * const builtin_sparse_checkout_set_usage[] = {
@ -826,6 +836,8 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
PARSE_OPT_NONEG), PARSE_OPT_NONEG),
OPT_END(), OPT_END(),
}; };
struct strvec patterns = STRVEC_INIT;
int ret;


setup_work_tree(); setup_work_tree();
repo_read_index(the_repository); repo_read_index(the_repository);
@ -846,13 +858,18 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
* top-level directory (much as 'init' would do). * top-level directory (much as 'init' would do).
*/ */
if (!core_sparse_checkout_cone && !set_opts.use_stdin && argc == 0) { if (!core_sparse_checkout_cone && !set_opts.use_stdin && argc == 0) {
argv = default_patterns; for (int i = 0; i < default_patterns_nr; i++)
argc = default_patterns_nr; strvec_push(&patterns, default_patterns[i]);
} else { } else {
sanitize_paths(argc, argv, prefix, set_opts.skip_checks); for (int i = 0; i < argc; i++)
strvec_push(&patterns, argv[i]);
sanitize_paths(&patterns, prefix, set_opts.skip_checks);
} }


return modify_pattern_list(argc, argv, set_opts.use_stdin, REPLACE); ret = modify_pattern_list(&patterns, set_opts.use_stdin, REPLACE);

strvec_clear(&patterns);
return ret;
} }


static char const * const builtin_sparse_checkout_reapply_usage[] = { static char const * const builtin_sparse_checkout_reapply_usage[] = {

View File

@ -384,7 +384,6 @@ linux-musl)
;; ;;
linux-leaks|linux-reftable-leaks) linux-leaks|linux-reftable-leaks)
export SANITIZE=leak export SANITIZE=leak
export GIT_TEST_PASSING_SANITIZE_LEAK=true
;; ;;
linux-asan-ubsan) linux-asan-ubsan)
export SANITIZE=address,undefined export SANITIZE=address,undefined

View File

@ -1527,26 +1527,6 @@ int cmd_main(int, const char **);
int common_exit(const char *file, int line, int code); int common_exit(const char *file, int line, int code);
#define exit(code) exit(common_exit(__FILE__, __LINE__, (code))) #define exit(code) exit(common_exit(__FILE__, __LINE__, (code)))


/*
* You can mark a stack variable with UNLEAK(var) to avoid it being
* reported as a leak by tools like LSAN or valgrind. The argument
* should generally be the variable itself (not its address and not what
* it points to). It's safe to use this on pointers which may already
* have been freed, or on pointers which may still be in use.
*
* Use this _only_ for a variable that leaks by going out of scope at
* program exit (so only from cmd_* functions or their direct helpers).
* Normal functions, especially those which may be called multiple
* times, should actually free their memory. This is only meant as
* an annotation, and does nothing in non-leak-checking builds.
*/
#ifdef SUPPRESS_ANNOTATED_LEAKS
void unleak_memory(const void *ptr, size_t len);
#define UNLEAK(var) unleak_memory(&(var), sizeof(var))
#else
#define UNLEAK(var) do {} while (0)
#endif

#define z_const #define z_const
#include <zlib.h> #include <zlib.h>



122
git.c
View File

@ -362,7 +362,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
return (*argv) - orig_argv; return (*argv) - orig_argv;
} }


static int handle_alias(int *argcp, const char ***argv) static int handle_alias(struct strvec *args)
{ {
int envchanged = 0, ret = 0, saved_errno = errno; int envchanged = 0, ret = 0, saved_errno = errno;
int count, option_count; int count, option_count;
@ -370,10 +370,10 @@ static int handle_alias(int *argcp, const char ***argv)
const char *alias_command; const char *alias_command;
char *alias_string; char *alias_string;


alias_command = (*argv)[0]; alias_command = args->v[0];
alias_string = alias_lookup(alias_command); alias_string = alias_lookup(alias_command);
if (alias_string) { if (alias_string) {
if (*argcp > 1 && !strcmp((*argv)[1], "-h")) if (args->nr > 1 && !strcmp(args->v[1], "-h"))
fprintf_ln(stderr, _("'%s' is aliased to '%s'"), fprintf_ln(stderr, _("'%s' is aliased to '%s'"),
alias_command, alias_string); alias_command, alias_string);
if (alias_string[0] == '!') { if (alias_string[0] == '!') {
@ -390,7 +390,7 @@ static int handle_alias(int *argcp, const char ***argv)
child.wait_after_clean = 1; child.wait_after_clean = 1;
child.trace2_child_class = "shell_alias"; child.trace2_child_class = "shell_alias";
strvec_push(&child.args, alias_string + 1); strvec_push(&child.args, alias_string + 1);
strvec_pushv(&child.args, (*argv) + 1); strvec_pushv(&child.args, args->v + 1);


trace2_cmd_alias(alias_command, child.args.v); trace2_cmd_alias(alias_command, child.args.v);
trace2_cmd_name("_run_shell_alias_"); trace2_cmd_name("_run_shell_alias_");
@ -423,15 +423,13 @@ static int handle_alias(int *argcp, const char ***argv)
trace_argv_printf(new_argv, trace_argv_printf(new_argv,
"trace: alias expansion: %s =>", "trace: alias expansion: %s =>",
alias_command); alias_command);

REALLOC_ARRAY(new_argv, count + *argcp);
/* insert after command name */
COPY_ARRAY(new_argv + count, *argv + 1, *argcp);

trace2_cmd_alias(alias_command, new_argv); trace2_cmd_alias(alias_command, new_argv);


*argv = new_argv; /* Replace the alias with the new arguments. */
*argcp += count - 1; strvec_splice(args, 0, 1, new_argv, count);

free(alias_string);
free(new_argv);


ret = 1; ret = 1;
} }
@ -698,63 +696,57 @@ void load_builtin_commands(const char *prefix, struct cmdnames *cmds)
} }


#ifdef STRIP_EXTENSION #ifdef STRIP_EXTENSION
static void strip_extension(const char **argv) static void strip_extension(struct strvec *args)
{ {
size_t len; size_t len;


if (strip_suffix(argv[0], STRIP_EXTENSION, &len)) if (strip_suffix(args->v[0], STRIP_EXTENSION, &len)) {
argv[0] = xmemdupz(argv[0], len); char *stripped = xmemdupz(args->v[0], len);
strvec_replace(args, 0, stripped);
free(stripped);
}
} }
#else #else
#define strip_extension(cmd) #define strip_extension(cmd)
#endif #endif


static void handle_builtin(int argc, const char **argv) static void handle_builtin(struct strvec *args)
{ {
struct strvec args = STRVEC_INIT;
const char **argv_copy = NULL;
const char *cmd; const char *cmd;
struct cmd_struct *builtin; struct cmd_struct *builtin;


strip_extension(argv); strip_extension(args);
cmd = argv[0]; cmd = args->v[0];


/* Turn "git cmd --help" into "git help --exclude-guides cmd" */ /* Turn "git cmd --help" into "git help --exclude-guides cmd" */
if (argc > 1 && !strcmp(argv[1], "--help")) { if (args->nr > 1 && !strcmp(args->v[1], "--help")) {
int i; const char *exclude_guides_arg[] = { "--exclude-guides" };


argv[1] = argv[0]; strvec_replace(args, 1, args->v[0]);
argv[0] = cmd = "help"; strvec_replace(args, 0, "help");
cmd = "help";
strvec_splice(args, 2, 0, exclude_guides_arg,
ARRAY_SIZE(exclude_guides_arg));
}


for (i = 0; i < argc; i++) { builtin = get_builtin(cmd);
strvec_push(&args, argv[i]); if (builtin) {
if (!i) const char **argv_copy = NULL;
strvec_push(&args, "--exclude-guides"); int ret;
}

argc++;


/* /*
* `run_builtin()` will modify the argv array, so we need to * `run_builtin()` will modify the argv array, so we need to
* create a shallow copy such that we can free all of its * create a shallow copy such that we can free all of its
* strings. * strings.
*/ */
CALLOC_ARRAY(argv_copy, argc + 1); if (args->nr)
COPY_ARRAY(argv_copy, args.v, argc); DUP_ARRAY(argv_copy, args->v, args->nr + 1);


argv = argv_copy; ret = run_builtin(builtin, args->nr, argv_copy, the_repository);
} strvec_clear(args);

builtin = get_builtin(cmd);
if (builtin) {
int ret = run_builtin(builtin, argc, argv, the_repository);
strvec_clear(&args);
free(argv_copy); free(argv_copy);
exit(ret); exit(ret);
} }

strvec_clear(&args);
free(argv_copy);
} }


static void execv_dashed_external(const char **argv) static void execv_dashed_external(const char **argv)
@ -800,10 +792,10 @@ static void execv_dashed_external(const char **argv)
exit(128); exit(128);
} }


static int run_argv(int *argcp, const char ***argv) static int run_argv(struct strvec *args)
{ {
int done_alias = 0; int done_alias = 0;
struct string_list cmd_list = STRING_LIST_INIT_NODUP; struct string_list cmd_list = STRING_LIST_INIT_DUP;
struct string_list_item *seen; struct string_list_item *seen;


while (1) { while (1) {
@ -817,8 +809,8 @@ static int run_argv(int *argcp, const char ***argv)
* process. * process.
*/ */
if (!done_alias) if (!done_alias)
handle_builtin(*argcp, *argv); handle_builtin(args);
else if (get_builtin(**argv)) { else if (get_builtin(args->v[0])) {
struct child_process cmd = CHILD_PROCESS_INIT; struct child_process cmd = CHILD_PROCESS_INIT;
int i; int i;


@ -834,8 +826,8 @@ static int run_argv(int *argcp, const char ***argv)
commit_pager_choice(); commit_pager_choice();


strvec_push(&cmd.args, "git"); strvec_push(&cmd.args, "git");
for (i = 0; i < *argcp; i++) for (i = 0; i < args->nr; i++)
strvec_push(&cmd.args, (*argv)[i]); strvec_push(&cmd.args, args->v[i]);


trace_argv_printf(cmd.args.v, "trace: exec:"); trace_argv_printf(cmd.args.v, "trace: exec:");


@ -850,13 +842,13 @@ static int run_argv(int *argcp, const char ***argv)
i = run_command(&cmd); i = run_command(&cmd);
if (i >= 0 || errno != ENOENT) if (i >= 0 || errno != ENOENT)
exit(i); exit(i);
die("could not execute builtin %s", **argv); die("could not execute builtin %s", args->v[0]);
} }


/* .. then try the external ones */ /* .. then try the external ones */
execv_dashed_external(*argv); execv_dashed_external(args->v);


seen = unsorted_string_list_lookup(&cmd_list, *argv[0]); seen = unsorted_string_list_lookup(&cmd_list, args->v[0]);
if (seen) { if (seen) {
int i; int i;
struct strbuf sb = STRBUF_INIT; struct strbuf sb = STRBUF_INIT;
@ -873,14 +865,14 @@ static int run_argv(int *argcp, const char ***argv)
" not terminate:%s"), cmd_list.items[0].string, sb.buf); " not terminate:%s"), cmd_list.items[0].string, sb.buf);
} }


string_list_append(&cmd_list, *argv[0]); string_list_append(&cmd_list, args->v[0]);


/* /*
* It could be an alias -- this works around the insanity * It could be an alias -- this works around the insanity
* of overriding "git log" with "git show" by having * of overriding "git log" with "git show" by having
* alias.log = show * alias.log = show
*/ */
if (!handle_alias(argcp, argv)) if (!handle_alias(args))
break; break;
done_alias = 1; done_alias = 1;
} }
@ -892,6 +884,7 @@ static int run_argv(int *argcp, const char ***argv)


int cmd_main(int argc, const char **argv) int cmd_main(int argc, const char **argv)
{ {
struct strvec args = STRVEC_INIT;
const char *cmd; const char *cmd;
int done_help = 0; int done_help = 0;


@ -917,8 +910,10 @@ int cmd_main(int argc, const char **argv)
* that one cannot handle it. * that one cannot handle it.
*/ */
if (skip_prefix(cmd, "git-", &cmd)) { if (skip_prefix(cmd, "git-", &cmd)) {
argv[0] = cmd; strvec_push(&args, cmd);
handle_builtin(argc, argv); strvec_pushv(&args, argv + 1);
handle_builtin(&args);
strvec_clear(&args);
die(_("cannot handle %s as a builtin"), cmd); die(_("cannot handle %s as a builtin"), cmd);
} }


@ -951,25 +946,34 @@ int cmd_main(int argc, const char **argv)
*/ */
setup_path(); setup_path();


for (size_t i = 0; i < argc; i++)
strvec_push(&args, argv[i]);

while (1) { while (1) {
int was_alias = run_argv(&argc, &argv); int was_alias = run_argv(&args);
if (errno != ENOENT) if (errno != ENOENT)
break; break;
if (was_alias) { if (was_alias) {
fprintf(stderr, _("expansion of alias '%s' failed; " fprintf(stderr, _("expansion of alias '%s' failed; "
"'%s' is not a git command\n"), "'%s' is not a git command\n"),
cmd, argv[0]); cmd, args.v[0]);
strvec_clear(&args);
exit(1); exit(1);
} }
if (!done_help) { if (!done_help) {
cmd = argv[0] = help_unknown_cmd(cmd); char *assumed = help_unknown_cmd(cmd);
strvec_replace(&args, 0, assumed);
free(assumed);
cmd = args.v[0];
done_help = 1; done_help = 1;
} else } else {
break; break;
}
} }


fprintf(stderr, _("failed to run command '%s': %s\n"), fprintf(stderr, _("failed to run command '%s': %s\n"),
cmd, strerror(errno)); cmd, strerror(errno));
strvec_clear(&args);


return 1; return 1;
} }

58
help.c
View File

@ -546,8 +546,10 @@ int is_in_cmdlist(struct cmdnames *c, const char *s)
return 0; return 0;
} }


static int autocorrect; struct help_unknown_cmd_config {
static struct cmdnames aliases; int autocorrect;
struct cmdnames aliases;
};


#define AUTOCORRECT_PROMPT (-3) #define AUTOCORRECT_PROMPT (-3)
#define AUTOCORRECT_NEVER (-2) #define AUTOCORRECT_NEVER (-2)
@ -555,28 +557,29 @@ static struct cmdnames aliases;


static int git_unknown_cmd_config(const char *var, const char *value, static int git_unknown_cmd_config(const char *var, const char *value,
const struct config_context *ctx, const struct config_context *ctx,
void *cb UNUSED) void *cb)
{ {
struct help_unknown_cmd_config *cfg = cb;
const char *p; const char *p;


if (!strcmp(var, "help.autocorrect")) { if (!strcmp(var, "help.autocorrect")) {
if (!value) if (!value)
return config_error_nonbool(var); return config_error_nonbool(var);
if (!strcmp(value, "never")) { if (!strcmp(value, "never")) {
autocorrect = AUTOCORRECT_NEVER; cfg->autocorrect = AUTOCORRECT_NEVER;
} else if (!strcmp(value, "immediate")) { } else if (!strcmp(value, "immediate")) {
autocorrect = AUTOCORRECT_IMMEDIATELY; cfg->autocorrect = AUTOCORRECT_IMMEDIATELY;
} else if (!strcmp(value, "prompt")) { } else if (!strcmp(value, "prompt")) {
autocorrect = AUTOCORRECT_PROMPT; cfg->autocorrect = AUTOCORRECT_PROMPT;
} else { } else {
int v = git_config_int(var, value, ctx->kvi); int v = git_config_int(var, value, ctx->kvi);
autocorrect = (v < 0) cfg->autocorrect = (v < 0)
? AUTOCORRECT_IMMEDIATELY : v; ? AUTOCORRECT_IMMEDIATELY : v;
} }
} }
/* Also use aliases for command lookup */ /* Also use aliases for command lookup */
if (skip_prefix(var, "alias.", &p)) if (skip_prefix(var, "alias.", &p))
add_cmdname(&aliases, p, strlen(p)); add_cmdname(&cfg->aliases, p, strlen(p));


return 0; return 0;
} }
@ -609,32 +612,30 @@ static const char bad_interpreter_advice[] =
N_("'%s' appears to be a git command, but we were not\n" N_("'%s' appears to be a git command, but we were not\n"
"able to execute it. Maybe git-%s is broken?"); "able to execute it. Maybe git-%s is broken?");


const char *help_unknown_cmd(const char *cmd) char *help_unknown_cmd(const char *cmd)
{ {
struct help_unknown_cmd_config cfg = { 0 };
int i, n, best_similarity = 0; int i, n, best_similarity = 0;
struct cmdnames main_cmds, other_cmds; struct cmdnames main_cmds = { 0 };
struct cmdnames other_cmds = { 0 };
struct cmdname_help *common_cmds; struct cmdname_help *common_cmds;


memset(&main_cmds, 0, sizeof(main_cmds)); read_early_config(the_repository, git_unknown_cmd_config, &cfg);
memset(&other_cmds, 0, sizeof(other_cmds));
memset(&aliases, 0, sizeof(aliases));

read_early_config(the_repository, git_unknown_cmd_config, NULL);


/* /*
* Disable autocorrection prompt in a non-interactive session * Disable autocorrection prompt in a non-interactive session
*/ */
if ((autocorrect == AUTOCORRECT_PROMPT) && (!isatty(0) || !isatty(2))) if ((cfg.autocorrect == AUTOCORRECT_PROMPT) && (!isatty(0) || !isatty(2)))
autocorrect = AUTOCORRECT_NEVER; cfg.autocorrect = AUTOCORRECT_NEVER;


if (autocorrect == AUTOCORRECT_NEVER) { if (cfg.autocorrect == AUTOCORRECT_NEVER) {
fprintf_ln(stderr, _("git: '%s' is not a git command. See 'git --help'."), cmd); fprintf_ln(stderr, _("git: '%s' is not a git command. See 'git --help'."), cmd);
exit(1); exit(1);
} }


load_command_list("git-", &main_cmds, &other_cmds); load_command_list("git-", &main_cmds, &other_cmds);


add_cmd_list(&main_cmds, &aliases); add_cmd_list(&main_cmds, &cfg.aliases);
add_cmd_list(&main_cmds, &other_cmds); add_cmd_list(&main_cmds, &other_cmds);
QSORT(main_cmds.names, main_cmds.cnt, cmdname_compare); QSORT(main_cmds.names, main_cmds.cnt, cmdname_compare);
uniq(&main_cmds); uniq(&main_cmds);
@ -693,20 +694,19 @@ const char *help_unknown_cmd(const char *cmd)
n++) n++)
; /* still counting */ ; /* still counting */
} }
if (autocorrect && n == 1 && SIMILAR_ENOUGH(best_similarity)) { if (cfg.autocorrect && n == 1 && SIMILAR_ENOUGH(best_similarity)) {
const char *assumed = main_cmds.names[0]->name; char *assumed = xstrdup(main_cmds.names[0]->name);
main_cmds.names[0] = NULL;
cmdnames_release(&main_cmds);
fprintf_ln(stderr, fprintf_ln(stderr,
_("WARNING: You called a Git command named '%s', " _("WARNING: You called a Git command named '%s', "
"which does not exist."), "which does not exist."),
cmd); cmd);
if (autocorrect == AUTOCORRECT_IMMEDIATELY) if (cfg.autocorrect == AUTOCORRECT_IMMEDIATELY)
fprintf_ln(stderr, fprintf_ln(stderr,
_("Continuing under the assumption that " _("Continuing under the assumption that "
"you meant '%s'."), "you meant '%s'."),
assumed); assumed);
else if (autocorrect == AUTOCORRECT_PROMPT) { else if (cfg.autocorrect == AUTOCORRECT_PROMPT) {
char *answer; char *answer;
struct strbuf msg = STRBUF_INIT; struct strbuf msg = STRBUF_INIT;
strbuf_addf(&msg, _("Run '%s' instead [y/N]? "), assumed); strbuf_addf(&msg, _("Run '%s' instead [y/N]? "), assumed);
@ -719,9 +719,13 @@ const char *help_unknown_cmd(const char *cmd)
fprintf_ln(stderr, fprintf_ln(stderr,
_("Continuing in %0.1f seconds, " _("Continuing in %0.1f seconds, "
"assuming that you meant '%s'."), "assuming that you meant '%s'."),
(float)autocorrect/10.0, assumed); (float)cfg.autocorrect/10.0, assumed);
sleep_millisec(autocorrect * 100); sleep_millisec(cfg.autocorrect * 100);
} }

cmdnames_release(&cfg.aliases);
cmdnames_release(&main_cmds);
cmdnames_release(&other_cmds);
return assumed; return assumed;
} }



2
help.h
View File

@ -32,7 +32,7 @@ void list_all_other_cmds(struct string_list *list);
void list_cmds_by_category(struct string_list *list, void list_cmds_by_category(struct string_list *list,
const char *category); const char *category);
void list_cmds_by_config(struct string_list *list); void list_cmds_by_config(struct string_list *list);
const char *help_unknown_cmd(const char *cmd); char *help_unknown_cmd(const char *cmd);
void load_command_list(const char *prefix, void load_command_list(const char *prefix,
struct cmdnames *main_cmds, struct cmdnames *main_cmds,
struct cmdnames *other_cmds); struct cmdnames *other_cmds);

View File

@ -1237,6 +1237,7 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
* don't follow any other path in history * don't follow any other path in history
*/ */
add_line_range(rev, parents[i], cand[i]); add_line_range(rev, parents[i], cand[i]);
free_commit_list(commit->parents);
commit_list_append(parents[i], &commit->parents); commit_list_append(parents[i], &commit->parents);


ret = 0; ret = 0;

View File

@ -51,8 +51,8 @@


volatile show_early_output_fn_t show_early_output; volatile show_early_output_fn_t show_early_output;


static const char *term_bad; static char *term_bad;
static const char *term_good; static char *term_good;


implement_shared_commit_slab(revision_sources, char *); implement_shared_commit_slab(revision_sources, char *);



View File

@ -97,7 +97,11 @@ void move_cache_to_base_index(struct index_state *istate)
mem_pool_combine(istate->ce_mem_pool, istate->split_index->base->ce_mem_pool); mem_pool_combine(istate->ce_mem_pool, istate->split_index->base->ce_mem_pool);
} }


ALLOC_ARRAY(si->base, 1); if (si->base)
release_index(si->base);
else
ALLOC_ARRAY(si->base, 1);

index_state_init(si->base, istate->repo); index_state_init(si->base, istate->repo);
si->base->version = istate->version; si->base->version = istate->version;
/* zero timestamp disables racy test in ce_write_index() */ /* zero timestamp disables racy test in ce_write_index() */

View File

@ -56,6 +56,25 @@ void strvec_pushv(struct strvec *array, const char **items)
strvec_push(array, *items); strvec_push(array, *items);
} }


void strvec_splice(struct strvec *array, size_t idx, size_t len,
const char **replacement, size_t replacement_len)
{
if (idx + len > array->nr)
BUG("range outside of array boundary");
if (replacement_len > len)
ALLOC_GROW(array->v, array->nr + (replacement_len - len) + 1,
array->alloc);
for (size_t i = 0; i < len; i++)
free((char *)array->v[idx + i]);
if (replacement_len != len) {
memmove(array->v + idx + replacement_len, array->v + idx + len,
(array->nr - idx - len + 1) * sizeof(char *));
array->nr += (replacement_len - len);
}
for (size_t i = 0; i < replacement_len; i++)
array->v[idx + i] = xstrdup(replacement[i]);
}

const char *strvec_replace(struct strvec *array, size_t idx, const char *replacement) const char *strvec_replace(struct strvec *array, size_t idx, const char *replacement)
{ {
char *to_free; char *to_free;

View File

@ -67,6 +67,15 @@ void strvec_pushl(struct strvec *, ...);
/* Push a null-terminated array of strings onto the end of the array. */ /* Push a null-terminated array of strings onto the end of the array. */
void strvec_pushv(struct strvec *, const char **); void strvec_pushv(struct strvec *, const char **);


/*
* Replace `len` values starting at `idx` with the provided replacement
* strings. If `len` is zero this is effectively an insert at the given `idx`.
* If `replacement_len` is zero this is effectively a delete of `len` items
* starting at `idx`.
*/
void strvec_splice(struct strvec *array, size_t idx, size_t len,
const char **replacement, size_t replacement_len);

/** /**
* Replace the value at the given index with a new value. The index must be * Replace the value at the given index with a new value. The index must be
* valid. Returns a pointer to the inserted value. * valid. Returns a pointer to the inserted value.

View File

@ -368,27 +368,6 @@ excluded as so much relies on it, but this might change in the future.
GIT_TEST_SPLIT_INDEX=<boolean> forces split-index mode on the whole GIT_TEST_SPLIT_INDEX=<boolean> forces split-index mode on the whole
test suite. Accept any boolean values that are accepted by git-config. test suite. Accept any boolean values that are accepted by git-config.


GIT_TEST_PASSING_SANITIZE_LEAK=true skips those tests that haven't
declared themselves as leak-free by setting
"TEST_PASSES_SANITIZE_LEAK=true" before sourcing "test-lib.sh". This
test mode is used by the "linux-leaks" CI target.

GIT_TEST_PASSING_SANITIZE_LEAK=check checks that our
"TEST_PASSES_SANITIZE_LEAK=true" markings are current. Rather than
skipping those tests that haven't set "TEST_PASSES_SANITIZE_LEAK=true"
before sourcing "test-lib.sh" this mode runs them with
"--invert-exit-code". This is used to check that there's a one-to-one
mapping between "TEST_PASSES_SANITIZE_LEAK=true" and those tests that
pass under "SANITIZE=leak". This is especially useful when testing a
series that fixes various memory leaks with "git rebase -x".

GIT_TEST_PASSING_SANITIZE_LEAK=check when combined with "--immediate"
will run to completion faster, and result in the same failing
tests.

GIT_TEST_PASSING_SANITIZE_LEAK=check-failing behaves the same as "check",
but skips all tests which are already marked as leak-free.

GIT_TEST_PROTOCOL_VERSION=<n>, when set, makes 'protocol.version' GIT_TEST_PROTOCOL_VERSION=<n>, when set, makes 'protocol.version'
default to n. default to n.



View File

@ -97,7 +97,6 @@ int cmd__read_graph(int argc, const char **argv)
} }


done: done:
UNLEAK(graph); free_commit_graph(graph);

return ret; return ret;
} }

View File

@ -1,7 +1,3 @@
if test -z "$TEST_FAILS_SANITIZE_LEAK"
then
TEST_PASSES_SANITIZE_LEAK=true
fi
. ./test-lib.sh . ./test-lib.sh


if test -n "$NO_SVN_TESTS" if test -n "$NO_SVN_TESTS"

View File

@ -2,7 +2,6 @@


test_description='git init' test_description='git init'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


check_config () { check_config () {

View File

@ -7,7 +7,6 @@ Verify that plumbing commands work when .git is a file
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


objpath() { objpath() {

View File

@ -2,7 +2,6 @@


test_description=gitattributes test_description=gitattributes


TEST_PASSES_SANITIZE_LEAK=true
TEST_CREATE_REPO_NO_TEMPLATE=1 TEST_CREATE_REPO_NO_TEMPLATE=1
. ./test-lib.sh . ./test-lib.sh



View File

@ -2,7 +2,6 @@


test_description='detect unwritable repository and fail correctly' test_description='detect unwritable repository and fail correctly'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success setup ' test_expect_success setup '

View File

@ -2,7 +2,6 @@


test_description='signals work as we expect' test_description='signals work as we expect'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


cat >expect <<EOF cat >expect <<EOF

View File

@ -2,7 +2,6 @@


test_description='test date parsing and printing' test_description='test date parsing and printing'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


# arbitrary reference time: 2009-08-30 19:20:00 # arbitrary reference time: 2009-08-30 19:20:00

View File

@ -2,7 +2,6 @@


test_description='basic sanity checks for git var' test_description='basic sanity checks for git var'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


sane_unset_all_editors () { sane_unset_all_editors () {

View File

@ -2,7 +2,6 @@


test_description=check-ignore test_description=check-ignore


TEST_PASSES_SANITIZE_LEAK=true
TEST_CREATE_REPO_NO_TEMPLATE=1 TEST_CREATE_REPO_NO_TEMPLATE=1
. ./test-lib.sh . ./test-lib.sh



View File

@ -2,7 +2,6 @@


test_description='racy GIT' test_description='racy GIT'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


# This test can give false success if your machine is sufficiently # This test can give false success if your machine is sufficiently

View File

@ -2,7 +2,6 @@


test_description='help' test_description='help'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


configure_help () { configure_help () {

View File

@ -2,7 +2,6 @@


test_description='test sha1 collision detection' test_description='test sha1 collision detection'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
TEST_DATA="$TEST_DIRECTORY/t0013" TEST_DATA="$TEST_DIRECTORY/t0013"



View File

@ -2,7 +2,6 @@


test_description='test test-tool env-helper' test_description='test test-tool env-helper'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh





View File

@ -5,7 +5,6 @@ test_description='Test advise_if_enabled functionality'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=trunk GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=trunk
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 'advice should be printed when config variable is unset' ' test_expect_success 'advice should be printed when config variable is unset' '

View File

@ -2,7 +2,6 @@


test_description='test json-writer JSON generation' test_description='test json-writer JSON generation'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'unit test of json-writer routines' ' test_expect_success 'unit test of json-writer routines' '

View File

@ -5,7 +5,6 @@ test_description='CRLF conversion'
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


has_cr() { has_cr() {

View File

@ -5,7 +5,6 @@ test_description='blob conversion via gitattributes'
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-terminal.sh . "$TEST_DIRECTORY"/lib-terminal.sh



View File

@ -2,7 +2,6 @@


test_description='ignore CR in CRLF sequence while computing similiarity' test_description='ignore CR in CRLF sequence while computing similiarity'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success setup ' test_expect_success setup '

View File

@ -2,7 +2,6 @@


test_description='Test am with auto.crlf' test_description='Test am with auto.crlf'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


cat >patchfile <<\EOF cat >patchfile <<\EOF

View File

@ -2,7 +2,6 @@


test_description='respect crlf in git archive' test_description='respect crlf in git archive'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success setup ' test_expect_success setup '

View File

@ -2,7 +2,6 @@


test_description='CRLF renormalization' test_description='CRLF renormalization'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success setup ' test_expect_success setup '

View File

@ -2,7 +2,6 @@


test_description='CRLF conversion' test_description='CRLF conversion'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


has_cr() { has_cr() {

View File

@ -2,7 +2,6 @@


test_description='CRLF conversion all combinations' test_description='CRLF conversion all combinations'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


compare_files () { compare_files () {

View File

@ -5,7 +5,6 @@ test_description='working-tree-encoding conversion via gitattributes'
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_CREATE_REPO_NO_TEMPLATE=1 TEST_CREATE_REPO_NO_TEMPLATE=1
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY/lib-encoding.sh" . "$TEST_DIRECTORY/lib-encoding.sh"

View File

@ -2,7 +2,6 @@


test_description='test the Windows-only core.unsetenvvars setting' test_description='test the Windows-only core.unsetenvvars setting'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


if ! test_have_prereq MINGW if ! test_have_prereq MINGW

View File

@ -5,7 +5,6 @@


test_description='git stripspace' test_description='git stripspace'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


t40='A quick brown fox jumps over the lazy do' t40='A quick brown fox jumps over the lazy do'

View File

@ -2,7 +2,6 @@


test_description='verify safe.directory checks' test_description='verify safe.directory checks'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


GIT_TEST_ASSUME_DIFFERENT_OWNER=1 GIT_TEST_ASSUME_DIFFERENT_OWNER=1

View File

@ -2,7 +2,6 @@


test_description='verify safe.bareRepository checks' test_description='verify safe.bareRepository checks'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


pwd="$(pwd)" pwd="$(pwd)"

View File

@ -5,7 +5,6 @@


test_description='our own option parser' test_description='our own option parser'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


cat >expect <<\EOF cat >expect <<\EOF

View File

@ -5,7 +5,6 @@ test_description='Test commands behavior when given invalid argument value'
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 ' '

View File

@ -5,7 +5,6 @@ test_description='Various filesystem issues'
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


auml=$(printf '\303\244') auml=$(printf '\303\244')

View File

@ -2,7 +2,6 @@


test_description='simple command server' test_description='simple command server'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test-tool simple-ipc SUPPORTS_SIMPLE_IPC || { test-tool simple-ipc SUPPORTS_SIMPLE_IPC || {

View File

@ -2,7 +2,6 @@


test_description='update-index and add refuse to add beyond symlinks' test_description='update-index and add refuse to add beyond symlinks'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success SYMLINKS setup ' test_expect_success SYMLINKS setup '

View File

@ -2,7 +2,6 @@


test_description='"-C <path>" option and its effects on other path-related options' test_description='"-C <path>" option and its effects on other path-related options'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success '"git -C <path>" runs git from the directory <path>' ' test_expect_success '"git -C <path>" runs git from the directory <path>' '

View File

@ -5,7 +5,6 @@


test_description='Test various path utilities' test_description='Test various path utilities'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


norm_path() { norm_path() {

View File

@ -5,7 +5,6 @@


test_description='Test run command' test_description='Test run command'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


cat >hello-script <<-EOF cat >hello-script <<-EOF

View File

@ -5,7 +5,6 @@


test_description='Test revision walking api' test_description='Test revision walking api'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


cat >run_twice_expected <<-EOF cat >run_twice_expected <<-EOF

View File

@ -5,7 +5,6 @@


test_description='Test string list functionality' test_description='Test string list functionality'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_split () { test_split () {

View File

@ -2,7 +2,6 @@


test_description='Test the dir-iterator functionality' test_description='Test the dir-iterator functionality'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'setup' ' test_expect_success 'setup' '

View File

@ -2,7 +2,6 @@


test_description='Test parse_pathspec_file()' test_description='Test parse_pathspec_file()'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'one item from stdin' ' test_expect_success 'one item from stdin' '

View File

@ -2,7 +2,6 @@


test_description='git for-each-repo builtin' test_description='git for-each-repo builtin'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'run based on configured value' ' test_expect_success 'run based on configured value' '

View File

@ -6,7 +6,6 @@ test_description='check that the most basic functions work
Verify wrappers and compatibility functions. Verify wrappers and compatibility functions.
' '


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'mktemp to nonexistent directory prints filename' ' test_expect_success 'mktemp to nonexistent directory prints filename' '

View File

@ -2,7 +2,6 @@


test_description='verify sort functions' test_description='verify sort functions'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'DEFINE_LIST_SORT_DEBUG' ' test_expect_success 'DEFINE_LIST_SORT_DEBUG' '

View File

@ -2,7 +2,6 @@


test_description='Test the output of the unit test framework' test_description='Test the output of the unit test framework'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'TAP output from unit tests' - <<\EOT test_expect_success 'TAP output from unit tests' - <<\EOT

View File

@ -2,7 +2,6 @@


test_description='test `test-tool find-pack`' test_description='test `test-tool find-pack`'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'setup' ' test_expect_success 'setup' '

View File

@ -6,7 +6,6 @@ Tests whether various commands properly update and/or rewrite the
cache-tree extension. cache-tree extension.
" "


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


cmp_cache_tree () { cmp_cache_tree () {

View File

@ -2,7 +2,6 @@


test_description='git bugreport' test_description='git bugreport'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'create a report' ' test_expect_success 'create a report' '

View File

@ -2,7 +2,6 @@


test_description='git diagnose' test_description='git diagnose'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success UNZIP 'creates diagnostics zip archive' ' test_expect_success UNZIP 'creates diagnostics zip archive' '

View File

@ -2,7 +2,6 @@


test_description='Testing the various Bloom filter computations in bloom.c' test_description='Testing the various Bloom filter computations in bloom.c'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'compute unseeded murmur3 hash for empty string' ' test_expect_success 'compute unseeded murmur3 hash for empty string' '
@ -77,7 +76,7 @@ test_expect_success 'compute bloom key for test string 2' '
test_cmp expect actual test_cmp expect actual
' '


test_expect_success !SANITIZE_LEAK 'get bloom filters for commit with no changes' ' test_expect_success 'get bloom filters for commit with no changes' '
git init && git init &&
git commit --allow-empty -m "c0" && git commit --allow-empty -m "c0" &&
cat >expect <<-\EOF && cat >expect <<-\EOF &&

View File

@ -5,7 +5,6 @@ test_description='previous branch syntax @{-n}'
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 'branch -d @{-1}' ' test_expect_success 'branch -d @{-1}' '

View File

@ -2,7 +2,6 @@


test_description='various @{whatever} syntax tests' test_description='various @{whatever} syntax tests'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'setup' ' test_expect_success 'setup' '

View File

@ -5,7 +5,6 @@


test_description='Gettext support for Git' test_description='Gettext support for Git'


TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh . ./lib-gettext.sh


test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" ' test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '

View File

@ -8,7 +8,6 @@ test_description='Gettext Shell fallbacks'
GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease
export GIT_INTERNAL_GETTEXT_TEST_FALLBACKS export GIT_INTERNAL_GETTEXT_TEST_FALLBACKS


TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh . ./lib-gettext.sh


test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" ' test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '

View File

@ -5,7 +5,6 @@


test_description='Perl gettext interface (Git::I18N)' test_description='Perl gettext interface (Git::I18N)'


TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh . ./lib-gettext.sh
. "$TEST_DIRECTORY"/lib-perl.sh . "$TEST_DIRECTORY"/lib-perl.sh
skip_all_if_no_Test_More skip_all_if_no_Test_More

View File

@ -5,7 +5,6 @@


test_description="The Git C functions aren't broken by setlocale(3)" test_description="The Git C functions aren't broken by setlocale(3)"


TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh . ./lib-gettext.sh


test_expect_success 'git show a ISO-8859-1 commit under C locale' ' test_expect_success 'git show a ISO-8859-1 commit under C locale' '

View File

@ -5,7 +5,6 @@


test_description="Gettext reencoding of our *.po/*.mo files works" test_description="Gettext reencoding of our *.po/*.mo files works"


TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh . ./lib-gettext.sh


# The constants used in a tricky observation for undefined behaviour # The constants used in a tricky observation for undefined behaviour

View File

@ -2,7 +2,6 @@


test_description='test trace2 facility (normal target)' test_description='test trace2 facility (normal target)'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


# Turn off any inherited trace2 settings for this test. # Turn off any inherited trace2 settings for this test.

View File

@ -2,7 +2,6 @@


test_description='test trace2 facility (perf target)' test_description='test trace2 facility (perf target)'


TEST_PASSES_SANITIZE_LEAK=false
. ./test-lib.sh . ./test-lib.sh


# Turn off any inherited trace2 settings for this test. # Turn off any inherited trace2 settings for this test.

View File

@ -2,7 +2,6 @@


test_description='test trace2 facility' test_description='test trace2 facility'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


# Turn off any inherited trace2 settings for this test. # Turn off any inherited trace2 settings for this test.

View File

@ -2,7 +2,6 @@


test_description='basic credential helper tests' test_description='basic credential helper tests'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh . "$TEST_DIRECTORY"/lib-credential.sh



View File

@ -2,7 +2,6 @@


test_description='credential-cache tests' test_description='credential-cache tests'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh . "$TEST_DIRECTORY"/lib-credential.sh



View File

@ -2,7 +2,6 @@


test_description='credential-store tests' test_description='credential-store tests'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh . "$TEST_DIRECTORY"/lib-credential.sh



View File

@ -29,7 +29,6 @@ you can set GIT_TEST_CREDENTIAL_HELPER_SETUP to a sequence of shell
commands. commands.
' '


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh . "$TEST_DIRECTORY"/lib-credential.sh



View File

@ -2,7 +2,6 @@


test_description='partial clone' test_description='partial clone'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/lib-terminal.sh . "$TEST_DIRECTORY"/lib-terminal.sh



View File

@ -2,7 +2,6 @@


test_description='check that local clone does not fetch from promisor remotes' test_description='check that local clone does not fetch from promisor remotes'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'create evil repo' ' test_expect_success 'create evil repo' '

View File

@ -5,7 +5,6 @@ test_description='assert (unbuilt) Documentation/*.txt and -h output
Run this with --debug to see a summary of where we still fail to make Run this with --debug to see a summary of where we still fail to make
the two versions consistent with one another.' the two versions consistent with one another.'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'setup: list of builtins' ' test_expect_success 'setup: list of builtins' '

View File

@ -2,7 +2,6 @@


test_description='progress display' test_description='progress display'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


show_cr () { show_cr () {

View File

@ -7,7 +7,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
GIT_TEST_DEFAULT_REF_FORMAT=files GIT_TEST_DEFAULT_REF_FORMAT=files
export GIT_TEST_DEFAULT_REF_FORMAT export GIT_TEST_DEFAULT_REF_FORMAT


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'setup' ' test_expect_success 'setup' '

View File

@ -15,7 +15,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
GIT_TEST_DEFAULT_REF_FORMAT=files GIT_TEST_DEFAULT_REF_FORMAT=files
export GIT_TEST_DEFAULT_REF_FORMAT export GIT_TEST_DEFAULT_REF_FORMAT


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success 'enable reflogs' ' test_expect_success 'enable reflogs' '

View File

@ -6,7 +6,6 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
GIT_TEST_DEFAULT_REF_FORMAT=files GIT_TEST_DEFAULT_REF_FORMAT=files
export GIT_TEST_DEFAULT_REF_FORMAT export GIT_TEST_DEFAULT_REF_FORMAT
TEST_PASSES_SANITIZE_LEAK=true


. ./test-lib.sh . ./test-lib.sh



View File

@ -10,7 +10,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
GIT_TEST_DEFAULT_REF_FORMAT=reftable GIT_TEST_DEFAULT_REF_FORMAT=reftable
export GIT_TEST_DEFAULT_REF_FORMAT export GIT_TEST_DEFAULT_REF_FORMAT


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


INVALID_OID=$(test_oid 001) INVALID_OID=$(test_oid 001)

View File

@ -2,7 +2,6 @@


test_description='reftable HTTPD tests' test_description='reftable HTTPD tests'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/lib-httpd.sh . "$TEST_DIRECTORY"/lib-httpd.sh



View File

@ -11,7 +11,6 @@ export GIT_TEST_DEFAULT_REF_FORMAT
GIT_TEST_SPLIT_INDEX=0 GIT_TEST_SPLIT_INDEX=0
export GIT_TEST_SPLIT_INDEX export GIT_TEST_SPLIT_INDEX


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


if ! test_have_prereq JGIT if ! test_have_prereq JGIT

View File

@ -16,7 +16,6 @@ export GIT_TEST_DEFAULT_HASH
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
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 'default write options' ' test_expect_success 'default write options' '

View File

@ -72,7 +72,6 @@ In addition:


' '


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh . "$TEST_DIRECTORY"/lib-read-tree.sh
. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh . "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh

View File

@ -21,7 +21,6 @@ In the test, these paths are used:
yomin - not in H or M yomin - not in H or M
' '


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh . "$TEST_DIRECTORY"/lib-read-tree.sh



View File

@ -9,7 +9,6 @@ This is identical to t1001, but uses -u to update the work tree as well.


' '


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh . "$TEST_DIRECTORY"/lib-read-tree.sh



Some files were not shown because too many files have changed in this diff Show More