diff options
| author | Alban Gruin <alban.gruin@gmail.com> | 2018-08-10 18:51:36 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-08-10 11:56:22 -0700 |
| commit | d4ed5d7713c779487a52d30e83185a056c4bf023 (patch) | |
| tree | 849af7905191b65d6f02495b00c94e652682273e /sequencer.c | |
| parent | a9f5476fbca515171e42a4e06b584a9241341ae9 (diff) | |
| download | git-d4ed5d7713c779487a52d30e83185a056c4bf023.tar.xz | |
sequencer: change the way skip_unnecessary_picks() returns its result
Instead of skip_unnecessary_picks() printing its result to stdout, it
returns it into a struct object_id, as the rewrite of complete_action()
(to come in the next commit) will need it.
rebase--helper then is modified to fit this change.
Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
| -rw-r--r-- | sequencer.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sequencer.c b/sequencer.c index df2c80d879..cd2374ee1a 100644 --- a/sequencer.c +++ b/sequencer.c @@ -4416,17 +4416,17 @@ static int rewrite_file(const char *path, const char *buf, size_t len) } /* skip picking commits whose parents are unchanged */ -int skip_unnecessary_picks(void) +int skip_unnecessary_picks(struct object_id *output_oid) { const char *todo_file = rebase_path_todo(); struct strbuf buf = STRBUF_INIT; struct todo_list todo_list = TODO_LIST_INIT; - struct object_id onto_oid, *oid = &onto_oid, *parent_oid; + struct object_id *parent_oid; int fd, i; if (!read_oneliner(&buf, rebase_path_onto(), 0)) return error(_("could not read 'onto'")); - if (get_oid(buf.buf, &onto_oid)) { + if (get_oid(buf.buf, output_oid)) { strbuf_release(&buf); return error(_("need a HEAD to fixup")); } @@ -4456,9 +4456,9 @@ int skip_unnecessary_picks(void) if (item->commit->parents->next) break; /* merge commit */ parent_oid = &item->commit->parents->item->object.oid; - if (hashcmp(parent_oid->hash, oid->hash)) + if (hashcmp(parent_oid->hash, output_oid->hash)) break; - oid = &item->commit->object.oid; + oidcpy(output_oid, &item->commit->object.oid); } if (i > 0) { int offset = get_item_line_offset(&todo_list, i); @@ -4487,11 +4487,10 @@ int skip_unnecessary_picks(void) todo_list.current = i; if (is_fixup(peek_command(&todo_list, 0))) - record_in_rewritten(oid, peek_command(&todo_list, 0)); + record_in_rewritten(output_oid, peek_command(&todo_list, 0)); } todo_list_release(&todo_list); - printf("%s\n", oid_to_hex(oid)); return 0; } |
