Don't find objects in packs which aren't available anymore.
[gitweb.git] / entry.c
diff --git a/entry.c b/entry.c
index 5d9aefd03fa4ff0e86d1212dc3354c9b50bba22a..0ebf0f0c1996b3f5ec3e16e0b557294f255b7b29 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -1,6 +1,5 @@
-#include <sys/types.h>
-#include <dirent.h>
 #include "cache.h"
+#include "blob.h"
 
 static void create_directories(const char *path, struct checkout *state)
 {
@@ -72,7 +71,7 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
        char type[20];
 
        new = read_sha1_file(ce->sha1, type, &size);
-       if (!new || strcmp(type, "blob")) {
+       if (!new || strcmp(type, blob_type)) {
                if (new)
                        free(new);
                return error("git-checkout-index: unable to read sha1 file of %s (%s)",
@@ -90,7 +89,7 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
                        return error("git-checkout-index: unable to create file %s (%s)",
                                path, strerror(errno));
                }
-               wrote = write(fd, new, size);
+               wrote = write_in_full(fd, new, size);
                close(fd);
                free(new);
                if (wrote != size)
@@ -105,7 +104,7 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
                                return error("git-checkout-index: unable to create "
                                                 "file %s (%s)", path, strerror(errno));
                        }
-                       wrote = write(fd, new, size);
+                       wrote = write_in_full(fd, new, size);
                        close(fd);
                        free(new);
                        if (wrote != size)
@@ -134,7 +133,7 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
 
 int checkout_entry(struct cache_entry *ce, struct checkout *state, char *topath)
 {
-       static char path[MAXPATHLEN+1];
+       static char path[PATH_MAX + 1];
        struct stat st;
        int len = state->base_dir_len;
 
@@ -171,5 +170,3 @@ int checkout_entry(struct cache_entry *ce, struct checkout *state, char *topath)
        create_directories(path, state);
        return write_entry(ce, path, state, 0);
 }
-
-