mirror of
https://github.com/git/git.git
synced 2026-01-11 21:33:13 +09:00
replay: yield the object ID of the final rewritten commit
In a subsequent commit we'll introduce a new git-history(1) command that uses the replay machinery to rewrite commits. One of its supported modes will only want to update the "HEAD" reference, but that is not currently supported by the replay machinery. Allow implementing this use case by exposing a `final_oid` field for the reference updates. This field will be set to the last commit that was rewritten, which is sufficient information for us to implement this mode in git-history(1). Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
6a91f2abfb
commit
a9f788acf0
2
replay.c
2
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:
|
||||
|
||||
16
replay.h
16
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user