public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Karthik Nayak <karthik.188@gmail•com>
Cc: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>,
	Git <git@vger•kernel.org>,
	Christian Couder <christian.couder@gmail•com>
Subject: Re: [PATCH v13 00/12] port tag.c to use ref-filter APIs
Date: Tue, 25 Aug 2015 12:16:08 -0700	[thread overview]
Message-ID: <xmqqzj1fxjpj.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAOLa=ZQwW9hpg4p8+DE2oZA28Av7mLrqAhEdcro=esuqHe35Xg@mail.gmail.com> (Karthik Nayak's message of "Tue, 25 Aug 2015 18:56:55 +0530")

Karthik Nayak <karthik.188@gmail•com> writes:

>> Here is what I see...
>>
>> ok 98 - verifying rfc1991 signature
>>
>> expecting success:
>>         echo "rfc1991" >gpghome/gpg.conf &&
>>         echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
>>         git tag -l -n1 rfc1991-signed-tag >actual &&
>>         test_cmp expect actual &&
>>         git tag -l -n2 rfc1991-signed-tag >actual &&
>>         test_cmp expect actual &&
>>         git tag -l -n999 rfc1991-signed-tag >actual &&
>>         test_cmp expect actual
>>
>> --- expect      2015-08-24 22:54:44.607272653 +0000
>> +++ actual      2015-08-24 22:54:44.611272643 +0000
>> @@ -1 +1 @@
>> -rfc1991-signed-tag RFC1991 signed tag
>> +rfc1991-signed-tagRFC1991 signed tag
>> not ok 99 - list tag with rfc1991 signature
>
> Thats weird, I just ran all tests, and nothing failed.

You may be missing GPG or RFC1991 prerequisites and not running this
particular test, which could be why you missed it.

Your builtin/tag.c calls show_ref_array_item() with 

	"%(align:16,left)%(refname:short)%(end)"

as the format, and "rfc1991-signed-tag" is longer than 16.

And immediately after showing that, there is this hack at the end of
show_ref_array_item() function, which I _think_ should not be there
in ref-filter.c:show_ref_array_item() in the first place.

	if (lines > 0) {
		struct object_id oid;
		hashcpy(oid.hash, info->objectname);
		show_tag_lines(&oid, lines);
	}

This belongs to the caller who knows that it is dealing with a tag.

But that broken design aside, the reason why this breaks is because
you do not have a separating SP after the aligned short refs.

I didn't check how wide the original is supposed to be, but perhaps
changing builtin/tag.c this way

		if (filter->lines)
-			format = "%(align:16,left)%(refname:short)%(end)";
+			format = "%(align:15,left)%(refname:short)%(end) ";
		else
			format = "%(refname:short)";
	}

may be one way to fix it.  Check the original "tag -l" output for
tags whose names are 14, 15, 16 and 17 display-columns wide and try
to match it.

And then move the tag-specific code at the end of
show_ref_array_item() to here:

	verify_ref_format(format);
	filter_refs(&array, filter, FILTER_REFS_TAGS);
	ref_array_sort(sorting, &array);

-	for (i = 0; i < array.nr; i++)
+	for (i = 0; i < array.nr; i++) {
		show_ref_array_item(array.items[i], format, QUOTE_NONE, filter->lines);
+		if (lines) {
+			struct object_id oid;
+			hashcpy(oid.hash, info->objectname);
+			show_tag_lines(&oid, lines);
+		}
+	}

perhaps.

  reply	other threads:[~2015-08-25 19:16 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-22  3:39 [PATCH v13 00/12] port tag.c to use ref-filter APIs Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 01/12] ref-filter: move `struct atom_value` to ref-filter.c Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 02/12] ref-filter: introduce ref_formatting_state and ref_formatting_stack Karthik Nayak
2015-08-24 21:56   ` Junio C Hamano
2015-08-25 10:26     ` Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 03/12] utf8: add function to align a string into given strbuf Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 04/12] ref-filter: implement an `align` atom Karthik Nayak
2015-08-24 22:13   ` Junio C Hamano
2015-08-24 22:15     ` Junio C Hamano
2015-08-25 13:28       ` Karthik Nayak
2015-08-25  6:47     ` Matthieu Moy
2015-08-25 13:30       ` Karthik Nayak
2015-08-25 17:56         ` Junio C Hamano
2015-08-26  6:41           ` Karthik Nayak
2015-08-25 17:52       ` Junio C Hamano
2015-08-25 13:28     ` Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 05/12] ref-filter: add option to filter out tags, branches and remotes Karthik Nayak
2015-08-24 22:24   ` Junio C Hamano
2015-08-25 13:07     ` Karthik Nayak
2015-08-26 16:10   ` Michael Haggerty
2015-08-27 12:42     ` Karthik Nayak
2015-08-27 15:24       ` Michael Haggerty
2015-08-27 15:35         ` Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 06/12] ref-filter: support printing N lines from tag annotation Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 07/12] ref-filter: add support to sort by version Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 08/12] ref-filter: add option to match literal pattern Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 09/12] tag.c: use 'ref-filter' data structures Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 10/12] tag.c: use 'ref-filter' APIs Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 11/12] tag.c: implement '--format' option Karthik Nayak
2015-08-23 19:56   ` Matthieu Moy
2015-08-24 15:07     ` Karthik Nayak
2015-08-24 15:14       ` Matthieu Moy
2015-08-24 15:21         ` Karthik Nayak
2015-08-22  3:39 ` [PATCH v13 12/12] tag.c: implement '--merged' and '--no-merged' options Karthik Nayak
2015-08-23 20:00 ` [PATCH v13 00/12] port tag.c to use ref-filter APIs Matthieu Moy
2015-08-24 15:09   ` Karthik Nayak
2015-08-24 15:16     ` Matthieu Moy
2015-08-24 15:22       ` Karthik Nayak
2015-08-24 22:34   ` Junio C Hamano
2015-08-24 22:58     ` Junio C Hamano
2015-08-25 13:26       ` Karthik Nayak
2015-08-25 19:16         ` Junio C Hamano [this message]
2015-08-25 19:43           ` Junio C Hamano
2015-08-26  5:56           ` Karthik Nayak
2015-08-26 14:37             ` Junio C Hamano
2015-08-26 19:14               ` Karthik Nayak
2015-08-26 20:19                 ` Junio C Hamano
2015-08-27 18:00                   ` Karthik Nayak
2015-08-25 13:23     ` Karthik Nayak
2015-08-24 17:27 ` Junio C Hamano
2015-08-24 18:09   ` Karthik Nayak
2015-08-24 18:53     ` Junio C Hamano
2015-08-24 22:35       ` Junio C Hamano
2015-08-26 10:07         ` Karthik Nayak
2015-08-26 11:54           ` Matthieu Moy
2015-08-26 15:44             ` Junio C Hamano
2015-08-26 15:46               ` Junio C Hamano
2015-08-26 15:48                 ` Matthieu Moy
2015-08-26 19:11                   ` Karthik Nayak
2015-08-25 13:25       ` Karthik Nayak

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=xmqqzj1fxjpj.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Matthieu.Moy@grenoble-inp$(echo .)fr \
    --cc=christian.couder@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=karthik.188@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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