X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=index-pack.c;h=6e93ee6af64593937ee9b078e599e81d40b74303;hb=f4f78e668dd40f2d4a5bc119cccb3c34c2675c38;hp=7697b1dfe378183dc47636fa18671722198b8045;hpb=cc137194519a8ddbc0514da088fb012bea40df51;p=git.git diff --git a/index-pack.c b/index-pack.c index 7697b1dfe..6e93ee6af 100644 --- a/index-pack.c +++ b/index-pack.c @@ -8,6 +8,7 @@ #include "tree.h" #include "progress.h" #include "fsck.h" +#include "exec_cmd.h" static const char index_pack_usage[] = "git index-pack [-v] [-o ] [{ ---keep | --keep= }] [--strict] { | --stdin [--fix-thin] [] }"; @@ -177,7 +178,7 @@ static char *open_pack_file(char *pack_name) } else output_fd = open(pack_name, O_CREAT|O_EXCL|O_RDWR, 0600); if (output_fd < 0) - die("unable to create %s: %s\n", pack_name, strerror(errno)); + die("unable to create %s: %s", pack_name, strerror(errno)); pack_fd = output_fd; } else { input_fd = open(pack_name, O_RDONLY); @@ -231,7 +232,7 @@ static void free_base_data(struct base_data *c) static void prune_base_data(struct base_data *retain) { - struct base_data *b = base_cache; + struct base_data *b; for (b = base_cache; base_cache_used > delta_base_cache_limit && b; b = b->child) { @@ -822,8 +823,7 @@ static void final(const char *final_pack_name, const char *curr_pack_name, } if (move_temp_to_file(curr_pack_name, final_pack_name)) die("cannot store pack file"); - } - if (from_stdin) + } else if (from_stdin) chmod(final_pack_name, 0444); if (final_index_name != curr_index_name) { @@ -834,8 +834,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name, } if (move_temp_to_file(curr_index_name, final_index_name)) die("cannot store index file"); - } - chmod(final_index_name, 0444); + } else + chmod(final_index_name, 0444); if (!from_stdin) { printf("%s\n", sha1_to_hex(sha1)); @@ -881,6 +881,8 @@ int main(int argc, char **argv) struct pack_idx_entry **idx_objects; unsigned char pack_sha1[20]; + git_extract_argv0_path(argv[0]); + /* * We wish to read the repository's config file if any, and * for that it is necessary to call setup_git_directory_gently().