From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 1/1] pull --rebase=<type>: allow single-letter abbreviations for the type
Date: Tue, 07 Aug 2018 21:28:42 +0200 [thread overview]
Message-ID: <87sh3qrn6d.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <d2ba1e6bef9d6d4eabc8eaa60435dcae1105fd07.1533410586.git.gitgitgadget@gmail.com>
On Sat, Aug 04 2018, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> Git for Windows' original 4aa8b8c8283 (Teach 'git pull' to handle
> --rebase=interactive, 2011-10-21) had support for the very convenient
> abbreviation
>
> git pull --rebase=i
>
> which was later lost when it was ported to the builtin `git pull`, and
> it was not introduced before the patch eventually made it into Git as
> f5eb87b98dd (pull: allow interactive rebase with --rebase=interactive,
> 2016-01-13).
>
> However, it is *really* a useful short hand for the occasional rebasing
> pull on branches that do not usually want to be rebased.
>
> So let's reintroduce this convenience, at long last.
I agree with the shorthand, but I really think this should be
documented. The amount of people who'll discover this by reading the
code is much smaller than those who might discover it via the docs.
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> builtin/pull.c | 6 +++---
> t/t5520-pull.sh | 12 ++++++++++++
> 2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/pull.c b/builtin/pull.c
> index 4e7893539..53bc5facf 100644
> --- a/builtin/pull.c
> +++ b/builtin/pull.c
> @@ -48,11 +48,11 @@ static enum rebase_type parse_config_rebase(const char *key, const char *value,
> return REBASE_FALSE;
> else if (v > 0)
> return REBASE_TRUE;
> - else if (!strcmp(value, "preserve"))
> + else if (!strcmp(value, "preserve") || !strcmp(value, "p"))
> return REBASE_PRESERVE;
> - else if (!strcmp(value, "merges"))
> + else if (!strcmp(value, "merges") || !strcmp(value, "m"))
> return REBASE_MERGES;
> - else if (!strcmp(value, "interactive"))
> + else if (!strcmp(value, "interactive") || !strcmp(value, "i"))
> return REBASE_INTERACTIVE;
Here 3 special cases are added...
> if (fatal)
> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
> index 68aa5f034..5e501c8b0 100755
> --- a/t/t5520-pull.sh
> +++ b/t/t5520-pull.sh
> @@ -475,10 +475,22 @@ test_expect_success 'pull.rebase=interactive' '
> false
> EOF
> test_set_editor "$TRASH_DIRECTORY/fake-editor" &&
> + test_when_finished "test_might_fail git rebase --abort" &&
> test_must_fail git pull --rebase=interactive . copy &&
> test "I was here" = "$(cat fake.out)"
> '
>
> +test_expect_success 'pull --rebase=i' '
> + write_script "$TRASH_DIRECTORY/fake-editor" <<-\EOF &&
> + echo I was here, too >fake.out &&
> + false
> + EOF
> + test_set_editor "$TRASH_DIRECTORY/fake-editor" &&
> + test_when_finished "test_might_fail git rebase --abort" &&
> + test_must_fail git pull --rebase=i . copy &&
> + test "I was here, too" = "$(cat fake.out)"
> +'
> +
> test_expect_success 'pull.rebase=invalid fails' '
> git reset --hard before-preserve-rebase &&
> test_config pull.rebase invalid &&
...but this test is only for 1/3. I haven't run this, but it looks like
the tests will still pass if we remove --rebase=p and --rebase=m.
next prev parent reply other threads:[~2018-08-07 19:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-04 19:23 [PATCH 0/1] Support git pull --rebase=i <remote> <branch> Johannes Schindelin via GitGitGadget
2018-08-04 19:23 ` [PATCH 1/1] pull --rebase=<type>: allow single-letter abbreviations for the type Johannes Schindelin via GitGitGadget
2018-08-06 19:59 ` Junio C Hamano
2018-08-07 12:02 ` Johannes Schindelin
2018-08-07 19:28 ` Ævar Arnfjörð Bjarmason [this message]
2018-08-08 19:51 ` Junio C Hamano
2018-08-08 22:19 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sh3qrn6d.fsf@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.