diff --git a/replay.c b/replay.c index 313fb2a768..20560e792b 100644 --- a/replay.c +++ b/replay.c @@ -338,6 +338,8 @@ int replay_revisions(struct repository *repo, struct rev_info *revs, &onto->object.oid, &last_commit->object.oid); + out->final_oid = last_commit->object.oid; + ret = 0; out: diff --git a/replay.h b/replay.h index 84bc8a7a5b..f8f9889112 100644 --- a/replay.h +++ b/replay.h @@ -46,6 +46,22 @@ struct replay_result { /* Set to true in case the replay failed with a merge conflict. */ bool merge_conflict; + + /* + * The final object ID that was rewritten. Note that this field has + * somewhat special semantics and may or may not be what you want: + * + * - If no commits were rewritten it will remain uninitialized. + * + * - If a thicket of branches is rewritten it is undefined in which + * order those branches will be rewritten, and thus the final object + * ID may point to a different commit than you'd expect. + * + * That being said, this field can still be useful when you know that + * you only replay a single strand of commits. In that case, the final + * commit will point to the tip of the rewritten strand of commits. + */ + struct object_id final_oid; }; void replay_result_release(struct replay_result *result);