The eighth batch
[git.git] / patch-ids.h
blobab6c6a680474c9b2a37725fc9392683ac5a33083
1 #ifndef PATCH_IDS_H
2 #define PATCH_IDS_H
4 #include "diff.h"
5 #include "hashmap.h"
7 struct commit;
8 struct object_id;
9 struct repository;
11 struct patch_id {
12 struct hashmap_entry ent;
13 struct object_id patch_id;
14 struct commit *commit;
17 struct patch_ids {
18 struct hashmap patches;
19 struct diff_options diffopts;
22 int commit_patch_id(struct commit *commit, struct diff_options *options,
23 struct object_id *oid, int, int);
24 int init_patch_ids(struct repository *, struct patch_ids *);
25 int free_patch_ids(struct patch_ids *);
27 /* Add a patch_id for a single commit to the set. */
28 struct patch_id *add_commit_patch_id(struct commit *, struct patch_ids *);
30 /* Returns true if the patch-id of "commit" is present in the set. */
31 int has_commit_patch_id(struct commit *commit, struct patch_ids *);
34 * Iterate over all commits in the set whose patch id matches that of
35 * "commit", like:
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 * }
44 struct patch_id *patch_id_iter_first(struct commit *commit, struct patch_ids *);
45 struct patch_id *patch_id_iter_next(struct patch_id *cur, struct patch_ids *);
47 #endif /* PATCH_IDS_H */