|
|
@ -26,6 +26,7 @@ |
|
|
|
#include "resolve-undo.h" |
|
|
|
#include "resolve-undo.h" |
|
|
|
#include "run-command.h" |
|
|
|
#include "run-command.h" |
|
|
|
#include "worktree.h" |
|
|
|
#include "worktree.h" |
|
|
|
|
|
|
|
#include "pack-revindex.h" |
|
|
|
|
|
|
|
|
|
|
|
#define REACHABLE 0x0001 |
|
|
|
#define REACHABLE 0x0001 |
|
|
|
#define SEEN 0x0002 |
|
|
|
#define SEEN 0x0002 |
|
|
@ -55,6 +56,7 @@ static int name_objects; |
|
|
|
#define ERROR_REFS 010 |
|
|
|
#define ERROR_REFS 010 |
|
|
|
#define ERROR_COMMIT_GRAPH 020 |
|
|
|
#define ERROR_COMMIT_GRAPH 020 |
|
|
|
#define ERROR_MULTI_PACK_INDEX 040 |
|
|
|
#define ERROR_MULTI_PACK_INDEX 040 |
|
|
|
|
|
|
|
#define ERROR_PACK_REV_INDEX 0100 |
|
|
|
|
|
|
|
|
|
|
|
static const char *describe_object(const struct object_id *oid) |
|
|
|
static const char *describe_object(const struct object_id *oid) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -858,6 +860,38 @@ static int mark_packed_for_connectivity(const struct object_id *oid, |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int check_pack_rev_indexes(struct repository *r, int show_progress) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
struct progress *progress = NULL; |
|
|
|
|
|
|
|
uint32_t pack_count = 0; |
|
|
|
|
|
|
|
int res = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (show_progress) { |
|
|
|
|
|
|
|
for (struct packed_git *p = get_all_packs(the_repository); p; p = p->next) |
|
|
|
|
|
|
|
pack_count++; |
|
|
|
|
|
|
|
progress = start_delayed_progress("Verifying reverse pack-indexes", pack_count); |
|
|
|
|
|
|
|
pack_count = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (struct packed_git *p = get_all_packs(the_repository); p; p = p->next) { |
|
|
|
|
|
|
|
int load_error = load_pack_revindex_from_disk(p); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (load_error < 0) { |
|
|
|
|
|
|
|
error(_("unable to load rev-index for pack '%s'"), p->pack_name); |
|
|
|
|
|
|
|
res = ERROR_PACK_REV_INDEX; |
|
|
|
|
|
|
|
} else if (!load_error && |
|
|
|
|
|
|
|
!load_pack_revindex(the_repository, p) && |
|
|
|
|
|
|
|
verify_pack_revindex(p)) { |
|
|
|
|
|
|
|
error(_("invalid rev-index for pack '%s'"), p->pack_name); |
|
|
|
|
|
|
|
res = ERROR_PACK_REV_INDEX; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
display_progress(progress, ++pack_count); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
stop_progress(&progress); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return res; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static char const * const fsck_usage[] = { |
|
|
|
static char const * const fsck_usage[] = { |
|
|
|
N_("git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n" |
|
|
|
N_("git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n" |
|
|
|
" [--[no-]full] [--strict] [--verbose] [--lost-found]\n" |
|
|
|
" [--[no-]full] [--strict] [--verbose] [--lost-found]\n" |
|
|
@ -1021,6 +1055,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) |
|
|
|
free_worktrees(worktrees); |
|
|
|
free_worktrees(worktrees); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errors_found |= check_pack_rev_indexes(the_repository, show_progress); |
|
|
|
|
|
|
|
|
|
|
|
check_connectivity(); |
|
|
|
check_connectivity(); |
|
|
|
|
|
|
|
|
|
|
|
if (the_repository->settings.core_commit_graph) { |
|
|
|
if (the_repository->settings.core_commit_graph) { |
|
|
|