From: Julian Phillips Date: Wed, 14 Apr 2010 21:28:56 GMT Subject: Re: [RFC/PATCH v2 0/4] A new library for plumbing output Message-ID: <0e50c39792144f5cb18260009384b4d0@212.159.54.234> In-Reply-To: <201004142316.07947.jnareb@gmail.com> On Wed, 14 Apr 2010 23:16:06 +0200, Jakub Narebski wrote: > On Wed, 14 Apr 2010, Julian Phillips wrote: >> On Wed, 14 Apr 2010 21:10:35 +0200, Jakub Narebski >> wrote: >> Anyway, I have already converted blame to use the library for both >> --porcelain and --incremental output, so it'll be in the next version of >> the patch series. So you can try before you buy ... > > Nice. > > How did you managed to work with a bit non-standard rules of --porcelain > format, namely maybe-quoting of filenames, and that not all lines conform > to "
SP LF" syntax: group definition begins with SHA-1, > and contents is indented with TAB? I had to extend the output API for quoting rules. There are now qstr/qstrf output functions that call different backend functions. The normal output then applies git quoting rules to the q versions only, whereas the JSON output treats them both the same. For the rest of it, only the actual data is going through the output_str etc functions the rest is using output_token that is ignored by the JSON backend. I actually started converting blame twice - the first time I added an API function that allowed telling the normal output how to format values, but I decided that I wanted to apply grouping to the structured output, so that e.g. the author and committer information were two objects with name, mail, date and tz members so I never finished the first attempt. -- Julian