diff options
author | Slavica Đukić <slawica92@hotmail.com> | 2019-11-15 14:11:20 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-11-18 05:18:30 +0300 |
commit | 8c159044625e46de67cd8467f07424f38eb8301e (patch) | |
tree | af742630888828a67ce0d727a03f11be290017b2 /add-interactive.c | |
parent | 3d965c76744482b50669a7d1b445c0ddbf92209a (diff) |
built-in add -i: implement the `help` command
This imitates the code to show the help text from the Perl script
`git-add--interactive.perl` in the built-in version.
To make sure that it renders exactly like the Perl version of `git add
-i`, we also add a test case for that to `t3701-add-interactive.sh`.
Signed-off-by: Slavica Đukić <slawica92@hotmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'add-interactive.c')
-rw-r--r-- | add-interactive.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/add-interactive.c b/add-interactive.c index 170a5800e3..d6cb98cd40 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -508,6 +508,26 @@ static int run_status(struct add_i_state *s, const struct pathspec *ps, return 0; } +static int run_help(struct add_i_state *s, const struct pathspec *unused_ps, + struct string_list *unused_files, + struct list_options *unused_opts) +{ + color_fprintf_ln(stdout, s->help_color, "status - %s", + _("show paths with changes")); + color_fprintf_ln(stdout, s->help_color, "update - %s", + _("add working tree state to the staged set of changes")); + color_fprintf_ln(stdout, s->help_color, "revert - %s", + _("revert staged set of changes back to the HEAD version")); + color_fprintf_ln(stdout, s->help_color, "patch - %s", + _("pick hunks and update selectively")); + color_fprintf_ln(stdout, s->help_color, "diff - %s", + _("view diff between HEAD and index")); + color_fprintf_ln(stdout, s->help_color, "add untracked - %s", + _("add contents of untracked files to the staged set of changes")); + + return 0; +} + typedef int (*command_t)(struct add_i_state *s, const struct pathspec *ps, struct string_list *files, struct list_options *opts); @@ -561,6 +581,7 @@ int run_add_i(struct repository *r, const struct pathspec *ps) command_t command; } command_list[] = { { "status", run_status }, + { "help", run_help }, }; struct prefix_item_list commands = PREFIX_ITEM_LIST_INIT; |