git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
To: git@vger.kernel.org, Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Subject: [PATCHv2 3/2] remote rename: warn when refspec was not updated
Date: Sat,  3 Sep 2011 11:26:59 -0400	[thread overview]
Message-ID: <1315063619-6072-1-git-send-email-martin.von.zweigbergk@gmail.com> (raw)
In-Reply-To: <20110902160333.GB19690@sigill.intra.peff.net>

When renaming a remote, we also try to update the fetch refspec
accordingly, but only if it has the default format. For others, such
as refs/heads/master:refs/heads/origin, we are conservative and leave
it untouched. Let's give the user a warning about refspecs that are
not updated, so he can manually update the config if necessary.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
---

This addresses the first part of your email. I'm not sure what should
happen when only some refspecs can be updated. I can't think of any
sensible examples with mixed default and non-default refspecs, so for
me it's hard to see whether we would make things better or worse by
making it all-or-nothing. I have more or less always used the default
ones myself. Do you have any good examples?

 builtin/remote.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/builtin/remote.c b/builtin/remote.c
index 0df6ab0..61326cb 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -672,6 +672,12 @@ static int mv(int argc, const char **argv)
 				      ptr-buf2.buf + strlen(":refs/remotes/"),
 				      strlen(rename.old), rename.new,
 				      strlen(rename.new));
+		else
+			warning("Not updating non-default fetch respec\n"
+				"\t%s\n"
+				"\tPlease update the configuration manually if necessary.",
+				buf2.buf);
+
 		if (git_config_set_multivar(buf.buf, buf2.buf, "^$", 0))
 			return error("Could not append '%s'", buf.buf);
 	}
-- 
1.7.6.51.g07e0e

  reply	other threads:[~2011-09-03 15:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02  0:50 [PATCHv2 1/2] remote: write correct fetch spec when renaming remote 'remote' Martin von Zweigbergk
2011-09-02  0:50 ` [PATCHv2 2/2] remote: "rename o foo" should not rename ref "origin/bar" Martin von Zweigbergk
2011-09-02 16:03 ` [PATCHv2 1/2] remote: write correct fetch spec when renaming remote 'remote' Jeff King
2011-09-03 15:26   ` Martin von Zweigbergk [this message]
2011-09-06 22:58 ` Junio C Hamano
2011-09-08  1:40   ` Martin von Zweigbergk
2011-09-08  3:43     ` Junio C Hamano
2011-09-08  9:08       ` Martin von Zweigbergk
2011-09-08 16:46         ` Junio C Hamano
2011-09-10 19:39           ` [PATCH 4/2] remote: only update remote-tracking branch if updating refspec Martin von Zweigbergk

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=1315063619-6072-1-git-send-email-martin.von.zweigbergk@gmail.com \
    --to=martin.von.zweigbergk@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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 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 NNTP newsgroup(s).