From: Justin Tobler Date: Wed, 05 Feb 2025 17:17:32 GMT Subject: Re: [PATCH v4 0/2] rev-list: print additional missing object information Message-ID: <4peozlz56kmdhziyq6uhsvm4t7atmwtbl7divyuqqb4l64wgom@z3adjdx7v5x2> In-Reply-To: On 25/02/05 05:18AM, Junio C Hamano wrote: > Justin Tobler writes: > > > One concern I currently have with this quoting approach is that it is a > > bit more challenging to machine parse compared to something like using a > > null byte to delimit between missing info. One option is, in a followup > > series, introduce a git-for-each-ref(1) style format syntax. Maybe > > something like: `--missing=print-info:%(path)%00%(type)`. I'm curious if > > anyone may have thoughts around this. > > Would it be so bad if we said that in -z mode with --info option, > each record is terminated with two NUL bytes, and elements on a list > of var=value pairs have a single NUL in between, or something silly > like that? The point is to get away with just a fixed format, > without any customization. I agree that some sort of fixed format would be preferable as it's less complex while also being simpler to implement. I originally considered using NUL but realized a single NUL byte to delimit between entries wouldn't be sufficient to determine where each record would end. Using two NUL bytes next to each other to mark the end of a record would work though. Since even a normal rev-list record may have an object name entry in addition to its OID when the `--objects` option is set, maybe we could introduce a `-z` option that always terminates a record with two NUL bytes? The output for `git rev-list -z --objects --missing=print-info` could look something like the following (no LF at EOL): 6aa71444d3d41315509c3f2cfe2d45d86cea20d7 f009994f5d7fc97c1e87b4dc7ad69057a07e85c4foo/bar ?f10f78c60046b2be841c9e2403960663439296c3path=foo/bar/baztype=blob ?ead43a34efd775b58d6b3e86db6bc71bbedd2c1cpath=foo/bar/baz 2type=blob Having two NUL bytes to delimit between records might be a bit odd in the common case for git-rev-list(1) without the `--objects` and `--missing` options since we would only expect a list of OIDs. Having consistent `-z` option output irrespective of other options might be preferable though. If this approach seems reasonable, I can do so in a followup series. Thanks -Justin