From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-5.7 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,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id C233B1F8C6 for ; Mon, 6 Sep 2021 10:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241760AbhIFKQg (ORCPT ); Mon, 6 Sep 2021 06:16:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241728AbhIFKQf (ORCPT ); Mon, 6 Sep 2021 06:16:35 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B82C061575 for ; Mon, 6 Sep 2021 03:15:30 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id g138so4193340wmg.4 for ; Mon, 06 Sep 2021 03:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=reply-to:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=s6NteKBRPVJvzNl0iLtYDR+R+y5VBW5cBx0FKdqxp/E=; b=h+JgjlnpeHb4IsMZiZkb0TBYZwdbvvlzYhVpi7cS4pLCmt0EKl6lU2BL+m4dy0Tth0 V67DK4CXYyyT0jAY0xBpUISkGh54z49g/xQEbQ1ZxwbkbB+y3ifAbm6axdzIrSZ5bMgr kP1Rbz4QVWqpbtwRQTAHoWHvp3HWfJafrAE3k4KacH+yOht5OMnhmtREIc/GInQkXYac fBl4KluUbUIJKnmH8EigQQbfWZWkFTu7SJTe58ZrH04RaX8YVIm2XZYES7a7zdO48NBT gBRdEJKxQYwHHn6IG7zwbp7D9TbaUCEZjreSiMYXvhHbbdeVRpu7PZ652ZhrqE5246X2 EJAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=s6NteKBRPVJvzNl0iLtYDR+R+y5VBW5cBx0FKdqxp/E=; b=PACx3ykOM7MZdOFlAxt9DyH6CvcdGjgT5tZHTGzm3nC5jTsjJYnYrnUq0wZ7BMgvZe afuzK5hNzViQM8SH/r3nILzdHGU7sM0n88ArdONr/aeyzfJY0AOxbSKm7fe3qVnNVbHK Hg5tfWMeIiDnFL7+zgpIkkZREHd+tJd6dvk82cSkPhIRq4dNQNo6ycQ0nmlkzThNRe7x YY4WqgKRVsg3ja5W6gRyg1injoq/oz/mNCgDl3rq1nsp+AYyham9oXmEvCvLKigsJMYa h4025nVYjD1QoCzRAHnf82hmEhkgxq7RkgeKRvk+GuIEksMy9SzVFyY9vouo2uPOmXCJ 2g/Q== X-Gm-Message-State: AOAM5307a24FaNtf63FfOm0uUKMe6NuvE7bD0e7BQpaBHmAy0nrXXg8J Q/qP3mGm2MkAyTpJwqdR6fs= X-Google-Smtp-Source: ABdhPJwJTBeB0vFd00rnlOmzgh7HxU+NgNOjB82jBKTz1qHhSHmAeuqrpUEdsFk4HWDsggrnTMGqbQ== X-Received: by 2002:a05:600c:3b0e:: with SMTP id m14mr10763655wms.118.1630923328993; Mon, 06 Sep 2021 03:15:28 -0700 (PDT) Received: from [192.168.1.201] ([31.185.185.254]) by smtp.googlemail.com with ESMTPSA id r20sm7674425wrr.47.2021.09.06.03.15.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Sep 2021 03:15:28 -0700 (PDT) Reply-To: phillip.wood@dunelm.org.uk Subject: Re: [PATCH v2 5/7] rebase: drop support for `--preserve-merges` To: Johannes Schindelin via GitGitGadget , git@vger.kernel.org Cc: Eric Wong , Johannes Schindelin References: From: Phillip Wood Message-ID: Date: Mon, 6 Sep 2021 11:15:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi dscho On 01/09/2021 12:57, Johannes Schindelin via GitGitGadget wrote: > From: Johannes Schindelin > > This option was deprecated in favor of `--rebase-merges` some time ago, > and now we retire it. This all looks good to me. I did see the comment below in builtin/rebase.c that could be tweaked if you reroll, but it is a very minor issue. /* -i followed by -p is still explicitly interactive, but -p alone is not */ static int parse_opt_interactive(const struct option *opt, const char *arg, int unset) I do wonder if we need these option parsing functions now but that is a question for another day. Best Wishes Phillip > Signed-off-by: Johannes Schindelin > --- > .gitignore | 1 - > Documentation/git-rebase.txt | 51 -- > Makefile | 2 - > builtin/rebase.c | 133 +--- > git-rebase--preserve-merges.sh | 1057 -------------------------------- > 5 files changed, 6 insertions(+), 1238 deletions(-) > delete mode 100644 git-rebase--preserve-merges.sh > > diff --git a/.gitignore b/.gitignore > index 311841f9bed..98d6275b20d 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -125,7 +125,6 @@ > /git-range-diff > /git-read-tree > /git-rebase > -/git-rebase--preserve-merges > /git-receive-pack > /git-reflog > /git-remote > diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt > index 55af6fd24e2..1382dc6f005 100644 > --- a/Documentation/git-rebase.txt > +++ b/Documentation/git-rebase.txt > @@ -525,29 +525,12 @@ i.e. commits that would be excluded by linkgit:git-log[1]'s > the `rebase-cousins` mode is turned on, such commits are instead rebased > onto `` (or ``, if specified). > + > -The `--rebase-merges` mode is similar in spirit to the deprecated > -`--preserve-merges` but works with interactive rebases, > -where commits can be reordered, inserted and dropped at will. > -+ > It is currently only possible to recreate the merge commits using the > `recursive` merge strategy; Different merge strategies can be used only via > explicit `exec git merge -s [...]` commands. > + > See also REBASING MERGES and INCOMPATIBLE OPTIONS below. > > --p:: > ---preserve-merges:: > - [DEPRECATED: use `--rebase-merges` instead] Recreate merge commits > - instead of flattening the history by replaying commits a merge commit > - introduces. Merge conflict resolutions or manual amendments to merge > - commits are not preserved. > -+ > -This uses the `--interactive` machinery internally, but combining it > -with the `--interactive` option explicitly is generally not a good > -idea unless you know what you are doing (see BUGS below). > -+ > -See also INCOMPATIBLE OPTIONS below. > - > -x :: > --exec :: > Append "exec " after each line creating a commit in the > @@ -579,9 +562,6 @@ See also INCOMPATIBLE OPTIONS below. > the root commit(s) on a branch. When used with --onto, it > will skip changes already contained in (instead of > ) whereas without --onto it will operate on every change. > - When used together with both --onto and --preserve-merges, > - 'all' root commits will be rewritten to have as parent > - instead. > + > See also INCOMPATIBLE OPTIONS below. > > @@ -643,7 +623,6 @@ are incompatible with the following options: > * --allow-empty-message > * --[no-]autosquash > * --rebase-merges > - * --preserve-merges > * --interactive > * --exec > * --no-keep-empty > @@ -654,13 +633,6 @@ are incompatible with the following options: > > In addition, the following pairs of options are incompatible: > > - * --preserve-merges and --interactive > - * --preserve-merges and --signoff > - * --preserve-merges and --rebase-merges > - * --preserve-merges and --empty= > - * --preserve-merges and --ignore-whitespace > - * --preserve-merges and --committer-date-is-author-date > - * --preserve-merges and --ignore-date > * --keep-base and --onto > * --keep-base and --root > * --fork-point and --root > @@ -1274,29 +1246,6 @@ CONFIGURATION > include::config/rebase.txt[] > include::config/sequencer.txt[] > > -BUGS > ----- > -The todo list presented by the deprecated `--preserve-merges --interactive` > -does not represent the topology of the revision graph (use `--rebase-merges` > -instead). Editing commits and rewording their commit messages should work > -fine, but attempts to reorder commits tend to produce counterintuitive results. > -Use `--rebase-merges` in such scenarios instead. > - > -For example, an attempt to rearrange > ------------- > -1 --- 2 --- 3 --- 4 --- 5 > ------------- > -to > ------------- > -1 --- 2 --- 4 --- 3 --- 5 > ------------- > -by moving the "pick 4" line will result in the following history: > ------------- > - 3 > - / > -1 --- 2 --- 4 --- 5 > ------------- > - > GIT > --- > Part of the linkgit:git[1] suite > diff --git a/Makefile b/Makefile > index 9573190f1d7..43f93f61660 100644 > --- a/Makefile > +++ b/Makefile > @@ -616,7 +616,6 @@ SCRIPT_SH += git-submodule.sh > SCRIPT_SH += git-web--browse.sh > > SCRIPT_LIB += git-mergetool--lib > -SCRIPT_LIB += git-rebase--preserve-merges > SCRIPT_LIB += git-sh-i18n > SCRIPT_LIB += git-sh-setup > > @@ -2649,7 +2648,6 @@ XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \ > --keyword=__ --keyword=N__ --keyword="__n:1,2" > LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H) > LOCALIZED_SH = $(SCRIPT_SH) > -LOCALIZED_SH += git-rebase--preserve-merges.sh > LOCALIZED_SH += git-sh-setup.sh > LOCALIZED_PERL = $(SCRIPT_PERL) > > diff --git a/builtin/rebase.c b/builtin/rebase.c > index 33e09619005..5af6aff9c5e 100644 > --- a/builtin/rebase.c > +++ b/builtin/rebase.c > @@ -48,8 +48,7 @@ static GIT_PATH_FUNC(merge_dir, "rebase-merge") > enum rebase_type { > REBASE_UNSPECIFIED = -1, > REBASE_APPLY, > - REBASE_MERGE, > - REBASE_PRESERVE_MERGES > + REBASE_MERGE > }; > > enum empty_type { > @@ -571,8 +570,7 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix) > > static int is_merge(struct rebase_options *opts) > { > - return opts->type == REBASE_MERGE || > - opts->type == REBASE_PRESERVE_MERGES; > + return opts->type == REBASE_MERGE; > } > > static void imply_merge(struct rebase_options *opts, const char *option) > @@ -582,7 +580,6 @@ static void imply_merge(struct rebase_options *opts, const char *option) > die(_("%s requires the merge backend"), option); > break; > case REBASE_MERGE: > - case REBASE_PRESERVE_MERGES: > break; > default: > opts->type = REBASE_MERGE; /* implied */ > @@ -773,17 +770,6 @@ static struct commit *peel_committish(const char *name) > return (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT); > } > > -static void add_var(struct strbuf *buf, const char *name, const char *value) > -{ > - if (!value) > - strbuf_addf(buf, "unset %s; ", name); > - else { > - strbuf_addf(buf, "%s=", name); > - sq_quote_buf(buf, value); > - strbuf_addstr(buf, "; "); > - } > -} > - > static int move_to_original_branch(struct rebase_options *opts) > { > struct strbuf orig_head_reflog = STRBUF_INIT, head_reflog = STRBUF_INIT; > @@ -940,10 +926,8 @@ static int run_am(struct rebase_options *opts) > > static int run_specific_rebase(struct rebase_options *opts, enum action action) > { > - const char *argv[] = { NULL, NULL }; > - struct strbuf script_snippet = STRBUF_INIT, buf = STRBUF_INIT; > + struct strbuf script_snippet = STRBUF_INIT; > int status; > - const char *backend, *backend_func; > > if (opts->type == REBASE_MERGE) { > /* Run sequencer-based rebase */ > @@ -960,87 +944,11 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action) > } > > status = run_sequencer_rebase(opts, action); > - goto finished_rebase; > - } > - > - if (opts->type == REBASE_APPLY) { > + } else if (opts->type == REBASE_APPLY) > status = run_am(opts); > - goto finished_rebase; > - } > - > - add_var(&script_snippet, "GIT_DIR", absolute_path(get_git_dir())); > - add_var(&script_snippet, "state_dir", opts->state_dir); > - > - add_var(&script_snippet, "upstream_name", opts->upstream_name); > - add_var(&script_snippet, "upstream", opts->upstream ? > - oid_to_hex(&opts->upstream->object.oid) : NULL); > - add_var(&script_snippet, "head_name", > - opts->head_name ? opts->head_name : "detached HEAD"); > - add_var(&script_snippet, "orig_head", oid_to_hex(&opts->orig_head)); > - add_var(&script_snippet, "onto", opts->onto ? > - oid_to_hex(&opts->onto->object.oid) : NULL); > - add_var(&script_snippet, "onto_name", opts->onto_name); > - add_var(&script_snippet, "revisions", opts->revisions); > - add_var(&script_snippet, "restrict_revision", opts->restrict_revision ? > - oid_to_hex(&opts->restrict_revision->object.oid) : NULL); > - sq_quote_argv_pretty(&buf, opts->git_am_opts.v); > - add_var(&script_snippet, "git_am_opt", buf.buf); > - strbuf_release(&buf); > - add_var(&script_snippet, "verbose", > - opts->flags & REBASE_VERBOSE ? "t" : ""); > - add_var(&script_snippet, "diffstat", > - opts->flags & REBASE_DIFFSTAT ? "t" : ""); > - add_var(&script_snippet, "force_rebase", > - opts->flags & REBASE_FORCE ? "t" : ""); > - if (opts->switch_to) > - add_var(&script_snippet, "switch_to", opts->switch_to); > - add_var(&script_snippet, "action", opts->action ? opts->action : ""); > - add_var(&script_snippet, "signoff", opts->signoff ? "--signoff" : ""); > - add_var(&script_snippet, "allow_rerere_autoupdate", > - opts->allow_rerere_autoupdate ? > - opts->allow_rerere_autoupdate == RERERE_AUTOUPDATE ? > - "--rerere-autoupdate" : "--no-rerere-autoupdate" : ""); > - add_var(&script_snippet, "keep_empty", opts->keep_empty ? "yes" : ""); > - add_var(&script_snippet, "autosquash", opts->autosquash ? "t" : ""); > - add_var(&script_snippet, "gpg_sign_opt", opts->gpg_sign_opt); > - add_var(&script_snippet, "cmd", opts->cmd); > - add_var(&script_snippet, "allow_empty_message", > - opts->allow_empty_message ? "--allow-empty-message" : ""); > - add_var(&script_snippet, "rebase_merges", > - opts->rebase_merges ? "t" : ""); > - add_var(&script_snippet, "rebase_cousins", > - opts->rebase_cousins ? "t" : ""); > - add_var(&script_snippet, "strategy", opts->strategy); > - add_var(&script_snippet, "strategy_opts", opts->strategy_opts); > - add_var(&script_snippet, "rebase_root", opts->root ? "t" : ""); > - add_var(&script_snippet, "squash_onto", > - opts->squash_onto ? oid_to_hex(opts->squash_onto) : ""); > - add_var(&script_snippet, "git_format_patch_opt", > - opts->git_format_patch_opt.buf); > - > - if (is_merge(opts) && > - !(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) { > - strbuf_addstr(&script_snippet, > - "GIT_SEQUENCE_EDITOR=:; export GIT_SEQUENCE_EDITOR; "); > - opts->autosquash = 0; > - } > - > - switch (opts->type) { > - case REBASE_PRESERVE_MERGES: > - backend = "git-rebase--preserve-merges"; > - backend_func = "git_rebase__preserve_merges"; > - break; > - default: > + else > BUG("Unhandled rebase type %d", opts->type); > - break; > - } > > - strbuf_addf(&script_snippet, > - ". git-sh-setup && . %s && %s", backend, backend_func); > - argv[0] = script_snippet.buf; > - > - status = run_command_v_opt(argv, RUN_USING_SHELL); > -finished_rebase: > if (opts->dont_finish_rebase) > ; /* do nothing */ > else if (opts->type == REBASE_MERGE) > @@ -1377,10 +1285,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) > N_("let the user edit the list of commits to rebase"), > PARSE_OPT_NOARG | PARSE_OPT_NONEG, > parse_opt_interactive), > - OPT_SET_INT_F('p', "preserve-merges", &options.type, > - N_("(DEPRECATED) try to recreate merges instead of " > - "ignoring them"), > - REBASE_PRESERVE_MERGES, PARSE_OPT_HIDDEN), > OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate), > OPT_CALLBACK_F(0, "empty", &options, "{drop,keep,ask}", > N_("how to handle commits that become empty"), > @@ -1448,8 +1352,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) > strbuf_reset(&buf); > strbuf_addf(&buf, "%s/rewritten", merge_dir()); > if (is_directory(buf.buf)) { > - options.type = REBASE_PRESERVE_MERGES; > - options.flags |= REBASE_INTERACTIVE_EXPLICIT; > + die("`rebase -p` is no longer supported"); > } else { > strbuf_reset(&buf); > strbuf_addf(&buf, "%s/interactive", merge_dir()); > @@ -1479,10 +1382,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) > usage_with_options(builtin_rebase_usage, > builtin_rebase_options); > > - if (options.type == REBASE_PRESERVE_MERGES) > - warning(_("git rebase --preserve-merges is deprecated. " > - "Use --rebase-merges instead.")); > - > if (keep_base) { > if (options.onto_name) > die(_("cannot combine '--keep-base' with '--onto'")); > @@ -1728,7 +1627,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) > case REBASE_APPLY: > die(_("--strategy requires --merge or --interactive")); > case REBASE_MERGE: > - case REBASE_PRESERVE_MERGES: > /* compatible */ > break; > case REBASE_UNSPECIFIED: > @@ -1780,7 +1678,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) > > switch (options.type) { > case REBASE_MERGE: > - case REBASE_PRESERVE_MERGES: > options.state_dir = merge_dir(); > break; > case REBASE_APPLY: > @@ -1805,28 +1702,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) > options.reschedule_failed_exec = reschedule_failed_exec; > > if (options.signoff) { > - if (options.type == REBASE_PRESERVE_MERGES) > - die("cannot combine '--signoff' with " > - "'--preserve-merges'"); > strvec_push(&options.git_am_opts, "--signoff"); > options.flags |= REBASE_FORCE; > } > > - if (options.type == REBASE_PRESERVE_MERGES) { > - /* > - * Note: incompatibility with --signoff handled in signoff block above > - * Note: incompatibility with --interactive is just a strong warning; > - * git-rebase.txt caveats with "unless you know what you are doing" > - */ > - if (options.rebase_merges) > - die(_("cannot combine '--preserve-merges' with " > - "'--rebase-merges'")); > - > - if (options.reschedule_failed_exec) > - die(_("error: cannot combine '--preserve-merges' with " > - "'--reschedule-failed-exec'")); > - } > - > if (!options.root) { > if (argc < 1) { > struct branch *branch; > diff --git a/git-rebase--preserve-merges.sh b/git-rebase--preserve-merges.sh > deleted file mode 100644 > index b9c71d2a71b..00000000000 > --- a/git-rebase--preserve-merges.sh > +++ /dev/null > @@ -1,1057 +0,0 @@ > -# This shell script fragment is sourced by git-rebase to implement its > -# preserve-merges mode. > -# > -# Copyright (c) 2006 Johannes E. Schindelin > -# > -# The file containing rebase commands, comments, and empty lines. > -# This file is created by "git rebase -i" then edited by the user. As > -# the lines are processed, they are removed from the front of this > -# file and written to the tail of $done. > -todo="$state_dir"/git-rebase-todo > - > -# The rebase command lines that have already been processed. A line > -# is moved here when it is first handled, before any associated user > -# actions. > -done="$state_dir"/done > - > -# The commit message that is planned to be used for any changes that > -# need to be committed following a user interaction. > -msg="$state_dir"/message > - > -# The file into which is accumulated the suggested commit message for > -# squash/fixup commands. When the first of a series of squash/fixups > -# is seen, the file is created and the commit message from the > -# previous commit and from the first squash/fixup commit are written > -# to it. The commit message for each subsequent squash/fixup commit > -# is appended to the file as it is processed. > -# > -# The first line of the file is of the form > -# # This is a combination of $count commits. > -# where $count is the number of commits whose messages have been > -# written to the file so far (including the initial "pick" commit). > -# Each time that a commit message is processed, this line is read and > -# updated. It is deleted just before the combined commit is made. > -squash_msg="$state_dir"/message-squash > - > -# If the current series of squash/fixups has not yet included a squash > -# command, then this file exists and holds the commit message of the > -# original "pick" commit. (If the series ends without a "squash" > -# command, then this can be used as the commit message of the combined > -# commit without opening the editor.) > -fixup_msg="$state_dir"/message-fixup > - > -# $rewritten is the name of a directory containing files for each > -# commit that is reachable by at least one merge base of $head and > -# $upstream. They are not necessarily rewritten, but their children > -# might be. This ensures that commits on merged, but otherwise > -# unrelated side branches are left alone. (Think "X" in the man page's > -# example.) > -rewritten="$state_dir"/rewritten > - > -dropped="$state_dir"/dropped > - > -end="$state_dir"/end > -msgnum="$state_dir"/msgnum > - > -# A script to set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and > -# GIT_AUTHOR_DATE that will be used for the commit that is currently > -# being rebased. > -author_script="$state_dir"/author-script > - > -# When an "edit" rebase command is being processed, the SHA1 of the > -# commit to be edited is recorded in this file. When "git rebase > -# --continue" is executed, if there are any staged changes then they > -# will be amended to the HEAD commit, but only provided the HEAD > -# commit is still the commit to be edited. When any other rebase > -# command is processed, this file is deleted. > -amend="$state_dir"/amend > - > -# For the post-rewrite hook, we make a list of rewritten commits and > -# their new sha1s. The rewritten-pending list keeps the sha1s of > -# commits that have been processed, but not committed yet, > -# e.g. because they are waiting for a 'squash' command. > -rewritten_list="$state_dir"/rewritten-list > -rewritten_pending="$state_dir"/rewritten-pending > - > -# Work around Git for Windows' Bash whose "read" does not strip CRLF > -# and leaves CR at the end instead. > -cr=$(printf "\015") > - > -resolvemsg=" > -$(gettext 'Resolve all conflicts manually, mark them as resolved with > -"git add/rm ", then run "git rebase --continue". > -You can instead skip this commit: run "git rebase --skip". > -To abort and get back to the state before "git rebase", run "git rebase --abort".') > -" > - > -write_basic_state () { > - echo "$head_name" > "$state_dir"/head-name && > - echo "$onto" > "$state_dir"/onto && > - echo "$orig_head" > "$state_dir"/orig-head && > - test t = "$GIT_QUIET" && : > "$state_dir"/quiet > - test t = "$verbose" && : > "$state_dir"/verbose > - test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy > - test -n "$strategy_opts" && echo "$strategy_opts" > \ > - "$state_dir"/strategy_opts > - test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \ > - "$state_dir"/allow_rerere_autoupdate > - test -n "$gpg_sign_opt" && echo "$gpg_sign_opt" > "$state_dir"/gpg_sign_opt > - test -n "$signoff" && echo "$signoff" >"$state_dir"/signoff > - test -n "$reschedule_failed_exec" && : > "$state_dir"/reschedule-failed-exec > -} > - > -apply_autostash () { > - if test -f "$state_dir/autostash" > - then > - stash_sha1=$(cat "$state_dir/autostash") > - if git stash apply $stash_sha1 >/dev/null 2>&1 > - then > - echo "$(gettext 'Applied autostash.')" >&2 > - else > - git stash store -m "autostash" -q $stash_sha1 || > - die "$(eval_gettext "Cannot store \$stash_sha1")" > - gettext 'Applying autostash resulted in conflicts. > -Your changes are safe in the stash. > -You can run "git stash pop" or "git stash drop" at any time. > -' >&2 > - fi > - fi > -} > - > -output () { > - case "$verbose" in > - '') > - output=$("$@" 2>&1 ) > - status=$? > - test $status != 0 && printf "%s\n" "$output" > - return $status > - ;; > - *) > - "$@" > - ;; > - esac > -} > - > -strategy_args=${strategy:+--strategy=$strategy} > -test -n "$strategy_opts" && > -eval ' > - for strategy_opt in '"$strategy_opts"' > - do > - strategy_args="$strategy_args -X$(git rev-parse --sq-quote "${strategy_opt#--}")" > - done > -' > - > -GIT_CHERRY_PICK_HELP="$resolvemsg" > -export GIT_CHERRY_PICK_HELP > - > -comment_char=$(git config --get core.commentchar 2>/dev/null) > -case "$comment_char" in > -'' | auto) > - comment_char="#" > - ;; > -?) > - ;; > -*) > - comment_char=$(echo "$comment_char" | cut -c1) > - ;; > -esac > - > -warn () { > - printf '%s\n' "$*" >&2 > -} > - > -# Output the commit message for the specified commit. > -commit_message () { > - git cat-file commit "$1" | sed "1,/^$/d" > -} > - > -orig_reflog_action="$GIT_REFLOG_ACTION" > - > -comment_for_reflog () { > - case "$orig_reflog_action" in > - ''|rebase*) > - GIT_REFLOG_ACTION="rebase -i ($1)" > - export GIT_REFLOG_ACTION > - ;; > - esac > -} > - > -last_count= > -mark_action_done () { > - sed -e 1q < "$todo" >> "$done" > - sed -e 1d < "$todo" >> "$todo".new > - mv -f "$todo".new "$todo" > - new_count=$(( $(git stripspace --strip-comments <"$done" | wc -l) )) > - echo $new_count >"$msgnum" > - total=$(($new_count + $(git stripspace --strip-comments <"$todo" | wc -l))) > - echo $total >"$end" > - if test "$last_count" != "$new_count" > - then > - last_count=$new_count > - eval_gettext "Rebasing (\$new_count/\$total)"; printf "\r" > - test -z "$verbose" || echo > - fi > -} > - > -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