case S_IFREG:
new = read_blob_entry(ce, path, &size);
if (!new)
- return error("git-checkout-index: unable to read sha1 file of %s (%s)",
+ return error("git checkout-index: unable to read sha1 file of %s (%s)",
path, sha1_to_hex(ce->sha1));
/*
fd = create_file(path, ce->ce_mode);
if (fd < 0) {
free(new);
- return error("git-checkout-index: unable to create file %s (%s)",
+ return error("git checkout-index: unable to create file %s (%s)",
path, strerror(errno));
}
close(fd);
free(new);
if (wrote != size)
- return error("git-checkout-index: unable to write file %s", path);
+ return error("git checkout-index: unable to write file %s", path);
break;
case S_IFLNK:
new = read_blob_entry(ce, path, &size);
if (!new)
- return error("git-checkout-index: unable to read sha1 file of %s (%s)",
+ return error("git checkout-index: unable to read sha1 file of %s (%s)",
path, sha1_to_hex(ce->sha1));
if (to_tempfile || !has_symlinks) {
if (to_tempfile) {
fd = create_file(path, 0666);
if (fd < 0) {
free(new);
- return error("git-checkout-index: unable to create "
+ return error("git checkout-index: unable to create "
"file %s (%s)", path, strerror(errno));
}
wrote = write_in_full(fd, new, size);
close(fd);
free(new);
if (wrote != size)
- return error("git-checkout-index: unable to write file %s",
+ return error("git checkout-index: unable to write file %s",
path);
} else {
wrote = symlink(new, path);
free(new);
if (wrote)
- return error("git-checkout-index: unable to create "
+ return error("git checkout-index: unable to create "
"symlink %s (%s)", path, strerror(errno));
}
break;
case S_IFGITLINK:
if (to_tempfile)
- return error("git-checkout-index: cannot create temporary subproject %s", path);
+ return error("git checkout-index: cannot create temporary subproject %s", path);
if (mkdir(path, 0777) < 0)
- return error("git-checkout-index: cannot create subproject directory %s", path);
+ return error("git checkout-index: cannot create subproject directory %s", path);
break;
default:
- return error("git-checkout-index: unknown file mode for %s", path);
+ return error("git checkout-index: unknown file mode for %s", path);
}
if (state->refresh_cache) {
* to emulate by hand - much easier to let the system
* just do the right thing)
*/
- unlink(path);
if (S_ISDIR(st.st_mode)) {
/* If it is a gitlink, leave it alone! */
if (S_ISGITLINK(ce->ce_mode))
if (!state->force)
return error("%s is a directory", path);
remove_subtree(path);
- }
+ } else if (unlink(path))
+ return error("unable to unlink old '%s' (%s)", path, strerror(errno));
} else if (state->not_new)
return 0;
create_directories(path, state);