Skip to content

Commit ffc00a4

Browse files
pcloudsgitster
authored andcommitted
diff-lib.c: remove the_repository references
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 385cb64 commit ffc00a4

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

builtin/commit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
908908
if (ignore_submodule_arg &&
909909
!strcmp(ignore_submodule_arg, "all"))
910910
flags.ignore_submodules = 1;
911-
committable = index_differs_from(parent, &flags, 1);
911+
committable = index_differs_from(the_repository,
912+
parent, &flags, 1);
912913
}
913914
}
914915
strbuf_release(&committer_ident);

builtin/merge-ours.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int cmd_merge_ours(int argc, const char **argv, const char *prefix)
2626
*/
2727
if (read_cache() < 0)
2828
die_errno("read_cache failed");
29-
if (index_differs_from("HEAD", NULL, 0))
29+
if (index_differs_from(the_repository, "HEAD", NULL, 0))
3030
exit(2);
3131
exit(0);
3232
}

diff-lib.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
542542
{
543543
struct rev_info revs;
544544

545-
repo_init_revisions(the_repository, &revs, NULL);
545+
repo_init_revisions(opt->repo, &revs, NULL);
546546
copy_pathspec(&revs.prune_data, &opt->pathspec);
547547
revs.diffopt = *opt;
548548

@@ -551,13 +551,14 @@ int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
551551
return 0;
552552
}
553553

554-
int index_differs_from(const char *def, const struct diff_flags *flags,
554+
int index_differs_from(struct repository *r,
555+
const char *def, const struct diff_flags *flags,
555556
int ita_invisible_in_index)
556557
{
557558
struct rev_info rev;
558559
struct setup_revision_opt opt;
559560

560-
repo_init_revisions(the_repository, &rev, NULL);
561+
repo_init_revisions(r, &rev, NULL);
561562
memset(&opt, 0, sizeof(opt));
562563
opt.def = def;
563564
setup_revisions(0, NULL, &rev, &opt);

diff.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,8 @@ int diff_result_code(struct diff_options *, int);
436436

437437
void diff_no_index(struct repository *, struct rev_info *, int, const char **);
438438

439-
int index_differs_from(const char *def, const struct diff_flags *flags,
439+
int index_differs_from(struct repository *r, const char *def,
440+
const struct diff_flags *flags,
440441
int ita_invisible_in_index);
441442

442443
/*

sequencer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ static int do_pick_commit(struct repository *r,
17131713
unborn = 1;
17141714
} else if (unborn)
17151715
oidcpy(&head, the_hash_algo->empty_tree);
1716-
if (index_differs_from(unborn ? empty_tree_oid_hex() : "HEAD",
1716+
if (index_differs_from(r, unborn ? empty_tree_oid_hex() : "HEAD",
17171717
NULL, 0))
17181718
return error_dirty_index(r->index, opts);
17191719
}
@@ -3915,7 +3915,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
39153915
if (res)
39163916
goto release_todo_list;
39173917
}
3918-
if (index_differs_from("HEAD", NULL, 0)) {
3918+
if (index_differs_from(r, "HEAD", NULL, 0)) {
39193919
res = error_dirty_index(r->index, opts);
39203920
goto release_todo_list;
39213921
}

0 commit comments

Comments
 (0)