diff options
author | shejialuo <shejialuo@gmail.com> | 2024-08-08 13:27:28 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-08 18:36:53 +0200 |
commit | bf061d26c7a595f1f46510aa584d50be1b1edb93 (patch) | |
tree | 054616ecdc6fa8a604bc6ac05538b5fae45208a7 /fsck.h | |
parent | refs: set up ref consistency check infrastructure (diff) | |
download | git-bf061d26c7a595f1f46510aa584d50be1b1edb93.tar.xz git-bf061d26c7a595f1f46510aa584d50be1b1edb93.zip |
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>
Diffstat (limited to 'fsck.h')
-rw-r--r-- | fsck.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -153,7 +153,8 @@ struct fsck_ref_report { struct fsck_options { fsck_walk_func walk; fsck_error error_func; - unsigned strict:1; + unsigned strict; + unsigned verbose; enum fsck_msg_type *msg_type; struct oidset skip_oids; struct oidset gitmodules_found; @@ -232,6 +233,11 @@ int fsck_tag_standalone(const struct object_id *oid, const char *buffer, int fsck_finish(struct fsck_options *options); /* + * Clear the fsck_options struct, freeing any allocated memory. + */ +void fsck_options_clear(struct fsck_options *options); + +/* * Report an error or warning for refs. */ __attribute__((format (printf, 4, 5))) |