From eb8381c88518b10d683a29deea1d43ed671f14ec Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Sat, 3 Feb 2007 13:25:43 -0500 Subject: scan reflogs independently from refs Currently, the search for all reflogs depends on the existence of corresponding refs under the .git/refs/ directory. Let's scan the .git/logs/ directory directly instead. Signed-off-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- fsck-objects.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'fsck-objects.c') diff --git a/fsck-objects.c b/fsck-objects.c index ecfb014fff..c9b4a39807 100644 --- a/fsck-objects.c +++ b/fsck-objects.c @@ -477,6 +477,12 @@ static int fsck_handle_reflog_ent(unsigned char *osha1, unsigned char *nsha1, return 0; } +static int fsck_handle_reflog(const char *logname, const unsigned char *sha1, int flag, void *cb_data) +{ + for_each_reflog_ent(logname, fsck_handle_reflog_ent, NULL); + return 0; +} + static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data) { struct object *obj; @@ -495,14 +501,13 @@ static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int f obj->used = 1; mark_reachable(obj, REACHABLE); - for_each_reflog_ent(refname, fsck_handle_reflog_ent, NULL); - return 0; } static void get_default_heads(void) { for_each_ref(fsck_handle_ref, NULL); + for_each_reflog(fsck_handle_reflog, NULL); /* * Not having any default heads isn't really fatal, but -- cgit v1.2.3