mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
builtin/refs: add verify subcommand
Introduce a new subcommand "verify" in git-refs(1) to allow the user to check the reference database consistency and also this subcommand will be used as the entry point of checking refs for "git-fsck(1)". Add "verbose" field into "fsck_options" to indicate whether we should print verbose messages when checking refs and objects consistency. Remove bit-field for "strict" field, this is because we cannot take address of a bit-field which makes it unhandy to set member variables when parsing the command line options. The "git-fsck(1)" declares "fsck_options" variable with "static" identifier which avoids complaint by the leak-checker. However, in "git-refs verify", we need to do memory clean manually. Thus add "fsck_options_clear" function in "fsck.c" to provide memory clean operation. Mentored-by: Patrick Steinhardt <ps@pks.im> Mentored-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: shejialuo <shejialuo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
ab6f79d8df
commit
bf061d26c7
11
fsck.c
11
fsck.c
@@ -1331,6 +1331,17 @@ int fsck_finish(struct fsck_options *options)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void fsck_options_clear(struct fsck_options *options)
|
||||
{
|
||||
free(options->msg_type);
|
||||
oidset_clear(&options->skip_oids);
|
||||
oidset_clear(&options->gitmodules_found);
|
||||
oidset_clear(&options->gitmodules_done);
|
||||
oidset_clear(&options->gitattributes_found);
|
||||
oidset_clear(&options->gitattributes_done);
|
||||
kh_clear_oid_map(options->object_names);
|
||||
}
|
||||
|
||||
int git_fsck_config(const char *var, const char *value,
|
||||
const struct config_context *ctx, void *cb)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user