Re: [PATCH 1/3] rebase: teach rebase --keep-base
On Sat, Mar 23, 2019 at 11:25 AM Denton Liu <liu.denton@gmail.com> wrote:>
Show 23 quoted lines
> [...]
> Since rebasing onto the merge base of the branch and the upstream is
> such a common case, introduce the --keep-base option as a shortcut.
> [...]
> Signed-off-by: Denton Liu <liu.denton@gmail.com>
> ---
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> @@ -1541,10 +1551,19 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
> /* Make sure the branch to rebase onto is valid. */
> - if (!options.onto_name)
> + if (keep_base) {
> + strbuf_reset(&buf);
> + strbuf_addstr(&buf, options.upstream_name);
> + strbuf_addstr(&buf, "...");
> + options.onto_name = xstrdup(buf.buf);
> + } else if (!options.onto_name)
> options.onto_name = options.upstream_name;
> if (strstr(options.onto_name, "...")) {
> if (get_oid_mb(options.onto_name, &merge_base) < 0)
> + if (keep_base)
> + die(_("'%s': need exactly one merge base with branch"),
> + options.upstream_name);
> + elseStyle: Indent with tabs, not spaces.