{"thread":{"id":"22950","subject":"git push --no-mirror ?","startedAt":"2010-03-08T12:34:23Z","lastAt":"2010-03-09T12:04:28Z","messageCount":3,"participants":["SZEDER Gábor","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"136387","messageId":"20100308123423.GA20486@neumann","threadId":"22950","inReplyTo":null,"subject":"git push --no-mirror ?","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2010-03-08T12:34:23Z","receivedAt":"2010-03-08T12:34:23Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\n\nI have a remote that I use mainly for backup with 'mirror = true' in\ngitconfig, but also for sharing my \"bleeding-edge\" code with a\nstudent.  Now I came across the situation where I would liked to push\nonly a single branch to that repo, only to discover that 'git push'\nhas no '--no-mirror' option to override the related configuration\nsetting.  Removing the 'mirror = true' line from the config, doing the\npush, restoring the config did the trick, of course, but I think there\nshould be a simpler way to do that.  Is there a fundamental reason why\nthere is no 'push --no-mirror', or just noone has noticed/bothered\nbefore?\n\n\nThanks,\nGábor\n"},{"id":"136411","messageId":"7vzl2ipmhn.fsf@alter.siamese.dyndns.org","threadId":"22950","inReplyTo":"20100308123423.GA20486@neumann","subject":"Re: git push --no-mirror ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-08T20:49:40Z","receivedAt":"2010-03-08T20:49:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder@ira.uka.de> writes:\n\n> I have a remote that I use mainly for backup with 'mirror = true' in\n> gitconfig, but also for sharing my \"bleeding-edge\" code with a\n> student.  Now I came across the situation where I would liked to push\n> only a single branch to that repo, only to discover that 'git push'\n> has no '--no-mirror' option to override the related configuration\n> setting.  Removing the 'mirror = true' line from the config, doing the\n> push, restoring the config did the trick, of course, but I think there\n> should be a simpler way to do that.  Is there a fundamental reason why\n> there is no 'push --no-mirror', or just noone has noticed/bothered\n> before?\n\nI think that is the case.  How does this look (haven't thought it through\nnor even compile tested yet)?\n\n builtin-push.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-push.c b/builtin-push.c\nindex f7bc2b2..89df1ff 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -145,7 +145,7 @@ static int do_push(const char *repo, int flags)\n \t\tdie(\"No destination configured to push to.\");\n \t}\n \n-\tif (remote->mirror)\n+\tif (!refspec && remote->mirror)\n \t\tflags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);\n \n \tif ((flags & TRANSPORT_PUSH_ALL) && refspec) {\n"},{"id":"136444","messageId":"20100309120428.GE4748@neumann","threadId":"22950","inReplyTo":"7vzl2ipmhn.fsf@alter.siamese.dyndns.org","subject":"Re: git push --no-mirror ?","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2010-03-09T12:04:28Z","receivedAt":"2010-03-09T12:04:28Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\n\nOn Mon, Mar 08, 2010 at 12:49:40PM -0800, Junio C Hamano wrote:\n> SZEDER Gábor <szeder@ira.uka.de> writes:\n> \n> > I have a remote that I use mainly for backup with 'mirror = true' in\n> > gitconfig, but also for sharing my \"bleeding-edge\" code with a\n> > student.  Now I came across the situation where I would liked to push\n> > only a single branch to that repo, only to discover that 'git push'\n> > has no '--no-mirror' option to override the related configuration\n> > setting.  Removing the 'mirror = true' line from the config, doing the\n> > push, restoring the config did the trick, of course, but I think there\n> > should be a simpler way to do that.  Is there a fundamental reason why\n> > there is no 'push --no-mirror', or just noone has noticed/bothered\n> > before?\n> \n> I think that is the case.  How does this look (haven't thought it through\n> nor even compile tested yet)?\n> \n>  builtin-push.c |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> \n> diff --git a/builtin-push.c b/builtin-push.c\n> index f7bc2b2..89df1ff 100644\n> --- a/builtin-push.c\n> +++ b/builtin-push.c\n> @@ -145,7 +145,7 @@ static int do_push(const char *repo, int flags)\n>  \t\tdie(\"No destination configured to push to.\");\n>  \t}\n>  \n> -\tif (remote->mirror)\n> +\tif (!refspec && remote->mirror)\n>  \t\tflags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);\n>  \n>  \tif ((flags & TRANSPORT_PUSH_ALL) && refspec) {\n\nthanks, this DWIMery seems to work just fine (i.e. solves my problem\nand does not break any tests in the test suite).\n\n\nBest,\nGábor\n"}]}