All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Anastas Dancha <anapsix@random.io>, git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] remote: allow adding remote w same name as alias
Date: Tue, 16 Dec 2014 10:33:40 +0100	[thread overview]
Message-ID: <548FFC74.7080307@drmicha.warpmail.net> (raw)
In-Reply-To: <20141216021900.50095.24877@random.io>

Anastas Dancha schrieb am 16.12.2014 um 03:30:
> From f80bdf3272e7bdf790ee67fb94196a8aa139331f Mon Sep 17 00:00:00 2001
> From: Anastas Dancha <anapsix@random.io>
> Date: Mon, 15 Dec 2014 16:30:50 -0500
> Subject: [PATCH] remote: allow adding remote w same name as alias
> 
> When ~/.gitconfig contains an alias (i.e. myremote)
> and you are adding a new remote using the same name
> for remote, Git will refuse to add the remote with
> the same name as one of the aliases, even though the
> remote with such name is not setup for current repo.
> 
> $ git remote add myremote git@host.com:team/repo.git
> fatal: remote myremote already exists.
> 
> The fatal error comes from strcmp(name, remote->url[0])
> condition, which compares a name of the new remote with
> existing urls of all the remotes, including the ones
> from ~/.gitconfig (or global variant).
> I'm not sure why that is necessary, unless Git is meant
> to prevent users from naming their remotes as their
> remote aliases..
> Imho, if someone want's to git remote add myremote
> myremote, they should, since git-remote always takes
> 2 arguments, first being the new remote's name and
> second being new remote's url (or alias, if set).

While that is true for "git remote", it is wrong for "git push" and the
like, which takes "remote name or remote URL" as a parameter. Therefore,
remote names and remote aliases need to be unique within the same namespace.

> Thanks to @mymuss for sanity check and debugging.
> 
> Signed-off-by: Anastas Dancha <anapsix@random.io>
> ---
>  builtin/remote.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

  parent reply	other threads:[~2014-12-16  9:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16  2:30 [PATCH] remote: allow adding remote w same name as alias Anastas Dancha
2014-12-16  9:01 ` Johannes Schindelin
2014-12-16 14:57   ` Anastas Dancha
2014-12-19  9:37     ` Johannes Schindelin
2014-12-19 15:44       ` Anastas Dancha
2014-12-19 16:30         ` Michael J Gruber
2014-12-20 20:57           ` Anastas Dancha
2014-12-21 20:40         ` Johannes Schindelin
2014-12-16  9:33 ` Michael J Gruber [this message]
2014-12-22 17:06 ` [PATCH 0/2] Let `git remote add` play nicer with url.<url>.insteadOf Johannes Schindelin
2014-12-22 17:06   ` [PATCH 1/2] git remote add: allow re-adding remotes with the same URL Johannes Schindelin
2014-12-22 17:49     ` Junio C Hamano
2014-12-23 13:25       ` Johannes Schindelin
     [not found]         ` <CAPc5daXcXs+Sw8jr65dmLnpf6LQ6Lr34y80bxSf2AhhFyXa_mQ@mail.gmail.com>
2014-12-23 18:26           ` Johannes Schindelin
2014-12-23 18:51             ` Junio C Hamano
2014-12-22 17:06   ` [PATCH 2/2] Add a regression test for 'git remote add <existing> <same-url>' Johannes Schindelin
2014-12-23 13:24 ` [PATCH v2 0/2] Let `git remote add` play nicer with url.<url>.insteadOf Johannes Schindelin
2014-12-23 13:25   ` [PATCH v2 1/2] git remote: allow adding remotes agreeing with url.<...>.insteadOf Johannes Schindelin
2014-12-23 13:25   ` [PATCH v2 2/2] Add a regression test for 'git remote add <existing> <same-url>' Johannes Schindelin

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=548FFC74.7080307@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=anapsix@random.io \
    --cc=git@vger.kernel.org \
    --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.