#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "hex.h"
#include "config.h"
#include "commit.h"
#include "tree.h"
#include "blob.h"
#include "tag.h"
#include "refs.h"
#include "pack.h"
#include "cache-tree.h"
#include "fsck.h"
#include "parse-options.h"
#include "progress.h"
#include "streaming.h"
#include "packfile.h"
#include "object-file.h"
#include "object-name.h"
#include "object-store-ll.h"
#include "path.h"
#include "read-cache-ll.h"
#include "replace-object.h"
#include "resolve-undo.h"
#include "run-command.h"
#include "sparse-index.h"
#include "worktree.h"
#include "pack-revindex.h"
#include "pack-bitmap.h"
#define REACHABLE …
#define SEEN …
#define HAS_OBJ …
#define USED …
static int show_root;
static int show_tags;
static int show_unreachable;
static int include_reflogs = …;
static int check_full = …;
static int connectivity_only;
static int check_strict;
static int keep_cache_objects;
static struct fsck_options fsck_walk_options = …;
static struct fsck_options fsck_obj_options = …;
static int errors_found;
static int write_lost_and_found;
static int verbose;
static int show_progress = …;
static int show_dangling = …;
static int name_objects;
#define ERROR_OBJECT …
#define ERROR_REACHABLE …
#define ERROR_PACK …
#define ERROR_REFS …
#define ERROR_COMMIT_GRAPH …
#define ERROR_MULTI_PACK_INDEX …
#define ERROR_PACK_REV_INDEX …
#define ERROR_BITMAP …
static const char *describe_object(const struct object_id *oid)
{ … }
static const char *printable_type(const struct object_id *oid,
enum object_type type)
{ … }
static int objerror(struct object *obj, const char *err)
{ … }
static int fsck_objects_error_func(struct fsck_options *o UNUSED,
void *fsck_report,
enum fsck_msg_type msg_type,
enum fsck_msg_id msg_id UNUSED,
const char *message)
{ … }
static struct object_array pending;
static int mark_object(struct object *obj, enum object_type type,
void *data, struct fsck_options *options UNUSED)
{ … }
static void mark_object_reachable(struct object *obj)
{ … }
static int traverse_one_object(struct object *obj)
{ … }
static int traverse_reachable(void)
{ … }
static int mark_used(struct object *obj, enum object_type type UNUSED,
void *data UNUSED, struct fsck_options *options UNUSED)
{ … }
static void mark_unreachable_referents(const struct object_id *oid)
{ … }
static int mark_loose_unreachable_referents(const struct object_id *oid,
const char *path UNUSED,
void *data UNUSED)
{ … }
static int mark_packed_unreachable_referents(const struct object_id *oid,
struct packed_git *pack UNUSED,
uint32_t pos UNUSED,
void *data UNUSED)
{ … }
static void check_reachable_object(struct object *obj)
{ … }
static void check_unreachable_object(struct object *obj)
{ … }
static void check_object(struct object *obj)
{ … }
static void check_connectivity(void)
{ … }
static int fsck_obj(struct object *obj, void *buffer, unsigned long size)
{ … }
static int fsck_obj_buffer(const struct object_id *oid, enum object_type type,
unsigned long size, void *buffer, int *eaten)
{ … }
static int default_refs;
static void fsck_handle_reflog_oid(const char *refname, struct object_id *oid,
timestamp_t timestamp)
{ … }
static int fsck_handle_reflog_ent(struct object_id *ooid, struct object_id *noid,
const char *email UNUSED,
timestamp_t timestamp, int tz UNUSED,
const char *message UNUSED, void *cb_data)
{ … }
static int fsck_handle_reflog(const char *logname, void *cb_data)
{ … }
static int fsck_handle_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
int flag UNUSED, void *cb_data UNUSED)
{ … }
static int fsck_head_link(const char *head_ref_name,
const char **head_points_at,
struct object_id *head_oid);
static void get_default_heads(void)
{ … }
struct for_each_loose_cb
{ … };
static int fsck_loose(const struct object_id *oid, const char *path, void *data)
{ … }
static int fsck_cruft(const char *basename, const char *path,
void *data UNUSED)
{ … }
static int fsck_subdir(unsigned int nr, const char *path UNUSED, void *data)
{ … }
static void fsck_object_dir(const char *path)
{ … }
static int fsck_head_link(const char *head_ref_name,
const char **head_points_at,
struct object_id *head_oid)
{ … }
static int fsck_cache_tree(struct cache_tree *it, const char *index_path)
{ … }
static int fsck_resolve_undo(struct index_state *istate,
const char *index_path)
{ … }
static void fsck_index(struct index_state *istate, const char *index_path,
int is_current_worktree)
{ … }
static void mark_object_for_connectivity(const struct object_id *oid)
{ … }
static int mark_loose_for_connectivity(const struct object_id *oid,
const char *path UNUSED,
void *data UNUSED)
{ … }
static int mark_packed_for_connectivity(const struct object_id *oid,
struct packed_git *pack UNUSED,
uint32_t pos UNUSED,
void *data UNUSED)
{ … }
static int check_pack_rev_indexes(struct repository *r, int show_progress)
{ … }
static char const * const fsck_usage[] = …;
static struct option fsck_opts[] = …;
int cmd_fsck(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{ … }