Browse Source

Merge branch 'ab/various-leak-fixes'

Various leak fixes.

* ab/various-leak-fixes:
  built-ins: use free() not UNLEAK() if trivial, rm dead code
  revert: fix parse_options_concat() leak
  cherry-pick: free "struct replay_opts" members
  rebase: don't leak on "--abort"
  connected.c: free the "struct packed_git"
  sequencer.c: fix "opts->strategy" leak in read_strategy_opts()
  ls-files: fix a --with-tree memory leak
  revision API: call graph_clear() in release_revisions()
  unpack-file: fix ancient leak in create_temp_file()
  built-ins & libs & helpers: add/move destructors, fix leaks
  dir.c: free "ident" and "exclude_per_dir" in "struct untracked_cache"
  read-cache.c: clear and free "sparse_checkout_patterns"
  commit: discard partial cache before (re-)reading it
  {reset,merge}: call discard_index() before returning
  tests: mark tests as passing with SANITIZE=leak
maint
Junio C Hamano 2 years ago
parent
commit
9ea1378d04
  1. 2
      builtin/add.c
  2. 9
      builtin/bugreport.c
  3. 2
      builtin/checkout.c
  4. 11
      builtin/commit.c
  5. 28
      builtin/config.c
  6. 2
      builtin/diff.c
  7. 1
      builtin/ls-files.c
  8. 1
      builtin/merge.c
  9. 4
      builtin/rebase.c
  10. 2
      builtin/repack.c
  11. 2
      builtin/reset.c
  12. 1
      builtin/rev-parse.c
  13. 4
      builtin/revert.c
  14. 2
      builtin/stash.c
  15. 1
      builtin/unpack-file.c
  16. 7
      builtin/worktree.c
  17. 6
      connected.c
  18. 8
      dir.c
  19. 1
      dir.h
  20. 5
      read-cache.c
  21. 1
      ref-filter.c
  22. 1
      revision.c
  23. 1
      sequencer.c
  24. 1
      t/helper/test-fake-ssh.c
  25. 1
      t/t0068-for-each-repo.sh
  26. 1
      t/t0070-fundamental.sh
  27. 1
      t/t1011-read-tree-sparse-checkout.sh
  28. 2
      t/t1022-read-tree-partial-clone.sh
  29. 2
      t/t1404-update-ref-errors.sh
  30. 1
      t/t1409-avoid-packing-refs.sh
  31. 1
      t/t1413-reflog-detach.sh
  32. 2
      t/t1501-work-tree.sh
  33. 1
      t/t2012-checkout-last.sh
  34. 1
      t/t2018-checkout-branch.sh
  35. 1
      t/t2025-checkout-no-overlay.sh
  36. 1
      t/t3009-ls-files-others-nonsubmodule.sh
  37. 2
      t/t3010-ls-files-killed-modified.sh
  38. 1
      t/t3050-subprojects-fetch.sh
  39. 2
      t/t3060-ls-files-with-tree.sh
  40. 1
      t/t3409-rebase-environ.sh
  41. 1
      t/t3413-rebase-hook.sh
  42. 1
      t/t3428-rebase-signoff.sh
  43. 1
      t/t3429-rebase-edit-todo.sh
  44. 1
      t/t3433-rebase-across-mode-change.sh
  45. 4
      t/t4015-diff-whitespace.sh
  46. 2
      t/t4045-diff-relative.sh
  47. 1
      t/t4052-stat-output.sh
  48. 1
      t/t4053-diff-no-index.sh
  49. 1
      t/t4067-diff-partial-clone.sh
  50. 1
      t/t4111-apply-subdir.sh
  51. 1
      t/t4135-apply-weird-filenames.sh
  52. 1
      t/t4213-log-tabexpand.sh
  53. 2
      t/t5544-pack-objects-hook.sh
  54. 2
      t/t5554-noop-fetch-negotiator.sh
  55. 1
      t/t5610-clone-detached.sh
  56. 1
      t/t5611-clone-config.sh
  57. 1
      t/t5614-clone-submodules-shallow.sh
  58. 1
      t/t5617-clone-submodules-remote.sh
  59. 2
      t/t5618-alternate-refs.sh
  60. 2
      t/t6060-merge-index.sh
  61. 1
      t/t6301-for-each-ref-errors.sh
  62. 2
      t/t6401-merge-criss-cross.sh
  63. 1
      t/t6406-merge-attr.sh
  64. 1
      t/t6407-merge-binary.sh
  65. 1
      t/t6415-merge-dir-to-symlink.sh
  66. 1
      t/t6435-merge-sparse.sh
  67. 2
      t/t7103-reset-bare.sh
  68. 1
      t/t7504-commit-msg-hook.sh
  69. 1
      t/t7517-per-repo-email.sh
  70. 1
      t/t7520-ignored-hook-warning.sh
  71. 1
      t/t7605-merge-resolve.sh
  72. 1
      t/t7614-merge-signoff.sh
  73. 2
      t/t9003-help-autocorrect.sh
  74. 1
      t/t9115-git-svn-dcommit-funky-renames.sh
  75. 1
      t/t9146-git-svn-empty-dirs.sh
  76. 1
      t/t9148-git-svn-propset.sh
  77. 1
      t/t9160-git-svn-preserve-empty-dirs.sh

2
builtin/add.c

@ -695,6 +695,6 @@ finish: @@ -695,6 +695,6 @@ finish:
die(_("Unable to write new index file"));

dir_clear(&dir);
UNLEAK(pathspec);
clear_pathspec(&pathspec);
return exit_status;
}

9
builtin/bugreport.c

@ -106,6 +106,7 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) @@ -106,6 +106,7 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
const char *user_relative_path = NULL;
char *prefixed_filename;
size_t output_path_len;
int ret;

const struct option bugreport_options[] = {
OPT_CALLBACK_F(0, "diagnose", &diagnose, N_("mode"),
@ -182,7 +183,9 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) @@ -182,7 +183,9 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
user_relative_path);

free(prefixed_filename);
UNLEAK(buffer);
UNLEAK(report_path);
return !!launch_editor(report_path.buf, NULL, NULL);
strbuf_release(&buffer);

ret = !!launch_editor(report_path.buf, NULL, NULL);
strbuf_release(&report_path);
return ret;
}

2
builtin/checkout.c

@ -1471,6 +1471,8 @@ static void die_if_some_operation_in_progress(void) @@ -1471,6 +1471,8 @@ static void die_if_some_operation_in_progress(void)
"or \"git worktree add\"."));
if (state.bisect_in_progress)
warning(_("you are switching branch while bisecting"));

wt_status_state_free_buffers(&state);
}

static int checkout_branch(struct checkout_opts *opts,

11
builtin/commit.c

@ -991,8 +991,11 @@ static int prepare_to_commit(const char *index_file, const char *prefix, @@ -991,8 +991,11 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
struct object_id oid;
const char *parent = "HEAD";

if (!active_nr && read_cache() < 0)
if (!active_nr) {
discard_cache();
if (read_cache() < 0)
die(_("Cannot read index"));
}

if (amend)
parent = "HEAD^1";
@ -1875,8 +1878,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix) @@ -1875,8 +1878,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
apply_autostash(git_path_merge_autostash(the_repository));

cleanup:
UNLEAK(author_ident);
UNLEAK(err);
UNLEAK(sb);
strbuf_release(&author_ident);
strbuf_release(&err);
strbuf_release(&sb);
return ret;
}

28
builtin/config.c

@ -639,8 +639,9 @@ static char *default_user_config(void) @@ -639,8 +639,9 @@ static char *default_user_config(void)
int cmd_config(int argc, const char **argv, const char *prefix)
{
int nongit = !startup_info->have_repository;
char *value;
char *value = NULL;
int flags = 0;
int ret = 0;

given_config_source.file = xstrdup_or_null(getenv(CONFIG_ENVIRONMENT));

@ -856,23 +857,19 @@ int cmd_config(int argc, const char **argv, const char *prefix) @@ -856,23 +857,19 @@ int cmd_config(int argc, const char **argv, const char *prefix)
free(config_file);
}
else if (actions == ACTION_SET) {
int ret;
check_write();
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1]);
UNLEAK(value);
ret = git_config_set_in_file_gently(given_config_source.file, argv[0], value);
if (ret == CONFIG_NOTHING_SET)
error(_("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
return ret;
}
else if (actions == ACTION_SET_ALL) {
check_write();
check_argc(argc, 2, 3);
value = normalize_value(argv[0], argv[1]);
UNLEAK(value);
return git_config_set_multivar_in_file_gently(given_config_source.file,
ret = git_config_set_multivar_in_file_gently(given_config_source.file,
argv[0], value, argv[2],
flags);
}
@ -880,8 +877,7 @@ int cmd_config(int argc, const char **argv, const char *prefix) @@ -880,8 +877,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
check_write();
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1]);
UNLEAK(value);
return git_config_set_multivar_in_file_gently(given_config_source.file,
ret = git_config_set_multivar_in_file_gently(given_config_source.file,
argv[0], value,
CONFIG_REGEX_NONE,
flags);
@ -890,8 +886,7 @@ int cmd_config(int argc, const char **argv, const char *prefix) @@ -890,8 +886,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
check_write();
check_argc(argc, 2, 3);
value = normalize_value(argv[0], argv[1]);
UNLEAK(value);
return git_config_set_multivar_in_file_gently(given_config_source.file,
ret = git_config_set_multivar_in_file_gently(given_config_source.file,
argv[0], value, argv[2],
flags | CONFIG_FLAGS_MULTI_REPLACE);
}
@ -934,26 +929,28 @@ int cmd_config(int argc, const char **argv, const char *prefix) @@ -934,26 +929,28 @@ int cmd_config(int argc, const char **argv, const char *prefix)
flags | CONFIG_FLAGS_MULTI_REPLACE);
}
else if (actions == ACTION_RENAME_SECTION) {
int ret;
check_write();
check_argc(argc, 2, 2);
ret = git_config_rename_section_in_file(given_config_source.file,
argv[0], argv[1]);
if (ret < 0)
return ret;
if (ret == 0)
else if (!ret)
die(_("no such section: %s"), argv[0]);
else
ret = 0;
}
else if (actions == ACTION_REMOVE_SECTION) {
int ret;
check_write();
check_argc(argc, 1, 1);
ret = git_config_rename_section_in_file(given_config_source.file,
argv[0], NULL);
if (ret < 0)
return ret;
if (ret == 0)
else if (!ret)
die(_("no such section: %s"), argv[0]);
else
ret = 0;
}
else if (actions == ACTION_GET_COLOR) {
check_argc(argc, 1, 2);
@ -966,5 +963,6 @@ int cmd_config(int argc, const char **argv, const char *prefix) @@ -966,5 +963,6 @@ int cmd_config(int argc, const char **argv, const char *prefix)
return get_colorbool(argv[0], argc == 2);
}

return 0;
free(value);
return ret;
}

2
builtin/diff.c

@ -612,7 +612,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix) @@ -612,7 +612,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
if (1 < rev.diffopt.skip_stat_unmatch)
refresh_index_quietly();
release_revisions(&rev);
UNLEAK(ent);
object_array_clear(&ent);
UNLEAK(blob);
return result;
}

1
builtin/ls-files.c

@ -613,6 +613,7 @@ void overlay_tree_on_index(struct index_state *istate, @@ -613,6 +613,7 @@ void overlay_tree_on_index(struct index_state *istate,
if (!fn)
fn = read_one_entry_quick;
err = read_tree(the_repository, tree, &pathspec, fn, istate);
clear_pathspec(&pathspec);
if (err)
die("unable to read tree entries %s", tree_name);


1
builtin/merge.c

@ -1789,5 +1789,6 @@ done: @@ -1789,5 +1789,6 @@ done:
}
strbuf_release(&buf);
free(branch_to_free);
discard_index(&the_index);
return ret;
}

4
builtin/rebase.c

@ -1322,6 +1322,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) @@ -1322,6 +1322,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (reset_head(the_repository, &ropts) < 0)
die(_("could not move back to %s"),
oid_to_hex(&options.orig_head->object.oid));
strbuf_release(&head_msg);
remove_branch_state(the_repository, 0);
ret = finish_rebase(&options);
goto cleanup;
@ -1828,10 +1829,13 @@ cleanup: @@ -1828,10 +1829,13 @@ cleanup:
strbuf_release(&revisions);
free(options.reflog_action);
free(options.head_name);
strvec_clear(&options.git_am_opts);
free(options.gpg_sign_opt);
free(options.cmd);
free(options.strategy);
strbuf_release(&options.git_format_patch_opt);
free(squash_onto_name);
string_list_clear(&exec, 0);
string_list_clear(&strategy_options, 0);
return !!ret;
}

2
builtin/repack.c

@ -973,6 +973,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix) @@ -973,6 +973,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
item = string_list_append(&names, line.buf);
item->util = populate_pack_exts(item->string);
}
strbuf_release(&line);
fclose(out);
ret = finish_command(&cmd);
if (ret)
@ -1175,7 +1176,6 @@ int cmd_repack(int argc, const char **argv, const char *prefix) @@ -1175,7 +1176,6 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
string_list_clear(&existing_nonkept_packs, 0);
string_list_clear(&existing_kept_packs, 0);
clear_pack_geometry(geometry);
strbuf_release(&line);

return 0;
}

2
builtin/reset.c

@ -485,5 +485,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) @@ -485,5 +485,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
if (!pathspec.nr)
remove_branch_state(the_repository, 0);

discard_index(&the_index);

return update_ref_status;
}

1
builtin/rev-parse.c

@ -530,6 +530,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix) @@ -530,6 +530,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
strbuf_addstr(&parsed, " --");
sq_quote_argv(&parsed, argv);
puts(parsed.buf);
strbuf_release(&parsed);
return 0;
}


4
builtin/revert.c

@ -221,6 +221,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts) @@ -221,6 +221,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
opts->strategy = xstrdup_or_null(opts->strategy);
if (!opts->strategy && getenv("GIT_TEST_MERGE_ALGORITHM"))
opts->strategy = xstrdup(getenv("GIT_TEST_MERGE_ALGORITHM"));
free(options);

if (cmd == 'q') {
int ret = sequencer_remove_state(opts);
@ -261,6 +262,9 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix) @@ -261,6 +262,9 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
opts.action = REPLAY_PICK;
sequencer_init_config(&opts);
res = run_sequencer(argc, argv, &opts);
if (opts.revs)
release_revisions(opts.revs);
free(opts.revs);
if (res < 0)
die(_("cherry-pick failed"));
return res;

2
builtin/stash.c

@ -1689,8 +1689,10 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q @@ -1689,8 +1689,10 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
}

done:
strbuf_release(&patch);
free_stash_info(&info);
strbuf_release(&stash_msg_buf);
strbuf_release(&untracked_files);
return ret;
}


1
builtin/unpack-file.c

@ -19,6 +19,7 @@ static char *create_temp_file(struct object_id *oid) @@ -19,6 +19,7 @@ static char *create_temp_file(struct object_id *oid)
if (write_in_full(fd, buf, size) < 0)
die_errno("unable to write temp-file");
close(fd);
free(buf);
return path;
}


7
builtin/worktree.c

@ -629,6 +629,7 @@ static int add(int ac, const char **av, const char *prefix) @@ -629,6 +629,7 @@ static int add(int ac, const char **av, const char *prefix)
N_("try to match the new branch name with a remote-tracking branch")),
OPT_END()
};
int ret;

memset(&opts, 0, sizeof(opts));
opts.checkout = 1;
@ -705,9 +706,9 @@ static int add(int ac, const char **av, const char *prefix) @@ -705,9 +706,9 @@ static int add(int ac, const char **av, const char *prefix)
die(_("--[no-]track can only be used if a new branch is created"));
}

UNLEAK(path);
UNLEAK(opts);
return add_worktree(path, branch, &opts);
ret = add_worktree(path, branch, &opts);
free(path);
return ret;
}

static void show_worktree_porcelain(struct worktree *wt, int line_terminator)

6
connected.c

@ -85,6 +85,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data, @@ -85,6 +85,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
promisor_pack_found:
;
} while ((oid = fn(cb_data)) != NULL);
free(new_pack);
return 0;
}

@ -121,8 +122,10 @@ no_promisor_pack_found: @@ -121,8 +122,10 @@ no_promisor_pack_found:
else
rev_list.no_stderr = opt->quiet;

if (start_command(&rev_list))
if (start_command(&rev_list)) {
free(new_pack);
return error(_("Could not run 'git rev-list'"));
}

sigchain_push(SIGPIPE, SIG_IGN);

@ -154,5 +157,6 @@ no_promisor_pack_found: @@ -154,5 +157,6 @@ no_promisor_pack_found:
err = error_errno(_("failed to close rev-list's stdin"));

sigchain_pop(SIGPIPE);
free(new_pack);
return finish_command(&rev_list) || err;
}

8
dir.c

@ -3581,7 +3581,11 @@ static void free_untracked(struct untracked_cache_dir *ucd) @@ -3581,7 +3581,11 @@ static void free_untracked(struct untracked_cache_dir *ucd)

void free_untracked_cache(struct untracked_cache *uc)
{
if (uc)
if (!uc)
return;

free(uc->exclude_per_dir_to_free);
strbuf_release(&uc->ident);
free_untracked(uc->root);
free(uc);
}
@ -3739,7 +3743,7 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned long @@ -3739,7 +3743,7 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned long
next + offset + hashsz);
uc->dir_flags = get_be32(next + ouc_offset(dir_flags));
exclude_per_dir = (const char *)next + exclude_per_dir_offset;
uc->exclude_per_dir = xstrdup(exclude_per_dir);
uc->exclude_per_dir = uc->exclude_per_dir_to_free = xstrdup(exclude_per_dir);
/* NUL after exclude_per_dir is covered by sizeof(*ouc) */
next += exclude_per_dir_offset + strlen(exclude_per_dir) + 1;
if (next >= end)

1
dir.h

@ -188,6 +188,7 @@ struct untracked_cache { @@ -188,6 +188,7 @@ struct untracked_cache {
struct oid_stat ss_info_exclude;
struct oid_stat ss_excludes_file;
const char *exclude_per_dir;
char *exclude_per_dir_to_free;
struct strbuf ident;
/*
* dir_struct#flags must match dir_flags or the untracked

5
read-cache.c

@ -2558,6 +2558,11 @@ void discard_index(struct index_state *istate) @@ -2558,6 +2558,11 @@ void discard_index(struct index_state *istate)
free_untracked_cache(istate->untracked);
istate->untracked = NULL;

if (istate->sparse_checkout_patterns) {
clear_pattern_list(istate->sparse_checkout_patterns);
FREE_AND_NULL(istate->sparse_checkout_patterns);
}

if (istate->ce_mem_pool) {
mem_pool_discard(istate->ce_mem_pool, should_validate_cache_entries());
FREE_AND_NULL(istate->ce_mem_pool);

1
ref-filter.c

@ -1358,6 +1358,7 @@ static void find_subpos(const char *buf, @@ -1358,6 +1358,7 @@ static void find_subpos(const char *buf,

/* parse signature first; we might not even have a subject line */
parse_signature(buf, end - buf, &payload, &signature);
strbuf_release(&payload);

/* skip past header until we hit empty line */
while (*buf && *buf != '\n') {

1
revision.c

@ -3054,6 +3054,7 @@ void release_revisions(struct rev_info *revs) @@ -3054,6 +3054,7 @@ void release_revisions(struct rev_info *revs)
date_mode_release(&revs->date_mode);
release_revisions_mailmap(revs->mailmap);
free_grep_patterns(&revs->grep_filter);
graph_clear(revs->graph);
/* TODO (need to handle "no_free"): diff_free(&revs->diffopt) */
diff_free(&revs->pruning);
reflog_walk_info_release(revs->reflog_info);

1
sequencer.c

@ -2897,6 +2897,7 @@ static void read_strategy_opts(struct replay_opts *opts, struct strbuf *buf) @@ -2897,6 +2897,7 @@ static void read_strategy_opts(struct replay_opts *opts, struct strbuf *buf)
strbuf_reset(buf);
if (!read_oneliner(buf, rebase_path_strategy(), 0))
return;
free(opts->strategy);
opts->strategy = strbuf_detach(buf, NULL);
if (!read_oneliner(buf, rebase_path_strategy_opts(), 0))
return;

1
t/helper/test-fake-ssh.c

@ -17,6 +17,7 @@ int cmd_main(int argc, const char **argv) @@ -17,6 +17,7 @@ int cmd_main(int argc, const char **argv)
f = fopen(buf.buf, "w");
if (!f)
die("Could not write to %s", buf.buf);
strbuf_release(&buf);
for (i = 0; i < argc; i++)
fprintf(f, "%s%s", i > 0 ? " " : "", i > 0 ? argv[i] : "ssh:");
fprintf(f, "\n");

1
t/t0068-for-each-repo.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='git for-each-repo builtin'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'run based on configured value' '

1
t/t0070-fundamental.sh

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

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'character classes (isspace, isalpha etc.)' '

1
t/t1011-read-tree-sparse-checkout.sh

@ -12,6 +12,7 @@ test_description='sparse checkout tests @@ -12,6 +12,7 @@ test_description='sparse checkout tests
'

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


2
t/t1022-read-tree-partial-clone.sh

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
test_description='git read-tree in partial clones'

TEST_NO_CREATE_REPO=1

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'read-tree in partial clone prefetches in one batch' '

2
t/t1404-update-ref-errors.sh

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
#!/bin/sh

test_description='Test git update-ref error handling'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

# Create some references, perhaps run pack-refs --all, then try to

1
t/t1409-avoid-packing-refs.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='avoid rewriting packed-refs unnecessarily'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

# Add an identifying mark to the packed-refs file header line. This

1
t/t1413-reflog-detach.sh

@ -4,6 +4,7 @@ test_description='Test reflog interaction with detached HEAD' @@ -4,6 +4,7 @@ test_description='Test reflog interaction with detached HEAD'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

reset_state () {

2
t/t1501-work-tree.sh

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
#!/bin/sh

test_description='test separate work tree'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t2012-checkout-last.sh

@ -5,6 +5,7 @@ test_description='checkout can switch to last branch and merge base' @@ -5,6 +5,7 @@ test_description='checkout can switch to last branch and merge base'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t2018-checkout-branch.sh

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
test_description='checkout'

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

# Arguments: [!] <branch> <oid> [<checkout options>]

1
t/t2025-checkout-no-overlay.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='checkout --no-overlay <tree-ish> -- <pathspec>'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t3009-ls-files-others-nonsubmodule.sh

@ -18,6 +18,7 @@ This test runs git ls-files --others with the following working tree: @@ -18,6 +18,7 @@ This test runs git ls-files --others with the following working tree:
git repository with a commit and an untracked file
'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup: directories' '

2
t/t3010-ls-files-killed-modified.sh

@ -41,6 +41,8 @@ Also for modification test, the cache and working tree have: @@ -41,6 +41,8 @@ Also for modification test, the cache and working tree have:
We should report path0, path1, path2/file2, path3/file3, path7 and path8
modified without reporting path9 and path10. submod1 is also modified.
'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'git update-index --add to add various paths.' '

1
t/t3050-subprojects-fetch.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='fetching and pushing project with subproject'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success setup '

2
t/t3060-ls-files-with-tree.sh

@ -8,6 +8,8 @@ test_description='git ls-files test (--with-tree). @@ -8,6 +8,8 @@ test_description='git ls-files test (--with-tree).
This test runs git ls-files --with-tree and in particular in
a scenario known to trigger a crash with some versions of git.
'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t3409-rebase-environ.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='git rebase interactive environment'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t3413-rebase-hook.sh

@ -5,6 +5,7 @@ test_description='git rebase with its hook(s)' @@ -5,6 +5,7 @@ test_description='git rebase with its hook(s)'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success setup '

1
t/t3428-rebase-signoff.sh

@ -5,6 +5,7 @@ test_description='git rebase --signoff @@ -5,6 +5,7 @@ test_description='git rebase --signoff
This test runs git rebase --signoff and make sure that it works.
'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

# A simple file to commit

1
t/t3429-rebase-edit-todo.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='rebase should reread the todo file if an exec modifies it'

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


1
t/t3433-rebase-across-mode-change.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='git rebase across mode change'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

4
t/t4015-diff-whitespace.sh

@ -1638,7 +1638,7 @@ test_expect_success 'no effect on diff from --color-moved with --word-diff' ' @@ -1638,7 +1638,7 @@ test_expect_success 'no effect on diff from --color-moved with --word-diff' '
test_cmp expect actual
'

test_expect_success !SANITIZE_LEAK 'no effect on show from --color-moved with --word-diff' '
test_expect_success 'no effect on show from --color-moved with --word-diff' '
git show --color-moved --word-diff >actual &&
git show --word-diff >expect &&
test_cmp expect actual
@ -2024,7 +2024,7 @@ test_expect_success '--color-moved rewinds for MIN_ALNUM_COUNT' ' @@ -2024,7 +2024,7 @@ test_expect_success '--color-moved rewinds for MIN_ALNUM_COUNT' '
test_cmp expected actual
'

test_expect_success !SANITIZE_LEAK 'move detection with submodules' '
test_expect_success 'move detection with submodules' '
test_create_repo bananas &&
echo ripe >bananas/recipe &&
git -C bananas add recipe &&

2
t/t4045-diff-relative.sh

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
#!/bin/sh

test_description='diff --relative tests'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t4052-stat-output.sh

@ -8,6 +8,7 @@ test_description='test --stat output of various commands' @@ -8,6 +8,7 @@ test_description='test --stat output of various commands'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

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


1
t/t4053-diff-no-index.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='diff --no-index'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t4067-diff-partial-clone.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='behavior of diff when reading objects in a partial clone'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'git show batches blobs' '

1
t/t4111-apply-subdir.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='patching from inconvenient places'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t4135-apply-weird-filenames.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='git apply with weird postimage filenames'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t4213-log-tabexpand.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='log/show --expand-tabs'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

HT=" "

2
t/t5544-pack-objects-hook.sh

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
#!/bin/sh

test_description='test custom script in place of pack-objects'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'create some history to fetch' '

2
t/t5554-noop-fetch-negotiator.sh

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
#!/bin/sh

test_description='test noop fetch negotiator'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'noop negotiator does not emit any "have"' '

1
t/t5610-clone-detached.sh

@ -4,6 +4,7 @@ test_description='test cloning a repository with detached HEAD' @@ -4,6 +4,7 @@ test_description='test cloning a repository with detached HEAD'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

head_is_detached() {

1
t/t5611-clone-config.sh

@ -4,6 +4,7 @@ test_description='tests for git clone -c key=value' @@ -4,6 +4,7 @@ test_description='tests for git clone -c key=value'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'clone -c sets config in cloned repo' '

1
t/t5614-clone-submodules-shallow.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='Test shallow cloning of repos with submodules'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

pwd=$(pwd)

1
t/t5617-clone-submodules-remote.sh

@ -5,6 +5,7 @@ test_description='Test cloning repos with submodules using remote-tracking branc @@ -5,6 +5,7 @@ test_description='Test cloning repos with submodules using remote-tracking branc
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

pwd=$(pwd)

2
t/t5618-alternate-refs.sh

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
#!/bin/sh

test_description='test handling of --alternate-refs traversal'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

# Avoid test_commit because we want a specific and known set of refs:

2
t/t6060-merge-index.sh

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
#!/bin/sh

test_description='basic git merge-index / git-merge-one-file tests'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup diverging branches' '

1
t/t6301-for-each-ref-errors.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='for-each-ref errors for broken refs'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

ZEROS=$ZERO_OID

2
t/t6401-merge-criss-cross.sh

@ -8,6 +8,8 @@ @@ -8,6 +8,8 @@


test_description='Test criss-cross merge'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'prepare repository' '

1
t/t6406-merge-attr.sh

@ -8,6 +8,7 @@ test_description='per path merge controlled by merge attribute' @@ -8,6 +8,7 @@ test_description='per path merge controlled by merge attribute'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success setup '

1
t/t6407-merge-binary.sh

@ -5,6 +5,7 @@ test_description='ask merge-recursive to merge binary files' @@ -5,6 +5,7 @@ test_description='ask merge-recursive to merge binary files'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success setup '

1
t/t6415-merge-dir-to-symlink.sh

@ -4,6 +4,7 @@ test_description='merging when a directory was replaced with a symlink' @@ -4,6 +4,7 @@ test_description='merging when a directory was replaced with a symlink'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'create a commit where dir a/b changed to symlink' '

1
t/t6435-merge-sparse.sh

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
test_description='merge with sparse files'

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

# test_file $filename $content

2
t/t7103-reset-bare.sh

@ -63,7 +63,7 @@ test_expect_success '"mixed" reset is not allowed in bare' ' @@ -63,7 +63,7 @@ test_expect_success '"mixed" reset is not allowed in bare' '
test_must_fail git reset --mixed HEAD^
'

test_expect_success !SANITIZE_LEAK '"soft" reset is allowed in bare' '
test_expect_success '"soft" reset is allowed in bare' '
git reset --soft HEAD^ &&
git show --pretty=format:%s >out &&
echo one >expect &&

1
t/t7504-commit-msg-hook.sh

@ -5,6 +5,7 @@ test_description='commit-msg hook' @@ -5,6 +5,7 @@ test_description='commit-msg hook'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'with no hook' '

1
t/t7517-per-repo-email.sh

@ -9,6 +9,7 @@ test_description='per-repo forced setting of email address' @@ -9,6 +9,7 @@ test_description='per-repo forced setting of email address'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup a likely user.useConfigOnly use case' '

1
t/t7520-ignored-hook-warning.sh

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@

test_description='ignored hook warning'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success setup '

1
t/t7605-merge-resolve.sh

@ -4,6 +4,7 @@ test_description='git merge @@ -4,6 +4,7 @@ test_description='git merge

Testing the resolve strategy.'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t7614-merge-signoff.sh

@ -8,6 +8,7 @@ This test runs git merge --signoff and makes sure that it works. @@ -8,6 +8,7 @@ This test runs git merge --signoff and makes sure that it works.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

# Setup test files

2
t/t9003-help-autocorrect.sh

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
#!/bin/sh

test_description='help.autocorrect finding a match'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '

1
t/t9115-git-svn-dcommit-funky-renames.sh

@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@

test_description='git svn dcommit can commit renames of files with ugly names'

TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh

test_expect_success 'load repository with strange names' '

1
t/t9146-git-svn-empty-dirs.sh

@ -4,7 +4,6 @@ @@ -4,7 +4,6 @@

test_description='git svn creates empty directories'

TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh

test_expect_success 'initialize repo' '

1
t/t9148-git-svn-propset.sh

@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@

test_description='git svn propset tests'

TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh

test_expect_success 'setup propset via import' '

1
t/t9160-git-svn-preserve-empty-dirs.sh

@ -9,7 +9,6 @@ This test uses git to clone a Subversion repository that contains empty @@ -9,7 +9,6 @@ This test uses git to clone a Subversion repository that contains empty
directories, and checks that corresponding directories are created in the
local Git repository with placeholder files.'

TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh

GIT_REPO=git-svn-repo

Loading…
Cancel
Save