Re: [PATCH v3 09/16] ref-filter: make "%(symref)" atom work with the ':short' modifier
On Thu, Mar 31, 2016 at 3:47 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 47 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes:
>
>> The "%(symref)" atom doesn't work when used with the ':short' modifier
>> because we strictly match only 'symref' for setting the 'need_symref'
>> indicator. Fix this by using comparing with valid_atom rather than used_atom.
>>
>> Add tests for %(symref) and %(symref:short) while we're here.
>>
>> Helped-by: Junio C Hamano <gitster@pobox.com>
>> Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
>> ---
>> ref-filter.c | 2 +-
>> t/t6300-for-each-ref.sh | 24 ++++++++++++++++++++++++
>> 2 files changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/ref-filter.c b/ref-filter.c
>> index 8c97cdb..5c59b17 100644
>> --- a/ref-filter.c
>> +++ b/ref-filter.c
>> @@ -338,7 +338,7 @@ int parse_ref_filter_atom(const char *atom, const char *ep)
>> valid_atom[i].parser(&used_atom[at], arg);
>> if (*atom == '*')
>> need_tagged = 1;
>> - if (!strcmp(used_atom[at].name, "symref"))
>> + if (!strcmp(valid_atom[i].name, "symref"))
>> need_symref = 1;
>> return at;
>> }
>
> Makes perfect sense.
>
>> diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
>> index 2c5f177..b06ea1c 100755
>> --- a/t/t6300-for-each-ref.sh
>> +++ b/t/t6300-for-each-ref.sh
>> @@ -38,6 +38,7 @@ test_atom() {
>> case "$1" in
>> head) ref=refs/heads/master ;;
>> tag) ref=refs/tags/testtag ;;
>> + sym) ref=refs/heads/sym ;;
>> *) ref=$1 ;;
>> esac
>
> An earlier review may have missed this, but I just noticed that the
> body of this case/esac is over-indented. Something we can fix later
> after the dust settles.
>Since I'll be re-rolling, I'll fix it :)
--
Regards,
Karthik Nayak