{"thread":{"id":"7249","subject":"[PATCH] Teach git-remote to list pushed branches.","startedAt":"2007-03-14T20:56:00Z","lastAt":"2007-03-14T20:56:00Z","messageCount":1,"participants":["Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"37106","messageId":"200703142156.00678.johannes.sixt@telecom.at","threadId":"7249","inReplyTo":null,"subject":"[PATCH] Teach git-remote to list pushed branches.","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2007-03-14T20:56:00Z","receivedAt":"2007-03-14T20:56:00Z","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\nThe hunk that reads the 'Push'es from the .git/remotes file is taken\nalmost 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"}]}