Re: [PATCH 3/6] push: change `simple` to accommodate triangular workflows
- From
Johan Herland <johan@herland.net>
- Date
- Jun 24, 2013, 08:48 UTC
- Message-ID
- <CALKQrgfCR10nfP9tVuHyhCPOfe3XVvBzzQayhM7b9Ra5ZDGnMw@mail.gmail.com>
- In-Reply-To
- <CALkWK0mAyDb3AjH0s3j2gRRDckx=a2nr9MR+O6gEtwX2MSJrtw@mail.gmail.com>
On Mon, Jun 24, 2013 at 9:46 AM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
Show 13 quoted lines
> Johan Herland wrote:
>>> +static void setup_push_current(struct remote *remote, struct branch *branch)
>>> +{
>>> + if (!branch)
>>> + die(_(message_detached_head_die), remote->name);
>>> + add_refspec(branch->name);
>>
>> Here (and above) we add a refspec to tell Git exactly what to push
>> from the local end, and into what on the remote end.
>
> Nope, we add the refspec "foo", without the :destination part. The
> remote end is unspecified (and defaults to "foo", but that is in the
> transport layer).Ok, so "foo" is not always semantically equivalent to "foo:foo", and when adding "foo:bar" it is always considered more specific than (and superior to) "foo". I think that makes sense.
Show 12 quoted lines
>> Is it possible to >> end up with multiple simultaneous refspecs matching the same local >> ref, but mapping to different remote refs? If so, which will win, and >> does that make sense? > > It is impossible. We either: > > - Get an explicit refspec from the user and never run > setup_default_push_refspecs() to begin with. > > - Run setup_push_refspecs() and add *one* refspec depending on the > push.default value.
Thanks, that's what I wanted to hear. But then, does it make sense to say that we will only ever have exactly _one_ push refspec in the current context, and we should therefore replace the "static const char **refspec;" string array with a single "static const char *refspec;" string? That would make it obvious that there is no room for ambiguity with overlapping refspecs.
...Johan
-- Johan Herland, <johan@herland.net> www.herland.net