Teach git-remote to list pushed branches.
The configured refspecs are printed almost verbatim, i.e. both the local and the remote branch name separated by a colon are printed; only the prefix 'refs/heads/' is removed, like this: Local branch(es) pushed with 'git push' master refs/tags/*:refs/tags/* next:next Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Sixt committed
Mar 18, 2007 at 21:34 UTC
8bf0e3d15d3d327ae16d8eaa56374492d03a7b88
1 file changed
+15
-1
git-remote.perl
+15
-1
@@ -15,6 +15,10 @@ sub add_remote_config {
15
$hash->{$name}{'FETCH'} ||= [];
16
push @{$hash->{$name}{'FETCH'}}, $value;
17
}
18
+ elsif ($what eq 'push') {
19
+ $hash->{$name}{'PUSH'} ||= [];
20
+ push @{$hash->{$name}{'PUSH'}}, $value;
21
+ }
22
if (!exists $hash->{$name}{'SOURCE'}) {
23
$hash->{$name}{'SOURCE'} = 'config';
24
}
@@ -44,7 +48,8 @@ sub add_remote_remotes {
48
}
49
}
50
elsif (/^Push:\s*(.*)$/) {
47
- ; # later
51
+ $it->{'PUSH'} ||= [];
52
+ push @{$it->{'PUSH'}}, $1;
53
}
54
elsif (/^Pull:\s*(.*)$/) {
55
$it->{'FETCH'} ||= [];
@@ -250,6 +255,15 @@ sub show_remote {
255
if ($info->{'LS_REMOTE'}) {
256
show_mapping($name, $info);
257
}
258
+ if ($info->{'PUSH'}) {
259
+ my @pushed = map {
260
+ s|^refs/heads/||;
261
+ s|:refs/heads/|:|;
262
+ $_;
263
+ } @{$info->{'PUSH'}};
264
+ print " Local branch(es) pushed with 'git push'\n";
265
+ print " @pushed\n";
266
+ }
267
}
268
269
sub add_remote {