Re: [PATCH] git push --track

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx> wrote:
> On Wed, 13 Jan 2010 16:43:10 +0100, Ilari Liusvaara
> <ilari.liusvaara@xxxxxxxxxxx> 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@xxxxxxxxxxxxx>
> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]