Merge branch 'nd/indentation-fix'
authorJunio C Hamano <gitster@pobox.com>
Mon, 14 Jan 2019 23:29:32 +0000 (15:29 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 Jan 2019 23:29:32 +0000 (15:29 -0800)
Code cleanup.

* nd/indentation-fix:
Indent code with TABs

1  2 
archive.c
cache-tree.c
git-compat-util.h
parse-options.c
parse-options.h
read-cache.c
revision.c
diff --combined archive.c
index be324af675d0444a5b6e11ebbccddbe407e9898a,c2fe16ad336f89eaeff93fc85f6cb4583cb05e10..1f98324a930e39aa1a7c41e78b4fcd6450899c66
+++ b/archive.c
@@@ -36,8 -36,8 +36,8 @@@ void init_archivers(void
  }
  
  static void format_subst(const struct commit *commit,
-                          const char *src, size_t len,
-                          struct strbuf *buf)
+                        const char *src, size_t len,
+                        struct strbuf *buf)
  {
        char *to_free = NULL;
        struct strbuf fmt = STRBUF_INIT;
@@@ -285,8 -285,7 +285,8 @@@ int write_archive_entries(struct archiv
                git_attr_set_direction(GIT_ATTR_INDEX);
        }
  
 -      err = read_tree_recursive(args->tree, "", 0, 0, &args->pathspec,
 +      err = read_tree_recursive(args->repo, args->tree, "",
 +                                0, 0, &args->pathspec,
                                  queue_or_write_archive_entry,
                                  &context);
        if (err == READ_TREE_RECURSIVE)
@@@ -347,8 -346,7 +347,8 @@@ static int path_exists(struct archiver_
        ctx.args = args;
        parse_pathspec(&ctx.pathspec, 0, 0, "", paths);
        ctx.pathspec.recursive = 1;
 -      ret = read_tree_recursive(args->tree, "", 0, 0, &ctx.pathspec,
 +      ret = read_tree_recursive(args->repo, args->tree, "",
 +                                0, 0, &ctx.pathspec,
                                  reject_entry, &ctx);
        clear_pathspec(&ctx.pathspec);
        return ret != 0;
@@@ -393,12 -391,12 +393,12 @@@ static void parse_treeish_arg(const cha
                int refnamelen = colon - name;
  
                if (!dwim_ref(name, refnamelen, &oid, &ref))
 -                      die("no such ref: %.*s", refnamelen, name);
 +                      die(_("no such ref: %.*s"), refnamelen, name);
                free(ref);
        }
  
        if (get_oid(name, &oid))
 -              die("Not a valid object name");
 +              die(_("not a valid object name: %s"), name);
  
        commit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);
        if (commit) {
  
        tree = parse_tree_indirect(&oid);
        if (tree == NULL)
 -              die("not a tree object");
 +              die(_("not a tree object: %s"), oid_to_hex(&oid));
  
        if (prefix) {
                struct object_id tree_oid;
                err = get_tree_entry(&tree->object.oid, prefix, &tree_oid,
                                     &mode);
                if (err || !S_ISDIR(mode))
 -                      die("current working directory is untracked");
 +                      die(_("current working directory is untracked"));
  
                tree = parse_tree_indirect(&tree_oid);
        }
diff --combined cache-tree.c
index 190c6e5aa6bbc79f5267fa96e3c14ed2438c0488,d6dbbebfb22412e696320b2124a1569fef546561..eabb8fb6546cbb5e418f30a4e9329d635520d601
@@@ -448,7 -448,7 +448,7 @@@ int cache_tree_update(struct index_stat
  }
  
  static void write_one(struct strbuf *buffer, struct cache_tree *it,
-                       const char *path, int pathlen)
+                     const char *path, int pathlen)
  {
        int i;
  
@@@ -659,9 -659,7 +659,9 @@@ out
        return ret;
  }
  
 -static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
 +static void prime_cache_tree_rec(struct repository *r,
 +                               struct cache_tree *it,
 +                               struct tree *tree)
  {
        struct tree_desc desc;
        struct name_entry entry;
                        cnt++;
                else {
                        struct cache_tree_sub *sub;
 -                      struct tree *subtree = lookup_tree(the_repository,
 -                                                         entry.oid);
 +                      struct tree *subtree = lookup_tree(r, entry.oid);
                        if (!subtree->object.parsed)
                                parse_tree(subtree);
                        sub = cache_tree_sub(it, entry.path);
                        sub->cache_tree = cache_tree();
 -                      prime_cache_tree_rec(sub->cache_tree, subtree);
 +                      prime_cache_tree_rec(r, sub->cache_tree, subtree);
                        cnt += sub->cache_tree->entry_count;
                }
        }
        it->entry_count = cnt;
  }
  
 -void prime_cache_tree(struct index_state *istate, struct tree *tree)
 +void prime_cache_tree(struct repository *r,
 +                    struct index_state *istate,
 +                    struct tree *tree)
  {
        cache_tree_free(&istate->cache_tree);
        istate->cache_tree = cache_tree();
 -      prime_cache_tree_rec(istate->cache_tree, tree);
 +      prime_cache_tree_rec(r, istate->cache_tree, tree);
        istate->cache_changed |= CACHE_TREE_CHANGED;
  }
  
@@@ -729,8 -726,7 +729,8 @@@ int cache_tree_matches_traversal(struc
        return 0;
  }
  
 -static void verify_one(struct index_state *istate,
 +static void verify_one(struct repository *r,
 +                     struct index_state *istate,
                       struct cache_tree *it,
                       struct strbuf *path)
  {
  
        for (i = 0; i < it->subtree_nr; i++) {
                strbuf_addf(path, "%s/", it->down[i]->name);
 -              verify_one(istate, it->down[i]->cache_tree, path);
 +              verify_one(r, istate, it->down[i]->cache_tree, path);
                strbuf_setlen(path, len);
        }
  
        if (it->entry_count < 0 ||
            /* no verification on tests (t7003) that replace trees */
 -          lookup_replace_object(the_repository, &it->oid) != &it->oid)
 +          lookup_replace_object(r, &it->oid) != &it->oid)
                return;
  
        if (path->len) {
        strbuf_release(&tree_buf);
  }
  
 -void cache_tree_verify(struct index_state *istate)
 +void cache_tree_verify(struct repository *r, struct index_state *istate)
  {
        struct strbuf path = STRBUF_INIT;
  
        if (!istate->cache_tree)
                return;
 -      verify_one(istate, istate->cache_tree, &path);
 +      verify_one(r, istate, istate->cache_tree, &path);
        strbuf_release(&path);
  }
diff --combined git-compat-util.h
index 5702556c89689e5ff72f8373802eaa154e8525fc,f281aa5185ec8b2fa984ed436f197b720c4c6ee7..b8ace774100649628863f0f7ce856e5a675c2c01
  #endif
  
  #if defined(__CYGWIN__)
 -#include "compat/cygwin.h"
 +#include "compat/win32/path-utils.h"
  #endif
  #if defined(__MINGW32__)
  /* pull in Windows compatibility stuff */
 +#include "compat/win32/path-utils.h"
  #include "compat/mingw.h"
  #elif defined(_MSC_VER)
  #include "compat/msvc.h"
@@@ -722,7 -721,7 +722,7 @@@ extern const char *githstrerror(int her
  #ifdef NO_MEMMEM
  #define memmem gitmemmem
  void *gitmemmem(const void *haystack, size_t haystacklen,
-                 const void *needle, size_t needlelen);
+               const void *needle, size_t needlelen);
  #endif
  
  #ifdef OVERRIDE_STRDUP
diff --combined parse-options.c
index 01c2acbd27c21d5b43ec9039fd4c06ac67536de9,27353c8e8d744f1b262867675322d61fc1062653..9f84bacce64e72d117be2bdbe91db6d4c190e257
@@@ -32,7 -32,7 +32,7 @@@ static int get_arg(struct parse_opt_ctx
                p->argc--;
                *arg = *++p->argv;
        } else
 -              return opterror(opt, "requires a value", flags);
 +              return error(_("%s requires a value"), optname(opt, flags));
        return 0;
  }
  
@@@ -49,6 -49,7 +49,6 @@@ static int opt_command_mode_error(cons
                                  int flags)
  {
        const struct option *that;
 -      struct strbuf message = STRBUF_INIT;
        struct strbuf that_name = STRBUF_INIT;
  
        /*
                        strbuf_addf(&that_name, "--%s", that->long_name);
                else
                        strbuf_addf(&that_name, "-%c", that->short_name);
 -              strbuf_addf(&message, ": incompatible with %s", that_name.buf);
 +              error(_("%s is incompatible with %s"),
 +                    optname(opt, flags), that_name.buf);
                strbuf_release(&that_name);
 -              opterror(opt, message.buf, flags);
 -              strbuf_release(&message);
                return -1;
        }
 -      return opterror(opt, ": incompatible with something else", flags);
 +      return error(_("%s : incompatible with something else"),
 +                   optname(opt, flags));
  }
  
  static int get_value(struct parse_opt_ctx_t *p,
        int err;
  
        if (unset && p->opt)
 -              return opterror(opt, "takes no value", flags);
 +              return error(_("%s takes no value"), optname(opt, flags));
        if (unset && (opt->flags & PARSE_OPT_NONEG))
 -              return opterror(opt, "isn't available", flags);
 +              return error(_("%s isn't available"), optname(opt, flags));
        if (!(flags & OPT_SHORT) && p->opt && (opt->flags & PARSE_OPT_NOARG))
 -              return opterror(opt, "takes no value", flags);
 +              return error(_("%s takes no value"), optname(opt, flags));
  
        switch (opt->type) {
        case OPTION_LOWLEVEL_CALLBACK:
                        return -1;
                *(int *)opt->value = strtol(arg, (char **)&s, 10);
                if (*s)
 -                      return opterror(opt, "expects a numerical value", flags);
 +                      return error(_("%s expects a numerical value"),
 +                                   optname(opt, flags));
                return 0;
  
        case OPTION_MAGNITUDE:
                if (get_arg(p, opt, flags, &arg))
                        return -1;
                if (!git_parse_ulong(arg, opt->value))
 -                      return opterror(opt,
 -                              "expects a non-negative integer value with an optional k/m/g suffix",
 -                              flags);
 +                      return error(_("%s expects a non-negative integer value"
 +                                     " with an optional k/m/g suffix"),
 +                                   optname(opt, flags));
                return 0;
  
        default:
 -              die("should not happen, someone must be hit on the forehead");
 +              BUG("opt->type %d should not happen", opt->type);
        }
  }
  
@@@ -236,7 -236,7 +236,7 @@@ static int parse_short_opt(struct parse
  }
  
  static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,
-                           const struct option *options)
+                         const struct option *options)
  {
        const struct option *all_opts = options;
        const char *arg_end = strchrnul(arg, '=');
@@@ -257,8 -257,7 +257,8 @@@ again
                        if (!rest)
                                continue;
                        if (*rest == '=')
 -                              return opterror(options, "takes no value", flags);
 +                              return error(_("%s takes no value"),
 +                                           optname(options, flags));
                        if (*rest)
                                continue;
                        p->out[p->cpidx++] = arg - 2;
@@@ -319,8 -318,8 +319,8 @@@ is_abbreviated
        }
  
        if (ambiguous_option) {
 -              error("Ambiguous option: %s "
 -                      "(could be --%s%s or --%s%s)",
 +              error(_("ambiguous option: %s "
 +                      "(could be --%s%s or --%s%s)"),
                        arg,
                        (ambiguous_flags & OPT_UNSET) ?  "no-" : "",
                        ambiguous_option->long_name,
@@@ -353,7 -352,7 +353,7 @@@ static void check_typos(const char *arg
                return;
  
        if (starts_with(arg, "no-")) {
 -              error ("did you mean `--%s` (with two dashes ?)", arg);
 +              error(_("did you mean `--%s` (with two dashes ?)"), arg);
                exit(129);
        }
  
                if (!options->long_name)
                        continue;
                if (starts_with(options->long_name, arg)) {
 -                      error ("did you mean `--%s` (with two dashes ?)", arg);
 +                      error(_("did you mean `--%s` (with two dashes ?)"), arg);
                        exit(129);
                }
        }
@@@ -424,7 -423,7 +424,7 @@@ void parse_options_start(struct parse_o
        ctx->flags = flags;
        if ((flags & PARSE_OPT_KEEP_UNKNOWN) &&
            (flags & PARSE_OPT_STOP_AT_NON_OPTION))
 -              die("STOP_AT_NON_OPTION and KEEP_UNKNOWN don't go together");
 +              BUG("STOP_AT_NON_OPTION and KEEP_UNKNOWN don't go together");
        parse_options_check(options);
  }
  
@@@ -517,7 -516,7 +517,7 @@@ static int show_gitcomp(struct parse_op
        show_negated_gitcomp(original_opts, -1);
        show_negated_gitcomp(original_opts, nr_noopts);
        fputc('\n', stdout);
 -      exit(0);
 +      return PARSE_OPT_COMPLETE;
  }
  
  static int usage_with_options_internal(struct parse_opt_ctx_t *,
@@@ -639,18 -638,16 +639,18 @@@ int parse_options(int argc, const char 
        case PARSE_OPT_HELP:
        case PARSE_OPT_ERROR:
                exit(129);
 +      case PARSE_OPT_COMPLETE:
 +              exit(0);
        case PARSE_OPT_NON_OPTION:
        case PARSE_OPT_DONE:
                break;
        default: /* PARSE_OPT_UNKNOWN */
                if (ctx.argv[0][1] == '-') {
 -                      error("unknown option `%s'", ctx.argv[0] + 2);
 +                      error(_("unknown option `%s'"), ctx.argv[0] + 2);
                } else if (isascii(*ctx.opt)) {
 -                      error("unknown switch `%c'", *ctx.opt);
 +                      error(_("unknown switch `%c'"), *ctx.opt);
                } else {
 -                      error("unknown non-ascii option in string: `%s'",
 +                      error(_("unknown non-ascii option in string: `%s'"),
                              ctx.argv[0]);
                }
                usage_with_options(usagestr, options);
@@@ -776,17 -773,12 +776,17 @@@ void NORETURN usage_msg_opt(const char 
        usage_with_options(usagestr, options);
  }
  
 -#undef opterror
 -int opterror(const struct option *opt, const char *reason, int flags)
 +const char *optname(const struct option *opt, int flags)
  {
 +      static struct strbuf sb = STRBUF_INIT;
 +
 +      strbuf_reset(&sb);
        if (flags & OPT_SHORT)
 -              return error("switch `%c' %s", opt->short_name, reason);
 -      if (flags & OPT_UNSET)
 -              return error("option `no-%s' %s", opt->long_name, reason);
 -      return error("option `%s' %s", opt->long_name, reason);
 +              strbuf_addf(&sb, "switch `%c'", opt->short_name);
 +      else if (flags & OPT_UNSET)
 +              strbuf_addf(&sb, "option `no-%s'", opt->long_name);
 +      else
 +              strbuf_addf(&sb, "option `%s'", opt->long_name);
 +
 +      return sb.buf;
  }
diff --combined parse-options.h
index 81380c22b62e3b55187705010fe459a795df1b0d,bd88f6424a9033af6660e1138f9d336f572acc64..14fe32428e57aee0716517219e3fc925ac5e8a0d
@@@ -175,18 -175,21 +175,18 @@@ struct option 
   * Returns the number of arguments left in argv[].
   */
  extern int parse_options(int argc, const char **argv, const char *prefix,
-                          const struct option *options,
-                          const char * const usagestr[], int flags);
+                        const struct option *options,
+                        const char * const usagestr[], int flags);
  
  extern NORETURN void usage_with_options(const char * const *usagestr,
-                                         const struct option *options);
+                                       const struct option *options);
  
  extern NORETURN void usage_msg_opt(const char *msg,
                                   const char * const *usagestr,
                                   const struct option *options);
  
  extern int optbug(const struct option *opt, const char *reason);
 -extern int opterror(const struct option *opt, const char *reason, int flags);
 -#if defined(__GNUC__)
 -#define opterror(o,r,f) (opterror((o),(r),(f)), const_error())
 -#endif
 +const char *optname(const struct option *opt, int flags);
  
  /*
   * Use these assertions for callbacks that expect to be called with NONEG and
  /*----- incremental advanced APIs -----*/
  
  enum {
 +      PARSE_OPT_COMPLETE = -2,
        PARSE_OPT_HELP = -1,
        PARSE_OPT_DONE,
        PARSE_OPT_NON_OPTION,
diff --combined read-cache.c
index 48c1797a4a4225ae3e0d13da2a761a2cc2f8131a,3428d34f3402d65ec7fc5bfacefc87bdb25385b0..bfff271a3db92cfaaa93d23c5bf52297dda0419e
@@@ -316,7 -316,7 +316,7 @@@ static int ce_match_stat_basic(const st
                        changed |= DATA_CHANGED;
                return changed;
        default:
 -              die("internal error: ce_mode is %o", ce->ce_mode);
 +              BUG("unsupported ce_mode: %o", ce->ce_mode);
        }
  
        changed |= match_stat_data(&ce->ce_stat_data, st);
@@@ -672,8 -672,7 +672,8 @@@ static struct cache_entry *create_alias
        struct cache_entry *new_entry;
  
        if (alias->ce_flags & CE_ADDED)
 -              die("Will not add file alias '%s' ('%s' already exists in index)", ce->name, alias->name);
 +              die(_("will not add file alias '%s' ('%s' already exists in index)"),
 +                  ce->name, alias->name);
  
        /* Ok, create the new entry using the name of the existing alias */
        len = ce_namelen(alias);
@@@ -688,7 -687,7 +688,7 @@@ void set_object_name_for_intent_to_add_
  {
        struct object_id oid;
        if (write_object_file("", 0, blob_type, &oid))
 -              die("cannot create an empty blob in the object database");
 +              die(_("cannot create an empty blob in the object database"));
        oidcpy(&ce->oid, &oid);
  }
  
@@@ -709,7 -708,7 +709,7 @@@ int add_to_index(struct index_state *is
                newflags |= HASH_RENORMALIZE;
  
        if (!S_ISREG(st_mode) && !S_ISLNK(st_mode) && !S_ISDIR(st_mode))
 -              return error("%s: can only add regular files, symbolic links or git-directories", path);
 +              return error(_("%s: can only add regular files, symbolic links or git-directories"), path);
  
        namelen = strlen(path);
        if (S_ISDIR(st_mode)) {
        if (!intent_only) {
                if (index_path(istate, &ce->oid, path, st, newflags)) {
                        discard_cache_entry(ce);
 -                      return error("unable to index file %s", path);
 +                      return error(_("unable to index file '%s'"), path);
                }
        } else
                set_object_name_for_intent_to_add_entry(ce);
                discard_cache_entry(ce);
        else if (add_index_entry(istate, ce, add_option)) {
                discard_cache_entry(ce);
 -              return error("unable to add %s to index", path);
 +              return error(_("unable to add '%s' to index"), path);
        }
        if (verbose && !was_same)
                printf("add '%s'\n", path);
@@@ -794,7 -793,7 +794,7 @@@ int add_file_to_index(struct index_stat
  {
        struct stat st;
        if (lstat(path, &st))
 -              die_errno("unable to stat '%s'", path);
 +              die_errno(_("unable to stat '%s'"), path);
        return add_to_index(istate, path, &st, flags);
  }
  
@@@ -819,7 -818,7 +819,7 @@@ struct cache_entry *make_cache_entry(st
        int len;
  
        if (!verify_path(path, mode)) {
 -              error("Invalid path '%s'", path);
 +              error(_("invalid path '%s'"), path);
                return NULL;
        }
  
@@@ -845,7 -844,7 +845,7 @@@ struct cache_entry *make_transient_cach
        int len;
  
        if (!verify_path(path, mode)) {
 -              error("Invalid path '%s'", path);
 +              error(_("invalid path '%s'"), path);
                return NULL;
        }
  
@@@ -1298,12 -1297,12 +1298,12 @@@ static int add_index_entry_with_check(s
        if (!ok_to_add)
                return -1;
        if (!verify_path(ce->name, ce->ce_mode))
 -              return error("Invalid path '%s'", ce->name);
 +              return error(_("invalid path '%s'"), ce->name);
  
        if (!skip_df_check &&
            check_file_directory_conflict(istate, ce, pos, ok_to_replace)) {
                if (!ok_to_replace)
 -                      return error("'%s' appears as both a file and as a directory",
 +                      return error(_("'%s' appears as both a file and as a directory"),
                                     ce->name);
                pos = index_name_stage_pos(istate, ce->name, ce_namelen(ce), ce_stage(ce));
                pos = -pos-1;
@@@ -1492,11 -1491,11 +1492,11 @@@ int refresh_index(struct index_state *i
                                                  istate->cache_nr);
  
        trace_performance_enter();
 -      modified_fmt = (in_porcelain ? "M\t%s\n" : "%s: needs update\n");
 -      deleted_fmt = (in_porcelain ? "D\t%s\n" : "%s: needs update\n");
 -      typechange_fmt = (in_porcelain ? "T\t%s\n" : "%s needs update\n");
 -      added_fmt = (in_porcelain ? "A\t%s\n" : "%s needs update\n");
 -      unmerged_fmt = (in_porcelain ? "U\t%s\n" : "%s: needs merge\n");
 +      modified_fmt   = in_porcelain ? "M\t%s\n" : "%s: needs update\n";
 +      deleted_fmt    = in_porcelain ? "D\t%s\n" : "%s: needs update\n";
 +      typechange_fmt = in_porcelain ? "T\t%s\n" : "%s: needs update\n";
 +      added_fmt      = in_porcelain ? "A\t%s\n" : "%s: needs update\n";
 +      unmerged_fmt   = in_porcelain ? "U\t%s\n" : "%s: needs merge\n";
        /*
         * Use the multi-threaded preload_index() to refresh most of the
         * cache entries quickly then in the single threaded loop below,
@@@ -1683,10 -1682,10 +1683,10 @@@ static int verify_hdr(const struct cach
        int hdr_version;
  
        if (hdr->hdr_signature != htonl(CACHE_SIGNATURE))
 -              return error("bad signature");
 +              return error(_("bad signature 0x%08x"), hdr->hdr_signature);
        hdr_version = ntohl(hdr->hdr_version);
        if (hdr_version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < hdr_version)
 -              return error("bad index version %d", hdr_version);
 +              return error(_("bad index version %d"), hdr_version);
  
        if (!verify_index_checksum)
                return 0;
        the_hash_algo->update_fn(&c, hdr, size - the_hash_algo->rawsz);
        the_hash_algo->final_fn(hash, &c);
        if (!hasheq(hash, (unsigned char *)hdr + size - the_hash_algo->rawsz))
 -              return error("bad index file sha1 signature");
 +              return error(_("bad index file sha1 signature"));
        return 0;
  }
  
@@@ -1725,9 -1724,9 +1725,9 @@@ static int read_index_extension(struct 
                break;
        default:
                if (*ext < 'A' || 'Z' < *ext)
 -                      return error("index uses %.4s extension, which we do not understand",
 +                      return error(_("index uses %.4s extension, which we do not understand"),
                                     ext);
 -              fprintf(stderr, "ignoring %.4s extension\n", ext);
 +              fprintf_ln(stderr, _("ignoring %.4s extension"), ext);
                break;
        }
        return 0;
@@@ -1774,7 -1773,7 +1774,7 @@@ static struct cache_entry *create_from_
                extended_flags = get_be16(&ondisk2->flags2) << 16;
                /* We do not yet understand any bit out of CE_EXTENDED_FLAGS */
                if (extended_flags & ~CE_EXTENDED_FLAGS)
 -                      die("Unknown index entry format %08x", extended_flags);
 +                      die(_("unknown index entry format 0x%08x"), extended_flags);
                flags |= extended_flags;
                name = ondisk2->name;
        }
@@@ -1845,13 -1844,13 +1845,13 @@@ static void check_ce_order(struct index
                int name_compare = strcmp(ce->name, next_ce->name);
  
                if (0 < name_compare)
 -                      die("unordered stage entries in index");
 +                      die(_("unordered stage entries in index"));
                if (!name_compare) {
                        if (!ce_stage(ce))
 -                              die("multiple stage entries for merged file '%s'",
 +                              die(_("multiple stage entries for merged file '%s'"),
                                    ce->name);
                        if (ce_stage(ce) > ce_stage(next_ce))
 -                              die("unordered stage entries for '%s'",
 +                              die(_("unordered stage entries for '%s'"),
                                    ce->name);
                }
        }
@@@ -2145,19 -2144,19 +2145,19 @@@ int do_read_index(struct index_state *i
        if (fd < 0) {
                if (!must_exist && errno == ENOENT)
                        return 0;
 -              die_errno("%s: index file open failed", path);
 +              die_errno(_("%s: index file open failed"), path);
        }
  
        if (fstat(fd, &st))
 -              die_errno("cannot stat the open index");
 +              die_errno(_("%s: cannot stat the open index"), path);
  
        mmap_size = xsize_t(st.st_size);
        if (mmap_size < sizeof(struct cache_header) + the_hash_algo->rawsz)
 -              die("index file smaller than expected");
 +              die(_("%s: index file smaller than expected"), path);
  
        mmap = xmmap(NULL, mmap_size, PROT_READ, MAP_PRIVATE, fd, 0);
        if (mmap == MAP_FAILED)
 -              die_errno("unable to map index file");
 +              die_errno(_("%s: unable to map index file"), path);
        close(fd);
  
        hdr = (const struct cache_header *)mmap;
  
  unmap:
        munmap((void *)mmap, mmap_size);
 -      die("index file corrupt");
 +      die(_("index file corrupt"));
  }
  
  /*
  static void freshen_shared_index(const char *shared_index, int warn)
  {
        if (!check_and_freshen_file(shared_index, 1) && warn)
 -              warning("could not freshen shared index '%s'", shared_index);
 +              warning(_("could not freshen shared index '%s'"), shared_index);
  }
  
  int read_index_from(struct index_state *istate, const char *path,
        base_path = xstrfmt("%s/sharedindex.%s", gitdir, base_oid_hex);
        ret = do_read_index(split_index->base, base_path, 1);
        if (!oideq(&split_index->base_oid, &split_index->base->oid))
 -              die("broken index, expect %s in %s, got %s",
 +              die(_("broken index, expect %s in %s, got %s"),
                    base_oid_hex, base_path,
                    oid_to_hex(&split_index->base->oid));
  
@@@ -2349,14 -2348,14 +2349,14 @@@ void validate_cache_entries(const struc
  
        for (i = 0; i < istate->cache_nr; i++) {
                if (!istate) {
 -                      die("internal error: cache entry is not allocated from expected memory pool");
 +                      BUG("cache entry is not allocated from expected memory pool");
                } else if (!istate->ce_mem_pool ||
                        !mem_pool_contains(istate->ce_mem_pool, istate->cache[i])) {
                        if (!istate->split_index ||
                                !istate->split_index->base ||
                                !istate->split_index->base->ce_mem_pool ||
                                !mem_pool_contains(istate->split_index->base->ce_mem_pool, istate->cache[i])) {
 -                              die("internal error: cache entry is not allocated from expected memory pool");
 +                              BUG("cache entry is not allocated from expected memory pool");
                        }
                }
        }
@@@ -3097,7 -3096,7 +3097,7 @@@ static int write_shared_index(struct in
                return ret;
        ret = adjust_shared_perm(get_tempfile_path(*temp));
        if (ret) {
 -              error("cannot fix permission bits on %s", get_tempfile_path(*temp));
 +              error(_("cannot fix permission bits on '%s'"), get_tempfile_path(*temp));
                return ret;
        }
        ret = rename_tempfile(temp,
@@@ -3147,7 -3146,7 +3147,7 @@@ int write_locked_index(struct index_sta
        struct split_index *si = istate->split_index;
  
        if (git_env_bool("GIT_TEST_CHECK_CACHE_TREE", 0))
 -              cache_tree_verify(istate);
 +              cache_tree_verify(the_repository, istate);
  
        if ((flags & SKIP_IF_UNCHANGED) && !istate->cache_changed) {
                if (flags & COMMIT_LOCK)
@@@ -3244,7 -3243,7 +3244,7 @@@ int read_index_unmerged(struct index_st
                new_ce->ce_namelen = len;
                new_ce->ce_mode = ce->ce_mode;
                if (add_index_entry(istate, new_ce, ADD_CACHE_SKIP_DFCHECK))
 -                      return error("%s: cannot drop to stage #0",
 +                      return error(_("%s: cannot drop to stage #0"),
                                     new_ce->name);
        }
        return unmerged;
@@@ -3495,71 -3494,71 +3495,71 @@@ static void write_eoie_extension(struc
  
  static struct index_entry_offset_table *read_ieot_extension(const char *mmap, size_t mmap_size, size_t offset)
  {
-        const char *index = NULL;
-        uint32_t extsize, ext_version;
-        struct index_entry_offset_table *ieot;
-        int i, nr;
-        /* find the IEOT extension */
-        if (!offset)
-              return NULL;
-        while (offset <= mmap_size - the_hash_algo->rawsz - 8) {
-              extsize = get_be32(mmap + offset + 4);
-              if (CACHE_EXT((mmap + offset)) == CACHE_EXT_INDEXENTRYOFFSETTABLE) {
-                      index = mmap + offset + 4 + 4;
-                      break;
-              }
-              offset += 8;
-              offset += extsize;
-        }
-        if (!index)
-              return NULL;
-        /* validate the version is IEOT_VERSION */
-        ext_version = get_be32(index);
-        if (ext_version != IEOT_VERSION) {
-              error("invalid IEOT version %d", ext_version);
-              return NULL;
-        }
-        index += sizeof(uint32_t);
-        /* extension size - version bytes / bytes per entry */
-        nr = (extsize - sizeof(uint32_t)) / (sizeof(uint32_t) + sizeof(uint32_t));
-        if (!nr) {
-              error("invalid number of IEOT entries %d", nr);
-              return NULL;
-        }
-        ieot = xmalloc(sizeof(struct index_entry_offset_table)
-              + (nr * sizeof(struct index_entry_offset)));
-        ieot->nr = nr;
-        for (i = 0; i < nr; i++) {
-              ieot->entries[i].offset = get_be32(index);
-              index += sizeof(uint32_t);
-              ieot->entries[i].nr = get_be32(index);
-              index += sizeof(uint32_t);
-        }
-        return ieot;
+       const char *index = NULL;
+       uint32_t extsize, ext_version;
+       struct index_entry_offset_table *ieot;
+       int i, nr;
+       /* find the IEOT extension */
+       if (!offset)
+               return NULL;
+       while (offset <= mmap_size - the_hash_algo->rawsz - 8) {
+               extsize = get_be32(mmap + offset + 4);
+               if (CACHE_EXT((mmap + offset)) == CACHE_EXT_INDEXENTRYOFFSETTABLE) {
+                       index = mmap + offset + 4 + 4;
+                       break;
+               }
+               offset += 8;
+               offset += extsize;
+       }
+       if (!index)
+               return NULL;
+       /* validate the version is IEOT_VERSION */
+       ext_version = get_be32(index);
+       if (ext_version != IEOT_VERSION) {
+               error("invalid IEOT version %d", ext_version);
+               return NULL;
+       }
+       index += sizeof(uint32_t);
+       /* extension size - version bytes / bytes per entry */
+       nr = (extsize - sizeof(uint32_t)) / (sizeof(uint32_t) + sizeof(uint32_t));
+       if (!nr) {
+               error("invalid number of IEOT entries %d", nr);
+               return NULL;
+       }
+       ieot = xmalloc(sizeof(struct index_entry_offset_table)
+                      + (nr * sizeof(struct index_entry_offset)));
+       ieot->nr = nr;
+       for (i = 0; i < nr; i++) {
+               ieot->entries[i].offset = get_be32(index);
+               index += sizeof(uint32_t);
+               ieot->entries[i].nr = get_be32(index);
+               index += sizeof(uint32_t);
+       }
+       return ieot;
  }
  
  static void write_ieot_extension(struct strbuf *sb, struct index_entry_offset_table *ieot)
  {
-        uint32_t buffer;
-        int i;
+       uint32_t buffer;
+       int i;
  
-        /* version */
-        put_be32(&buffer, IEOT_VERSION);
-        strbuf_add(sb, &buffer, sizeof(uint32_t));
+       /* version */
+       put_be32(&buffer, IEOT_VERSION);
+       strbuf_add(sb, &buffer, sizeof(uint32_t));
  
-        /* ieot */
-        for (i = 0; i < ieot->nr; i++) {
+       /* ieot */
+       for (i = 0; i < ieot->nr; i++) {
  
-              /* offset */
-              put_be32(&buffer, ieot->entries[i].offset);
-              strbuf_add(sb, &buffer, sizeof(uint32_t));
+               /* offset */
+               put_be32(&buffer, ieot->entries[i].offset);
+               strbuf_add(sb, &buffer, sizeof(uint32_t));
  
-              /* count */
-              put_be32(&buffer, ieot->entries[i].nr);
-              strbuf_add(sb, &buffer, sizeof(uint32_t));
-        }
+               /* count */
+               put_be32(&buffer, ieot->entries[i].nr);
+               strbuf_add(sb, &buffer, sizeof(uint32_t));
+       }
  }
diff --combined revision.c
index 8eda04701a7ce1a22fd2bf983955e8a3a4998091,f9ca1a8d537ff33f9e9cbc33cfb8bf51bf930819..13cfb59b388d1503adbaef424ea1dcecc410b673
@@@ -1463,7 -1463,6 +1463,7 @@@ void repo_init_revisions(struct reposit
        revs->abbrev = DEFAULT_ABBREV;
        revs->ignore_merges = 1;
        revs->simplify_history = 1;
 +      revs->pruning.repo = r;
        revs->pruning.flags.recursive = 1;
        revs->pruning.flags.quick = 1;
        revs->pruning.add_remove = file_add_remove;
  }
  
  static void add_pending_commit_list(struct rev_info *revs,
-                                     struct commit_list *commit_list,
-                                     unsigned int flags)
+                                   struct commit_list *commit_list,
+                                   unsigned int flags)
  {
        while (commit_list) {
                struct object *object = &commit_list->item->object;
@@@ -1730,8 -1729,6 +1730,8 @@@ int handle_revision_arg(const char *arg
        if (!cant_be_filename)
                verify_non_filename(revs->prefix, arg);
        object = get_reference(revs, arg, &oid, flags ^ local_flags);
 +      if (!object)
 +              return revs->ignore_missing ? 0 : -1;
        add_rev_cmdline(revs, object, arg_, REV_CMD_REV, flags ^ local_flags);
        add_pending_object_with_path(revs, object, arg, oc.mode, oc.path);
        free(oc.path);
@@@ -1794,8 -1791,7 +1794,8 @@@ static void add_message_grep(struct rev
  }
  
  static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
 -                             int *unkc, const char **unkv)
 +                             int *unkc, const char **unkv,
 +                             const struct setup_revision_opt* opt)
  {
        const char *arg = argv[0];
        const char *optarg;
                revs->limited = 1;
        } else if (!strcmp(arg, "--ignore-missing")) {
                revs->ignore_missing = 1;
 -      } else if (revs->allow_exclude_promisor_objects_opt &&
 +      } else if (opt && opt->allow_exclude_promisor_objects &&
                   !strcmp(arg, "--exclude-promisor-objects")) {
                if (fetch_if_missing)
                        BUG("exclude_promisor_objects can only be used when fetch_if_missing is 0");
@@@ -2177,7 -2173,7 +2177,7 @@@ void parse_revision_opt(struct rev_inf
                        const char * const usagestr[])
  {
        int n = handle_revision_opt(revs, ctx->argc, ctx->argv,
 -                                  &ctx->cpidx, ctx->out);
 +                                  &ctx->cpidx, ctx->out, NULL);
        if (n <= 0) {
                error("unknown option `%s'", ctx->argv[0]);
                usage_with_options(usagestr, options);
@@@ -2395,8 -2391,7 +2395,8 @@@ int setup_revisions(int argc, const cha
                                continue;
                        }
  
 -                      opts = handle_revision_opt(revs, argc - i, argv + i, &left, argv);
 +                      opts = handle_revision_opt(revs, argc - i, argv + i,
 +                                                 &left, argv, opt);
                        if (opts > 0) {
                                i += opts - 1;
                                continue;