Merge branch 'nd/the-index'

Various codepaths in the core-ish part learn to work on an
arbitrary in-core index structure, not necessarily the default
instance "the_index".

* nd/the-index: (23 commits)
  revision.c: reduce implicit dependency the_repository
  revision.c: remove implicit dependency on the_index
  ws.c: remove implicit dependency on the_index
  tree-diff.c: remove implicit dependency on the_index
  submodule.c: remove implicit dependency on the_index
  line-range.c: remove implicit dependency on the_index
  userdiff.c: remove implicit dependency on the_index
  rerere.c: remove implicit dependency on the_index
  sha1-file.c: remove implicit dependency on the_index
  patch-ids.c: remove implicit dependency on the_index
  merge.c: remove implicit dependency on the_index
  merge-blobs.c: remove implicit dependency on the_index
  ll-merge.c: remove implicit dependency on the_index
  diff-lib.c: remove implicit dependency on the_index
  read-cache.c: remove implicit dependency on the_index
  diff.c: remove implicit dependency on the_index
  grep.c: remove implicit dependency on the_index
  diff.c: remove the_index dependency in textconv() functions
  blame.c: rename "repo" argument to "r"
  combine-diff.c: remove implicit dependency on the_index
  ...
This commit is contained in:
Junio C Hamano
2018-10-19 13:34:02 +09:00
87 changed files with 751 additions and 552 deletions

View File

@ -390,7 +390,7 @@ static void squash_message(struct commit *commit, struct commit_list *remotehead
printf(_("Squash commit -- not updating HEAD\n"));
init_revisions(&rev, NULL);
repo_init_revisions(the_repository, &rev, NULL);
rev.ignore_merges = 1;
rev.commit_format = CMIT_FMT_MEDIUM;
@ -453,7 +453,7 @@ static void finish(struct commit *head_commit,
}
if (new_head && show_diffstat) {
struct diff_options opts;
diff_setup(&opts);
repo_diff_setup(the_repository, &opts);
opts.stat_width = -1; /* use full terminal width */
opts.stat_graph_width = -1; /* respect statGraphWidth config */
opts.output_format |=
@ -729,8 +729,9 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
die(_("unable to write %s"), get_index_file());
return clean ? 0 : 1;
} else {
return try_merge_command(strategy, xopts_nr, xopts,
common, head_arg, remoteheads);
return try_merge_command(the_repository,
strategy, xopts_nr, xopts,
common, head_arg, remoteheads);
}
}
@ -899,7 +900,7 @@ static int suggest_conflicts(void)
fputs(msgbuf.buf, fp);
strbuf_release(&msgbuf);
fclose(fp);
rerere(allow_rerere_auto);
repo_rerere(the_repository, allow_rerere_auto);
printf(_("Automatic merge failed; "
"fix conflicts and then commit the result.\n"));
return 1;
@ -911,7 +912,7 @@ static int evaluate_result(void)
struct rev_info rev;
/* Check how many files differ. */
init_revisions(&rev, "");
repo_init_revisions(the_repository, &rev, "");
setup_revisions(0, NULL, &rev, NULL);
rev.diffopt.output_format |=
DIFF_FORMAT_CALLBACK;
@ -1471,7 +1472,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
goto done;
}
if (checkout_fast_forward(&head_commit->object.oid,
if (checkout_fast_forward(the_repository,
&head_commit->object.oid,
&commit->object.oid,
overwrite_ignore)) {
ret = 1;