Commit 636a0ae
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>1 parent 90563ae commit 636a0ae
2 files changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1152 | 1152 | | |
1153 | 1153 | | |
1154 | 1154 | | |
1155 | | - | |
| 1155 | + | |
| 1156 | + | |
1156 | 1157 | | |
1157 | 1158 | | |
1158 | 1159 | | |
1159 | 1160 | | |
1160 | 1161 | | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1161 | 1165 | | |
1162 | 1166 | | |
1163 | 1167 | | |
| |||
1190 | 1194 | | |
1191 | 1195 | | |
1192 | 1196 | | |
1193 | | - | |
1194 | | - | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
1195 | 1204 | | |
1196 | 1205 | | |
1197 | 1206 | | |
| |||
1473 | 1482 | | |
1474 | 1483 | | |
1475 | 1484 | | |
1476 | | - | |
| 1485 | + | |
1477 | 1486 | | |
1478 | 1487 | | |
1479 | 1488 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
| 155 | + | |
155 | 156 | | |
156 | 157 | | |
0 commit comments