git/fsck.c

#define USE_THE_REPOSITORY_VARIABLE

#include "git-compat-util.h"
#include "date.h"
#include "dir.h"
#include "hex.h"
#include "object-store-ll.h"
#include "path.h"
#include "repository.h"
#include "object.h"
#include "attr.h"
#include "blob.h"
#include "tree.h"
#include "tree-walk.h"
#include "commit.h"
#include "tag.h"
#include "fsck.h"
#include "refs.h"
#include "url.h"
#include "utf8.h"
#include "oidset.h"
#include "packfile.h"
#include "submodule-config.h"
#include "config.h"
#include "help.h"

static ssize_t max_tree_entry_len =;

#define STR
#define MSG_ID
static struct {} msg_id_info[FSCK_MSG_MAX + 1] =;
#undef MSG_ID
#undef STR

static void prepare_msg_ids(void)
{}

static int parse_msg_id(const char *text)
{}

void list_config_fsck_msg_ids(struct string_list *list, const char *prefix)
{}

static enum fsck_msg_type fsck_msg_type(enum fsck_msg_id msg_id,
	struct fsck_options *options)
{}

static enum fsck_msg_type parse_msg_type(const char *str)
{}

int is_valid_msg_type(const char *msg_id, const char *msg_type)
{}

void fsck_set_msg_type_from_ids(struct fsck_options *options,
				enum fsck_msg_id msg_id,
				enum fsck_msg_type msg_type)
{}

void fsck_set_msg_type(struct fsck_options *options,
		       const char *msg_id_str, const char *msg_type_str)
{}

void fsck_set_msg_types(struct fsck_options *options, const char *values)
{}

static int object_on_skiplist(struct fsck_options *opts,
			      const struct object_id *oid)
{}

/*
 * Provide the common functionality for either fscking refs or objects.
 * It will get the current msg error type and call the error_func callback
 * which is registered in the "fsck_options" struct.
 */
static int fsck_vreport(struct fsck_options *options,
			void *fsck_report,
			enum fsck_msg_id msg_id, const char *fmt, va_list ap)
{}

__attribute__((format (printf, 5, 6)))
static int report(struct fsck_options *options,
		  const struct object_id *oid, enum object_type object_type,
		  enum fsck_msg_id msg_id, const char *fmt, ...)
{}

int fsck_report_ref(struct fsck_options *options,
		    struct fsck_ref_report *report,
		    enum fsck_msg_id msg_id,
		    const char *fmt, ...)
{}

void fsck_enable_object_names(struct fsck_options *options)
{}

const char *fsck_get_object_name(struct fsck_options *options,
				 const struct object_id *oid)
{}

void fsck_put_object_name(struct fsck_options *options,
			  const struct object_id *oid,
			  const char *fmt, ...)
{}

const char *fsck_describe_object(struct fsck_options *options,
				 const struct object_id *oid)
{}

static int fsck_walk_tree(struct tree *tree, void *data, struct fsck_options *options)
{}

static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_options *options)
{}

static int fsck_walk_tag(struct tag *tag, void *data, struct fsck_options *options)
{}

int fsck_walk(struct object *obj, void *data, struct fsck_options *options)
{}

struct name_stack {};

static void name_stack_push(struct name_stack *stack, const char *name)
{}

static const char *name_stack_pop(struct name_stack *stack)
{}

static void name_stack_clear(struct name_stack *stack)
{}

/*
 * The entries in a tree are ordered in the _path_ order,
 * which means that a directory entry is ordered by adding
 * a slash to the end of it.
 *
 * So a directory called "a" is ordered _after_ a file
 * called "a.c", because "a/" sorts after "a.c".
 */
#define TREE_UNORDERED
#define TREE_HAS_DUPS

static int is_less_than_slash(unsigned char c)
{}

static int verify_ordered(unsigned mode1, const char *name1,
			  unsigned mode2, const char *name2,
			  struct name_stack *candidates)
{}

static int fsck_tree(const struct object_id *tree_oid,
		     const char *buffer, unsigned long size,
		     struct fsck_options *options)
{}

/*
 * Confirm that the headers of a commit or tag object end in a reasonable way,
 * either with the usual "\n\n" separator, or at least with a trailing newline
 * on the final header line.
 *
 * This property is important for the memory safety of our callers. It allows
 * them to scan the buffer linewise without constantly checking the remaining
 * size as long as:
 *
 *   - they check that there are bytes left in the buffer at the start of any
 *     line (i.e., that the last newline they saw was not the final one we
 *     found here)
 *
 *   - any intra-line scanning they do will stop at a newline, which will worst
 *     case hit the newline we found here as the end-of-header. This makes it
 *     OK for them to use helpers like parse_oid_hex(), or even skip_prefix().
 */
static int verify_headers(const void *data, unsigned long size,
			  const struct object_id *oid, enum object_type type,
			  struct fsck_options *options)
{}

static int fsck_ident(const char **ident,
		      const struct object_id *oid, enum object_type type,
		      struct fsck_options *options)
{}

static int fsck_commit(const struct object_id *oid,
		       const char *buffer, unsigned long size,
		       struct fsck_options *options)
{}

static int fsck_tag(const struct object_id *oid, const char *buffer,
		    unsigned long size, struct fsck_options *options)
{}

int fsck_tag_standalone(const struct object_id *oid, const char *buffer,
			unsigned long size, struct fsck_options *options,
			struct object_id *tagged_oid,
			int *tagged_type)
{}

struct fsck_gitmodules_data {};

static int fsck_gitmodules_fn(const char *var, const char *value,
			      const struct config_context *ctx UNUSED,
			      void *vdata)
{}

static int fsck_blob(const struct object_id *oid, const char *buf,
		     unsigned long size, struct fsck_options *options)
{}

int fsck_object(struct object *obj, void *data, unsigned long size,
	struct fsck_options *options)
{}

int fsck_buffer(const struct object_id *oid, enum object_type type,
		const void *data, unsigned long size,
		struct fsck_options *options)
{}

int fsck_objects_error_function(struct fsck_options *o,
				void *fsck_report,
				enum fsck_msg_type msg_type,
				enum fsck_msg_id msg_id UNUSED,
				const char *message)
{}

int fsck_refs_error_function(struct fsck_options *options UNUSED,
			     void *fsck_report,
			     enum fsck_msg_type msg_type,
			     enum fsck_msg_id msg_id UNUSED,
			     const char *message)
{}

static int fsck_blobs(struct oidset *blobs_found, struct oidset *blobs_done,
		      enum fsck_msg_id msg_missing, enum fsck_msg_id msg_type,
		      struct fsck_options *options, const char *blob_type)
{}

int fsck_finish(struct fsck_options *options)
{}

void fsck_options_clear(struct fsck_options *options)
{}

int git_fsck_config(const char *var, const char *value,
		    const struct config_context *ctx, void *cb)
{}

/*
 * Custom error callbacks that are used in more than one place.
 */

int fsck_objects_error_cb_print_missing_gitmodules(struct fsck_options *o,
						   void *fsck_report,
						   enum fsck_msg_type msg_type,
						   enum fsck_msg_id msg_id,
						   const char *message)
{}