summaryrefslogtreecommitdiff
path: root/fsck-objects.c
diff options
context:
space:
mode:
authorLibravatar Nicolas Pitre <nico@cam.org>2007-02-03 13:25:43 -0500
committerLibravatar Junio C Hamano <junkio@cox.net>2007-02-03 11:57:18 -0800
commiteb8381c88518b10d683a29deea1d43ed671f14ec (patch)
treea9523ae68d874de91032c1ed3be92de168a2f73c /fsck-objects.c
parentadd reflog when moving HEAD to a new branch (diff)
downloadtgif-eb8381c88518b10d683a29deea1d43ed671f14ec.tar.xz
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 <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'fsck-objects.c')
-rw-r--r--fsck-objects.c9
1 files changed, 7 insertions, 2 deletions
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