-#include <sys/types.h>
-#include <dirent.h>
#include "cache.h"
+#include "blob.h"
static void create_directories(const char *path, struct checkout *state)
{
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)",
return error("git-checkout-index: unable to create file %s (%s)",
path, strerror(errno));
}
- wrote = write(fd, new, size);
+ /* FIXME: LF -> CRLF conversion goes here, based on "ce->name" */
+ wrote = write_in_full(fd, new, size);
close(fd);
free(new);
if (wrote != size)
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)
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;
create_directories(path, state);
return write_entry(ce, path, state, 0);
}
-
-