summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-07-19 18:33:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-19 19:49:03 (GMT)
commitd7ce9a220196b995117252bb236baf135c9b704f (patch)
treecf65ff67839eb026a4746126c536f2454fd35042 /sequencer.c
parentf57fd48d56864ed9a09d65cffe2c70b86ca7b652 (diff)
downloadgit-d7ce9a220196b995117252bb236baf135c9b704f.zip
git-d7ce9a220196b995117252bb236baf135c9b704f.tar.gz
git-d7ce9a220196b995117252bb236baf135c9b704f.tar.bz2
sequencer: define array with enum values
The todo_command_info array defines which strings match with which todo_command enum values. The array is defined in the same order as the enum values, but if one changed without the other, then we would have unexpected results. Make it easier to see changes to the enum and this array by using the enum values as the indices of the array. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sequencer.c b/sequencer.c
index c4f3b48..bcfd25c 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1712,20 +1712,20 @@ static struct {
char c;
const char *str;
} todo_command_info[] = {
- { 'p', "pick" },
- { 0, "revert" },
- { 'e', "edit" },
- { 'r', "reword" },
- { 'f', "fixup" },
- { 's', "squash" },
- { 'x', "exec" },
- { 'b', "break" },
- { 'l', "label" },
- { 't', "reset" },
- { 'm', "merge" },
- { 0, "noop" },
- { 'd', "drop" },
- { 0, NULL }
+ [TODO_PICK] = { 'p', "pick" },
+ [TODO_REVERT] = { 0, "revert" },
+ [TODO_EDIT] = { 'e', "edit" },
+ [TODO_REWORD] = { 'r', "reword" },
+ [TODO_FIXUP] = { 'f', "fixup" },
+ [TODO_SQUASH] = { 's', "squash" },
+ [TODO_EXEC] = { 'x', "exec" },
+ [TODO_BREAK] = { 'b', "break" },
+ [TODO_LABEL] = { 'l', "label" },
+ [TODO_RESET] = { 't', "reset" },
+ [TODO_MERGE] = { 'm', "merge" },
+ [TODO_NOOP] = { 0, "noop" },
+ [TODO_DROP] = { 'd', "drop" },
+ [TODO_COMMENT] = { 0, NULL },
};
static const char *command_to_string(const enum todo_command command)