patch-ids.c: remove implicit dependency on the_index
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
7e196c3a28
commit
a7edadda59
@ -914,7 +914,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
|
|||||||
if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
|
if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
|
||||||
die(_("Not a range."));
|
die(_("Not a range."));
|
||||||
|
|
||||||
init_patch_ids(ids);
|
init_patch_ids(the_repository, ids);
|
||||||
|
|
||||||
/* given a range a..b get all patch ids for b..a */
|
/* given a range a..b get all patch ids for b..a */
|
||||||
init_revisions(&check_rev, rev->prefix);
|
init_revisions(&check_rev, rev->prefix);
|
||||||
|
@ -56,10 +56,10 @@ static int patch_id_cmp(const void *cmpfn_data,
|
|||||||
return oidcmp(&a->patch_id, &b->patch_id);
|
return oidcmp(&a->patch_id, &b->patch_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int init_patch_ids(struct patch_ids *ids)
|
int init_patch_ids(struct repository *r, struct patch_ids *ids)
|
||||||
{
|
{
|
||||||
memset(ids, 0, sizeof(*ids));
|
memset(ids, 0, sizeof(*ids));
|
||||||
repo_diff_setup(the_repository, &ids->diffopts);
|
repo_diff_setup(r, &ids->diffopts);
|
||||||
ids->diffopts.detect_rename = 0;
|
ids->diffopts.detect_rename = 0;
|
||||||
ids->diffopts.flags.recursive = 1;
|
ids->diffopts.flags.recursive = 1;
|
||||||
diff_setup_done(&ids->diffopts);
|
diff_setup_done(&ids->diffopts);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
struct commit;
|
struct commit;
|
||||||
struct object_id;
|
struct object_id;
|
||||||
|
struct repository;
|
||||||
|
|
||||||
struct patch_id {
|
struct patch_id {
|
||||||
struct hashmap_entry ent;
|
struct hashmap_entry ent;
|
||||||
@ -20,7 +21,7 @@ struct patch_ids {
|
|||||||
|
|
||||||
int commit_patch_id(struct commit *commit, struct diff_options *options,
|
int commit_patch_id(struct commit *commit, struct diff_options *options,
|
||||||
struct object_id *oid, int);
|
struct object_id *oid, int);
|
||||||
int init_patch_ids(struct patch_ids *);
|
int init_patch_ids(struct repository *, struct patch_ids *);
|
||||||
int free_patch_ids(struct patch_ids *);
|
int free_patch_ids(struct patch_ids *);
|
||||||
struct patch_id *add_commit_patch_id(struct commit *, struct patch_ids *);
|
struct patch_id *add_commit_patch_id(struct commit *, struct patch_ids *);
|
||||||
struct patch_id *has_commit_patch_id(struct commit *, struct patch_ids *);
|
struct patch_id *has_commit_patch_id(struct commit *, struct patch_ids *);
|
||||||
|
@ -877,7 +877,7 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
left_first = left_count < right_count;
|
left_first = left_count < right_count;
|
||||||
init_patch_ids(&ids);
|
init_patch_ids(the_repository, &ids);
|
||||||
ids.diffopts.pathspec = revs->diffopt.pathspec;
|
ids.diffopts.pathspec = revs->diffopt.pathspec;
|
||||||
|
|
||||||
/* Compute patch-ids for one side */
|
/* Compute patch-ids for one side */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user