Skip to content

Commit 2abf350

Browse files
pcloudsgitster
authored andcommitted
revision.c: remove implicit dependency on the_index
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 26d024e commit 2abf350

37 files changed

+89
-78
lines changed

Documentation/technical/api-revision-walking.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ revision list.
1515
Functions
1616
---------
1717

18-
`init_revisions`::
18+
`repo_init_revisions`::
1919

20-
Initialize a rev_info structure with default values. The second
20+
Initialize a rev_info structure with default values. The third
2121
parameter may be NULL or can be prefix path, and then the `.prefix`
2222
variable will be set to it. This is typically the first function you
2323
want to call when you want to deal with a revision list. After calling

bisect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix,
632632
struct argv_array rev_argv = ARGV_ARRAY_INIT;
633633
int i;
634634

635-
init_revisions(revs, prefix);
635+
repo_init_revisions(the_repository, revs, prefix);
636636
revs->abbrev = 0;
637637
revs->commit_format = CMIT_FMT_UNSPECIFIED;
638638

@@ -889,7 +889,7 @@ static void show_diff_tree(const char *prefix, struct commit *commit)
889889
struct rev_info opt;
890890

891891
/* diff-tree init */
892-
init_revisions(&opt, prefix);
892+
repo_init_revisions(the_repository, &opt, prefix);
893893
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
894894
opt.abbrev = 0;
895895
opt.diff = 1;

builtin/add.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ int add_files_to_cache(const char *prefix,
110110
memset(&data, 0, sizeof(data));
111111
data.flags = flags;
112112

113-
init_revisions(&rev, prefix);
113+
repo_init_revisions(the_repository, &rev, prefix);
114114
setup_revisions(0, NULL, &rev, NULL);
115115
if (pathspec)
116116
copy_pathspec(&rev.prune_data, pathspec);
@@ -232,7 +232,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
232232
if (read_cache() < 0)
233233
die(_("Could not read the index"));
234234

235-
init_revisions(&rev, prefix);
235+
repo_init_revisions(the_repository, &rev, prefix);
236236
rev.diffopt.context = 7;
237237

238238
argc = setup_revisions(argc, argv, &rev, NULL);

builtin/am.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ static void write_commit_patch(const struct am_state *state, struct commit *comm
13721372
FILE *fp;
13731373

13741374
fp = xfopen(am_path(state, "patch"), "w");
1375-
init_revisions(&rev_info, NULL);
1375+
repo_init_revisions(the_repository, &rev_info, NULL);
13761376
rev_info.diff = 1;
13771377
rev_info.abbrev = 0;
13781378
rev_info.disable_stdin = 1;
@@ -1407,7 +1407,7 @@ static void write_index_patch(const struct am_state *state)
14071407
the_repository->hash_algo->empty_tree);
14081408

14091409
fp = xfopen(am_path(state, "patch"), "w");
1410-
init_revisions(&rev_info, NULL);
1410+
repo_init_revisions(the_repository, &rev_info, NULL);
14111411
rev_info.diff = 1;
14121412
rev_info.disable_stdin = 1;
14131413
rev_info.no_commit_id = 1;
@@ -1565,7 +1565,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
15651565
struct rev_info rev_info;
15661566
const char *diff_filter_str = "--diff-filter=AM";
15671567

1568-
init_revisions(&rev_info, NULL);
1568+
repo_init_revisions(the_repository, &rev_info, NULL);
15691569
rev_info.diffopt.output_format = DIFF_FORMAT_NAME_STATUS;
15701570
diff_opt_parse(&rev_info.diffopt, &diff_filter_str, 1, rev_info.prefix);
15711571
add_pending_oid(&rev_info, "HEAD", &our_tree, 0);

builtin/blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
830830

831831
setup_default_color_by_age();
832832
git_config(git_blame_config, &output_option);
833-
init_revisions(&revs, NULL);
833+
repo_init_revisions(the_repository, &revs, NULL);
834834
revs.date_mode = blame_date_mode;
835835
revs.diffopt.flags.allow_textconv = 1;
836836
revs.diffopt.flags.follow_renames = 1;

builtin/checkout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ static void show_local_changes(struct object *head,
392392
{
393393
struct rev_info rev;
394394
/* I think we want full paths, even if we're in a subdirectory. */
395-
init_revisions(&rev, NULL);
395+
repo_init_revisions(the_repository, &rev, NULL);
396396
rev.diffopt.flags = opts->flags;
397397
rev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS;
398398
diff_setup_done(&rev.diffopt);
@@ -801,7 +801,7 @@ static void orphaned_commit_warning(struct commit *old_commit, struct commit *ne
801801
struct rev_info revs;
802802
struct object *object = &old_commit->object;
803803

804-
init_revisions(&revs, NULL);
804+
repo_init_revisions(the_repository, &revs, NULL);
805805
setup_revisions(0, NULL, &revs, NULL);
806806

807807
object->flags &= ~UNINTERESTING;

builtin/commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ static const char *find_author_by_nickname(const char *name)
980980
const char *av[20];
981981
int ac = 0;
982982

983-
init_revisions(&revs, NULL);
983+
repo_init_revisions(the_repository, &revs, NULL);
984984
strbuf_addf(&buf, "--author=%s", name);
985985
av[++ac] = "--all";
986986
av[++ac] = "-i";

builtin/describe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ static void describe_blob(struct object_id oid, struct strbuf *dst)
488488
"--objects", "--in-commit-order", "--reverse", "HEAD",
489489
NULL);
490490

491-
init_revisions(&revs, NULL);
491+
repo_init_revisions(the_repository, &revs, NULL);
492492
if (setup_revisions(args.argc, args.argv, &revs, NULL) > 1)
493493
BUG("setup_revisions could not handle all args?");
494494

@@ -636,7 +636,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
636636
if (0 <= fd)
637637
update_index_if_able(&the_index, &index_lock);
638638

639-
init_revisions(&revs, prefix);
639+
repo_init_revisions(the_repository, &revs, prefix);
640640
argv_array_pushv(&args, diff_index_args);
641641
if (setup_revisions(args.argc, args.argv, &revs, NULL) != 1)
642642
BUG("malformed internal diff-index command line");

builtin/diff-files.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
2525
usage(diff_files_usage);
2626

2727
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
28-
init_revisions(&rev, prefix);
28+
repo_init_revisions(the_repository, &rev, prefix);
2929
rev.abbrev = 0;
3030
precompose_argv(argc, argv);
3131

builtin/diff-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
2222
usage(diff_cache_usage);
2323

2424
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
25-
init_revisions(&rev, prefix);
25+
repo_init_revisions(the_repository, &rev, prefix);
2626
rev.abbrev = 0;
2727
precompose_argv(argc, argv);
2828

0 commit comments

Comments
 (0)