{"thread":{"id":"7298","subject":"[PATCH] Teach git-remote to list pushed branches.","startedAt":"2007-03-18T20:34:46Z","lastAt":"2007-03-21T03:03:58Z","messageCount":6,"participants":["Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"37397","messageId":"200703182134.46450.johannes.sixt@telecom.at","threadId":"7298","inReplyTo":null,"subject":"[PATCH] Teach git-remote to list pushed branches.","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2007-03-18T20:34:46Z","receivedAt":"2007-03-18T20:34:46Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"The configured refspecs are printed almost verbatim, i.e. both the local\nand the remote branch name separated by a colon are printed; only the\nprefix 'refs/heads/' is removed, like this:\n\n  Local branch(es) pushed with 'git push'\n    master refs/tags/*:refs/tags/* next:next\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n [Resent; I don't see the patch applied nor were there any comments.]\n\n The hunk that reads the 'Push'es from the .git/remotes file is taken\n almost verbatim from the corresponding 'Pull' clause and is untested.\n\n -- Hannes\n\n git-remote.perl |   16 +++++++++++++++-\n 1 files changed, 15 insertions(+), 1 deletions(-)\n\ndiff --git a/git-remote.perl b/git-remote.perl\nindex bd70bf1..52013fe 100755\n--- a/git-remote.perl\n+++ b/git-remote.perl\n@@ -15,6 +15,10 @@ sub add_remote_config {\n \t\t$hash->{$name}{'FETCH'} ||= [];\n \t\tpush @{$hash->{$name}{'FETCH'}}, $value;\n \t}\n+\telsif ($what eq 'push') {\n+\t\t$hash->{$name}{'PUSH'} ||= [];\n+\t\tpush @{$hash->{$name}{'PUSH'}}, $value;\n+\t}\n \tif (!exists $hash->{$name}{'SOURCE'}) {\n \t\t$hash->{$name}{'SOURCE'} = 'config';\n \t}\n@@ -44,7 +48,8 @@ sub add_remote_remotes {\n \t\t\t}\n \t\t}\n \t\telsif (/^Push:\\s*(.*)$/) {\n-\t\t\t; # later\n+\t\t\t$it->{'PUSH'} ||= [];\n+\t\t\tpush @{$it->{'PUSH'}}, $1;\n \t\t}\n \t\telsif (/^Pull:\\s*(.*)$/) {\n \t\t\t$it->{'FETCH'} ||= [];\n@@ -250,6 +255,15 @@ sub show_remote {\n \tif ($info->{'LS_REMOTE'}) {\n \t\tshow_mapping($name, $info);\n \t}\n+\tif ($info->{'PUSH'}) {\n+\t\tmy @pushed = map {\n+\t\t\ts|^refs/heads/||;\n+\t\t\ts|:refs/heads/|:|;\n+\t\t\t$_;\n+\t\t} @{$info->{'PUSH'}};\n+\t\tprint \"  Local branch(es) pushed with 'git push'\\n\";\n+\t\tprint \"    @pushed\\n\";\n+\t}\n }\n \n sub add_remote {\n-- \n1.5.0.3.438.gc49b2\n"},{"id":"37398","messageId":"7vzm6ajnj1.fsf@assigned-by-dhcp.cox.net","threadId":"7298","inReplyTo":"200703182134.46450.johannes.sixt@telecom.at","subject":"Re: [PATCH] Teach git-remote to list pushed branches.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-18T20:37:54Z","receivedAt":"2007-03-18T20:37:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <johannes.sixt@telecom.at> writes:\n\n> The configured refspecs are printed almost verbatim, i.e. both the local\n> and the remote branch name separated by a colon are printed; only the\n> prefix 'refs/heads/' is removed, like this:\n>\n>   Local branch(es) pushed with 'git push'\n>     master refs/tags/*:refs/tags/* next:next\n>\n> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n> ---\n>  [Resent; I don't see the patch applied nor were there any comments.]\n>\n>  The hunk that reads the 'Push'es from the .git/remotes file is taken\n>  almost verbatim from the corresponding 'Pull' clause and is untested.\n\nMaybe while waiting for application nor comments you could have\ntested and removed that comment?\n"},{"id":"37534","messageId":"200703192016.46894.johannes.sixt@telecom.at","threadId":"7298","inReplyTo":"7vzm6ajnj1.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Teach git-remote to list pushed branches.","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2007-03-19T19:16:46Z","receivedAt":"2007-03-19T19:16:46Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Sunday 18 March 2007 21:37, Junio C Hamano wrote:\n> Johannes Sixt <johannes.sixt@telecom.at> writes:\n> >  The hunk that reads the 'Push'es from the .git/remotes file is taken\n> >  almost verbatim from the corresponding 'Pull' clause and is untested.\n>\n> Maybe while waiting for application nor comments you could have\n> tested and removed that comment?\n\nFair enough ;)\n\nWhile waiting for application or comments again, I did test now, and the patch \ndoes what I expect even for .git/remotes files, that is, it prints the refs \nto be pushed just like it does for remotes noted in the config file.\n\n-- Hannes\n"},{"id":"37555","messageId":"7v648wg8sy.fsf@assigned-by-dhcp.cox.net","threadId":"7298","inReplyTo":"200703192016.46894.johannes.sixt@telecom.at","subject":"Re: [PATCH] Teach git-remote to list pushed branches.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-19T22:36:29Z","receivedAt":"2007-03-19T22:36:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <johannes.sixt@telecom.at> writes:\n\n> On Sunday 18 March 2007 21:37, Junio C Hamano wrote:\n>> Johannes Sixt <johannes.sixt@telecom.at> writes:\n>> >  The hunk that reads the 'Push'es from the .git/remotes file is taken\n>> >  almost verbatim from the corresponding 'Pull' clause and is untested.\n>>\n>> Maybe while waiting for application nor comments you could have\n>> tested and removed that comment?\n>\n> Fair enough ;)\n>\n> While waiting for application or comments again, I did test\n> now, and the patch does what I expect even for .git/remotes\n> files, that is, it prints the refs to be pushed just like it\n> does for remotes noted in the config file.\n\nThanks, and sorry for that comment as I was in a grumpy mood.\n\nLet's queue it in 'next', as I do not see anything obviously\nwrong with it [*1*].\n\nNow let's find other people who find this new feature\ndesirable.  I am personally neutral right now.\n\n\n[Footnote]\n\n*1* Actually I think the refspec list on \"Push: \" lines should\nbe split out into separate array elements, because\n\n\tPush: A B C\n\nis equivalent to\n\n\tPush: A\n        Push: B\n        Push: C\n\nThis does not apply to \"Pull: \" lines, as\n\n\tPull: A B C\n\nand\n\n\tPull: A\n\tPull: B\n\tPull: C\n\nmean quite different things.\n\nThis distinction does not matter to the current callers, but I\nwas hoping that somebody would build \"interactive\" mode to edit\nPush and Pull list, and when that happens, having A B C as\nseparate entries in @{$hash->{$name}{'PUSH'}} would be handier\nto code.\n"},{"id":"37644","messageId":"200703210027.32307.johannes.sixt@telecom.at","threadId":"7298","inReplyTo":"7v648wg8sy.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Teach git-remote to list pushed branches.","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2007-03-20T23:27:32Z","receivedAt":"2007-03-20T23:27:32Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Monday 19 March 2007 23:36, Junio C Hamano wrote:\n> *1* Actually I think the refspec list on \"Push: \" lines should\n> be split out into separate array elements, because\n>\n> \tPush: A B C\n>\n> is equivalent to\n>\n> \tPush: A\n>         Push: B\n>         Push: C\n>\n> This does not apply to \"Pull: \" lines, as\n>\n> \tPull: A B C\n>\n> and\n>\n> \tPull: A\n> \tPull: B\n> \tPull: C\n>\n> mean quite different things.\n>\n> This distinction does not matter to the current callers, but I\n> was hoping that somebody would build \"interactive\" mode to edit\n> Push and Pull list, and when that happens, having A B C as\n> separate entries in @{$hash->{$name}{'PUSH'}} would be handier\n> to code.\n\nThe patch does just that, I think. It is only that everything is *printed* on \none line, just like the tracked branches.\n\nBTW, the .git/remotes parser does not allow multiple refspecs on one 'Push:' \nline, if I understand it correctly (I'm looking at get_remotes_uri in \nbuiltin-push.c).\n\n-- Hannes\n"},{"id":"37655","messageId":"7v1wjj70wx.fsf@assigned-by-dhcp.cox.net","threadId":"7298","inReplyTo":"200703210027.32307.johannes.sixt@telecom.at","subject":"Re: [PATCH] Teach git-remote to list pushed branches.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-21T03:03:58Z","receivedAt":"2007-03-21T03:03:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <johannes.sixt@telecom.at> writes:\n\n> BTW, the .git/remotes parser does not allow multiple refspecs on one 'Push:' \n> line, if I understand it correctly (I'm looking at get_remotes_uri in \n> builtin-push.c).\n\nSheesh, you are right.  That is a regression introduced, when\ngit-push was rewritten as a built-in, and I did not know about\nit until now.\n"}]}