🌐 AI搜索 & 代理 主页
blob: ab6c6a680474c9b2a37725fc9392683ac5a33083 [file] [log] [blame]
Junio C Hamano5d23e132007-04-10 00:01:271#ifndef PATCH_IDS_H
2#define PATCH_IDS_H
3
Elijah Newrenef3ca952018-08-15 17:54:054#include "diff.h"
5#include "hashmap.h"
6
7struct commit;
8struct object_id;
Nguyễn Thái Ngọc Duya7edadd2018-09-21 15:57:309struct repository;
Elijah Newrenef3ca952018-08-15 17:54:0510
Junio C Hamano5d23e132007-04-10 00:01:2711struct patch_id {
Kevin Willforddfb7a1b2016-07-29 16:19:1712 struct hashmap_entry ent;
Brandon Williams34f3c0e2017-05-30 17:30:5313 struct object_id patch_id;
Kevin Willford683f17e2016-07-29 16:19:1814 struct commit *commit;
Junio C Hamano5d23e132007-04-10 00:01:2715};
16
17struct patch_ids {
Kevin Willforddfb7a1b2016-07-29 16:19:1718 struct hashmap patches;
Junio C Hamano5d23e132007-04-10 00:01:2719 struct diff_options diffopts;
Junio C Hamano5d23e132007-04-10 00:01:2720};
21
Xiaolong Yeded2c092016-04-26 07:51:2122int commit_patch_id(struct commit *commit, struct diff_options *options,
Stephen Boyda8f68552019-04-26 23:51:5723 struct object_id *oid, int, int);
Nguyễn Thái Ngọc Duya7edadd2018-09-21 15:57:3024int init_patch_ids(struct repository *, struct patch_ids *);
Junio C Hamano5d23e132007-04-10 00:01:2725int free_patch_ids(struct patch_ids *);
Jeff Kingc9e3a4e2021-01-12 15:52:3226
27/* Add a patch_id for a single commit to the set. */
Junio C Hamano5d23e132007-04-10 00:01:2728struct patch_id *add_commit_patch_id(struct commit *, struct patch_ids *);
Jeff Kingc9e3a4e2021-01-12 15:52:3229
30/* Returns true if the patch-id of "commit" is present in the set. */
31int has_commit_patch_id(struct commit *commit, struct patch_ids *);
32
33/*
34 * Iterate over all commits in the set whose patch id matches that of
35 * "commit", like:
36 *
37 * struct patch_id *cur;
38 * for (cur = patch_id_iter_first(commit, ids);
39 * cur;
40 * cur = patch_id_iter_next(cur, ids) {
41 * ... look at cur->commit
42 * }
43 */
44struct patch_id *patch_id_iter_first(struct commit *commit, struct patch_ids *);
45struct patch_id *patch_id_iter_next(struct patch_id *cur, struct patch_ids *);
Junio C Hamano5d23e132007-04-10 00:01:2746
47#endif /* PATCH_IDS_H */