summaryrefslogtreecommitdiff
path: root/t/t4202-log.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t4202-log.sh')
-rwxr-xr-xt/t4202-log.sh220
1 files changed, 187 insertions, 33 deletions
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 0f766ba65f..fd9af658af 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -483,7 +483,7 @@ test_expect_success 'set up merge history' '
'
cat > expect <<\EOF
-* Merge branch 'side'
+* Merge branch 'side' into master
|\
| * side-2
| * side-1
@@ -502,7 +502,7 @@ test_expect_success 'log --graph with merge' '
'
cat > expect <<\EOF
-| | | * Merge branch 'side'
+| | | * Merge branch 'side' into master
| | | |\
| | | | * side-2
| | | | * side-1
@@ -521,7 +521,7 @@ test_expect_success 'log --graph --line-prefix="| | | " with merge' '
'
cat > expect.colors <<\EOF
-* Merge branch 'side'
+* Merge branch 'side' into master
<BLUE>|<RESET><CYAN>\<RESET>
<BLUE>|<RESET> * side-2
<BLUE>|<RESET> * side-1
@@ -555,7 +555,7 @@ cat > expect <<\EOF
|\ Merge: A B
| | Author: A U Thor <author@example.com>
| |
-| | Merge branch 'side'
+| | Merge branch 'side' into master
| |
| * commit tags/side-2
| | Author: A U Thor <author@example.com>
@@ -632,11 +632,11 @@ test_expect_success 'set up more tangled history' '
'
cat > expect <<\EOF
-* Merge tag 'reach'
+* Merge tag 'reach' into master
|\
| \
| \
-*-. \ Merge tags 'octopus-a' and 'octopus-b'
+*-. \ Merge tags 'octopus-a' and 'octopus-b' into master
|\ \ \
* | | | seventh
| | * | octopus-b
@@ -646,14 +646,14 @@ cat > expect <<\EOF
|/ /
| * reach
|/
-* Merge branch 'tangle'
+* Merge branch 'tangle' into master
|\
| * Merge branch 'side' (early part) into tangle
| |\
| * \ Merge branch 'master' (early part) into tangle
| |\ \
| * | | tangle-a
-* | | | Merge branch 'side'
+* | | | Merge branch 'side' into master
|\ \ \ \
| * | | | side-2
| | |_|/
@@ -735,22 +735,38 @@ test_expect_success 'log.decorate configuration' '
test_expect_success 'decorate-refs with glob' '
cat >expect.decorate <<-\EOF &&
- Merge-tag-reach
- Merge-tags-octopus-a-and-octopus-b
+ Merge-tag-reach-into-master
+ Merge-tags-octopus-a-and-octopus-b-into-master
seventh
octopus-b (octopus-b)
octopus-a (octopus-a)
reach
EOF
+ cat >expect.no-decorate <<-\EOF &&
+ Merge-tag-reach-into-master
+ Merge-tags-octopus-a-and-octopus-b-into-master
+ seventh
+ octopus-b
+ octopus-a
+ reach
+ EOF
git log -n6 --decorate=short --pretty="tformat:%f%d" \
--decorate-refs="heads/octopus*" >actual &&
+ test_cmp expect.decorate actual &&
+ git log -n6 --decorate=short --pretty="tformat:%f%d" \
+ --decorate-refs-exclude="heads/octopus*" \
+ --decorate-refs="heads/octopus*" >actual &&
+ test_cmp expect.no-decorate actual &&
+ git -c log.excludeDecoration="heads/octopus*" log \
+ -n6 --decorate=short --pretty="tformat:%f%d" \
+ --decorate-refs="heads/octopus*" >actual &&
test_cmp expect.decorate actual
'
test_expect_success 'decorate-refs without globs' '
cat >expect.decorate <<-\EOF &&
- Merge-tag-reach
- Merge-tags-octopus-a-and-octopus-b
+ Merge-tag-reach-into-master
+ Merge-tags-octopus-a-and-octopus-b-into-master
seventh
octopus-b
octopus-a
@@ -763,8 +779,8 @@ test_expect_success 'decorate-refs without globs' '
test_expect_success 'multiple decorate-refs' '
cat >expect.decorate <<-\EOF &&
- Merge-tag-reach
- Merge-tags-octopus-a-and-octopus-b
+ Merge-tag-reach-into-master
+ Merge-tags-octopus-a-and-octopus-b-into-master
seventh
octopus-b (octopus-b)
octopus-a (octopus-a)
@@ -778,8 +794,8 @@ test_expect_success 'multiple decorate-refs' '
test_expect_success 'decorate-refs-exclude with glob' '
cat >expect.decorate <<-\EOF &&
- Merge-tag-reach (HEAD -> master)
- Merge-tags-octopus-a-and-octopus-b
+ Merge-tag-reach-into-master (HEAD -> master)
+ Merge-tags-octopus-a-and-octopus-b-into-master
seventh (tag: seventh)
octopus-b (tag: octopus-b)
octopus-a (tag: octopus-a)
@@ -787,13 +803,16 @@ test_expect_success 'decorate-refs-exclude with glob' '
EOF
git log -n6 --decorate=short --pretty="tformat:%f%d" \
--decorate-refs-exclude="heads/octopus*" >actual &&
+ test_cmp expect.decorate actual &&
+ git -c log.excludeDecoration="heads/octopus*" log \
+ -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
test_cmp expect.decorate actual
'
test_expect_success 'decorate-refs-exclude without globs' '
cat >expect.decorate <<-\EOF &&
- Merge-tag-reach (HEAD -> master)
- Merge-tags-octopus-a-and-octopus-b
+ Merge-tag-reach-into-master (HEAD -> master)
+ Merge-tags-octopus-a-and-octopus-b-into-master
seventh (tag: seventh)
octopus-b (tag: octopus-b, octopus-b)
octopus-a (tag: octopus-a, octopus-a)
@@ -801,13 +820,16 @@ test_expect_success 'decorate-refs-exclude without globs' '
EOF
git log -n6 --decorate=short --pretty="tformat:%f%d" \
--decorate-refs-exclude="tags/reach" >actual &&
+ test_cmp expect.decorate actual &&
+ git -c log.excludeDecoration="tags/reach" log \
+ -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
test_cmp expect.decorate actual
'
test_expect_success 'multiple decorate-refs-exclude' '
cat >expect.decorate <<-\EOF &&
- Merge-tag-reach (HEAD -> master)
- Merge-tags-octopus-a-and-octopus-b
+ Merge-tag-reach-into-master (HEAD -> master)
+ Merge-tags-octopus-a-and-octopus-b-into-master
seventh (tag: seventh)
octopus-b (tag: octopus-b)
octopus-a (tag: octopus-a)
@@ -816,13 +838,21 @@ test_expect_success 'multiple decorate-refs-exclude' '
git log -n6 --decorate=short --pretty="tformat:%f%d" \
--decorate-refs-exclude="heads/octopus*" \
--decorate-refs-exclude="tags/reach" >actual &&
+ test_cmp expect.decorate actual &&
+ git -c log.excludeDecoration="heads/octopus*" \
+ -c log.excludeDecoration="tags/reach" log \
+ -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
+ test_cmp expect.decorate actual &&
+ git -c log.excludeDecoration="heads/octopus*" log \
+ --decorate-refs-exclude="tags/reach" \
+ -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
test_cmp expect.decorate actual
'
test_expect_success 'decorate-refs and decorate-refs-exclude' '
- cat >expect.decorate <<-\EOF &&
- Merge-tag-reach (master)
- Merge-tags-octopus-a-and-octopus-b
+ cat >expect.no-decorate <<-\EOF &&
+ Merge-tag-reach-into-master (master)
+ Merge-tags-octopus-a-and-octopus-b-into-master
seventh
octopus-b
octopus-a
@@ -831,21 +861,40 @@ test_expect_success 'decorate-refs and decorate-refs-exclude' '
git log -n6 --decorate=short --pretty="tformat:%f%d" \
--decorate-refs="heads/*" \
--decorate-refs-exclude="heads/oc*" >actual &&
+ test_cmp expect.no-decorate actual
+'
+
+test_expect_success 'deocrate-refs and log.excludeDecoration' '
+ cat >expect.decorate <<-\EOF &&
+ Merge-tag-reach-into-master (master)
+ Merge-tags-octopus-a-and-octopus-b-into-master
+ seventh
+ octopus-b (octopus-b)
+ octopus-a (octopus-a)
+ reach (reach)
+ EOF
+ git -c log.excludeDecoration="heads/oc*" log \
+ --decorate-refs="heads/*" \
+ -n6 --decorate=short --pretty="tformat:%f%d" >actual &&
test_cmp expect.decorate actual
'
test_expect_success 'decorate-refs-exclude and simplify-by-decoration' '
cat >expect.decorate <<-\EOF &&
- Merge-tag-reach (HEAD -> master)
+ Merge-tag-reach-into-master (HEAD -> master)
reach (tag: reach, reach)
seventh (tag: seventh)
- Merge-branch-tangle
+ Merge-branch-tangle-into-master
Merge-branch-side-early-part-into-tangle (tangle)
tangle-a (tag: tangle-a)
EOF
git log -n6 --decorate=short --pretty="tformat:%f%d" \
--decorate-refs-exclude="*octopus*" \
--simplify-by-decoration >actual &&
+ test_cmp expect.decorate actual &&
+ git -c log.excludeDecoration="*octopus*" log \
+ -n6 --decorate=short --pretty="tformat:%f%d" \
+ --simplify-by-decoration >actual &&
test_cmp expect.decorate actual
'
@@ -1019,7 +1068,7 @@ cat >expect <<\EOF
|\ Merge: MERGE_PARENTS
| | Author: A U Thor <author@example.com>
| |
-| | Merge branch 'tangle'
+| | Merge branch 'tangle' into master
| |
| * commit COMMIT_OBJECT_NAME
| |\ Merge: MERGE_PARENTS
@@ -1053,7 +1102,7 @@ cat >expect <<\EOF
|\ \ \ \ Merge: MERGE_PARENTS
| | | | | Author: A U Thor <author@example.com>
| | | | |
-| | | | | Merge branch 'side'
+| | | | | Merge branch 'side' into master
| | | | |
| * | | | commit COMMIT_OBJECT_NAME
| | |_|/ Author: A U Thor <author@example.com>
@@ -1294,7 +1343,7 @@ cat >expect <<\EOF
*** |\ Merge: MERGE_PARENTS
*** | | Author: A U Thor <author@example.com>
*** | |
-*** | | Merge branch 'tangle'
+*** | | Merge branch 'tangle' into master
*** | |
*** | * commit COMMIT_OBJECT_NAME
*** | |\ Merge: MERGE_PARENTS
@@ -1328,7 +1377,7 @@ cat >expect <<\EOF
*** |\ \ \ \ Merge: MERGE_PARENTS
*** | | | | | Author: A U Thor <author@example.com>
*** | | | | |
-*** | | | | | Merge branch 'side'
+*** | | | | | Merge branch 'side' into master
*** | | | | |
*** | * | | | commit COMMIT_OBJECT_NAME
*** | | |_|/ Author: A U Thor <author@example.com>
@@ -1491,8 +1540,8 @@ cat >expect <<-\EOF
* reach
|
| A reach.t
-* Merge branch 'tangle'
-* Merge branch 'side'
+* Merge branch 'tangle' into master
+* Merge branch 'side' into master
|\
| * side-2
|
@@ -1513,8 +1562,8 @@ cat >expect <<-\EOF
* reach
|
| reach.t
-* Merge branch 'tangle'
-* Merge branch 'side'
+* Merge branch 'tangle' into master
+* Merge branch 'side' into master
|\
| * side-2
|
@@ -1627,6 +1676,66 @@ test_expect_success GPG 'log --graph --show-signature for merged tag in shallow
grep "tag signed_tag_shallow names a non-parent $hash" actual
'
+test_expect_success GPG 'log --graph --show-signature for merged tag with missing key' '
+ test_when_finished "git reset --hard && git checkout master" &&
+ git checkout -b plain-nokey master &&
+ echo aaa >bar &&
+ git add bar &&
+ git commit -m bar_commit &&
+ git checkout -b tagged-nokey master &&
+ echo bbb >baz &&
+ git add baz &&
+ git commit -m baz_commit &&
+ git tag -s -m signed_tag_msg signed_tag_nokey &&
+ git checkout plain-nokey &&
+ git merge --no-ff -m msg signed_tag_nokey &&
+ GNUPGHOME=. git log --graph --show-signature -n1 plain-nokey >actual &&
+ grep "^|\\\ merged tag" actual &&
+ grep "^| | gpg: Signature made" actual &&
+ grep -E "^| | gpg: Can'"'"'t check signature: (public key not found|No public key)" actual
+'
+
+test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' '
+ test_when_finished "git reset --hard && git checkout master" &&
+ git checkout -b plain-bad master &&
+ echo aaa >bar &&
+ git add bar &&
+ git commit -m bar_commit &&
+ git checkout -b tagged-bad master &&
+ echo bbb >baz &&
+ git add baz &&
+ git commit -m baz_commit &&
+ git tag -s -m signed_tag_msg signed_tag_bad &&
+ git cat-file tag signed_tag_bad >raw &&
+ sed -e "s/signed_tag_msg/forged/" raw >forged &&
+ git hash-object -w -t tag forged >forged.tag &&
+ git checkout plain-bad &&
+ git merge --no-ff -m msg "$(cat forged.tag)" &&
+ git log --graph --show-signature -n1 plain-bad >actual &&
+ grep "^|\\\ merged tag" actual &&
+ grep "^| | gpg: Signature made" actual &&
+ grep "^| | gpg: BAD signature from" actual
+'
+
+test_expect_success GPG 'log --show-signature for merged tag with GPG failure' '
+ test_when_finished "git reset --hard && git checkout master" &&
+ git checkout -b plain-fail master &&
+ echo aaa >bar &&
+ git add bar &&
+ git commit -m bar_commit &&
+ git checkout -b tagged-fail master &&
+ echo bbb >baz &&
+ git add baz &&
+ git commit -m baz_commit &&
+ git tag -s -m signed_tag_msg signed_tag_fail &&
+ git checkout plain-fail &&
+ git merge --no-ff -m msg signed_tag_fail &&
+ TMPDIR="$(pwd)/bogus" git log --show-signature -n1 plain-fail >actual &&
+ grep "^merged tag" actual &&
+ grep "^No signature" actual &&
+ ! grep "^gpg: Signature made" actual
+'
+
test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
test_when_finished "git reset --hard && git checkout master" &&
test_config gpg.format x509 &&
@@ -1648,6 +1757,51 @@ test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
grep "^| | gpgsm: Good signature" actual
'
+test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 missing key' '
+ test_when_finished "git reset --hard && git checkout master" &&
+ test_config gpg.format x509 &&
+ test_config user.signingkey $GIT_COMMITTER_EMAIL &&
+ git checkout -b plain-x509-nokey master &&
+ echo aaa >bar &&
+ git add bar &&
+ git commit -m bar_commit &&
+ git checkout -b tagged-x509-nokey master &&
+ echo bbb >baz &&
+ git add baz &&
+ git commit -m baz_commit &&
+ git tag -s -m signed_tag_msg signed_tag_x509_nokey &&
+ git checkout plain-x509-nokey &&
+ git merge --no-ff -m msg signed_tag_x509_nokey &&
+ GNUPGHOME=. git log --graph --show-signature -n1 plain-x509-nokey >actual &&
+ grep "^|\\\ merged tag" actual &&
+ grep "^| | gpgsm: certificate not found" actual
+'
+
+test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 bad signature' '
+ test_when_finished "git reset --hard && git checkout master" &&
+ test_config gpg.format x509 &&
+ test_config user.signingkey $GIT_COMMITTER_EMAIL &&
+ git checkout -b plain-x509-bad master &&
+ echo aaa >bar &&
+ git add bar &&
+ git commit -m bar_commit &&
+ git checkout -b tagged-x509-bad master &&
+ echo bbb >baz &&
+ git add baz &&
+ git commit -m baz_commit &&
+ git tag -s -m signed_tag_msg signed_tag_x509_bad &&
+ git cat-file tag signed_tag_x509_bad >raw &&
+ sed -e "s/signed_tag_msg/forged/" raw >forged &&
+ git hash-object -w -t tag forged >forged.tag &&
+ git checkout plain-x509-bad &&
+ git merge --no-ff -m msg "$(cat forged.tag)" &&
+ git log --graph --show-signature -n1 plain-x509-bad >actual &&
+ grep "^|\\\ merged tag" actual &&
+ grep "^| | gpgsm: Signature made" actual &&
+ grep "^| | gpgsm: invalid signature" actual
+'
+
+
test_expect_success GPG '--no-show-signature overrides --show-signature' '
git log -1 --show-signature --no-show-signature signed >actual &&
! grep "^gpg:" actual