| 1168 | } |
| 1169 | |
| 1170 | static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids) |
| 1171 | { |
| 1172 | struct rev_info check_rev; |
| 1173 | struct commit *commit, *c1, *c2; |
| 1174 | struct object *o1, *o2; |
| 1175 | unsigned flags1, flags2; |
| 1176 | |
| 1177 | if (rev->pending.nr != 2) |
| 1178 | die(_("need exactly one range")); |
| 1179 | |
| 1180 | o1 = rev->pending.objects[0].item; |
| 1181 | o2 = rev->pending.objects[1].item; |
| 1182 | flags1 = o1->flags; |
| 1183 | flags2 = o2->flags; |
| 1184 | c1 = lookup_commit_reference(the_repository, &o1->oid); |
| 1185 | c2 = lookup_commit_reference(the_repository, &o2->oid); |
| 1186 | |
| 1187 | if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING)) |
| 1188 | die(_("not a range")); |
| 1189 | |
| 1190 | init_patch_ids(the_repository, ids); |
| 1191 | |
| 1192 | /* given a range a..b get all patch ids for b..a */ |
| 1193 | repo_init_revisions(the_repository, &check_rev, rev->prefix); |
| 1194 | check_rev.max_parents = 1; |
| 1195 | o1->flags ^= UNINTERESTING; |
| 1196 | o2->flags ^= UNINTERESTING; |
| 1197 | add_pending_object(&check_rev, o1, "o1"); |
| 1198 | add_pending_object(&check_rev, o2, "o2"); |
| 1199 | if (prepare_revision_walk(&check_rev)) |
| 1200 | die(_("revision walk setup failed")); |
| 1201 | |
| 1202 | while ((commit = get_revision(&check_rev)) != NULL) { |
| 1203 | add_commit_patch_id(commit, ids); |
| 1204 | } |
| 1205 | |
| 1206 | /* reset for next revision walk */ |
| 1207 | clear_commit_marks(c1, SEEN | UNINTERESTING | SHOWN | ADDED); |
| 1208 | clear_commit_marks(c2, SEEN | UNINTERESTING | SHOWN | ADDED); |
| 1209 | o1->flags = flags1; |
| 1210 | o2->flags = flags2; |
| 1211 | } |
| 1212 | |
| 1213 | static void gen_message_id(struct rev_info *info, const char *base) |
| 1214 | { |
no test coverage detected