git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Dropping '+' from fetch = +refs/heads/*:refs/remotes/origin/*?
@ 2011-09-01 18:25 Junio C Hamano
  2011-09-01 18:39 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Junio C Hamano @ 2011-09-01 18:25 UTC (permalink / raw)
  To: git

Suggested reading:

  http://git-blame.blogspot.com/2011/08/how-to-inject-malicious-commit-to-git.html

I am wondering if we are better off applying something along the lines of
this patch, so that with the default configuration, users can notice if
their upstream unexpectedly rewound their branches.

It would produce

	[remote]
        	url = git://.../git.git/
                fetch = refs/heads/*:refs/remotes/origin/*

upon cloning from my repository, and your "git fetch" will fail because
the pu (proposed updates) branch is constantly unwinding, but that can be
easily fixed with


	[remote]
        	url = git://.../git.git/
                fetch = refs/heads/*:refs/remotes/origin/*
                fetch = +refs/heads/pu:refs/remotes/origin/pu

as the explicit refspec trumps the wildcard one.

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

diff --git a/builtin/remote.c b/builtin/remote.c
index f2a9c26..081fbbf 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -116,11 +116,11 @@ static int add_branch(const char *key, const char *branchname,
 		const char *remotename, int mirror, struct strbuf *tmp)
 {
 	strbuf_reset(tmp);
-	strbuf_addch(tmp, '+');
-	if (mirror)
+	if (mirror) {
+		strbuf_addch(tmp, '+');
 		strbuf_addf(tmp, "refs/%s:refs/%s",
 				branchname, branchname);
-	else
+	} else
 		strbuf_addf(tmp, "refs/heads/%s:refs/remotes/%s/%s",
 				branchname, remotename, branchname);
 	return git_config_set_multivar(key, tmp->buf, "^$", 0);

^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2011-09-07 22:43 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-01 18:25 Dropping '+' from fetch = +refs/heads/*:refs/remotes/origin/*? Junio C Hamano
2011-09-01 18:39 ` Junio C Hamano
2011-09-01 19:14   ` Shawn Pearce
2011-09-01 19:20 ` Michael J Gruber
2011-09-01 19:35   ` Matthieu Moy
2011-09-01 19:50     ` Shawn Pearce
2011-09-02  5:55       ` Matthieu Moy
2011-09-02  0:00 ` Jeff King
2011-09-02  7:00   ` Johannes Sixt
2011-09-02 15:26     ` Jeff King
2011-09-02  7:42   ` Michael J Gruber
2011-09-02 15:29     ` Jeff King
2011-09-02 16:14       ` Junio C Hamano
2011-09-02 16:25         ` Jeff King
2011-09-02 16:47           ` Junio C Hamano
2011-09-05 18:15           ` Shawn Pearce
2011-09-05 20:47             ` Jeff King
2011-09-05 20:53               ` Shawn Pearce
2011-09-05 20:57                 ` Jeff King
2011-09-05 21:14                   ` Shawn Pearce
2011-09-07 21:20                     ` [RFC/PATCH] fetch: bigger forced-update warnings Jeff King
2011-09-07 21:39                       ` Shawn Pearce
2011-09-07 21:53                       ` Junio C Hamano
2011-09-07 21:57                         ` Jeff King
2011-09-07 22:42                       ` Thomas Rast
2011-09-06  7:39             ` Dropping '+' from fetch = +refs/heads/*:refs/remotes/origin/*? Matthieu Moy
2011-09-06  7:51               ` Michael J Gruber

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).