mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
Merge branch 'ab/mark-leak-free-tests-more'
Bunch of tests are marked as "passing leak check". * ab/mark-leak-free-tests-more: merge: add missing strbuf_release() ls-files: add missing string_list_clear() ls-files: fix a trivial dir_clear() leak tests: fix test-oid-array leak, test in SANITIZE=leak tests: fix a memory leak in test-oidtree.c tests: fix a memory leak in test-parse-options.c tests: fix a memory leak in test-prio-queue.c
This commit is contained in:
commit
54c4f8ce52
|
@ -672,6 +672,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
|
||||||
N_("suppress duplicate entries")),
|
N_("suppress duplicate entries")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if (argc == 2 && !strcmp(argv[1], "-h"))
|
if (argc == 2 && !strcmp(argv[1], "-h"))
|
||||||
usage_with_options(ls_files_usage, builtin_ls_files_options);
|
usage_with_options(ls_files_usage, builtin_ls_files_options);
|
||||||
|
@ -775,16 +776,13 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
|
||||||
if (show_resolve_undo)
|
if (show_resolve_undo)
|
||||||
show_ru_info(the_repository->index);
|
show_ru_info(the_repository->index);
|
||||||
|
|
||||||
if (ps_matched) {
|
if (ps_matched && report_path_error(ps_matched, &pathspec)) {
|
||||||
int bad;
|
fprintf(stderr, "Did you forget to 'git add'?\n");
|
||||||
bad = report_path_error(ps_matched, &pathspec);
|
ret = 1;
|
||||||
if (bad)
|
|
||||||
fprintf(stderr, "Did you forget to 'git add'?\n");
|
|
||||||
|
|
||||||
return bad ? 1 : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string_list_clear(&exclude_list, 0);
|
||||||
dir_clear(&dir);
|
dir_clear(&dir);
|
||||||
free(max_prefix);
|
free(max_prefix);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1578,6 +1578,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
finish(head_commit, remoteheads, &commit->object.oid, msg.buf);
|
finish(head_commit, remoteheads, &commit->object.oid, msg.buf);
|
||||||
remove_merge_branch_state(the_repository);
|
remove_merge_branch_state(the_repository);
|
||||||
|
strbuf_release(&msg);
|
||||||
goto done;
|
goto done;
|
||||||
} else if (!remoteheads->next && common->next)
|
} else if (!remoteheads->next && common->next)
|
||||||
;
|
;
|
||||||
|
@ -1748,6 +1749,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||||
ret = suggest_conflicts();
|
ret = suggest_conflicts();
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
strbuf_release(&buf);
|
||||||
free(branch_to_free);
|
free(branch_to_free);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,5 +35,9 @@ int cmd__oid_array(int argc, const char **argv)
|
||||||
else
|
else
|
||||||
die("unknown command: %s", line.buf);
|
die("unknown command: %s", line.buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strbuf_release(&line);
|
||||||
|
oid_array_clear(&array);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,5 +45,8 @@ int cmd__oidtree(int argc, const char **argv)
|
||||||
die("unknown command: %s", line.buf);
|
die("unknown command: %s", line.buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strbuf_release(&line);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ static int dry_run = 0, quiet = 0;
|
||||||
static char *string = NULL;
|
static char *string = NULL;
|
||||||
static char *file = NULL;
|
static char *file = NULL;
|
||||||
static int ambiguous;
|
static int ambiguous;
|
||||||
static struct string_list list = STRING_LIST_INIT_NODUP;
|
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
int called;
|
int called;
|
||||||
|
@ -107,6 +106,8 @@ int cmd__parse_options(int argc, const char **argv)
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
struct string_list expect = STRING_LIST_INIT_NODUP;
|
struct string_list expect = STRING_LIST_INIT_NODUP;
|
||||||
|
struct string_list list = STRING_LIST_INIT_NODUP;
|
||||||
|
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT_BOOL(0, "yes", &boolean, "get a boolean"),
|
OPT_BOOL(0, "yes", &boolean, "get a boolean"),
|
||||||
OPT_BOOL('D', "no-doubt", &boolean, "begins with 'no-'"),
|
OPT_BOOL('D', "no-doubt", &boolean, "begins with 'no-'"),
|
||||||
|
@ -185,5 +186,9 @@ int cmd__parse_options(int argc, const char **argv)
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
show(&expect, &ret, "arg %02d: %s", i, argv[i]);
|
show(&expect, &ret, "arg %02d: %s", i, argv[i]);
|
||||||
|
|
||||||
|
expect.strdup_strings = 1;
|
||||||
|
string_list_clear(&expect, 0);
|
||||||
|
string_list_clear(&list, 0);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,5 +46,7 @@ int cmd__prio_queue(int argc, const char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear_prio_queue(&pq);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='basic tests for priority queue implementation'
|
test_description='basic tests for priority queue implementation'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
cat >expect <<'EOF'
|
cat >expect <<'EOF'
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='basic tests for the oid array implementation'
|
test_description='basic tests for the oid array implementation'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
echoid () {
|
echoid () {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='basic tests for the oidtree implementation'
|
test_description='basic tests for the oidtree implementation'
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
maxhexsz=$(test_oid hexsz)
|
maxhexsz=$(test_oid hexsz)
|
||||||
|
|
|
@ -8,6 +8,7 @@ test_description='git ls-files --others --exclude
|
||||||
This test runs git ls-files --others and tests --exclude patterns.
|
This test runs git ls-files --others and tests --exclude patterns.
|
||||||
'
|
'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
rm -fr one three
|
rm -fr one three
|
||||||
|
@ -102,7 +103,7 @@ test_expect_success \
|
||||||
>output &&
|
>output &&
|
||||||
test_cmp expect output'
|
test_cmp expect output'
|
||||||
|
|
||||||
test_expect_success 'restore gitignore' '
|
test_expect_success !SANITIZE_LEAK 'restore gitignore' '
|
||||||
git checkout --ignore-skip-worktree-bits $allignores &&
|
git checkout --ignore-skip-worktree-bits $allignores &&
|
||||||
rm .git/index
|
rm .git/index
|
||||||
'
|
'
|
||||||
|
@ -125,7 +126,7 @@ cat > expect << EOF
|
||||||
# three/
|
# three/
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'git status honors core.excludesfile' \
|
test_expect_success !SANITIZE_LEAK 'git status honors core.excludesfile' \
|
||||||
'test_cmp expect output'
|
'test_cmp expect output'
|
||||||
|
|
||||||
test_expect_success 'trailing slash in exclude allows directory match(1)' '
|
test_expect_success 'trailing slash in exclude allows directory match(1)' '
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='ls-files tests with relative paths
|
||||||
This test runs git ls-files with various relative path arguments.
|
This test runs git ls-files with various relative path arguments.
|
||||||
'
|
'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'prepare' '
|
test_expect_success 'prepare' '
|
||||||
|
|
|
@ -9,6 +9,8 @@ This test runs git ls-files --error-unmatch to ensure it correctly
|
||||||
returns an error when a non-existent path is provided on the command
|
returns an error when a non-existent path is provided on the command
|
||||||
line.
|
line.
|
||||||
'
|
'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
test_description='Test of git add, including the -- option.'
|
test_description='Test of git add, including the -- option.'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# Test the file mode "$1" of the file "$2" in the index.
|
# Test the file mode "$1" of the file "$2" in the index.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='reset --hard unmerged'
|
test_description='reset --hard unmerged'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='git merge
|
||||||
|
|
||||||
Testing merge when using a custom message for the merge commit.'
|
Testing merge when using a custom message for the merge commit.'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
create_merge_msgs() {
|
create_merge_msgs() {
|
||||||
|
|
Loading…
Reference in a new issue