static const char index_pack_usage[] =
"git index-pack [-v] [-o <index-file>] [{ ---keep | --keep=<msg> }] [--strict] { <pack-file> | --stdin [--fix-thin] [<pack-file>] }";
static const char index_pack_usage[] =
"git index-pack [-v] [-o <index-file>] [{ ---keep | --keep=<msg> }] [--strict] { <pack-file> | --stdin [--fix-thin] [<pack-file>] }";
- die("cannot open packfile '%s': %s",
- pack_name, strerror(errno));
+ die_errno("cannot open packfile '%s'", pack_name);
do {
ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);
if (n < 0)
do {
ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);
if (n < 0)
die("invalid %s", typename(type));
if (fsck_object(obj, 1, fsck_error_function))
die("Error in object");
die("invalid %s", typename(type));
if (fsck_object(obj, 1, fsck_error_function))
die("Error in object");
die("Not all child objects of %s are reachable", sha1_to_hex(obj->sha1));
if (obj->type == OBJ_TREE) {
die("Not all child objects of %s are reachable", sha1_to_hex(obj->sha1));
if (obj->type == OBJ_TREE) {
/* If input_fd is a file, we should have reached its end now. */
if (fstat(input_fd, &st))
/* If input_fd is a file, we should have reached its end now. */
if (fstat(input_fd, &st))
if (S_ISREG(st.st_mode) &&
lseek(input_fd, 0, SEEK_CUR) - input_len != st.st_size)
die("pack has junk at the end");
if (S_ISREG(st.st_mode) &&
lseek(input_fd, 0, SEEK_CUR) - input_len != st.st_size)
die("pack has junk at the end");
- die("cannot write keep file '%s' (%s)",
- keep_name, strerror(errno));
+ die_errno("cannot write keep file '%s'",
+ keep_name);
} else {
if (keep_msg_len > 0) {
write_or_die(keep_fd, keep_msg, keep_msg_len);
write_or_die(keep_fd, "\n", 1);
}
if (close(keep_fd) != 0)
} else {
if (keep_msg_len > 0) {
write_or_die(keep_fd, keep_msg, keep_msg_len);
write_or_die(keep_fd, "\n", 1);
}
if (close(keep_fd) != 0)
- die("cannot close written keep file '%s' (%s)",
- keep_name, strerror(errno));
+ die_errno("cannot close written keep file '%s'",
+ keep_name);
}
if (move_temp_to_file(curr_pack_name, final_pack_name))
die("cannot store pack file");
}
if (move_temp_to_file(curr_pack_name, final_pack_name))
die("cannot store pack file");
chmod(final_pack_name, 0444);
if (final_index_name != curr_index_name) {
chmod(final_pack_name, 0444);
if (final_index_name != curr_index_name) {
}
if (move_temp_to_file(curr_index_name, final_index_name))
die("cannot store index file");
}
if (move_temp_to_file(curr_index_name, final_index_name))
die("cannot store index file");
/*
* We wish to read the repository's config file if any, and
* for that it is necessary to call setup_git_directory_gently().
/*
* We wish to read the repository's config file if any, and
* for that it is necessary to call setup_git_directory_gently().