diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
commit | 93ba78d6f4632ef1c5228965e3edc8c0faf88c1e (patch) | |
tree | 85730c182a9f5f492ade8e8ccdb1c2356f9900bd /third_party/git/t/t4202-log.sh | |
parent | 6f8fbf4aa4b1654ab27d4829e114538761817de0 (diff) |
revert(3p/git): Revert merge of git upstream at v2.26.2 r/852
This causes cgit to serve error pages, which is undesirable. This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing changes made to f2b211131f2347342dde63975b09cf603149f1a3.
Diffstat (limited to 'third_party/git/t/t4202-log.sh')
-rwxr-xr-x | third_party/git/t/t4202-log.sh | 244 |
1 files changed, 103 insertions, 141 deletions
diff --git a/third_party/git/t/t4202-log.sh b/third_party/git/t/t4202-log.sh index 0f766ba65f59..c20209324c8e 100755 --- a/third_party/git/t/t4202-log.sh +++ b/third_party/git/t/t4202-log.sh @@ -5,11 +5,6 @@ test_description='git log' . ./test-lib.sh . "$TEST_DIRECTORY/lib-gpg.sh" . "$TEST_DIRECTORY/lib-terminal.sh" -. "$TEST_DIRECTORY/lib-log-graph.sh" - -test_cmp_graph () { - lib_test_cmp_graph --format=%s "$@" -} test_expect_success setup ' @@ -92,12 +87,12 @@ test_expect_success 'format %w(,1,2)' ' ' cat > expect << EOF -$(git rev-parse --short :/sixth ) sixth -$(git rev-parse --short :/fifth ) fifth -$(git rev-parse --short :/fourth ) fourth -$(git rev-parse --short :/third ) third -$(git rev-parse --short :/second ) second -$(git rev-parse --short :/initial) initial +804a787 sixth +394ef78 fifth +5d31159 fourth +2fbe8c0 third +f7dab8e second +3a2fdcb initial EOF test_expect_success 'oneline' ' @@ -178,45 +173,43 @@ test_expect_success 'git config log.follow is overridden by --no-follow' ' verbose test "$actual" = "$expect" ' -# Note that these commits are intentionally listed out of order. -last_three="$(git rev-parse :/fourth :/sixth :/fifth)" cat > expect << EOF -$(git rev-parse --short :/sixth ) sixth -$(git rev-parse --short :/fifth ) fifth -$(git rev-parse --short :/fourth) fourth +804a787 sixth +394ef78 fifth +5d31159 fourth EOF test_expect_success 'git log --no-walk <commits> sorts by commit time' ' - git log --no-walk --oneline $last_three > actual && + git log --no-walk --oneline 5d31159 804a787 394ef78 > actual && test_cmp expect actual ' test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' ' - git log --no-walk=sorted --oneline $last_three > actual && + git log --no-walk=sorted --oneline 5d31159 804a787 394ef78 > actual && test_cmp expect actual ' cat > expect << EOF -=== $(git rev-parse --short :/sixth ) sixth -=== $(git rev-parse --short :/fifth ) fifth -=== $(git rev-parse --short :/fourth) fourth +=== 804a787 sixth +=== 394ef78 fifth +=== 5d31159 fourth EOF test_expect_success 'git log --line-prefix="=== " --no-walk <commits> sorts by commit time' ' - git log --line-prefix="=== " --no-walk --oneline $last_three > actual && + git log --line-prefix="=== " --no-walk --oneline 5d31159 804a787 394ef78 > actual && test_cmp expect actual ' cat > expect << EOF -$(git rev-parse --short :/fourth) fourth -$(git rev-parse --short :/sixth ) sixth -$(git rev-parse --short :/fifth ) fifth +5d31159 fourth +804a787 sixth +394ef78 fifth EOF test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' ' - git log --no-walk=unsorted --oneline $last_three > actual && + git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual && test_cmp expect actual ' test_expect_success 'git show <commits> leaves list of commits as given' ' - git show --oneline -s $last_three > actual && + git show --oneline -s 5d31159 804a787 394ef78 > actual && test_cmp expect actual ' @@ -457,7 +450,8 @@ cat > expect <<EOF EOF test_expect_success 'simple log --graph' ' - test_cmp_graph + git log --graph --pretty=tformat:%s >actual && + test_cmp expect actual ' cat > expect <<EOF @@ -471,7 +465,8 @@ cat > expect <<EOF EOF test_expect_success 'simple log --graph --line-prefix="123 "' ' - test_cmp_graph --line-prefix="123 " + git log --graph --line-prefix="123 " --pretty=tformat:%s >actual && + test_cmp expect actual ' test_expect_success 'set up merge history' ' @@ -498,7 +493,9 @@ cat > expect <<\EOF EOF test_expect_success 'log --graph with merge' ' - test_cmp_graph --date-order + git log --graph --date-order --pretty=tformat:%s | + sed "s/ *\$//" >actual && + test_cmp expect actual ' cat > expect <<\EOF @@ -517,7 +514,9 @@ cat > expect <<\EOF EOF test_expect_success 'log --graph --line-prefix="| | | " with merge' ' - test_cmp_graph --line-prefix="| | | " --date-order + git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s | + sed "s/ *\$//" >actual && + test_cmp expect actual ' cat > expect.colors <<\EOF @@ -537,7 +536,9 @@ EOF test_expect_success 'log --graph with merge with log.graphColors' ' test_config log.graphColors " blue,invalid-color, cyan, red , " && - lib_test_cmp_colored_graph --date-order --format=%s + git log --color=always --graph --date-order --pretty=tformat:%s | + test_decode_color | sed "s/ *\$//" >actual && + test_cmp expect.colors actual ' test_expect_success 'log --raw --graph -m with merge' ' @@ -666,14 +667,16 @@ cat > expect <<\EOF * | | fifth * | | fourth |/ / -* / third +* | third |/ * second * initial EOF test_expect_success 'log --graph with merge' ' - test_cmp_graph --date-order + git log --graph --date-order --pretty=tformat:%s | + sed "s/ *\$//" >actual && + test_cmp expect actual ' test_expect_success 'log.decorate configuration' ' @@ -834,21 +837,6 @@ test_expect_success 'decorate-refs and decorate-refs-exclude' ' test_cmp expect.decorate actual ' -test_expect_success 'decorate-refs-exclude and simplify-by-decoration' ' - cat >expect.decorate <<-\EOF && - Merge-tag-reach (HEAD -> master) - reach (tag: reach, reach) - seventh (tag: seventh) - Merge-branch-tangle - 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 -' - test_expect_success 'log.decorate config parsing' ' git log --oneline --decorate=full >expect.full && git log --oneline --decorate=short >expect.short && @@ -954,7 +942,7 @@ cat >expect <<\EOF | | | | diff --git a/reach.t b/reach.t | | new file mode 100644 -| | index BEFORE..AFTER +| | index 0000000..10c9591 | | --- /dev/null | | +++ b/reach.t | | @@ -0,0 +1 @@ @@ -977,7 +965,7 @@ cat >expect <<\EOF | | | | | | diff --git a/octopus-b.t b/octopus-b.t | | | new file mode 100644 -| | | index BEFORE..AFTER +| | | index 0000000..d5fcad0 | | | --- /dev/null | | | +++ b/octopus-b.t | | | @@ -0,0 +1 @@ @@ -993,7 +981,7 @@ cat >expect <<\EOF | | | | diff --git a/octopus-a.t b/octopus-a.t | | new file mode 100644 -| | index BEFORE..AFTER +| | index 0000000..11ee015 | | --- /dev/null | | +++ b/octopus-a.t | | @@ -0,0 +1 @@ @@ -1009,7 +997,7 @@ cat >expect <<\EOF | | diff --git a/seventh.t b/seventh.t | new file mode 100644 -| index BEFORE..AFTER +| index 0000000..9744ffc | --- /dev/null | +++ b/seventh.t | @@ -0,0 +1 @@ @@ -1043,7 +1031,7 @@ cat >expect <<\EOF | | | | | | | | diff --git a/tangle-a b/tangle-a | | | | new file mode 100644 -| | | | index BEFORE..AFTER +| | | | index 0000000..7898192 | | | | --- /dev/null | | | | +++ b/tangle-a | | | | @@ -0,0 +1 @@ @@ -1065,7 +1053,7 @@ cat >expect <<\EOF | | | | | | | | diff --git a/2 b/2 | | | | new file mode 100644 -| | | | index BEFORE..AFTER +| | | | index 0000000..0cfbf08 | | | | --- /dev/null | | | | +++ b/2 | | | | @@ -0,0 +1 @@ @@ -1081,7 +1069,7 @@ cat >expect <<\EOF | | | | | | | | diff --git a/1 b/1 | | | | new file mode 100644 -| | | | index BEFORE..AFTER +| | | | index 0000000..d00491f | | | | --- /dev/null | | | | +++ b/1 | | | | @@ -0,0 +1 @@ @@ -1097,7 +1085,7 @@ cat >expect <<\EOF | | | | | | | | diff --git a/one b/one | | | | new file mode 100644 -| | | | index BEFORE..AFTER +| | | | index 0000000..9a33383 | | | | --- /dev/null | | | | +++ b/one | | | | @@ -0,0 +1 @@ @@ -1113,7 +1101,7 @@ cat >expect <<\EOF | | | | | | diff --git a/a/two b/a/two | | | deleted file mode 100644 -| | | index BEFORE..AFTER +| | | index 9245af5..0000000 | | | --- a/a/two | | | +++ /dev/null | | | @@ -1 +0,0 @@ @@ -1129,7 +1117,7 @@ cat >expect <<\EOF | | | | | | diff --git a/a/two b/a/two | | | new file mode 100644 -| | | index BEFORE..AFTER +| | | index 0000000..9245af5 | | | --- /dev/null | | | +++ b/a/two | | | @@ -0,0 +1 @@ @@ -1145,7 +1133,7 @@ cat >expect <<\EOF | | | | diff --git a/ein b/ein | | new file mode 100644 -| | index BEFORE..AFTER +| | index 0000000..9d7e69f | | --- /dev/null | | +++ b/ein | | @@ -0,0 +1 @@ @@ -1162,14 +1150,14 @@ cat >expect <<\EOF | | diff --git a/ichi b/ichi | new file mode 100644 -| index BEFORE..AFTER +| index 0000000..9d7e69f | --- /dev/null | +++ b/ichi | @@ -0,0 +1 @@ | +ichi | diff --git a/one b/one | deleted file mode 100644 -| index BEFORE..AFTER +| index 9d7e69f..0000000 | --- a/one | +++ /dev/null | @@ -1 +0,0 @@ @@ -1184,7 +1172,7 @@ cat >expect <<\EOF | 1 file changed, 1 insertion(+), 1 deletion(-) | | diff --git a/one b/one -| index BEFORE..AFTER 100644 +| index 5626abf..9d7e69f 100644 | --- a/one | +++ b/one | @@ -1 +1 @@ @@ -1201,15 +1189,30 @@ cat >expect <<\EOF diff --git a/one b/one new file mode 100644 - index BEFORE..AFTER + index 0000000..5626abf --- /dev/null +++ b/one @@ -0,0 +1 @@ +one EOF +sanitize_output () { + sed -e 's/ *$//' \ + -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \ + -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \ + -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \ + -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \ + -e 's/, 0 deletions(-)//' \ + -e 's/, 0 insertions(+)//' \ + -e 's/ 1 files changed, / 1 file changed, /' \ + -e 's/, 1 deletions(-)/, 1 deletion(-)/' \ + -e 's/, 1 insertions(+)/, 1 insertion(+)/' +} + test_expect_success 'log --graph with diff and stats' ' - lib_test_cmp_short_graph --no-renames --stat -p + git log --no-renames --graph --pretty=short --stat -p >actual && + sanitize_output >actual.sanitized <actual && + test_i18ncmp expect actual.sanitized ' cat >expect <<\EOF @@ -1229,7 +1232,7 @@ cat >expect <<\EOF *** | | *** | | diff --git a/reach.t b/reach.t *** | | new file mode 100644 -*** | | index BEFORE..AFTER +*** | | index 0000000..10c9591 *** | | --- /dev/null *** | | +++ b/reach.t *** | | @@ -0,0 +1 @@ @@ -1252,7 +1255,7 @@ cat >expect <<\EOF *** | | | *** | | | diff --git a/octopus-b.t b/octopus-b.t *** | | | new file mode 100644 -*** | | | index BEFORE..AFTER +*** | | | index 0000000..d5fcad0 *** | | | --- /dev/null *** | | | +++ b/octopus-b.t *** | | | @@ -0,0 +1 @@ @@ -1268,7 +1271,7 @@ cat >expect <<\EOF *** | | *** | | diff --git a/octopus-a.t b/octopus-a.t *** | | new file mode 100644 -*** | | index BEFORE..AFTER +*** | | index 0000000..11ee015 *** | | --- /dev/null *** | | +++ b/octopus-a.t *** | | @@ -0,0 +1 @@ @@ -1284,7 +1287,7 @@ cat >expect <<\EOF *** | *** | diff --git a/seventh.t b/seventh.t *** | new file mode 100644 -*** | index BEFORE..AFTER +*** | index 0000000..9744ffc *** | --- /dev/null *** | +++ b/seventh.t *** | @@ -0,0 +1 @@ @@ -1318,7 +1321,7 @@ cat >expect <<\EOF *** | | | | *** | | | | diff --git a/tangle-a b/tangle-a *** | | | | new file mode 100644 -*** | | | | index BEFORE..AFTER +*** | | | | index 0000000..7898192 *** | | | | --- /dev/null *** | | | | +++ b/tangle-a *** | | | | @@ -0,0 +1 @@ @@ -1340,7 +1343,7 @@ cat >expect <<\EOF *** | | | | *** | | | | diff --git a/2 b/2 *** | | | | new file mode 100644 -*** | | | | index BEFORE..AFTER +*** | | | | index 0000000..0cfbf08 *** | | | | --- /dev/null *** | | | | +++ b/2 *** | | | | @@ -0,0 +1 @@ @@ -1356,7 +1359,7 @@ cat >expect <<\EOF *** | | | | *** | | | | diff --git a/1 b/1 *** | | | | new file mode 100644 -*** | | | | index BEFORE..AFTER +*** | | | | index 0000000..d00491f *** | | | | --- /dev/null *** | | | | +++ b/1 *** | | | | @@ -0,0 +1 @@ @@ -1372,7 +1375,7 @@ cat >expect <<\EOF *** | | | | *** | | | | diff --git a/one b/one *** | | | | new file mode 100644 -*** | | | | index BEFORE..AFTER +*** | | | | index 0000000..9a33383 *** | | | | --- /dev/null *** | | | | +++ b/one *** | | | | @@ -0,0 +1 @@ @@ -1388,7 +1391,7 @@ cat >expect <<\EOF *** | | | *** | | | diff --git a/a/two b/a/two *** | | | deleted file mode 100644 -*** | | | index BEFORE..AFTER +*** | | | index 9245af5..0000000 *** | | | --- a/a/two *** | | | +++ /dev/null *** | | | @@ -1 +0,0 @@ @@ -1404,7 +1407,7 @@ cat >expect <<\EOF *** | | | *** | | | diff --git a/a/two b/a/two *** | | | new file mode 100644 -*** | | | index BEFORE..AFTER +*** | | | index 0000000..9245af5 *** | | | --- /dev/null *** | | | +++ b/a/two *** | | | @@ -0,0 +1 @@ @@ -1420,7 +1423,7 @@ cat >expect <<\EOF *** | | *** | | diff --git a/ein b/ein *** | | new file mode 100644 -*** | | index BEFORE..AFTER +*** | | index 0000000..9d7e69f *** | | --- /dev/null *** | | +++ b/ein *** | | @@ -0,0 +1 @@ @@ -1437,14 +1440,14 @@ cat >expect <<\EOF *** | *** | diff --git a/ichi b/ichi *** | new file mode 100644 -*** | index BEFORE..AFTER +*** | index 0000000..9d7e69f *** | --- /dev/null *** | +++ b/ichi *** | @@ -0,0 +1 @@ *** | +ichi *** | diff --git a/one b/one *** | deleted file mode 100644 -*** | index BEFORE..AFTER +*** | index 9d7e69f..0000000 *** | --- a/one *** | +++ /dev/null *** | @@ -1 +0,0 @@ @@ -1459,7 +1462,7 @@ cat >expect <<\EOF *** | 1 file changed, 1 insertion(+), 1 deletion(-) *** | *** | diff --git a/one b/one -*** | index BEFORE..AFTER 100644 +*** | index 5626abf..9d7e69f 100644 *** | --- a/one *** | +++ b/one *** | @@ -1 +1 @@ @@ -1476,7 +1479,7 @@ cat >expect <<\EOF *** *** diff --git a/one b/one *** new file mode 100644 -*** index BEFORE..AFTER +*** index 0000000..5626abf *** --- /dev/null *** +++ b/one *** @@ -0,0 +1 @@ @@ -1484,7 +1487,9 @@ cat >expect <<\EOF EOF test_expect_success 'log --line-prefix="*** " --graph with diff and stats' ' - lib_test_cmp_short_graph --line-prefix="*** " --no-renames --stat -p + git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual && + sanitize_output >actual.sanitized <actual && + test_i18ncmp expect actual.sanitized ' cat >expect <<-\EOF @@ -1506,7 +1511,9 @@ cat >expect <<-\EOF EOF test_expect_success 'log --graph with --name-status' ' - test_cmp_graph --name-status tangle..reach + git log --graph --format=%s --name-status tangle..reach >actual && + sanitize_output <actual >actual.sanitized && + test_cmp expect actual.sanitized ' cat >expect <<-\EOF @@ -1528,7 +1535,9 @@ cat >expect <<-\EOF EOF test_expect_success 'log --graph with --name-only' ' - test_cmp_graph --name-only tangle..reach + git log --graph --format=%s --name-only tangle..reach >actual && + sanitize_output <actual >actual.sanitized && + test_cmp expect actual.sanitized ' test_expect_success 'dotdot is a parent directory' ' @@ -1546,14 +1555,6 @@ test_expect_success GPG 'setup signed branch' ' git commit -S -m signed_commit ' -test_expect_success GPG 'setup signed branch with subkey' ' - test_when_finished "git reset --hard && git checkout master" && - git checkout -b signed-subkey master && - echo foo >foo && - git add foo && - git commit -SB7227189 -m signed_commit -' - test_expect_success GPGSM 'setup signed branch x509' ' test_when_finished "git reset --hard && git checkout master" && git checkout -b signed-x509 master && @@ -1564,18 +1565,6 @@ test_expect_success GPGSM 'setup signed branch x509' ' git commit -S -m signed_commit ' -test_expect_success GPGSM 'log x509 fingerprint' ' - echo "F8BF62E0693D0694816377099909C779FA23FD65 | " >expect && - git log -n1 --format="%GF | %GP" signed-x509 >actual && - test_cmp expect actual -' - -test_expect_success GPGSM 'log OpenPGP fingerprint' ' - echo "D4BE22311AD3131E5EDA29A461092E85B7227189" > expect && - git log -n1 --format="%GP" signed-subkey >actual && - test_cmp expect actual -' - test_expect_success GPG 'log --graph --show-signature' ' git log --graph --show-signature -n1 signed >actual && grep "^| gpg: Signature made" actual && @@ -1607,26 +1596,6 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' ' grep "^| | gpg: Good signature" actual ' -test_expect_success GPG 'log --graph --show-signature for merged tag in shallow clone' ' - test_when_finished "git reset --hard && git checkout master" && - git checkout -b plain-shallow master && - echo aaa >bar && - git add bar && - git commit -m bar_commit && - git checkout --detach master && - echo bbb >baz && - git add baz && - git commit -m baz_commit && - git tag -s -m signed_tag_msg signed_tag_shallow && - hash=$(git rev-parse HEAD) && - git checkout plain-shallow && - git merge --no-ff -m msg signed_tag_shallow && - git clone --depth 1 --no-local . shallow && - test_when_finished "rm -rf shallow" && - git -C shallow log --graph --show-signature -n1 plain-shallow >actual && - grep "tag signed_tag_shallow names a non-parent $hash" 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 && @@ -1705,10 +1674,10 @@ test_expect_success 'set up --source tests' ' ' test_expect_success 'log --source paints branch names' ' - cat >expect <<-EOF && - $(git rev-parse --short :/three) source-b three - $(git rev-parse --short :/two ) source-a two - $(git rev-parse --short :/one ) source-b one + cat >expect <<-\EOF && + 09e12a9 source-b three + 8e393e1 source-a two + 1ac6c77 source-b one EOF git log --oneline --source source-a source-b >actual && test_cmp expect actual @@ -1716,19 +1685,19 @@ test_expect_success 'log --source paints branch names' ' test_expect_success 'log --source paints tag names' ' git tag -m tagged source-tag && - cat >expect <<-EOF && - $(git rev-parse --short :/three) source-tag three - $(git rev-parse --short :/two ) source-a two - $(git rev-parse --short :/one ) source-tag one + cat >expect <<-\EOF && + 09e12a9 source-tag three + 8e393e1 source-a two + 1ac6c77 source-tag one EOF git log --oneline --source source-tag source-a >actual && test_cmp expect actual ' test_expect_success 'log --source paints symmetric ranges' ' - cat >expect <<-EOF && - $(git rev-parse --short :/three) source-b three - $(git rev-parse --short :/two ) source-a two + cat >expect <<-\EOF && + 09e12a9 source-b three + 8e393e1 source-a two EOF git log --oneline --source source-a...source-b >actual && test_cmp expect actual @@ -1738,11 +1707,4 @@ test_expect_success '--exclude-promisor-objects does not BUG-crash' ' test_must_fail git log --exclude-promisor-objects source-a ' -test_expect_success 'log --end-of-options' ' - git update-ref refs/heads/--source HEAD && - git log --end-of-options --source >actual && - git log >expect && - test_cmp expect actual -' - test_done |