This patch series completes the support for all rebase options in the builtin rebase, e.g. --signoff, rerere-autoupdate, etc. It is based on pk/rebase -in-c-3-acts. Changes since v1: * Added the forgotten -k short option for --keep-empty (and verified that no other short options were forgotten). * The "Applied autostash" message is now translated (as was the original in the shell script version). Pratik Karki (18): builtin rebase: allow selecting the rebase "backend" builtin rebase: support --signoff builtin rebase: support --rerere-autoupdate builtin rebase: support --committer-date-is-author-date builtin rebase: support `ignore-whitespace` option builtin rebase: support `ignore-date` option builtin rebase: support `keep-empty` option builtin rebase: support `--autosquash` builtin rebase: support `--gpg-sign` option builtin rebase: support `-C` and `--whitespace=<type>` builtin rebase: support `--autostash` option builtin rebase: support `--exec` builtin rebase: support `--allow-empty-message` option builtin rebase: support --rebase-merges[=[no-]rebase-cousins] merge-base --fork-point: extract libified function builtin rebase: support `fork-point` option builtin rebase: add support for custom merge strategies builtin rebase: support --root builtin/merge-base.c | 81 +------- builtin/rebase.c | 449 ++++++++++++++++++++++++++++++++++++++++++- commit.c | 81 ++++++++ commit.h | 2 + 4 files changed, 528 insertions(+), 85 deletions(-) base-commit: e01f72be63e6cb58243124abb2491f9d5dbcdbef Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-33%2Fdscho%2Frebase-in-c-4-opts-v2 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-33/dscho/rebase-in-c-4-opts-v2 Pull-Request: https://github.com/gitgitgadget/git/pull/33 Range-diff vs v1: 1: 22a65191f8 ! 1: 7f751c6ce1 builtin rebase: allow selecting the rebase "backend" @@ -19,6 +19,7 @@ tests for this via `git pull --rebase=preserve`). Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 2: cb9129890b ! 2: 1e2ce4b34e builtin rebase: support --signoff @@ -7,6 +7,7 @@ handling is left to the rebase backends. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 3: 99ff1fc128 ! 3: a301ef6bbd builtin rebase: support --rerere-autoupdate @@ -7,6 +7,7 @@ `git-legacy-rebase.sh`. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 4: cb6596ea93 ! 4: 8f67a3969d builtin rebase: support --committer-date-is-author-date @@ -6,6 +6,7 @@ `git_am_opt` variable that is handled by the `git-rebase--am` backend. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 5: bf3279c2d5 ! 5: f04394a500 builtin rebase: support `ignore-whitespace` option @@ -7,6 +7,7 @@ `--am` backend. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 6: 804e1969c2 ! 6: 83bb277509 builtin rebase: support `ignore-date` option @@ -6,6 +6,7 @@ to easily change the dates of the rebased commits. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 7: fcf2243476 ! 7: a8f12bf01f builtin rebase: support `keep-empty` option @@ -12,6 +12,7 @@ already be chosen during the `parse_options()` call. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c @@ -60,7 +61,7 @@ &options.allow_rerere_autoupdate, N_("allow rerere to update index with resolved " "conflict")), -+ OPT_BOOL(0, "keep-empty", &options.keep_empty, ++ OPT_BOOL('k', "keep-empty", &options.keep_empty, + N_("preserve empty commits during rebase")), OPT_END(), }; 8: b4ecffc8f1 ! 8: 1b6851e5e1 builtin rebase: support `--autosquash` @@ -12,6 +12,7 @@ falls back to) git_default_config(). Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c @@ -46,7 +47,7 @@ @@ "conflict")), - OPT_BOOL(0, "keep-empty", &options.keep_empty, + OPT_BOOL('k', "keep-empty", &options.keep_empty, N_("preserve empty commits during rebase")), + OPT_BOOL(0, "autosquash", &options.autosquash, + N_("move commits that begin with " 9: e2a26f10e5 ! 9: b8055fb258 builtin rebase: support `--gpg-sign` option @@ -6,6 +6,7 @@ to GPG-sign commits. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 10: a1f3245250 ! 10: 98908573ce builtin rebase: support `-C` and `--whitespace=<type>` @@ -8,6 +8,7 @@ shell script version does so, too. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 11: 7b3c0dbbd9 ! 11: 5e5e5cb758 builtin rebase: support `--autostash` option @@ -11,6 +11,7 @@ builtin. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c @@ -57,7 +58,7 @@ + stash_apply.no_stderr = stash_apply.no_stdout = + stash_apply.no_stdin = 1; + if (!run_command(&stash_apply)) -+ printf("Applied autostash.\n"); ++ printf(_("Applied autostash.\n")); + else { + struct argv_array args = ARGV_ARRAY_INIT; + int res = 0; 12: 6f6b3d9339 ! 12: 01e5cb3e91 builtin rebase: support `--exec` @@ -14,6 +14,7 @@ The `--exec` option requires `--interactive` machinery. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 13: fa643c4b3f ! 13: 1c723ad592 builtin rebase: support `--allow-empty-message` option @@ -14,6 +14,7 @@ `git rebase`, therefore the builtin rebase does the same. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 14: 00d7ccd356 ! 14: 1bebcde41c builtin rebase: support --rebase-merges[=[no-]rebase-cousins] @@ -6,6 +6,7 @@ rebase, too. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 15: 1cf16f416e ! 15: 05652bccfe merge-base --fork-point: extract libified function @@ -12,6 +12,7 @@ process definitely did not traverse any commits before exiting. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/merge-base.c b/builtin/merge-base.c --- a/builtin/merge-base.c 16: 78ffb7aaff ! 16: 25f6771947 builtin rebase: support `fork-point` option @@ -6,6 +6,7 @@ This is converted as-is from `git-legacy-rebase.sh`. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 17: 693b662542 ! 17: 10dc87d4ff builtin rebase: add support for custom merge strategies @@ -9,6 +9,7 @@ This commit adds that support to the builtin rebase. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c 18: 95679ccf0b ! 18: f155141023 builtin rebase: support --root @@ -9,6 +9,7 @@ the fact that we do not have to write an empty tree in C. Signed-off-by: Pratik Karki <predatoramigo@xxxxxxxxx> + Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> diff --git a/builtin/rebase.c b/builtin/rebase.c --- a/builtin/rebase.c -- gitgitgadget