Skip to content

Commit 92741d8

Browse files
committed
Merge branch 'ak/pretty-decorate-more-fix'
Unlike "git log --pretty=%D", "git log --pretty="%(decorate)" did not auto-initialize the decoration subsystem, which has been corrected. * ak/pretty-decorate-more-fix: pretty: fix ref filtering for %(decorate) formats
2 parents 6b1e225 + 2b09d16 commit 92741d8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pretty.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,10 @@ void userformat_find_requirements(const char *fmt, struct userformat_want *w)
19611961
case 'D':
19621962
w->decorate = 1;
19631963
break;
1964+
case '(':
1965+
if (starts_with(fmt + 1, "decorate"))
1966+
w->decorate = 1;
1967+
break;
19641968
}
19651969
}
19661970
}

t/t4205-log-pretty-formats.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,9 @@ test_expect_success 'pretty format %decorate' '
590590
git log --format="%(decorate:prefix=,suffix=)" -1 >actual2 &&
591591
test_cmp expect2 actual2 &&
592592
593-
echo "[ HEAD -> foo; tag: bar; qux ]" >expect3 &&
594-
git log --format="%(decorate:prefix=[ ,suffix= ],separator=%x3B )" \
595-
-1 >actual3 &&
593+
echo "[ bar; qux; foo ]" >expect3 &&
594+
git log --format="%(decorate:prefix=[ ,suffix= ],separator=%x3B ,tag=)" \
595+
--decorate-refs=refs/ -1 >actual3 &&
596596
test_cmp expect3 actual3 &&
597597
598598
# Try with a typo (in "separator"), in which case the placeholder should

0 commit comments

Comments
 (0)