revisions API: release "reflog_info" in release revisions()
Add a missing reflog_walk_info_release() to "reflog-walk.c" and use it in release_revisions(). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
ab1f6926e9
commit
81ffbf8380
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
struct complete_reflogs {
|
struct complete_reflogs {
|
||||||
char *ref;
|
char *ref;
|
||||||
const char *short_ref;
|
char *short_ref;
|
||||||
struct reflog_info {
|
struct reflog_info {
|
||||||
struct object_id ooid, noid;
|
struct object_id ooid, noid;
|
||||||
char *email;
|
char *email;
|
||||||
@ -51,9 +51,16 @@ static void free_complete_reflog(struct complete_reflogs *array)
|
|||||||
}
|
}
|
||||||
free(array->items);
|
free(array->items);
|
||||||
free(array->ref);
|
free(array->ref);
|
||||||
|
free(array->short_ref);
|
||||||
free(array);
|
free(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void complete_reflogs_clear(void *util, const char *str)
|
||||||
|
{
|
||||||
|
struct complete_reflogs *array = util;
|
||||||
|
free_complete_reflog(array);
|
||||||
|
}
|
||||||
|
|
||||||
static struct complete_reflogs *read_complete_reflog(const char *ref)
|
static struct complete_reflogs *read_complete_reflog(const char *ref)
|
||||||
{
|
{
|
||||||
struct complete_reflogs *reflogs =
|
struct complete_reflogs *reflogs =
|
||||||
@ -116,6 +123,21 @@ void init_reflog_walk(struct reflog_walk_info **info)
|
|||||||
(*info)->complete_reflogs.strdup_strings = 1;
|
(*info)->complete_reflogs.strdup_strings = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reflog_walk_info_release(struct reflog_walk_info *info)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (!info)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < info->nr; i++)
|
||||||
|
free(info->logs[i]);
|
||||||
|
string_list_clear_func(&info->complete_reflogs,
|
||||||
|
complete_reflogs_clear);
|
||||||
|
free(info->logs);
|
||||||
|
free(info);
|
||||||
|
}
|
||||||
|
|
||||||
int add_reflog_for_walk(struct reflog_walk_info *info,
|
int add_reflog_for_walk(struct reflog_walk_info *info,
|
||||||
struct commit *commit, const char *name)
|
struct commit *commit, const char *name)
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ struct reflog_walk_info;
|
|||||||
struct date_mode;
|
struct date_mode;
|
||||||
|
|
||||||
void init_reflog_walk(struct reflog_walk_info **info);
|
void init_reflog_walk(struct reflog_walk_info **info);
|
||||||
|
void reflog_walk_info_release(struct reflog_walk_info *info);
|
||||||
int add_reflog_for_walk(struct reflog_walk_info *info,
|
int add_reflog_for_walk(struct reflog_walk_info *info,
|
||||||
struct commit *commit, const char *name);
|
struct commit *commit, const char *name);
|
||||||
void show_reflog_message(struct reflog_walk_info *info, int,
|
void show_reflog_message(struct reflog_walk_info *info, int,
|
||||||
|
@ -2953,6 +2953,7 @@ void release_revisions(struct rev_info *revs)
|
|||||||
clear_pathspec(&revs->prune_data);
|
clear_pathspec(&revs->prune_data);
|
||||||
release_revisions_mailmap(revs->mailmap);
|
release_revisions_mailmap(revs->mailmap);
|
||||||
free_grep_patterns(&revs->grep_filter);
|
free_grep_patterns(&revs->grep_filter);
|
||||||
|
reflog_walk_info_release(revs->reflog_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_child(struct rev_info *revs, struct commit *parent, struct commit *child)
|
static void add_child(struct rev_info *revs, struct commit *parent, struct commit *child)
|
||||||
|
@ -5,6 +5,7 @@ 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}' '
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='basic symbolic-ref tests'
|
test_description='basic symbolic-ref tests'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# If the tests munging HEAD fail, they can break detection of
|
# If the tests munging HEAD fail, they can break detection of
|
||||||
|
@ -4,6 +4,7 @@ test_description='Test reflog display routines'
|
|||||||
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' '
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='reflog walk shows repeated commits again'
|
test_description='reflog walk shows repeated commits again'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup commits' '
|
test_expect_success 'setup commits' '
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
test_description='per-worktree refs'
|
test_description='per-worktree refs'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
Reference in New Issue
Block a user