Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt/t4205-log-pretty-formats.sh28
-rw-r--r--trailer.c3
2 files changed, 30 insertions, 1 deletions
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 5e5452212d..cb09a13249 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -605,6 +605,12 @@ test_expect_success 'pretty format %(trailers) shows trailers' '
test_cmp expect actual
'
+test_expect_success 'pretty format %(trailers:) enables no options' '
+ git log --no-walk --pretty="%(trailers:)" >actual &&
+ # "expect" the same as the test above
+ test_cmp expect actual
+'
+
test_expect_success '%(trailers:only) shows only "key: value" trailers' '
git log --no-walk --pretty="%(trailers:only)" >actual &&
{
@@ -715,7 +721,29 @@ test_expect_success '%(trailers:key=foo,valueonly) shows only value' '
test_cmp expect actual
'
+test_expect_success '%(trailers:valueonly) shows only values' '
+ git log --no-walk --pretty="format:%(trailers:valueonly)" >actual &&
+ test_write_lines \
+ "A U Thor <author@example.com>" \
+ "A U Thor <author@example.com>" \
+ "[ v2 updated patch description ]" \
+ "A U Thor" \
+ " <author@example.com>" >expect &&
+ test_cmp expect actual
+'
+
test_expect_success 'pretty format %(trailers:separator) changes separator' '
+ git log --no-walk --pretty=format:"X%(trailers:separator=%x00)X" >actual &&
+ (
+ printf "XSigned-off-by: A U Thor <author@example.com>\0" &&
+ printf "Acked-by: A U Thor <author@example.com>\0" &&
+ printf "[ v2 updated patch description ]\0" &&
+ printf "Signed-off-by: A U Thor\n <author@example.com>X"
+ ) >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'pretty format %(trailers:separator=X,unfold) changes separator' '
git log --no-walk --pretty=format:"X%(trailers:separator=%x00,unfold)X" >actual &&
(
printf "XSigned-off-by: A U Thor <author@example.com>\0" &&
diff --git a/trailer.c b/trailer.c
index 3f7391d793..d2d01015b1 100644
--- a/trailer.c
+++ b/trailer.c
@@ -1131,7 +1131,8 @@ static void format_trailer_info(struct strbuf *out,
size_t i;
/* If we want the whole block untouched, we can take the fast path. */
- if (!opts->only_trailers && !opts->unfold && !opts->filter && !opts->separator) {
+ if (!opts->only_trailers && !opts->unfold && !opts->filter &&
+ !opts->separator && !opts->value_only) {
strbuf_add(out, info->trailer_start,
info->trailer_end - info->trailer_start);
return;