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
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
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
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
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
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
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 ++
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
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
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
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
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
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
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 ++--
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
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
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
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
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
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
Оля Тележная 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.
>
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
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
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
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
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
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
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
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
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 ++
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
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
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
Junio C Hamano writes:
> Anders Waldenborg writes:
>
>> @@ -1352,6 +1353,17 @@ static size_t format_commit_one(struct strbuf *sb, /*
>> in UTF-8 */
>> arg++;
>>
>>
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
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
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
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
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
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
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
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
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
(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
44 matches
Mail list logo