Re: [PATCH v4 2/7] pretty: allow %(trailers) options with explicit value

2019-01-31 Thread Anders Waldenborg
Оля Тележная writes: >> Oh my. I wasn't aware that there was a totally separate string >> interpolation implementation used for ref filters. That one has >> separated parsing, making it more amenable to good error handling. >> I wonder if that could be generalized and reused for pretty formats. >

Re: [PATCH v4 2/7] pretty: allow %(trailers) options with explicit value

2019-01-29 Thread Anders Waldenborg
Jeff King writes: > There's some small value in leaving > %X alone if we do not understand "X" (not to mention the backwards > %compatibility you mentioned), but I think %() is a pretty > deliberate indication that a placeholder was meant there. Good point. > We already do this for ref-filter e

Re: [PATCH v5 2/7 update] pretty: allow %(trailers) options with explicit value

2019-01-28 Thread Anders Waldenborg
override defaults from future options. Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 14 ++--- pretty.c | 52 +++- t/t4205-log-pretty-formats.sh| 18 +++ 3 files changed, 73 insertions(+), 11 deletions

Re: [PATCH v5 2/7] pretty: Allow %(trailers) options with explicit value

2019-01-28 Thread Anders Waldenborg
Junio C Hamano writes: >> ... >> +static int match_placeholder_bool_arg(const char *to_parse, const char >> *candidate, >> + const char **end, int *val) >> +{ >> +char buf[8]; >> +const char *strval; >> +size_t len; >> +int v; >> + >> +if (!m

[PATCH v5 6/7] strbuf: separate callback for strbuf_expand:ing literals

2019-01-28 Thread Anders Waldenborg
Expanding '%n' and '%xNN' is generic functionality, so extract that from the pretty.c formatter into a callback that can be reused. No functional change intended Signed-off-by: Anders Waldenborg --- pretty.c | 16 +--- strbuf.c | 21 + strbu

[PATCH v5 3/7] pretty: single return path in %(trailers) handling

2019-01-28 Thread Anders Waldenborg
No functional change intended. This change may not seem useful on its own, but upcoming commits will do memory allocation in there, and a single return path makes deallocation easier. Signed-off-by: Anders Waldenborg --- pretty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff

[PATCH v5 1/7] doc: group pretty-format.txt placeholders descriptions

2019-01-28 Thread Anders Waldenborg
The placeholders can be grouped into three kinds: * literals * affecting formatting of later placeholders * expanding to information in commit Also change the list to a definition list (using '::') Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats

[PATCH v5 5/7] pretty: add support for "valueonly" option in %(trailers)

2019-01-28 Thread Anders Waldenborg
railers:key=Signed-off-by,valueonly)' 88182 will show: > upload-pack: fix broken if/else chain in config callback > Jeff King > Junio C Hamano Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 2 ++ pretty.c | 3 ++- t/t4205-log-pre

[PATCH v5 7/7] pretty: add support for separator option in %(trailers)

2019-01-28 Thread Anders Waldenborg
ng codes %n and %xNN allowing it to be things that are otherwise hard to type such as %x00, or comma and end-parenthesis which would break parsing. E.g: $ git log --pretty='%(trailers:key=Reviewed-by,valueonly,separator=%x00)' Signed-off-by: Anders Waldenborg --- Documen

[PATCH v5 4/7] pretty: allow showing specific trailers

2019-01-28 Thread Anders Waldenborg
Adds a new "key=X" option to "%(trailers)" which will cause it to only print trailer lines which match any of the specified keys. Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 8 + pretty.c | 36 ++--

[PATCH v5 2/7] pretty: Allow %(trailers) options with explicit value

2019-01-28 Thread Anders Waldenborg
override defaults from future options. Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 14 ++--- pretty.c | 52 +++- t/t4205-log-pretty-formats.sh| 18 +++ 3 files changed, 73 insertions(+), 11 deletions

[PATCH v5 0/7] %(trailers) improvements in pretty format

2019-01-28 Thread Anders Waldenborg
Updates since v4: * Coding style fixes * Reuse git_parse_maybe_bool for bool parsing Anders Waldenborg (7): doc: group pretty-format.txt placeholders descriptions pretty: Allow %(trailers) options with explicit value pretty: single return path in %(trailers) handling pretty: allow

Re: [PATCH v4 2/7] pretty: allow %(trailers) options with explicit value

2018-12-18 Thread Anders Waldenborg
Junio C Hamano writes: > That way, we can handle %(trailers:only=bogo) more sensibly, > no? Syntactically we can recognize that the user wanted to give > 'bogo' as the value to 'only', and say "'bogo' is not a boolean" if > we did so. I agree that proper error reporting for the pretty formattin

[PATCH v4 4/7] pretty: allow showing specific trailers

2018-12-08 Thread Anders Waldenborg
Adds a new "key=X" option to "%(trailers)" which will cause it to only print trailer lines which match any of the specified keys. Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 8 + pretty.c | 47 ++

[PATCH v4 3/7] pretty: single return path in %(trailers) handling

2018-12-08 Thread Anders Waldenborg
No functional change intended. This change may not seem useful on its own, but upcoming commits will do memory allocation in there, and a single return path makes deallocation easier. Signed-off-by: Anders Waldenborg --- pretty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff

[PATCH v4 0/7] %(trailers) improvements in pretty format

2018-12-08 Thread Anders Waldenborg
Updated since v3: * multiple 'key=' matches any * allow overriding implicit 'only' when using key * minor grammar and spelling fixes * documentation restructuring * Helper functions for parsing options Anders Waldenborg (7): doc: group pretty-format.txt placeholders d

[PATCH v4 6/7] strbuf: separate callback for strbuf_expand:ing literals

2018-12-08 Thread Anders Waldenborg
Expanding '%n' and '%xNN' is generic functionality, so extract that from the pretty.c formatter into a callback that can be reused. No functional change intended Signed-off-by: Anders Waldenborg --- pretty.c | 16 +--- strbuf.c | 21 + strbu

[PATCH v4 5/7] pretty: add support for "valueonly" option in %(trailers)

2018-12-08 Thread Anders Waldenborg
railers:key=Signed-off-by,valueonly)' 88182 will show: > upload-pack: fix broken if/else chain in config callback > Jeff King > Junio C Hamano Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 2 ++ pretty.c | 3 ++- t/t4205-log-pre

[PATCH v4 1/7] doc: group pretty-format.txt placeholders descriptions

2018-12-08 Thread Anders Waldenborg
The placeholders can be grouped into three kinds: * literals * affecting formatting of later placeholders * expanding to information in commit Also change the list to a definition list (using '::') Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats

[PATCH v4 2/7] pretty: allow %(trailers) options with explicit value

2018-12-08 Thread Anders Waldenborg
override defaults from future options. Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 14 ++ pretty.c | 32 +++- t/t4205-log-pretty-formats.sh| 18 ++ 3 files changed, 55 insertions(+), 9

[PATCH v4 7/7] pretty: add support for separator option in %(trailers)

2018-12-08 Thread Anders Waldenborg
ng codes %n and %xNN allowing it to be things that are otherwise hard to type such as %x00, or comma and end-parenthesis which would break parsing. E.g: $ git log --pretty='%(trailers:key=Reviewed-by,valueonly,separator=%x00)' Signed-off-by: Anders Waldenborg --- Documen

Re: [PATCH v3 2/5] pretty: allow showing specific trailers

2018-11-25 Thread Anders Waldenborg
Junio C Hamano writes: > I was confused by the "only" stuff. > > When you give a key (or two), they cannot possibly name non-trailer > lines, so while it may be possible to ask "oh, by the way, I also > want non-trailer lines in addition to signed-off-by and cc lines", > the value of being able t

Re: [PATCH v3 2/5] pretty: allow showing specific trailers

2018-11-25 Thread Anders Waldenborg
Junio C Hamano writes: > Also, use of 'key=' automatically turns on 'only' as described, and > I tend to agree that it would a convenient default mode (i.e. when > picking certain trailers only with this mechanism, it is likely that > the user is willing to use %(subject) etc. to fill in what was

[PATCH v3 0/5] %(trailers) improvements in pretty format

2018-11-18 Thread Anders Waldenborg
in tests * Rename function to strbuf_expand_literal_cb * cocci suggested fixes Anders Waldenborg (5): pretty: single return path in %(trailers) handling pretty: allow showing specific trailers pretty: add support for "valueonly" option in %(trailers) strbuf: separate callback for strbuf_e

[PATCH v3 1/5] pretty: single return path in %(trailers) handling

2018-11-18 Thread Anders Waldenborg
No functional change intended. This change may not seem useful on its own, but upcoming commits will do memory allocation in there, and a single return path makes deallocation easier. Signed-off-by: Anders Waldenborg --- pretty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff

[PATCH v3 4/5] strbuf: separate callback for strbuf_expand:ing literals

2018-11-18 Thread Anders Waldenborg
Expanding '%n' and '%xNN' is generic functionality, so extract that from the pretty.c formatter into a callback that can be reused. No functional change intended Signed-off-by: Anders Waldenborg --- pretty.c | 16 +--- strbuf.c | 21 + strbu

[PATCH v3 5/5] pretty: add support for separator option in %(trailers)

2018-11-18 Thread Anders Waldenborg
ng codes %n and %xNN allowing it to be things that are otherwise hard to type as %x00, or comma and end-parenthesis which would break parsing. E.g: $ git log --pretty='%(trailers:key=Reviewed-by,valueonly,separator=%x00)' Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.t

[PATCH v3 3/5] pretty: add support for "valueonly" option in %(trailers)

2018-11-18 Thread Anders Waldenborg
railers:key=Signed-off-by,valueonly)' 88182 will show: > upload-pack: fix broken if/else chain in config callback > Jeff King > Junio C Hamano Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 2 ++ pretty.c | 2 ++ t/t4205-log-pre

[PATCH v3 2/5] pretty: allow showing specific trailers

2018-11-18 Thread Anders Waldenborg
Adds a new "key=X" option to "%(trailers)" which will cause it to only print trailers lines which match the specified key. Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 17 +-- pretty.c | 31

Re: [PATCH v2 5/5] pretty: add support for separator option in %(trailers)

2018-11-05 Thread Anders Waldenborg
Junio C Hamano writes: > Anders Waldenborg writes: > >> @@ -1352,6 +1353,17 @@ static size_t format_commit_one(struct strbuf *sb, /* >> in UTF-8 */ >> arg++; >> >>

Re: [PATCH v2 4/5] pretty: extract fundamental placeholders to separate function

2018-11-05 Thread Anders Waldenborg
Junio C Hamano writes: > I do not think "fundamental" is the best name for this, but I agree > that it would be useful to split the helpers into one that is > "constant across commits" and the other one that is "per commit". Any suggestions for a better name? standalone? simple? invariant? free

Re: [PATCH v2 2/5] pretty: allow showing specific trailers

2018-11-05 Thread Anders Waldenborg
Eric Sunshine writes: > Should the code tolerate a trailing colon? (Genuine question; it's > easy to do and would be more user-friendly.) I would make sense to allow the trailing colon, it is easy enough to just strip that away when reading the argument. However I'm not sure how that would fit

Re: [PATCH v2 0/5] %(trailers) improvements in pretty format

2018-11-04 Thread Anders Waldenborg
Eric Sunshine writes: > If "key" is for including particular trailers, intuition might lead > people to think that "nokey" is for excluding certain trailers. > Perhaps a different name for "nokey", such as "valueonly" or > "stripkey", would be better. Good point. I guess "valueonly" would be pre

[PATCH v2 3/5] pretty: add support for "nokey" option in %(trailers)

2018-11-04 Thread Anders Waldenborg
railers:key=Signed-off-by,nokey)' 88182 will show: > upload-pack: fix broken if/else chain in config callback > Jeff King > Junio C Hamano Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 11 ++- pretty.c | 2 ++

[PATCH v2 2/5] pretty: allow showing specific trailers

2018-11-04 Thread Anders Waldenborg
Adds a new "key=X" option to "%(trailers)" which will cause it to only print trailers lines which matches the specified key. Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 13 + pretty.c | 15 ++- t/t4205-l

[PATCH v2 4/5] pretty: extract fundamental placeholders to separate function

2018-11-04 Thread Anders Waldenborg
No functional change intended Signed-off-by: Anders Waldenborg --- pretty.c | 37 ++--- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/pretty.c b/pretty.c index f87ba4f18..9fdddce9d 100644 --- a/pretty.c +++ b/pretty.c @@ -1074,6 +1074,27

[PATCH v2 5/5] pretty: add support for separator option in %(trailers)

2018-11-04 Thread Anders Waldenborg
ng codes %n and %xNN allowing it to be things that are otherwise hard to type as %x00, or command and end-parenthesis which would break parsing. E.g: $ git log --pretty='%(trailers:key=Reviewed-by,nokey,separator=%x00)' Signed-off-by: Anders Waldenborg --- Documen

[PATCH v2 1/5] pretty: single return path in %(trailers) handling

2018-11-04 Thread Anders Waldenborg
No functional change intended. This change may not seem useful on its own, but upcoming commits will do memory allocation in there, and a single return path makes deallocation easier. Signed-off-by: Anders Waldenborg --- pretty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff

[PATCH v2 0/5] %(trailers) improvements in pretty format

2018-11-04 Thread Anders Waldenborg
This adds support for three new options to %(trailers): * key -- show only trailers with specified key * nokey -- don't show key part of trailers * separator -- allow specifying custom separator between trailers Anders Waldenborg (5): pretty: single return path in %(trailers) han

Re: [PATCH] pretty: Add %(trailer:X) to display single trailer

2018-10-31 Thread Anders Waldenborg
Jeff King writes: > On the other hand, if the rule were not "this affects the next > placeholder" but had a true ending mark, then we could make a real > parse-tree out of it, and format chunks of placeholders. E.g.: > > %(format:lpad=30,filename)%(subject) %(authordate)%(end) > > would pad an

Re: [PATCH] pretty: Add %(trailer:X) to display single trailer

2018-10-29 Thread Anders Waldenborg
On Mon, Oct 29, 2018 at 3:14 PM Jeff King wrote: > Junio's review already covered my biggest question, which is why not > something like "%(trailers:key=ticket)". And likewise making things like > comma-separation options. Jeff, Junio, thanks! Your questions pretty much matches what I (and a

[PATCH] pretty: Add %(trailer:X) to display single trailer

2018-10-28 Thread Anders Waldenborg
ome good commit > > Ticket: XYZ-123 running: $ git log --pretty="%H %s% (trailer:Ticket)" will give: > 123456789a Some good commit (Ticket: XYZ-123) Signed-off-by: Anders Waldenborg --- Documentation/pretty-formats.txt | 4 pretty.c | 16

Re: [PATCH] diff: Add diff.orderfile configuration variable

2013-10-25 Thread Anders Waldenborg
(Jonathan, sorry if you got this multiple times, it seems I forgot to Cc list) On Mon, Oct 21, 2013 at 8:40 PM, Jonathan Nieder wrote: > Should the git-diff(1) manpage get a note about this setting as > well (perhaps in a new CONFIGURATION section)? I'll add a reference to the documentation for

[PATCH] diff: Add diff.orderfile configuration variable

2013-10-21 Thread Anders Waldenborg
diff.orderfile acts as a default for the -O command line option. Signed-off-by: Anders Waldenborg --- Documentation/diff-config.txt | 4 +++ diff.c| 5 +++ t/t4056-diff-order.sh | 74 +++ 3 files changed, 83 insertions