diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2024-04-18 15:14:06 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-18 22:33:41 +0200 |
commit | a3152edc97ff37f61387c6b222c68bc4f8b19bee (patch) | |
tree | 86706fd5e59e68587ae52ac2ccd9f1bda767efac /sequencer.h | |
parent | sequencer: always free "struct replay_opts" (diff) | |
download | git-a3152edc97ff37f61387c6b222c68bc4f8b19bee.tar.xz git-a3152edc97ff37f61387c6b222c68bc4f8b19bee.zip |
sequencer: start removing private fields from public API
"struct replay_opts" has a number of fields that are for internal
use. While they are marked as private having them in a public struct is
a distraction for callers and means that every time the internal details
are changed we have to recompile all the files that include sequencer.h
even though the public API is unchanged. This commit starts the process
of removing the private fields by adding an opaque pointer to a "struct
replay_ctx" to "struct replay_opts" and moving the "reflog_message"
member to the new private struct.
The sequencer currently updates the state files on disc each time it
processes a command in the todo list. This is an artifact of the
scripted implementation and makes the code hard to reason about as it is
not possible to get a complete view of the state in memory. In the
future we will add new members to "struct replay_ctx" to remedy this and
avoid writing state to disc unless the sequencer stops for user
interaction.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.h')
-rw-r--r-- | sequencer.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sequencer.h b/sequencer.h index dcef7bb99c..069f06400d 100644 --- a/sequencer.h +++ b/sequencer.h @@ -29,6 +29,9 @@ enum commit_msg_cleanup_mode { COMMIT_MSG_CLEANUP_ALL }; +struct replay_ctx; +struct replay_ctx* replay_ctx_new(void); + struct replay_opts { enum replay_action action; @@ -78,13 +81,14 @@ struct replay_opts { struct rev_info *revs; /* Private use */ - const char *reflog_message; + struct replay_ctx *ctx; }; #define REPLAY_OPTS_INIT { \ .edit = -1, \ .action = -1, \ .current_fixups = STRBUF_INIT, \ .xopts = STRVEC_INIT, \ + .ctx = replay_ctx_new(), \ } /* |