Re: [PATCH 4/5] remote.c: teach branch_get() to treat symrefs other than HEAD
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- May 1, 2013, 18:44 UTC
- Message-ID
- <CALkWK0n2odCn=GnYSXv7g113PFEX42WF1d2GBGV=ye2TuY3CHA@mail.gmail.com>
- In-Reply-To
- <CAMP44s20F-QALd18VPHLF4Fj=eFFvXmkhC4XK__kxNhMoeN=ug@mail.gmail.com>
Felipe Contreras wrote:
> But why? I'm not familiar with branch_get, but my intuition tells me > you are changing the behavior, and now branch_get() is doing something > it wasn't intended to do. And for what?
Why is there a commit message? I've explained what the behavior change is.
> Your rationale is that it fixes the test cases below, but that's not > reason enough, since there are other ways to fix them, as my patch > series shows.
For what exactly. To fix a real bug: H@{u} and @@{u} don't work where either H or @ are symbolic refs. I want custom symbolic refs, because they are useful. In other words, "HEAD" is not a sacred symbolic ref.
Show 15 quoted lines
>> if (ret && ret->remote_name) {
>> ret->remote = remote_get(ret->remote_name);
>> if (ret->merge_nr) {
>> diff --git a/sha1_name.c b/sha1_name.c
>> index f30e344..c4a3a54 100644
>> --- a/sha1_name.c
>> +++ b/sha1_name.c
>> @@ -1060,7 +1060,7 @@ int interpret_branch_name(const char *name, struct strbuf *buf)
>> return ret - used + len;
>> }
>>
>> - cp = strchr(name, '@');
>> + cp = strstr(name, "@{");
>
> This might make sense, but it feels totally sneaked in.Sneaked in? I have three paragraphs in my commit message. The first two explain two related changes, and the third one shows how they are related.
Show 6 quoted lines
>> if (!cp) >> return -1; >> tmp_len = upstream_mark(cp, namelen - (cp - name)); > > I think these are two patches should be introduced separately, and > with a reason for them to exist independent of each other.
I cannot justify the remote.c patch without the "@{" change.