All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Teach git-remote to list pushed branches.
@ 2007-03-18 20:34 Johannes Sixt
  2007-03-18 20:37 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Sixt @ 2007-03-18 20:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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>
---
 [Resent; I don't see the patch applied nor were there any comments.]

 The hunk that reads the 'Push'es from the .git/remotes file is taken
 almost verbatim from the corresponding 'Pull' clause and is untested.

 -- Hannes

 git-remote.perl |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/git-remote.perl b/git-remote.perl
index bd70bf1..52013fe 100755
--- a/git-remote.perl
+++ b/git-remote.perl
@@ -15,6 +15,10 @@ sub add_remote_config {
 		$hash->{$name}{'FETCH'} ||= [];
 		push @{$hash->{$name}{'FETCH'}}, $value;
 	}
+	elsif ($what eq 'push') {
+		$hash->{$name}{'PUSH'} ||= [];
+		push @{$hash->{$name}{'PUSH'}}, $value;
+	}
 	if (!exists $hash->{$name}{'SOURCE'}) {
 		$hash->{$name}{'SOURCE'} = 'config';
 	}
@@ -44,7 +48,8 @@ sub add_remote_remotes {
 			}
 		}
 		elsif (/^Push:\s*(.*)$/) {
-			; # later
+			$it->{'PUSH'} ||= [];
+			push @{$it->{'PUSH'}}, $1;
 		}
 		elsif (/^Pull:\s*(.*)$/) {
 			$it->{'FETCH'} ||= [];
@@ -250,6 +255,15 @@ sub show_remote {
 	if ($info->{'LS_REMOTE'}) {
 		show_mapping($name, $info);
 	}
+	if ($info->{'PUSH'}) {
+		my @pushed = map {
+			s|^refs/heads/||;
+			s|:refs/heads/|:|;
+			$_;
+		} @{$info->{'PUSH'}};
+		print "  Local branch(es) pushed with 'git push'\n";
+		print "    @pushed\n";
+	}
 }
 
 sub add_remote {
-- 
1.5.0.3.438.gc49b2

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

* Re: [PATCH] Teach git-remote to list pushed branches.
  2007-03-18 20:34 [PATCH] Teach git-remote to list pushed branches Johannes Sixt
@ 2007-03-18 20:37 ` Junio C Hamano
  2007-03-19 19:16   ` Johannes Sixt
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-03-18 20:37 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Johannes Sixt <johannes.sixt@telecom.at> writes:

> 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>
> ---
>  [Resent; I don't see the patch applied nor were there any comments.]
>
>  The hunk that reads the 'Push'es from the .git/remotes file is taken
>  almost verbatim from the corresponding 'Pull' clause and is untested.

Maybe while waiting for application nor comments you could have
tested and removed that comment?

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

* Re: [PATCH] Teach git-remote to list pushed branches.
  2007-03-18 20:37 ` Junio C Hamano
@ 2007-03-19 19:16   ` Johannes Sixt
  2007-03-19 22:36     ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Sixt @ 2007-03-19 19:16 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

On Sunday 18 March 2007 21:37, Junio C Hamano wrote:
> Johannes Sixt <johannes.sixt@telecom.at> writes:
> >  The hunk that reads the 'Push'es from the .git/remotes file is taken
> >  almost verbatim from the corresponding 'Pull' clause and is untested.
>
> Maybe while waiting for application nor comments you could have
> tested and removed that comment?

Fair enough ;)

While waiting for application or comments again, I did test now, and the patch 
does what I expect even for .git/remotes files, that is, it prints the refs 
to be pushed just like it does for remotes noted in the config file.

-- Hannes

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

* Re: [PATCH] Teach git-remote to list pushed branches.
  2007-03-19 19:16   ` Johannes Sixt
@ 2007-03-19 22:36     ` Junio C Hamano
  2007-03-20 23:27       ` Johannes Sixt
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-03-19 22:36 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Johannes Sixt <johannes.sixt@telecom.at> writes:

> On Sunday 18 March 2007 21:37, Junio C Hamano wrote:
>> Johannes Sixt <johannes.sixt@telecom.at> writes:
>> >  The hunk that reads the 'Push'es from the .git/remotes file is taken
>> >  almost verbatim from the corresponding 'Pull' clause and is untested.
>>
>> Maybe while waiting for application nor comments you could have
>> tested and removed that comment?
>
> Fair enough ;)
>
> While waiting for application or comments again, I did test
> now, and the patch does what I expect even for .git/remotes
> files, that is, it prints the refs to be pushed just like it
> does for remotes noted in the config file.

Thanks, and sorry for that comment as I was in a grumpy mood.

Let's queue it in 'next', as I do not see anything obviously
wrong with it [*1*].

Now let's find other people who find this new feature
desirable.  I am personally neutral right now.


[Footnote]

*1* Actually I think the refspec list on "Push: " lines should
be split out into separate array elements, because

	Push: A B C

is equivalent to

	Push: A
        Push: B
        Push: C

This does not apply to "Pull: " lines, as

	Pull: A B C

and

	Pull: A
	Pull: B
	Pull: C

mean quite different things.

This distinction does not matter to the current callers, but I
was hoping that somebody would build "interactive" mode to edit
Push and Pull list, and when that happens, having A B C as
separate entries in @{$hash->{$name}{'PUSH'}} would be handier
to code.

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

* Re: [PATCH] Teach git-remote to list pushed branches.
  2007-03-19 22:36     ` Junio C Hamano
@ 2007-03-20 23:27       ` Johannes Sixt
  2007-03-21  3:03         ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Sixt @ 2007-03-20 23:27 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

On Monday 19 March 2007 23:36, Junio C Hamano wrote:
> *1* Actually I think the refspec list on "Push: " lines should
> be split out into separate array elements, because
>
> 	Push: A B C
>
> is equivalent to
>
> 	Push: A
>         Push: B
>         Push: C
>
> This does not apply to "Pull: " lines, as
>
> 	Pull: A B C
>
> and
>
> 	Pull: A
> 	Pull: B
> 	Pull: C
>
> mean quite different things.
>
> This distinction does not matter to the current callers, but I
> was hoping that somebody would build "interactive" mode to edit
> Push and Pull list, and when that happens, having A B C as
> separate entries in @{$hash->{$name}{'PUSH'}} would be handier
> to code.

The patch does just that, I think. It is only that everything is *printed* on 
one line, just like the tracked branches.

BTW, the .git/remotes parser does not allow multiple refspecs on one 'Push:' 
line, if I understand it correctly (I'm looking at get_remotes_uri in 
builtin-push.c).

-- Hannes

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

* Re: [PATCH] Teach git-remote to list pushed branches.
  2007-03-20 23:27       ` Johannes Sixt
@ 2007-03-21  3:03         ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2007-03-21  3:03 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Johannes Sixt <johannes.sixt@telecom.at> writes:

> BTW, the .git/remotes parser does not allow multiple refspecs on one 'Push:' 
> line, if I understand it correctly (I'm looking at get_remotes_uri in 
> builtin-push.c).

Sheesh, you are right.  That is a regression introduced, when
git-push was rewritten as a built-in, and I did not know about
it until now.

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

* [PATCH] Teach git-remote to list pushed branches.
@ 2007-03-14 20:56 Johannes Sixt
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Sixt @ 2007-03-14 20:56 UTC (permalink / raw)
  To: git

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

The hunk that reads the 'Push'es from the .git/remotes file is taken
almost verbatim from the corresponding 'Pull' clause and is untested.

-- Hannes

 git-remote.perl |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/git-remote.perl b/git-remote.perl
index bd70bf1..52013fe 100755
--- a/git-remote.perl
+++ b/git-remote.perl
@@ -15,6 +15,10 @@ sub add_remote_config {
 		$hash->{$name}{'FETCH'} ||= [];
 		push @{$hash->{$name}{'FETCH'}}, $value;
 	}
+	elsif ($what eq 'push') {
+		$hash->{$name}{'PUSH'} ||= [];
+		push @{$hash->{$name}{'PUSH'}}, $value;
+	}
 	if (!exists $hash->{$name}{'SOURCE'}) {
 		$hash->{$name}{'SOURCE'} = 'config';
 	}
@@ -44,7 +48,8 @@ sub add_remote_remotes {
 			}
 		}
 		elsif (/^Push:\s*(.*)$/) {
-			; # later
+			$it->{'PUSH'} ||= [];
+			push @{$it->{'PUSH'}}, $1;
 		}
 		elsif (/^Pull:\s*(.*)$/) {
 			$it->{'FETCH'} ||= [];
@@ -250,6 +255,15 @@ sub show_remote {
 	if ($info->{'LS_REMOTE'}) {
 		show_mapping($name, $info);
 	}
+	if ($info->{'PUSH'}) {
+		my @pushed = map {
+			s|^refs/heads/||;
+			s|:refs/heads/|:|;
+			$_;
+		} @{$info->{'PUSH'}};
+		print "  Local branch(es) pushed with 'git push'\n";
+		print "    @pushed\n";
+	}
 }
 
 sub add_remote {
-- 
1.5.0.3.438.gc49b2

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

end of thread, other threads:[~2007-03-21  3:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-18 20:34 [PATCH] Teach git-remote to list pushed branches Johannes Sixt
2007-03-18 20:37 ` Junio C Hamano
2007-03-19 19:16   ` Johannes Sixt
2007-03-19 22:36     ` Junio C Hamano
2007-03-20 23:27       ` Johannes Sixt
2007-03-21  3:03         ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2007-03-14 20:56 Johannes Sixt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.