From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id ED96E1F403 for ; Thu, 7 Jun 2018 10:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753608AbeFGKbA (ORCPT ); Thu, 7 Jun 2018 06:31:00 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:43640 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753213AbeFGKa5 (ORCPT ); Thu, 7 Jun 2018 06:30:57 -0400 Received: by mail-wr0-f195.google.com with SMTP id d2-v6so9490158wrm.10 for ; Thu, 07 Jun 2018 03:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8FnEltgr80DOnKut3Xw4nkl5uJFjxD7vszY+ZEeBOMw=; b=SnKddUm35ptPwxDt1DnCi8lLofC2m/FLRk+69I+BbspLXbioHbaWkQii+bolwcXnHK +kD0q2QtFs4QSUEYtCVKGM5HWT0PrSYxMhTSWZhOafDUOWBDcc3XTB0kybInlOONa+QH 5VuE1cM+xWPHjLaOrif2D5Txxz5kNfo2+JhlEr4N8DuSZsjuzHZrAk0a0Q/ZD0e62rtD Gx2DVv3DiQLIeST3Yy2j9d7X1wZpF+uq/Tj8/IXXjSOhYCE5ebqUPP3F3rS7ax7vOjnM GGEJ2B+bIUXW1drMvbZU1JSCRhlGDHQc2rhmMQGpwvTTPnSUQHcq9Kh+xdc/NP918RZ9 Irbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8FnEltgr80DOnKut3Xw4nkl5uJFjxD7vszY+ZEeBOMw=; b=tt95ZrHTjZDhXcnC24j+fiIH0AyaDCsxmr7pZsZp8gkIZuvk8VM+7blhO6cZ5pVAk/ ATXIodT9KArcE12R5KbZ+/2o/awP1Dp4fYvqtgE3HNXdX3Gsy9g2EEz5iBTsseOLibfb CIT90Dg1YDFbgjy1zfjBX09it+CidM9JTfmz3yQNqxi5JW5Akyb6Kkyj9NQS/y4p/QXc 3HUQ/8p+oZ2U9e0fkvfU/VsWKlqgzZQsUdc0FHkCi06f1Urfo2vosbY6rpAES8Ds+X8Q NlKkEJEydylhuYx/utjE8Hn5y8AfduBHMW45N2yXQqIYylkFUpj+lAbmyBvFeLOoQXlk c1FQ== X-Gm-Message-State: APt69E2jAWeOX/rFtwoauQHBwJYzmWyyP+zwYbmhH1/9ZyyJyHkUuSJH OKx/UhUTYp7KozIsipb2XQBh7KMP X-Google-Smtp-Source: ADUXVKLt3Dtbcj2DvSe0p4oa/z8wjigKHft+njVFRwBMGEYzWl/NuOixU8xcKmjAIW2ksQrpQatgyw== X-Received: by 2002:adf:a0aa:: with SMTP id m39-v6mr1161696wrm.125.1528367455998; Thu, 07 Jun 2018 03:30:55 -0700 (PDT) Received: from localhost.localdomain (AToulouse-658-1-25-147.w86-222.abo.wanadoo.fr. [86.222.24.147]) by smtp.googlemail.com with ESMTPSA id v138-v6sm1871573wmd.47.2018.06.07.03.30.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 03:30:55 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Stefan Beller , Christian Couder , Johannes Schindelin , phillip.wood@dunelm.org.uk, Alban Gruin Subject: [GSoC][PATCH v3 1/1] rebase--interactive: rewrite append_todo_help() in C Date: Thu, 7 Jun 2018 12:30:12 +0200 Message-Id: <20180607103012.22981-2-alban.gruin@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180607103012.22981-1-alban.gruin@gmail.com> References: <20180605125334.14082-1-alban.gruin@gmail.com> <20180607103012.22981-1-alban.gruin@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This rewrites append_todo_help() from shell to C. It also incorporates some parts of initiate_action() and complete_action() that also write help texts to the todo file. Two flags are added to rebase--helper.c: one to call append_todo_help() (`--append-todo-help`), and another one to tell append_todo_help() to write the help text suited for the edit-todo mode (`--write-edit-todo`). Finally, append_todo_help() is removed from git-rebase--interactive.sh to use `rebase--helper --append-todo-help` instead. Signed-off-by: Alban Gruin --- builtin/rebase--helper.c | 10 ++++++-- git-rebase--interactive.sh | 52 ++-------------------------------------- sequencer.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ sequencer.h | 1 + 4 files changed, 71 insertions(+), 52 deletions(-) diff --git a/builtin/rebase--helper.c b/builtin/rebase--helper.c index f7c2a5fdc..ded5e291d 100644 --- a/builtin/rebase--helper.c +++ b/builtin/rebase--helper.c @@ -12,12 +12,12 @@ static const char * const builtin_rebase_helper_usage[] = { int cmd_rebase__helper(int argc, const char **argv, const char *prefix) { struct replay_opts opts = REPLAY_OPTS_INIT; - unsigned flags = 0, keep_empty = 0, rebase_merges = 0; + unsigned flags = 0, keep_empty = 0, rebase_merges = 0, write_edit_todo = 0; int abbreviate_commands = 0, rebase_cousins = -1; enum { CONTINUE = 1, ABORT, MAKE_SCRIPT, SHORTEN_OIDS, EXPAND_OIDS, CHECK_TODO_LIST, SKIP_UNNECESSARY_PICKS, REARRANGE_SQUASH, - ADD_EXEC + ADD_EXEC, APPEND_TODO_HELP } command = 0; struct option options[] = { OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")), @@ -27,6 +27,8 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix) OPT_BOOL(0, "rebase-merges", &rebase_merges, N_("rebase merge commits")), OPT_BOOL(0, "rebase-cousins", &rebase_cousins, N_("keep original branch points of cousins")), + OPT_BOOL(0, "write-edit-todo", &write_edit_todo, + N_("append the edit-todo message to the todo-list")), OPT_CMDMODE(0, "continue", &command, N_("continue rebase"), CONTINUE), OPT_CMDMODE(0, "abort", &command, N_("abort rebase"), @@ -45,6 +47,8 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix) N_("rearrange fixup/squash lines"), REARRANGE_SQUASH), OPT_CMDMODE(0, "add-exec-commands", &command, N_("insert exec commands in todo list"), ADD_EXEC), + OPT_CMDMODE(0, "append-todo-help", &command, + N_("insert the help in the todo list"), APPEND_TODO_HELP), OPT_END() }; @@ -84,5 +88,7 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix) return !!rearrange_squash(); if (command == ADD_EXEC && argc == 2) return !!sequencer_add_exec_commands(argv[1]); + if (command == APPEND_TODO_HELP && argc == 1) + return !!append_todo_help(write_edit_todo, keep_empty); usage_with_options(builtin_rebase_helper_usage, options); } diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 299ded213..94c23a7af 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -39,38 +39,6 @@ comment_for_reflog () { esac } -append_todo_help () { - gettext " -Commands: -p, pick = use commit -r, reword = use commit, but edit the commit message -e, edit = use commit, but stop for amending -s, squash = use commit, but meld into previous commit -f, fixup = like \"squash\", but discard this commit's log message -x, exec = run command (the rest of the line) using shell -d, drop = remove commit -l, label