All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Thomas Gummerer <t.gummerer@gmail.com>
Cc: Git List <git@vger.kernel.org>, Jeff King <peff@peff.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 4/4] remote: use remote_is_configured() for add and rename
Date: Mon, 15 Feb 2016 17:52:14 -0500	[thread overview]
Message-ID: <CAPig+cTH+S67_T=O58E_x--ZhawQEZKjCmK8G+unzm_8f2w8eA@mail.gmail.com> (raw)
In-Reply-To: <1455575984-24348-5-git-send-email-t.gummerer@gmail.com>

On Mon, Feb 15, 2016 at 5:39 PM, Thomas Gummerer <t.gummerer@gmail.com> wrote:
> Both remote add and remote rename use a slightly different hand-rolled
> check if the remote exits.  The hand-rolled check may have some subtle
> cases in which it might fail to detect when a remote already exists.
> One such case was fixed in fb86e32 ("git remote: allow adding remotes
> agreeing with url.<...>.insteadOf").  Another case is when a remote is
> configured as follows:
> [...]
> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
> ---
> diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
> @@ -157,6 +157,24 @@ test_expect_success 'rename errors out early when deleting non-existent branch'
> +test_expect_success 'add existing foreign_vcs remote' '
> +       git config --add remote.foo.vcs "bar" &&
> +       git config --add remote.bar.vcs "bar" &&
> +       test_when_finished git remote rm foo &&
> +       test_when_finished git remote rm bar &&

Nit: If the second git-config fails, then none of the cleanup will
happen. You'd either want to re-order them like this:

    git config --add remote.foo.vcs "bar" &&
    test_when_finished git remote rm foo &&
    git config --add remote.bar.vcs "bar" &&
    test_when_finished git remote rm bar &&

or this:

    test_when_finished git remote rm foo &&
    git config --add remote.foo.vcs "bar" &&
    test_when_finished git remote rm bar &&
    git config --add remote.bar.vcs "bar" &&

or this:

    test_when_finished git remote rm foo &&
    test_when_finished git remote rm bar &&
    git config --add remote.foo.vcs "bar" &&
    git config --add remote.bar.vcs "bar" &&

Probably not worth a re-roll, though.

> +       echo "fatal: remote bar already exists." >expect &&
> +       test_must_fail git remote rename foo bar 2>actual &&
> +       test_i18ncmp expect actual
> +'

  reply	other threads:[~2016-02-15 22:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 22:39 [PATCH v2 0/4] git remote improvements Thomas Gummerer
2016-02-15 22:39 ` [PATCH v2 1/4] remote: use parse_config_key Thomas Gummerer
2016-02-15 23:04   ` Jeff King
2016-02-16  0:13     ` Thomas Gummerer
2016-02-15 22:39 ` [PATCH v2 2/4] remote: simplify remote_is_configured() Thomas Gummerer
2016-02-15 22:39 ` [PATCH v2 3/4] remote: actually check if remote exits Thomas Gummerer
2016-02-15 22:39 ` [PATCH v2 4/4] remote: use remote_is_configured() for add and rename Thomas Gummerer
2016-02-15 22:52   ` Eric Sunshine [this message]
2016-02-15 23:09     ` Jeff King
2016-02-16  0:16       ` Thomas Gummerer
2016-02-16  9:47 ` [PATCH v3 0/4] git remote improvements Thomas Gummerer
2016-02-16  9:47   ` [PATCH v3 1/4] remote: use parse_config_key Thomas Gummerer
2016-02-16  9:47   ` [PATCH v3 2/4] remote: simplify remote_is_configured() Thomas Gummerer
2016-02-16  9:47   ` [PATCH v3 3/4] remote: actually check if remote exits Thomas Gummerer
2016-02-16  9:47   ` [PATCH v3 4/4] remote: use remote_is_configured() for add and rename Thomas Gummerer
2016-02-16 15:52   ` [PATCH v3 0/4] git remote improvements Jeff King
2016-02-16 21:36   ` 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='CAPig+cTH+S67_T=O58E_x--ZhawQEZKjCmK8G+unzm_8f2w8eA@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=t.gummerer@gmail.com \
    /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.