]> git.ipfire.org Git - thirdparty/git.git/blobdiff - fsck-objects.c
config-set: check write-in-full returns in set_multivar
[thirdparty/git.git] / fsck-objects.c
index 46b628cb94375e3f645f868efb04547ffc20e6e7..0d8a8ebb4615c832a116a0278dfac3da1a737268 100644 (file)
@@ -1,6 +1,3 @@
-#include <sys/types.h>
-#include <dirent.h>
-
 #include "cache.h"
 #include "commit.h"
 #include "tree.h"
@@ -402,6 +399,27 @@ static void fsck_dir(int i, char *path)
 
 static int default_refs;
 
+static int fsck_handle_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
+               const char *email, unsigned long timestamp, int tz,
+               const char *message, void *cb_data)
+{
+       struct object *obj;
+
+       if (!is_null_sha1(osha1)) {
+               obj = lookup_object(osha1);
+               if (obj) {
+                       obj->used = 1;
+                       mark_reachable(obj, REACHABLE);
+               }
+       }
+       obj = lookup_object(nsha1);
+       if (obj) {
+               obj->used = 1;
+               mark_reachable(obj, REACHABLE);
+       }
+       return 0;
+}
+
 static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
 {
        struct object *obj;
@@ -419,6 +437,9 @@ static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int f
        default_refs++;
        obj->used = 1;
        mark_reachable(obj, REACHABLE);
+
+       for_each_reflog_ent(refname, fsck_handle_reflog_ent, NULL);
+
        return 0;
 }