Re: [PATCH v2 00/12] Pulling signed/annotated tags
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:52:26
On Mon, Nov 7, 2011 at 9:10 PM, Junio C Hamano [off-list ref] wrote:
Eek. The mergetag stuff is a dump of "cat-file tag" so if you have a line that begins with "object " the parsing side (which does not exist yet) would have trouble. We would need to devise e.g. adding number of lines at the beginning, or something.
Might I suggest making it simpler still to parse?
Change "strbuf_add_lines()" to have two *different* prefixes: one for
the first line, and one for "continuation lines".
Then you can just use the same prefix if you want to - and get the
semantics you have now for that helper.
But instead of just having "mergetag" as the prefix for all the lines
copied from the merge, wouldn't it be nice and easy to have "mergetag"
as the prefix for the *first* line of each copied tag, but then have
some other tag for lines 2..n?
I think that would be *way* easier to parse, and I think something
like that could be a good generic model for any multi-line thing -
have the first line tagged, and the rest have just the continuation
marker. You don't really need to repeat the tag over and over again
each line, it just causes ambiguoity as shown by this example.
But I don't have any really strong opinions on it. I just think it's a
good idea to make it easy to parse both mechanically and
human-visually, and "number of lines" doesn't strike me as being very
human-friendly.
Linus