Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-08-02 18:33:12 +0300
committerJunio C Hamano <gitster@pobox.com>2022-08-03 20:13:50 +0300
commitc541e77cf83707d04eeaea4e25f1147017397afe (patch)
tree8463d232f1b9b33882356ec9f5418253e3d5f82a /t
parentc5365e93fd946c6bd82d0fe1a6083c78ddcce1ab (diff)
test-fast-rebase helper: use release_revisions() (again)
Fix a bug in 0139c58ab95 (revisions API users: add "goto cleanup" for release_revisions(), 2022-04-13), in that commit a release_revisions() call was added to this function, but it never did anything due to this TODO memset() added in fe1a21d5267 (fast-rebase: demonstrate merge-ort's API via new test-tool command, 2020-10-29). Simply removing the memset() will fix the "cmdline" which can be seen when running t5520-pull.sh. This sort of thing could be detected automatically with a rule similar to the unused.cocci merged in 7fa60d2a5b6 (Merge branch 'ab/cocci-unused' into next, 2022-07-11). The following rule on top would catch the case being fixed here: @@ type T; identifier I; identifier REL1 =~ "^[a-z_]*_(release|reset|clear|free)$"; identifier REL2 =~ "^(release|clear|free)_[a-z_]*$"; @@ - memset(\( I \| &I \), 0, ...); ... when != \( I \| &I \) ( \( REL1 \| REL2 \)( \( I \| &I \), ...); | \( REL1 \| REL2 \)( \( &I \| I \) ); ) ... when != \( I \| &I \) That rule should arguably use only &I, not I (as we might be passed a pointer). The distinction would matter if anyone cared about the side-effects of a memset() followed by release() of a pointer to a variable passed into the function. As such a pattern would be at best very confusing, and most likely point to buggy code as in this case, the above rule is probably fine as-is. But as this rule only found one such bug in the entire codebase let's not add it to contrib/coccinelle/unused.cocci for now, we can always dig it up in the future if it's deemed useful. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rw-r--r--t/helper/test-fast-rebase.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c
index 4e5553e202..45665ec19a 100644
--- a/t/helper/test-fast-rebase.c
+++ b/t/helper/test-fast-rebase.c
@@ -184,8 +184,6 @@ int cmd__fast_rebase(int argc, const char **argv)
last_picked_commit = commit;
last_commit = create_commit(result.tree, commit, last_commit);
}
- /* TODO: There should be some kind of rev_info_free(&revs) call... */
- memset(&revs, 0, sizeof(revs));
merge_switch_to_result(&merge_opt, head_tree, &result, 1, !result.clean);