This is the first version of a patch series to start porting git-add--interactive from Perl to C. Daniel Ferreira's patch series used as a head start: https://public-inbox.org/git/1494907234-28903-1-git-send-email-bnmvco@xxxxxxxxx/t/#u Changes since v2: * fixed translation misuse and avoided command names translation in add_i_show_help Daniel Ferreira (4): diff: export diffstat interface add--helper: create builtin helper for interactive add add-interactive.c: implement status command add--interactive.perl: use add--helper --status for status_cmd Slavica Djukic (3): add-interactive.c: implement show-help command t3701-add-interactive: test add_i_show_help() add--interactive.perl: use add--helper --show-help for help_cmd .gitignore | 1 + Makefile | 2 + add-interactive.c | 263 +++++++++++++++++++++++++++++++++++++ add-interactive.h | 10 ++ builtin.h | 1 + builtin/add--helper.c | 43 ++++++ diff.c | 36 ++--- diff.h | 18 +++ git-add--interactive.perl | 15 +-- git.c | 1 + t/t3701-add-interactive.sh | 24 ++++ 11 files changed, 379 insertions(+), 35 deletions(-) create mode 100644 add-interactive.c create mode 100644 add-interactive.h create mode 100644 builtin/add--helper.c base-commit: b21ebb671bb7dea8d342225f0d66c41f4e54d5ca Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-103%2FslavicaDj%2Fadd-i-v3 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-103/slavicaDj/add-i-v3 Pull-Request: https://github.com/gitgitgadget/git/pull/103 Range-diff vs v2: 1: 737767b6f4 = 1: 737767b6f4 diff: export diffstat interface 2: 91b1963125 = 2: 91b1963125 add--helper: create builtin helper for interactive add 3: d247ef69fe = 3: d247ef69fe add-interactive.c: implement status command 4: 4950c889aa = 4: 4950c889aa add--interactive.perl: use add--helper --status for status_cmd 5: cf4e913a5a ! 5: 581b108c9c add-interactive.c: implement show-help command @@ -23,24 +23,18 @@ +void add_i_show_help(void) +{ + const char *help_color = get_color(COLOR_HELP); -+ color_fprintf(stdout, help_color, "%s%s", _("status"), -+ N_(" - show paths with changes")); -+ printf("\n"); -+ color_fprintf(stdout, help_color, "%s%s", _("update"), -+ N_(" - add working tree state to the staged set of changes")); -+ printf("\n"); -+ color_fprintf(stdout, help_color, "%s%s", _("revert"), -+ N_(" - revert staged set of changes back to the HEAD version")); -+ printf("\n"); -+ color_fprintf(stdout, help_color, "%s%s", _("patch"), -+ N_(" - pick hunks and update selectively")); -+ printf("\n"); -+ color_fprintf(stdout, help_color, "%s%s", _("diff"), -+ N_(" - view diff between HEAD and index")); -+ printf("\n"); -+ color_fprintf(stdout, help_color, "%s%s", _("add untracked"), -+ N_(" - add contents of untracked files to the staged set of changes")); -+ printf("\n"); ++ color_fprintf_ln(stdout, help_color, "status - %s", ++ _("show paths with changes")); ++ color_fprintf_ln(stdout, help_color, "update - %s", ++ _("add working tree state to the staged set of changes")); ++ color_fprintf_ln(stdout, help_color, "revert - %s", ++ _("revert staged set of changes back to the HEAD version")); ++ color_fprintf_ln(stdout, help_color, "patch - %s", ++ _("pick hunks and update selectively")); ++ color_fprintf_ln(stdout, help_color, "diff - %s", ++ _("view diff between HEAD and index")); ++ color_fprintf_ln(stdout, help_color, "add untracked - %s", ++ _("add contents of untracked files to the staged set of changes")); +} diff --git a/add-interactive.h b/add-interactive.h 6: 2b4714b8d0 = 6: aede733318 t3701-add-interactive: test add_i_show_help() 7: 6ede6d9251 = 7: b9a1a7e37a add--interactive.perl: use add--helper --show-help for help_cmd -- gitgitgadget