diff options
author | Hariom Verma <hariom18599@gmail.com> | 2021-02-13 01:52:42 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-15 16:48:38 -0800 |
commit | 636a0aeedfee5f3cce2ebf1fcc174a49ab9bb0c3 (patch) | |
tree | ca074954347c6211cbf431bed91504460f70a229 /ls-refs.c | |
parent | pretty.c: refactor trailer logic to `format_set_trailers_options()` (diff) | |
download | tgif-636a0aeedfee5f3cce2ebf1fcc174a49ab9bb0c3.tar.xz |
pretty.c: capture invalid trailer argument
As we would like to use this trailers logic in the ref-filter, it's
nice to get an invalid trailer argument. This will allow us to print
precise error message while using `format_set_trailers_options()` in
ref-filter.
For capturing the invalid argument, we changed the working of
`format_set_trailers_options()` a little bit.
Original logic does "break" and fell through in mainly 2 cases -
1. unknown/invalid argument
2. end of the arg string
But now instead of "break", we capture invalid argument and return
non-zero. And non-zero is handled by the caller.
(We prepared the caller to handle non-zero in the previous commit).
Capturing invalid arguments this way will also affects the working
of current logic. As at the end of the arg string it will return non-zero.
So in order to make things correct, introduced an additional conditional
statement i.e if encounter ")", do 'break'.
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ls-refs.c')
0 files changed, 0 insertions, 0 deletions