Merge branch 'nd/index-pack-error-message'
authorJunio C Hamano <gitster@pobox.com>
Tue, 25 Mar 2014 18:08:19 +0000 (11:08 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 25 Mar 2014 18:08:19 +0000 (11:08 -0700)
* nd/index-pack-error-message:
index-pack: report error using the correct variable

1  2 
builtin/index-pack.c
diff --combined builtin/index-pack.c
index a6b1c17996da28cef97560378e7586bbf1bd8b6b,80c937413529153117e8e0fe0f205c5ef66de040..b9f6e12c0e91635eafd8510dc7cf20d6c3e58433
@@@ -1291,7 -1291,7 +1291,7 @@@ static void final(const char *final_pac
                if (keep_fd < 0) {
                        if (errno != EEXIST)
                                die_errno(_("cannot write keep file '%s'"),
-                                         keep_name);
+                                         keep_name ? keep_name : name);
                } else {
                        if (keep_msg_len > 0) {
                                write_or_die(keep_fd, keep_msg, keep_msg_len);
                        }
                        if (close(keep_fd) != 0)
                                die_errno(_("cannot close written keep file '%s'"),
-                                   keep_name);
+                                         keep_name ? keep_name : name);
                        report = "keep";
                }
        }
@@@ -1502,7 -1502,7 +1502,7 @@@ int cmd_index_pack(int argc, const cha
        if (argc == 2 && !strcmp(argv[1], "-h"))
                usage(index_pack_usage);
  
 -      read_replace_refs = 0;
 +      check_replace_refs = 0;
  
        reset_pack_idx_option(&opts);
        git_config(git_index_pack_config, &opts);
                                stat_only = 1;
                        } else if (!strcmp(arg, "--keep")) {
                                keep_msg = "";
 -                      } else if (!prefixcmp(arg, "--keep=")) {
 +                      } else if (starts_with(arg, "--keep=")) {
                                keep_msg = arg + 7;
 -                      } else if (!prefixcmp(arg, "--threads=")) {
 +                      } else if (starts_with(arg, "--threads=")) {
                                char *end;
                                nr_threads = strtoul(arg+10, &end, 0);
                                if (!arg[10] || *end || nr_threads < 0)
                                                  "ignoring %s"), arg);
                                nr_threads = 1;
  #endif
 -                      } else if (!prefixcmp(arg, "--pack_header=")) {
 +                      } else if (starts_with(arg, "--pack_header=")) {
                                struct pack_header *hdr;
                                char *c;
  
                                if (index_name || (i+1) >= argc)
                                        usage(index_pack_usage);
                                index_name = argv[++i];
 -                      } else if (!prefixcmp(arg, "--index-version=")) {
 +                      } else if (starts_with(arg, "--index-version=")) {
                                char *c;
                                opts.version = strtoul(arg + 16, &c, 10);
                                if (opts.version > 2)