Merge branch 'ds/decorate-filter-tweak'
The namespaces used by "log --decorate" from "refs/" hierarchy by default has been tightened. * ds/decorate-filter-tweak: fetch: use ref_namespaces during prefetch maintenance: stop writing log.excludeDecoration log: create log.initialDecorationSet=all log: add --clear-decorations option log: add default decoration filter log-tree: use ref_namespaces instead of if/else-if refs: use ref_namespaces for replace refs base refs: add array of ref namespaces t4207: test coloring of grafted decorations t4207: modernize test refs: allow "HEAD" as decoration filter
This commit is contained in:
132
t/t4202-log.sh
132
t/t4202-log.sh
@ -704,9 +704,12 @@ test_expect_success 'set up more tangled history' '
|
||||
git checkout -b tangle HEAD~6 &&
|
||||
test_commit tangle-a tangle-a a &&
|
||||
git merge main~3 &&
|
||||
git update-ref refs/prefetch/merge HEAD &&
|
||||
git merge side~1 &&
|
||||
git update-ref refs/rewritten/merge HEAD &&
|
||||
git checkout main &&
|
||||
git merge tangle &&
|
||||
git update-ref refs/hidden/tangle HEAD &&
|
||||
git checkout -b reach &&
|
||||
test_commit reach &&
|
||||
git checkout main &&
|
||||
@ -974,9 +977,9 @@ test_expect_success 'decorate-refs-exclude and simplify-by-decoration' '
|
||||
Merge-tag-reach (HEAD -> main)
|
||||
reach (tag: reach, reach)
|
||||
seventh (tag: seventh)
|
||||
Merge-branch-tangle
|
||||
Merge-branch-side-early-part-into-tangle (tangle)
|
||||
tangle-a (tag: tangle-a)
|
||||
Merge-branch-tangle (refs/hidden/tangle)
|
||||
Merge-branch-side-early-part-into-tangle (refs/rewritten/merge, tangle)
|
||||
Merge-branch-main-early-part-into-tangle (refs/prefetch/merge)
|
||||
EOF
|
||||
git log -n6 --decorate=short --pretty="tformat:%f%d" \
|
||||
--decorate-refs-exclude="*octopus*" \
|
||||
@ -1025,6 +1028,115 @@ test_expect_success 'decorate-refs and simplify-by-decoration without output' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'decorate-refs-exclude HEAD' '
|
||||
git log --decorate=full --oneline \
|
||||
--decorate-refs-exclude="HEAD" >actual &&
|
||||
! grep HEAD actual
|
||||
'
|
||||
|
||||
test_expect_success 'decorate-refs focus from default' '
|
||||
git log --decorate=full --oneline \
|
||||
--decorate-refs="refs/heads" >actual &&
|
||||
! grep HEAD actual
|
||||
'
|
||||
|
||||
test_expect_success '--clear-decorations overrides defaults' '
|
||||
cat >expect.default <<-\EOF &&
|
||||
Merge-tag-reach (HEAD -> refs/heads/main)
|
||||
Merge-tags-octopus-a-and-octopus-b
|
||||
seventh (tag: refs/tags/seventh)
|
||||
octopus-b (tag: refs/tags/octopus-b, refs/heads/octopus-b)
|
||||
octopus-a (tag: refs/tags/octopus-a, refs/heads/octopus-a)
|
||||
reach (tag: refs/tags/reach, refs/heads/reach)
|
||||
Merge-branch-tangle
|
||||
Merge-branch-side-early-part-into-tangle (refs/heads/tangle)
|
||||
Merge-branch-main-early-part-into-tangle
|
||||
tangle-a (tag: refs/tags/tangle-a)
|
||||
Merge-branch-side
|
||||
side-2 (tag: refs/tags/side-2, refs/heads/side)
|
||||
side-1 (tag: refs/tags/side-1)
|
||||
Second
|
||||
sixth
|
||||
fifth
|
||||
fourth
|
||||
third
|
||||
second
|
||||
initial
|
||||
EOF
|
||||
git log --decorate=full --pretty="tformat:%f%d" >actual &&
|
||||
test_cmp expect.default actual &&
|
||||
|
||||
cat >expect.all <<-\EOF &&
|
||||
Merge-tag-reach (HEAD -> refs/heads/main)
|
||||
Merge-tags-octopus-a-and-octopus-b
|
||||
seventh (tag: refs/tags/seventh)
|
||||
octopus-b (tag: refs/tags/octopus-b, refs/heads/octopus-b)
|
||||
octopus-a (tag: refs/tags/octopus-a, refs/heads/octopus-a)
|
||||
reach (tag: refs/tags/reach, refs/heads/reach)
|
||||
Merge-branch-tangle (refs/hidden/tangle)
|
||||
Merge-branch-side-early-part-into-tangle (refs/rewritten/merge, refs/heads/tangle)
|
||||
Merge-branch-main-early-part-into-tangle (refs/prefetch/merge)
|
||||
tangle-a (tag: refs/tags/tangle-a)
|
||||
Merge-branch-side
|
||||
side-2 (tag: refs/tags/side-2, refs/heads/side)
|
||||
side-1 (tag: refs/tags/side-1)
|
||||
Second
|
||||
sixth
|
||||
fifth
|
||||
fourth
|
||||
third
|
||||
second
|
||||
initial
|
||||
EOF
|
||||
git log --decorate=full --pretty="tformat:%f%d" \
|
||||
--clear-decorations >actual &&
|
||||
test_cmp expect.all actual &&
|
||||
git -c log.initialDecorationSet=all log \
|
||||
--decorate=full --pretty="tformat:%f%d" >actual &&
|
||||
test_cmp expect.all actual
|
||||
'
|
||||
|
||||
test_expect_success '--clear-decorations clears previous exclusions' '
|
||||
cat >expect.all <<-\EOF &&
|
||||
Merge-tag-reach (HEAD -> refs/heads/main)
|
||||
reach (tag: refs/tags/reach, refs/heads/reach)
|
||||
Merge-tags-octopus-a-and-octopus-b
|
||||
octopus-b (tag: refs/tags/octopus-b, refs/heads/octopus-b)
|
||||
octopus-a (tag: refs/tags/octopus-a, refs/heads/octopus-a)
|
||||
seventh (tag: refs/tags/seventh)
|
||||
Merge-branch-tangle (refs/hidden/tangle)
|
||||
Merge-branch-side-early-part-into-tangle (refs/rewritten/merge, refs/heads/tangle)
|
||||
Merge-branch-main-early-part-into-tangle (refs/prefetch/merge)
|
||||
tangle-a (tag: refs/tags/tangle-a)
|
||||
side-2 (tag: refs/tags/side-2, refs/heads/side)
|
||||
side-1 (tag: refs/tags/side-1)
|
||||
initial
|
||||
EOF
|
||||
|
||||
git log --decorate=full --pretty="tformat:%f%d" \
|
||||
--simplify-by-decoration \
|
||||
--decorate-refs-exclude="heads/octopus*" \
|
||||
--decorate-refs="heads" \
|
||||
--clear-decorations >actual &&
|
||||
test_cmp expect.all actual &&
|
||||
|
||||
cat >expect.filtered <<-\EOF &&
|
||||
Merge-tags-octopus-a-and-octopus-b
|
||||
octopus-b (refs/heads/octopus-b)
|
||||
octopus-a (refs/heads/octopus-a)
|
||||
initial
|
||||
EOF
|
||||
|
||||
git log --decorate=full --pretty="tformat:%f%d" \
|
||||
--simplify-by-decoration \
|
||||
--decorate-refs-exclude="heads/octopus" \
|
||||
--decorate-refs="heads" \
|
||||
--clear-decorations \
|
||||
--decorate-refs-exclude="tags/" \
|
||||
--decorate-refs="heads/octopus*" >actual &&
|
||||
test_cmp expect.filtered actual
|
||||
'
|
||||
|
||||
test_expect_success 'log.decorate config parsing' '
|
||||
git log --oneline --decorate=full >expect.full &&
|
||||
git log --oneline --decorate=short >expect.short &&
|
||||
@ -2192,6 +2304,20 @@ test_expect_success 'log --decorate includes all levels of tag annotated tags' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'log --decorate does not include things outside filter' '
|
||||
reflist="refs/prefetch refs/rebase-merge refs/bundle" &&
|
||||
|
||||
for ref in $reflist
|
||||
do
|
||||
git update-ref $ref/fake HEAD || return 1
|
||||
done &&
|
||||
|
||||
git log --decorate=full --oneline >actual &&
|
||||
|
||||
# None of the refs are visible:
|
||||
! grep /fake actual
|
||||
'
|
||||
|
||||
test_expect_success 'log --end-of-options' '
|
||||
git update-ref refs/heads/--source HEAD &&
|
||||
git log --end-of-options --source >actual &&
|
||||
|
Reference in New Issue
Block a user