git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tay Ray Chuan <rctay89@gmail.com>
To: Rudolf Polzer <divVerent@alientrap.org>
Cc: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>,
	Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Miles Bader <miles@gnu.org>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	git@vger.kernel.org
Subject: Re: [PATCH] git push --track
Date: Thu, 14 Jan 2010 13:21:17 +0800	[thread overview]
Message-ID: <be6fef0d1001132121w4e25c7f0j760d71c136012401@mail.gmail.com> (raw)
In-Reply-To: <op.u6haiiiog402ra@nb-04>

Hi,

generally, it would be better if you could add some tests for this.

If I'm not wrong, the place to put it would be t5516-fetch-push.sh.

On Wed, Jan 13, 2010 at 11:55 PM, Rudolf Polzer <divVerent@alientrap.org> wrote:
> On Wed, 13 Jan 2010 16:43:10 +0100, Ilari Liusvaara
> <ilari.liusvaara@elisanet.fi> wrote:

please don't drop people from the Cc list - especially when you're
replying to somebody!

> From 123598516c7d4e1f83591e8dae64e2c76dc87c90 Mon Sep 17 00:00:00 2001
> From: Rudolf Polzer <divVerent@alientrap.org>
> Date: Wed, 13 Jan 2010 16:42:04 +0100
> Subject: [PATCH 1/2] Add a feature "git push --track" to automatically make
> the pushed branches tracking

Each patch should be sent out in its own mail. (As Matthieu has
recommended, you should check out Documentation/SubmittingPatches.)

>  static const char * const push_usage[] = {
> @@ -115,6 +116,36 @@ static int push_with_options(struct transport
> *transport, int flags)
>                fprintf(stderr, "Pushing to %s\n", transport->url);
>        err = transport_push(transport, refspec_nr, refspec, flags,
>                             &nonfastforward);
> +       if (err == 0 && flags & TRANSPORT_PUSH_TRACK) {
> +               struct ref *remote_refs =
> +                       transport->get_refs_list(transport, 1);
> +               struct ref *local_refs = get_local_heads();
> +               int match_flags = 0;
> +               if (flags & TRANSPORT_PUSH_ALL)
> +                       match_flags |= MATCH_REFS_ALL;
> +               if (flags & TRANSPORT_PUSH_MIRROR)
> +                       match_flags |= MATCH_REFS_MIRROR;
> +               if(!(flags & TRANSPORT_PUSH_DRY_RUN))
> +               if(!match_refs(local_refs, &remote_refs, refspec_nr,
> refspec,
> +                                       match_flags)) {

It would be better if you can move this to
transport.c::transport_push(). It repeats what's already there, so you
don't have to configure match_flags, nor call match_refs, etc.

> +                       struct ref *next = remote_refs;
> +                       while(next) {
> [snip]
> +                               next = next->next;

In most places, this is done like this:

  struct ref* ref;
  for (ref = remote_refs; ref; ref = ref->next) {
    ...
  }

-- 
Cheers,
Ray Chuan

  parent reply	other threads:[~2010-01-14  5:21 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 15:12 [PATCH] git push --track Rudolf Polzer
2010-01-13 15:43 ` Ilari Liusvaara
2010-01-13 15:55   ` Rudolf Polzer
2010-01-13 16:27     ` Ilari Liusvaara
2010-01-13 16:37     ` Matthieu Moy
2010-01-14  5:21     ` Tay Ray Chuan [this message]
2010-01-14  7:00       ` Rudolf Polzer
2010-01-14 23:13         ` Junio C Hamano
2010-01-14  7:16     ` Jeff King
2010-01-15  5:47     ` Junio C Hamano
2010-01-15 14:00       ` Rudolf Polzer
2010-01-15 15:45         ` Miles Bader
2010-01-15 18:16         ` Junio C Hamano
2010-01-14  0:28   ` Miles Bader
2010-01-14  0:25 ` Miles Bader
2010-01-14  0:33   ` Johannes Schindelin
2010-01-14  0:36     ` Miles Bader
2010-01-14  0:46   ` Miles Bader
2010-01-14  7:01   ` Rudolf Polzer
2010-01-14 13:44   ` Martin Langhoff
2010-01-14 14:16     ` Johannes Schindelin
2010-01-14 14:25       ` Matthieu Moy
2010-01-14 14:35         ` Martin Langhoff
2010-01-14 15:27         ` Andreas Krey
2010-01-14  1:27 ` Tay Ray Chuan
2010-01-14  1:35   ` Miles Bader
2010-01-14  1:37     ` Tay Ray Chuan
2010-01-14  1:49       ` Miles Bader
2010-01-14  1:58         ` Tay Ray Chuan
2010-01-14  7:03   ` Rudolf Polzer
2010-01-14 23:46     ` Junio C Hamano
2010-01-15  0:30       ` Miles Bader
2010-01-15 18:18         ` Junio C Hamano
2010-01-15 18:54           ` Miles Bader
2010-01-15 13:26       ` Matthieu Moy
2010-01-14  6:41 ` Nanako Shiraishi
2010-01-14  7:08   ` Rudolf Polzer
2010-01-14 10:31   ` Johannes Schindelin
2010-01-14 22:27     ` Nanako Shiraishi
2010-01-14 23:50       ` Junio C Hamano
2010-01-15 13:44       ` Rudolf Polzer
2010-01-15 14:09         ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be6fef0d1001132121w4e25c7f0j760d71c136012401@mail.gmail.com \
    --to=rctay89@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=divVerent@alientrap.org \
    --cc=git@vger.kernel.org \
    --cc=ilari.liusvaara@elisanet.fi \
    --cc=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).