| 5897 | } |
| 5898 | |
| 5899 | static int make_script_with_merges(struct pretty_print_context *pp, |
| 5900 | struct rev_info *revs, struct strbuf *out, |
| 5901 | unsigned flags) |
| 5902 | { |
| 5903 | int keep_empty = flags & TODO_LIST_KEEP_EMPTY; |
| 5904 | int rebase_cousins = flags & TODO_LIST_REBASE_COUSINS; |
| 5905 | int root_with_onto = flags & TODO_LIST_ROOT_WITH_ONTO; |
| 5906 | int skipped_commit = 0; |
| 5907 | struct strbuf buf = STRBUF_INIT, oneline = STRBUF_INIT; |
| 5908 | struct strbuf label_from_message = STRBUF_INIT; |
| 5909 | struct commit_list *commits = NULL, **tail = &commits, *iter; |
| 5910 | struct commit_list *tips = NULL, **tips_tail = &tips; |
| 5911 | struct commit *commit; |
| 5912 | struct oidmap commit2todo = OIDMAP_INIT; |
| 5913 | struct string_entry *entry; |
| 5914 | struct oidset interesting = OIDSET_INIT, child_seen = OIDSET_INIT, |
| 5915 | shown = OIDSET_INIT; |
| 5916 | struct label_state state = |
| 5917 | { OIDMAP_INIT, { NULL }, STRBUF_INIT, GIT_MAX_LABEL_LENGTH }; |
| 5918 | |
| 5919 | int abbr = flags & TODO_LIST_ABBREVIATE_CMDS; |
| 5920 | const char *cmd_pick = abbr ? "p" : "pick", |
| 5921 | *cmd_label = abbr ? "l" : "label", |
| 5922 | *cmd_reset = abbr ? "t" : "reset", |
| 5923 | *cmd_merge = abbr ? "m" : "merge"; |
| 5924 | |
| 5925 | repo_config_get_int(the_repository, "rebase.maxlabellength", &state.max_label_length); |
| 5926 | |
| 5927 | oidmap_init(&commit2todo, 0); |
| 5928 | oidmap_init(&state.commit2label, 0); |
| 5929 | hashmap_init(&state.labels, labels_cmp, NULL, 0); |
| 5930 | strbuf_init(&state.buf, 32); |
| 5931 | load_branch_decorations(); |
| 5932 | |
| 5933 | if (revs->cmdline.nr && (revs->cmdline.rev[0].flags & BOTTOM)) { |
| 5934 | struct labels_entry *onto_label_entry; |
| 5935 | struct object_id *oid = &revs->cmdline.rev[0].item->oid; |
| 5936 | FLEX_ALLOC_STR(entry, string, "onto"); |
| 5937 | oidcpy(&entry->entry.oid, oid); |
| 5938 | oidmap_put(&state.commit2label, entry); |
| 5939 | |
| 5940 | FLEX_ALLOC_STR(onto_label_entry, label, "onto"); |
| 5941 | hashmap_entry_init(&onto_label_entry->entry, strihash("onto")); |
| 5942 | hashmap_add(&state.labels, &onto_label_entry->entry); |
| 5943 | } |
| 5944 | |
| 5945 | /* |
| 5946 | * First phase: |
| 5947 | * - get onelines for all commits |
| 5948 | * - gather all branch tips (i.e. 2nd or later parents of merges) |
| 5949 | * - label all branch tips |
| 5950 | */ |
| 5951 | while ((commit = get_revision(revs))) { |
| 5952 | struct commit_list *to_merge; |
| 5953 | const char *p1, *p2; |
| 5954 | struct object_id *oid; |
| 5955 | int is_empty; |
| 5956 |
no test coverage detected