git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jardel Weyrich <jweyrich@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] Possible bug in `remote set-url --add --push`
Date: Fri, 11 Jan 2013 23:10:36 -0800	[thread overview]
Message-ID: <7vliby98r7.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAN8TAOsnX1Mr72LPa47KKXDeUZPgSHTJ6u4YpPFPrtsK7VdN+A@mail.gmail.com> (Jardel Weyrich's message of "Sat, 12 Jan 2013 03:44:25 -0200")

Jardel Weyrich <jweyrich@gmail.com> writes:

> I believe `remote set-url --add --push` has a bug. Performed tests
> with v1.8.0.1 and v1.8.1 (Mac OS X).
>
> Quoting the relevant part of the documentation:
>
>> set-url
>>     Changes URL remote points to. Sets first URL remote points to matching regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If <oldurl> doesn’t match any URL, error occurs and nothing is changed.
>>
>>     With --push, push URLs are manipulated instead of fetch URLs.
>>     With --add, instead of changing some URL, new URL is added.
>>     With --delete, instead of changing some URL, all URLs matching regex <url> are deleted. Trying to delete all non-push URLs is an error.
>
> Here are some steps to reproduce:
>
> 1. Show the remote URLs
>
> jweyrich@pharao:test_clone1 [* master]$ git remote -v
> origin  /Volumes/sandbox/test (fetch)
> origin  /Volumes/sandbox/test (push)
>
> 2. Add a new push URL for origin
>
> jweyrich@pharao:test_clone1 [* master]$ git remote set-url --add --push origin \
>     /Volumes/sandbox/test_clone2
>
> 3. Check what happened
>
> jweyrich@pharao:test_clone1 [* master]$ git remote -v
> origin  /Volumes/sandbox/test (fetch)
> origin  /Volumes/sandbox/test_clone2 (push)

The original pushurl was replaced with the additional one, instead
of being left and the new one getting added.  That looks certainly
wrong.

However, the result of applying the attached patch (either to
v1.7.12 or v1.8.1) still passes the test and I do not think it is
doing anything differently from what you described above.

What do you get from

	git config -l | grep '^remote\.origin'

in steps 1. and 3. in your procedure?  This question is trying to
tell if your bug is in "git remote -v" or in "git remote set-url".

-- >8 --
From 0f6cbc67db926e97707ae732b02e790b4604508e Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Fri, 11 Jan 2013 23:04:16 -0800
Subject: [PATCH] t5505: adding one pushurl from jweyrich

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t5505-remote.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index c03ffdd..b31c5bb 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -901,6 +901,25 @@ test_expect_success 'remote set-url --push --add aaa' '
 	cmp expect actual
 '
 
+test_expect_success 'remote set-url --push --add' '
+	git config remote.jweyrich.url /Volumes/sandbox/test &&
+	git config remote.jweyrich.pushurl /Volumes/sandbox/test &&
+	git config remote.jweyrich.fetch "refs/heads/*:refs/remotes/jweyrich/*" &&
+
+	added=/Volumes/sandbox/test_clone2 &&
+	{
+		git config -l | grep "^remote\.jweyrich\." &&
+		echo "remote.jweyrich.pushurl=$added"
+	} | sort >expect &&
+
+	git remote set-url --add --push jweyrich "$added" &&
+	git config -l | grep "^remote\.jweyrich\." | sort >actual &&
+
+	test_cmp expect actual &&
+
+	git remote -v | grep "^jweyrich" # this is just for debugging
+'
+
 test_expect_success 'remote set-url --push bar aaa' '
 	git remote set-url --push someremote bar aaa &&
 	echo foo >expect &&
-- 
1.8.1.421.g6236851

  reply	other threads:[~2013-01-12  7:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-12  5:44 [BUG] Possible bug in `remote set-url --add --push` Jardel Weyrich
2013-01-12  7:10 ` Junio C Hamano [this message]
2013-01-12  8:09   ` Jardel Weyrich
2013-01-12  8:23     ` Junio C Hamano
2013-01-12  8:44   ` Sascha Cunz
2013-01-12  9:33     ` Jardel Weyrich
2013-01-14 13:07       ` Michael J Gruber
2013-01-14 16:41         ` Jonathan Nieder
2013-01-14 19:09         ` Junio C Hamano
2013-01-15  5:20           ` Jardel Weyrich
2013-01-15  6:22             ` Junio C Hamano
2013-01-15  6:39               ` Junio C Hamano
2013-01-15  9:44                 ` Michael J Gruber
2013-01-15 15:53                   ` Junio C Hamano
2013-01-16  8:46                     ` Michael J Gruber
2013-01-16 15:50                       ` Junio C Hamano
2013-01-16 16:19                         ` Michael J Gruber
2013-01-16 19:30                         ` Andreas Schwab
2013-01-16 20:01                           ` Junio C Hamano
2013-01-16 10:14                     ` [PATCH] git-remote: distinguish between default and configured URLs Michael J Gruber
2013-01-16 10:27                       ` Michael J Gruber
2013-01-16 10:42                       ` John Keeping
2013-01-16 12:45                         ` Michael J Gruber
2013-01-16 13:04                           ` John Keeping
2013-01-16 19:19                           ` Junio C Hamano
2013-01-16 16:15                     ` [BUG] Possible bug in `remote set-url --add --push` Phil Hord
2013-01-16 16:24                       ` Michael J Gruber

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vliby98r7.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jweyrich@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).