From 93ba78d6f4632ef1c5228965e3edc8c0faf88c1e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 26 May 2020 00:06:52 +0100 Subject: revert(3p/git): Revert merge of git upstream at v2.26.2 This causes cgit to serve error pages, which is undesirable. This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing changes made to f2b211131f2347342dde63975b09cf603149f1a3. --- third_party/git/t/README | 17 +- third_party/git/t/check-non-portable-shell.pl | 2 +- third_party/git/t/gitweb-lib.sh | 7 +- third_party/git/t/helper/.gitignore | 9 +- third_party/git/t/helper/test-config.c | 18 +- third_party/git/t/helper/test-date.c | 27 +- third_party/git/t/helper/test-drop-caches.c | 11 +- third_party/git/t/helper/test-dump-fsmonitor.c | 2 +- third_party/git/t/helper/test-hashmap.c | 50 +- .../git/t/helper/test-lazy-init-name-hash.c | 12 +- third_party/git/t/helper/test-parse-options.c | 2 - .../git/t/helper/test-parse-pathspec-file.c | 33 - third_party/git/t/helper/test-path-utils.c | 113 --- third_party/git/t/helper/test-progress.c | 81 -- third_party/git/t/helper/test-read-cache.c | 5 +- third_party/git/t/helper/test-read-graph.c | 53 - third_party/git/t/helper/test-run-command.c | 335 +------ third_party/git/t/helper/test-tool.c | 3 - third_party/git/t/helper/test-tool.h | 3 - third_party/git/t/helper/test-windows-named-pipe.c | 2 +- third_party/git/t/lib-bash.sh | 6 +- third_party/git/t/lib-credential.sh | 2 +- third_party/git/t/lib-git-daemon.sh | 2 +- third_party/git/t/lib-git-p4.sh | 2 +- third_party/git/t/lib-git-svn.sh | 4 +- third_party/git/t/lib-httpd.sh | 4 +- third_party/git/t/lib-httpd/apache.conf | 6 +- third_party/git/t/lib-httpd/apply-one-time-perl.sh | 27 - third_party/git/t/lib-httpd/apply-one-time-sed.sh | 22 + third_party/git/t/lib-log-graph.sh | 28 - third_party/git/t/lib-pack.sh | 35 +- third_party/git/t/lib-rebase.sh | 37 +- third_party/git/t/oid-info/hash-info | 9 - third_party/git/t/perf/aggregate.perl | 21 +- third_party/git/t/perf/bisect_regression | 2 +- third_party/git/t/perf/p5303-many-packs.sh | 19 - third_party/git/t/perf/p5310-pack-bitmaps.sh | 22 - third_party/git/t/perf/p5600-clone-reference.sh | 27 + third_party/git/t/perf/p5601-clone-reference.sh | 27 - third_party/git/t/perf/perf-lib.sh | 4 +- third_party/git/t/t0000-basic.sh | 123 +-- third_party/git/t/t0003-attributes.sh | 47 +- third_party/git/t/t0008-ignores.sh | 39 +- third_party/git/t/t0014-alias.sh | 7 - third_party/git/t/t0020-crlf.sh | 18 +- third_party/git/t/t0021-conversion.sh | 8 +- third_party/git/t/t0027-auto-crlf.sh | 2 +- third_party/git/t/t0028-working-tree-encoding.sh | 45 +- third_party/git/t/t0040-parse-options.sh | 29 +- third_party/git/t/t0050-filesystem.sh | 20 - third_party/git/t/t0060-path-utils.sh | 45 +- third_party/git/t/t0061-run-command.sh | 25 +- third_party/git/t/t0067-parse_pathspec_file.sh | 108 -- third_party/git/t/t0090-cache-tree.sh | 5 +- third_party/git/t/t0211-trace2-perf.sh | 4 +- third_party/git/t/t0212-trace2-event.sh | 19 - third_party/git/t/t0300-credentials.sh | 279 +----- third_party/git/t/t0410-partial-clone.sh | 93 +- third_party/git/t/t0500-progress-display.sh | 286 ------ .../git/t/t1011-read-tree-sparse-checkout.sh | 3 +- third_party/git/t/t1014-read-tree-confusing.sh | 1 - third_party/git/t/t1050-large.sh | 16 +- third_party/git/t/t1091-sparse-checkout-builtin.sh | 524 ---------- third_party/git/t/t1300-config.sh | 255 ++--- third_party/git/t/t1305-config-include.sh | 2 +- third_party/git/t/t1306-xdg-files.sh | 8 +- third_party/git/t/t1307-config-blob.sh | 2 +- third_party/git/t/t1308-config-set.sh | 26 +- third_party/git/t/t1309-early-config.sh | 9 +- third_party/git/t/t1400-update-ref.sh | 62 +- third_party/git/t/t1404-update-ref-errors.sh | 64 +- third_party/git/t/t1406-submodule-ref-store.sh | 2 +- third_party/git/t/t1409-avoid-packing-refs.sh | 16 +- third_party/git/t/t1410-reflog.sh | 4 +- third_party/git/t/t1414-reflog-walk.sh | 3 +- third_party/git/t/t1450-fsck.sh | 20 +- third_party/git/t/t1500-rev-parse.sh | 25 - third_party/git/t/t1501-work-tree.sh | 2 +- third_party/git/t/t1506-rev-parse-diagnosis.sh | 79 +- third_party/git/t/t1507-rev-parse-upstream.sh | 116 +-- .../git/t/t1512-rev-parse-disambiguation.sh | 4 +- third_party/git/t/t1600-index.sh | 35 +- third_party/git/t/t2018-checkout-branch.sh | 75 +- third_party/git/t/t2022-checkout-paths.sh | 11 - third_party/git/t/t2024-checkout-dwim.sh | 28 +- third_party/git/t/t2026-checkout-pathspec-file.sh | 163 --- third_party/git/t/t2070-restore.sh | 28 - third_party/git/t/t2072-restore-pathspec-file.sh | 164 --- third_party/git/t/t2107-update-index-basic.sh | 1 + third_party/git/t/t2400-worktree-add.sh | 37 +- third_party/git/t/t2402-worktree-list.sh | 6 - third_party/git/t/t2405-worktree-submodule.sh | 90 -- third_party/git/t/t3005-ls-files-relative.sh | 12 +- .../git/t/t3007-ls-files-recurse-submodules.sh | 1 + .../git/t/t3008-ls-files-lazy-init-name-hash.sh | 2 +- ...3011-common-prefixes-and-directory-traversal.sh | 209 ---- third_party/git/t/t3030-merge-recursive.sh | 39 +- third_party/git/t/t3035-merge-sparse.sh | 4 +- third_party/git/t/t3060-ls-files-with-tree.sh | 4 +- third_party/git/t/t3201-branch-contains.sh | 8 +- third_party/git/t/t3206-range-diff.sh | 537 ++-------- third_party/git/t/t3206/history.export | 31 +- third_party/git/t/t3210-pack-refs.sh | 2 +- third_party/git/t/t3301-notes.sh | 400 +++----- third_party/git/t/t3305-notes-fanout.sh | 117 +-- third_party/git/t/t3306-notes-prune.sh | 45 +- third_party/git/t/t3308-notes-merge.sh | 83 +- .../git/t/t3309-notes-merge-auto-resolve.sh | 228 ++--- .../git/t/t3310-notes-merge-manual-resolve.sh | 106 +- third_party/git/t/t3311-notes-merge-fanout.sh | 60 +- third_party/git/t/t3400-rebase.sh | 102 +- third_party/git/t/t3401-rebase-and-am-rename.sh | 4 +- third_party/git/t/t3403-rebase-skip.sh | 32 - third_party/git/t/t3404-rebase-interactive.sh | 790 +++++---------- third_party/git/t/t3406-rebase-message.sh | 19 +- third_party/git/t/t3407-rebase-abort.sh | 6 +- third_party/git/t/t3415-rebase-autosquash.sh | 153 +-- third_party/git/t/t3416-rebase-onto-threedots.sh | 57 -- third_party/git/t/t3418-rebase-continue.sh | 14 - third_party/git/t/t3419-rebase-patch-id.sh | 5 +- third_party/git/t/t3420-rebase-autostash.sh | 34 +- third_party/git/t/t3421-rebase-topology-linear.sh | 79 +- .../git/t/t3422-rebase-incompatible-options.sh | 10 + third_party/git/t/t3424-rebase-empty.sh | 134 --- third_party/git/t/t3425-rebase-topology-merges.sh | 8 +- third_party/git/t/t3427-rebase-subtree.sh | 160 +-- third_party/git/t/t3429-rebase-edit-todo.sh | 53 +- third_party/git/t/t3430-rebase-merges.sh | 81 +- third_party/git/t/t3431-rebase-fork-point.sh | 57 -- third_party/git/t/t3432-rebase-fast-forward.sh | 123 --- .../git/t/t3433-rebase-across-mode-change.sh | 48 - third_party/git/t/t3434-rebase-i18n.sh | 84 -- third_party/git/t/t3434/ISO8859-1.txt | 3 - third_party/git/t/t3434/eucJP.txt | 4 - third_party/git/t/t3501-revert-cherry-pick.sh | 4 +- third_party/git/t/t3504-cherry-pick-rerere.sh | 6 +- third_party/git/t/t3506-cherry-pick-ff.sh | 8 +- third_party/git/t/t3507-cherry-pick-conflict.sh | 28 +- .../git/t/t3508-cherry-pick-many-commits.sh | 2 +- third_party/git/t/t3600-rm.sh | 25 +- third_party/git/t/t3601-rm-pathspec-file.sh | 79 -- third_party/git/t/t3700-add.sh | 4 +- third_party/git/t/t3701-add-interactive.sh | 181 +--- third_party/git/t/t3704-add-pathspec-file.sh | 159 --- third_party/git/t/t3800-mktag.sh | 49 +- third_party/git/t/t3900-i18n-commit.sh | 37 - third_party/git/t/t3903-stash.sh | 71 +- third_party/git/t/t3905-stash-include-untracked.sh | 4 +- third_party/git/t/t3906-stash-submodule.sh | 42 +- third_party/git/t/t3908-stash-in-worktree.sh | 27 - third_party/git/t/t3909-stash-pathspec-file.sh | 100 -- third_party/git/t/t4000-diff-format.sh | 2 +- third_party/git/t/t4002-diff-basic.sh | 367 ++----- third_party/git/t/t4009-diff-rename-4.sh | 19 +- third_party/git/t/t4010-diff-pathspec.sh | 20 +- third_party/git/t/t4011-diff-symlink.sh | 40 +- third_party/git/t/t4013-diff-various.sh | 47 +- third_party/git/t/t4014-format-patch.sh | 1059 ++++++++------------ third_party/git/t/t4015-diff-whitespace.sh | 213 ++-- third_party/git/t/t4018-diff-funcname.sh | 3 +- third_party/git/t/t4018/dts-labels | 9 - third_party/git/t/t4018/dts-node-unitless | 8 - third_party/git/t/t4018/dts-nodes | 8 - third_party/git/t/t4018/dts-nodes-boolean-prop | 9 - third_party/git/t/t4018/dts-nodes-comment1 | 8 - third_party/git/t/t4018/dts-nodes-comment2 | 8 - third_party/git/t/t4018/dts-nodes-multiline-prop | 13 - third_party/git/t/t4018/dts-reference | 9 - third_party/git/t/t4018/dts-root | 5 - third_party/git/t/t4018/dts-root-comment | 8 - third_party/git/t/t4018/elixir-do-not-pick-end | 5 - third_party/git/t/t4018/elixir-ex-unit-test | 6 - third_party/git/t/t4018/elixir-function | 5 - third_party/git/t/t4018/elixir-macro | 5 - third_party/git/t/t4018/elixir-module | 9 - third_party/git/t/t4018/elixir-module-func | 8 - third_party/git/t/t4018/elixir-nested-module | 9 - third_party/git/t/t4018/elixir-private-function | 5 - third_party/git/t/t4018/elixir-protocol | 6 - .../git/t/t4018/elixir-protocol-implementation | 5 - third_party/git/t/t4018/python-async-def | 4 - third_party/git/t/t4018/python-class | 4 - third_party/git/t/t4018/python-def | 4 - third_party/git/t/t4018/python-indented-async-def | 7 - third_party/git/t/t4018/python-indented-class | 5 - third_party/git/t/t4018/python-indented-def | 7 - third_party/git/t/t4026-color.sh | 12 - third_party/git/t/t4027-diff-submodule.sh | 16 +- third_party/git/t/t4034-diff-words.sh | 94 +- third_party/git/t/t4034/dts/expect | 37 - third_party/git/t/t4034/dts/post | 32 - third_party/git/t/t4034/dts/pre | 32 - third_party/git/t/t4038-diff-combined.sh | 23 +- third_party/git/t/t4039-diff-assume-unchanged.sh | 3 +- third_party/git/t/t4041-diff-submodule-option.sh | 20 +- .../git/t/t4044-diff-index-unique-abbrev.sh | 46 +- third_party/git/t/t4045-diff-relative.sh | 2 +- third_party/git/t/t4048-diff-combined-binary.sh | 58 +- third_party/git/t/t4054-diff-bogus-tree.sh | 3 +- third_party/git/t/t4057-diff-combined-paths.sh | 2 +- .../t/t4060-diff-submodule-option-diff-format.sh | 126 ++- third_party/git/t/t4066-diff-emit-delay.sh | 10 +- third_party/git/t/t4067-diff-partial-clone.sh | 31 - third_party/git/t/t4100/t-apply-1.patch | 4 +- third_party/git/t/t4100/t-apply-3.patch | 2 +- third_party/git/t/t4100/t-apply-5.patch | 4 +- third_party/git/t/t4100/t-apply-7.patch | 2 +- third_party/git/t/t4108-apply-threeway.sh | 55 +- third_party/git/t/t4117-apply-reject.sh | 6 +- third_party/git/t/t4124-apply-ws-rule.sh | 10 +- third_party/git/t/t4134-apply-submodule.sh | 5 +- third_party/git/t/t4138-apply-ws-expansion.sh | 16 +- third_party/git/t/t4150-am.sh | 72 -- third_party/git/t/t4200-rerere.sh | 3 +- third_party/git/t/t4202-log.sh | 244 ++--- third_party/git/t/t4203-mailmap.sh | 122 +-- third_party/git/t/t4204-patch-id.sh | 2 +- third_party/git/t/t4205-log-pretty-formats.sh | 81 +- third_party/git/t/t4210-log-i18n.sh | 41 +- third_party/git/t/t4211-line-log.sh | 85 +- third_party/git/t/t4211/expect.beginning-of-file | 43 + third_party/git/t/t4211/expect.end-of-file | 62 ++ third_party/git/t/t4211/expect.move-support-f | 80 ++ third_party/git/t/t4211/expect.multiple | 104 ++ .../git/t/t4211/expect.multiple-overlapping | 187 ++++ third_party/git/t/t4211/expect.multiple-superset | 187 ++++ .../git/t/t4211/expect.parallel-change-f-to-main | 160 +++ third_party/git/t/t4211/expect.simple-f | 59 ++ third_party/git/t/t4211/expect.simple-f-to-main | 100 ++ third_party/git/t/t4211/expect.simple-main | 68 ++ third_party/git/t/t4211/expect.simple-main-to-end | 70 ++ third_party/git/t/t4211/expect.two-ranges | 102 ++ third_party/git/t/t4211/expect.vanishes-early | 39 + .../git/t/t4211/sha1/expect.beginning-of-file | 43 - third_party/git/t/t4211/sha1/expect.end-of-file | 62 -- third_party/git/t/t4211/sha1/expect.move-support-f | 80 -- third_party/git/t/t4211/sha1/expect.multiple | 104 -- .../git/t/t4211/sha1/expect.multiple-overlapping | 187 ---- .../git/t/t4211/sha1/expect.multiple-superset | 187 ---- .../t/t4211/sha1/expect.parallel-change-f-to-main | 160 --- third_party/git/t/t4211/sha1/expect.simple-f | 59 -- .../git/t/t4211/sha1/expect.simple-f-to-main | 100 -- third_party/git/t/t4211/sha1/expect.simple-main | 68 -- .../git/t/t4211/sha1/expect.simple-main-to-end | 70 -- third_party/git/t/t4211/sha1/expect.two-ranges | 102 -- third_party/git/t/t4211/sha1/expect.vanishes-early | 39 - .../git/t/t4211/sha256/expect.beginning-of-file | 43 - third_party/git/t/t4211/sha256/expect.end-of-file | 62 -- .../git/t/t4211/sha256/expect.move-support-f | 80 -- third_party/git/t/t4211/sha256/expect.multiple | 104 -- .../git/t/t4211/sha256/expect.multiple-overlapping | 187 ---- .../git/t/t4211/sha256/expect.multiple-superset | 187 ---- .../t4211/sha256/expect.parallel-change-f-to-main | 160 --- third_party/git/t/t4211/sha256/expect.simple-f | 59 -- .../git/t/t4211/sha256/expect.simple-f-to-main | 100 -- third_party/git/t/t4211/sha256/expect.simple-main | 68 -- .../git/t/t4211/sha256/expect.simple-main-to-end | 70 -- third_party/git/t/t4211/sha256/expect.two-ranges | 102 -- .../git/t/t4211/sha256/expect.vanishes-early | 39 - third_party/git/t/t4213-log-tabexpand.sh | 2 +- third_party/git/t/t4214-log-graph-octopus.sh | 339 +------ third_party/git/t/t4215-log-skewed-merges.sh | 373 ------- third_party/git/t/t4256-am-format-flowed.sh | 2 +- third_party/git/t/t4300-merge-tree.sh | 188 ++-- third_party/git/t/t5004-archive-corner-cases.sh | 19 - third_party/git/t/t5100-mailinfo.sh | 15 - third_party/git/t/t5150-request-pull.sh | 8 +- third_party/git/t/t5302-pack-index.sh | 21 +- third_party/git/t/t5307-pack-missing-commit.sh | 4 +- third_party/git/t/t5309-pack-delta-cycles.sh | 18 +- third_party/git/t/t5310-pack-bitmaps.sh | 36 +- third_party/git/t/t5313-pack-bounds-checks.sh | 19 +- third_party/git/t/t5314-pack-cycle-detection.sh | 2 +- .../git/t/t5317-pack-objects-filter-objects.sh | 34 +- third_party/git/t/t5318-commit-graph.sh | 101 +- third_party/git/t/t5319-multi-pack-index.sh | 95 +- third_party/git/t/t5321-pack-large-objects.sh | 4 +- third_party/git/t/t5324-split-commit-graph.sh | 19 +- third_party/git/t/t5400-send-pack.sh | 2 +- third_party/git/t/t5407-post-rewrite-hook.sh | 16 +- .../git/t/t5409-colorize-remote-messages.sh | 3 +- third_party/git/t/t5500-fetch-pack.sh | 77 +- third_party/git/t/t5504-fetch-receive-strict.sh | 17 +- third_party/git/t/t5505-remote.sh | 88 +- third_party/git/t/t5509-fetch-push-namespaces.sh | 13 +- third_party/git/t/t5510-fetch.sh | 110 +- third_party/git/t/t5512-ls-remote.sh | 29 +- third_party/git/t/t5514-fetch-multiple.sh | 11 - third_party/git/t/t5515-fetch-merge-logic.sh | 63 +- third_party/git/t/t5516-fetch-push.sh | 23 +- third_party/git/t/t5517-push-mirror.sh | 10 - third_party/git/t/t5520-pull.sh | 366 +++---- third_party/git/t/t5528-push-default.sh | 2 +- third_party/git/t/t5530-upload-pack-error.sh | 26 +- third_party/git/t/t5535-fetch-push-symref.sh | 2 +- third_party/git/t/t5537-fetch-shallow.sh | 21 +- third_party/git/t/t5539-fetch-http-shallow.sh | 2 +- third_party/git/t/t5540-http-push-webdav.sh | 6 +- third_party/git/t/t5541-http-push-smart.sh | 50 +- third_party/git/t/t5545-push-options.sh | 5 +- third_party/git/t/t5550-http-fetch-dumb.sh | 16 +- third_party/git/t/t5551-http-fetch-smart.sh | 12 +- .../git/t/t5552-skipping-fetch-negotiator.sh | 41 +- third_party/git/t/t5553-set-upstream.sh | 178 ---- .../git/t/t5562-http-backend-content-length.sh | 2 +- third_party/git/t/t5573-pull-verify-signatures.sh | 64 -- third_party/git/t/t5580-clone-push-unc.sh | 77 ++ third_party/git/t/t5580-unc-paths.sh | 89 -- third_party/git/t/t5601-clone.sh | 11 +- third_party/git/t/t5604-clone-reference.sh | 5 +- third_party/git/t/t5607-clone-bundle.sh | 13 +- third_party/git/t/t5608-clone-2gb.sh | 2 +- third_party/git/t/t5616-partial-clone.sh | 219 +--- third_party/git/t/t5617-clone-submodules-remote.sh | 13 +- third_party/git/t/t5700-protocol-v1.sh | 6 +- third_party/git/t/t5702-protocol-v2.sh | 50 +- third_party/git/t/t5703-upload-pack-ref-in-want.sh | 250 +++-- third_party/git/t/t5801-remote-helpers.sh | 1 + third_party/git/t/t6000-rev-list-misc.sh | 33 +- third_party/git/t/t6006-rev-list-format.sh | 37 +- .../git/t/t6011-rev-list-with-bad-commit.sh | 2 +- .../git/t/t6016-rev-list-graph-simplify-history.sh | 30 +- third_party/git/t/t6019-rev-list-ancestry-path.sh | 4 +- third_party/git/t/t6020-merge-df.sh | 55 +- third_party/git/t/t6021-merge-criss-cross.sh | 137 ++- third_party/git/t/t6022-merge-rename.sh | 393 ++++---- third_party/git/t/t6023-merge-file.sh | 568 +++++------ third_party/git/t/t6024-recursive-merge.sh | 135 ++- third_party/git/t/t6025-merge-symlinks.sh | 95 +- third_party/git/t/t6026-merge-attr.sh | 46 +- third_party/git/t/t6030-bisect-porcelain.sh | 2 +- third_party/git/t/t6034-merge-rename-nocruft.sh | 122 +-- third_party/git/t/t6035-merge-dir-to-symlink.sh | 28 +- third_party/git/t/t6036-recursive-corner-cases.sh | 51 +- .../git/t/t6042-merge-rename-corner-cases.sh | 111 +- .../git/t/t6043-merge-rename-directories.sh | 574 ++++------- .../git/t/t6046-merge-skip-unneeded-updates.sh | 217 ++-- third_party/git/t/t6047-diff3-conflict-markers.sh | 211 ---- .../git/t/t6102-rev-list-unexpected-objects.sh | 2 +- .../git/t/t6112-rev-list-filters-objects.sh | 194 +--- third_party/git/t/t6113-rev-list-bitmap-filters.sh | 56 -- third_party/git/t/t6120-describe.sh | 138 +-- third_party/git/t/t6130-pathspec-noglob.sh | 1 - third_party/git/t/t6136-pathspec-in-bare.sh | 38 - third_party/git/t/t6300-for-each-ref.sh | 19 - third_party/git/t/t6500-gc.sh | 6 +- third_party/git/t/t6501-freshen-objects.sh | 6 +- third_party/git/t/t7004-tag.sh | 9 +- third_party/git/t/t7008-filter-branch-null-sha1.sh | 55 - third_party/git/t/t7008-grep-binary.sh | 249 +++++ third_party/git/t/t7009-filter-branch-null-sha1.sh | 55 + third_party/git/t/t7012-skip-worktree-writing.sh | 15 - third_party/git/t/t7030-verify-tag.sh | 38 +- third_party/git/t/t7061-wtstatus-ignore.sh | 9 +- third_party/git/t/t7105-reset-patch.sh | 21 - third_party/git/t/t7107-reset-pathspec-file.sh | 173 ---- third_party/git/t/t7300-clean.sh | 73 +- third_party/git/t/t7400-submodule-basic.sh | 64 +- third_party/git/t/t7406-submodule-update.sh | 33 +- third_party/git/t/t7410-submodule-checkout-to.sh | 77 ++ third_party/git/t/t7415-submodule-names.sh | 57 -- third_party/git/t/t7416-submodule-dash-url.sh | 157 +-- third_party/git/t/t7417-submodule-path-url.sh | 17 - third_party/git/t/t7419-submodule-set-branch.sh | 6 +- third_party/git/t/t7420-submodule-set-url.sh | 55 - .../git/t/t7500-commit-template-squash-signoff.sh | 9 - .../git/t/t7501-commit-basic-functionality.sh | 83 +- .../t7503-pre-commit-and-pre-merge-commit-hooks.sh | 281 ------ third_party/git/t/t7503-pre-commit-hook.sh | 139 +++ third_party/git/t/t7505-prepare-commit-msg-hook.sh | 8 +- third_party/git/t/t7505/expected-rebase-i | 3 +- third_party/git/t/t7508-status.sh | 2 +- third_party/git/t/t7510-signed-commit.sh | 39 - third_party/git/t/t7512-status-help.sh | 18 +- third_party/git/t/t7513-interpret-trailers.sh | 2 +- third_party/git/t/t7519-status-fsmonitor.sh | 37 +- third_party/git/t/t7519/fsmonitor-all | 1 + third_party/git/t/t7519/fsmonitor-all-v2 | 21 - third_party/git/t/t7519/fsmonitor-env | 24 - third_party/git/t/t7519/fsmonitor-watchman | 16 +- third_party/git/t/t7519/fsmonitor-watchman-v2 | 173 ---- third_party/git/t/t7526-commit-pathspec-file.sh | 164 --- third_party/git/t/t7612-merge-verify-signatures.sh | 22 - third_party/git/t/t7700-repack.sh | 172 ++-- third_party/git/t/t7800-difftool.sh | 5 +- third_party/git/t/t7811-grep-open.sh | 1 + third_party/git/t/t7812-grep-icase-non-ascii.sh | 31 - third_party/git/t/t7814-grep-recurse-submodules.sh | 32 +- third_party/git/t/t7815-grep-binary.sh | 148 --- third_party/git/t/t7816-grep-binary-pattern.sh | 127 --- third_party/git/t/t8003-blame-corner-cases.sh | 1 + third_party/git/t/t9001-send-email.sh | 8 +- third_party/git/t/t9010-svn-fe.sh | 4 +- .../git/t/t9106-git-svn-commit-diff-clobber.sh | 3 +- third_party/git/t/t9116-git-svn-log.sh | 12 +- third_party/git/t/t9300-fast-import.sh | 132 +-- third_party/git/t/t9301-fast-import-notes.sh | 2 +- third_party/git/t/t9350-fast-export.sh | 71 +- .../git/t/t9502-gitweb-standalone-parse-output.sh | 7 +- third_party/git/t/t9800-git-p4-basic.sh | 1 + third_party/git/t/t9809-git-p4-client-view.sh | 2 +- third_party/git/t/t9810-git-p4-rcs.sh | 1 + third_party/git/t/t9902-completion.sh | 145 +-- third_party/git/t/t9903-bash-prompt.sh | 8 +- third_party/git/t/test-lib-functions.sh | 88 +- third_party/git/t/test-lib.sh | 82 +- 406 files changed, 6683 insertions(+), 19187 deletions(-) delete mode 100644 third_party/git/t/helper/test-parse-pathspec-file.c delete mode 100644 third_party/git/t/helper/test-progress.c delete mode 100644 third_party/git/t/helper/test-read-graph.c delete mode 100644 third_party/git/t/lib-httpd/apply-one-time-perl.sh create mode 100644 third_party/git/t/lib-httpd/apply-one-time-sed.sh delete mode 100755 third_party/git/t/lib-log-graph.sh create mode 100755 third_party/git/t/perf/p5600-clone-reference.sh delete mode 100755 third_party/git/t/perf/p5601-clone-reference.sh delete mode 100755 third_party/git/t/t0067-parse_pathspec_file.sh delete mode 100755 third_party/git/t/t0500-progress-display.sh delete mode 100755 third_party/git/t/t1091-sparse-checkout-builtin.sh delete mode 100755 third_party/git/t/t2026-checkout-pathspec-file.sh delete mode 100755 third_party/git/t/t2072-restore-pathspec-file.sh delete mode 100755 third_party/git/t/t2405-worktree-submodule.sh delete mode 100755 third_party/git/t/t3011-common-prefixes-and-directory-traversal.sh delete mode 100755 third_party/git/t/t3424-rebase-empty.sh delete mode 100755 third_party/git/t/t3431-rebase-fork-point.sh delete mode 100755 third_party/git/t/t3432-rebase-fast-forward.sh delete mode 100755 third_party/git/t/t3433-rebase-across-mode-change.sh delete mode 100755 third_party/git/t/t3434-rebase-i18n.sh delete mode 100644 third_party/git/t/t3434/ISO8859-1.txt delete mode 100644 third_party/git/t/t3434/eucJP.txt delete mode 100755 third_party/git/t/t3601-rm-pathspec-file.sh delete mode 100755 third_party/git/t/t3704-add-pathspec-file.sh delete mode 100755 third_party/git/t/t3908-stash-in-worktree.sh delete mode 100755 third_party/git/t/t3909-stash-pathspec-file.sh delete mode 100644 third_party/git/t/t4018/dts-labels delete mode 100644 third_party/git/t/t4018/dts-node-unitless delete mode 100644 third_party/git/t/t4018/dts-nodes delete mode 100644 third_party/git/t/t4018/dts-nodes-boolean-prop delete mode 100644 third_party/git/t/t4018/dts-nodes-comment1 delete mode 100644 third_party/git/t/t4018/dts-nodes-comment2 delete mode 100644 third_party/git/t/t4018/dts-nodes-multiline-prop delete mode 100644 third_party/git/t/t4018/dts-reference delete mode 100644 third_party/git/t/t4018/dts-root delete mode 100644 third_party/git/t/t4018/dts-root-comment delete mode 100644 third_party/git/t/t4018/elixir-do-not-pick-end delete mode 100644 third_party/git/t/t4018/elixir-ex-unit-test delete mode 100644 third_party/git/t/t4018/elixir-function delete mode 100644 third_party/git/t/t4018/elixir-macro delete mode 100644 third_party/git/t/t4018/elixir-module delete mode 100644 third_party/git/t/t4018/elixir-module-func delete mode 100644 third_party/git/t/t4018/elixir-nested-module delete mode 100644 third_party/git/t/t4018/elixir-private-function delete mode 100644 third_party/git/t/t4018/elixir-protocol delete mode 100644 third_party/git/t/t4018/elixir-protocol-implementation delete mode 100644 third_party/git/t/t4018/python-async-def delete mode 100644 third_party/git/t/t4018/python-class delete mode 100644 third_party/git/t/t4018/python-def delete mode 100644 third_party/git/t/t4018/python-indented-async-def delete mode 100644 third_party/git/t/t4018/python-indented-class delete mode 100644 third_party/git/t/t4018/python-indented-def delete mode 100644 third_party/git/t/t4034/dts/expect delete mode 100644 third_party/git/t/t4034/dts/post delete mode 100644 third_party/git/t/t4034/dts/pre create mode 100644 third_party/git/t/t4211/expect.beginning-of-file create mode 100644 third_party/git/t/t4211/expect.end-of-file create mode 100644 third_party/git/t/t4211/expect.move-support-f create mode 100644 third_party/git/t/t4211/expect.multiple create mode 100644 third_party/git/t/t4211/expect.multiple-overlapping create mode 100644 third_party/git/t/t4211/expect.multiple-superset create mode 100644 third_party/git/t/t4211/expect.parallel-change-f-to-main create mode 100644 third_party/git/t/t4211/expect.simple-f create mode 100644 third_party/git/t/t4211/expect.simple-f-to-main create mode 100644 third_party/git/t/t4211/expect.simple-main create mode 100644 third_party/git/t/t4211/expect.simple-main-to-end create mode 100644 third_party/git/t/t4211/expect.two-ranges create mode 100644 third_party/git/t/t4211/expect.vanishes-early delete mode 100644 third_party/git/t/t4211/sha1/expect.beginning-of-file delete mode 100644 third_party/git/t/t4211/sha1/expect.end-of-file delete mode 100644 third_party/git/t/t4211/sha1/expect.move-support-f delete mode 100644 third_party/git/t/t4211/sha1/expect.multiple delete mode 100644 third_party/git/t/t4211/sha1/expect.multiple-overlapping delete mode 100644 third_party/git/t/t4211/sha1/expect.multiple-superset delete mode 100644 third_party/git/t/t4211/sha1/expect.parallel-change-f-to-main delete mode 100644 third_party/git/t/t4211/sha1/expect.simple-f delete mode 100644 third_party/git/t/t4211/sha1/expect.simple-f-to-main delete mode 100644 third_party/git/t/t4211/sha1/expect.simple-main delete mode 100644 third_party/git/t/t4211/sha1/expect.simple-main-to-end delete mode 100644 third_party/git/t/t4211/sha1/expect.two-ranges delete mode 100644 third_party/git/t/t4211/sha1/expect.vanishes-early delete mode 100644 third_party/git/t/t4211/sha256/expect.beginning-of-file delete mode 100644 third_party/git/t/t4211/sha256/expect.end-of-file delete mode 100644 third_party/git/t/t4211/sha256/expect.move-support-f delete mode 100644 third_party/git/t/t4211/sha256/expect.multiple delete mode 100644 third_party/git/t/t4211/sha256/expect.multiple-overlapping delete mode 100644 third_party/git/t/t4211/sha256/expect.multiple-superset delete mode 100644 third_party/git/t/t4211/sha256/expect.parallel-change-f-to-main delete mode 100644 third_party/git/t/t4211/sha256/expect.simple-f delete mode 100644 third_party/git/t/t4211/sha256/expect.simple-f-to-main delete mode 100644 third_party/git/t/t4211/sha256/expect.simple-main delete mode 100644 third_party/git/t/t4211/sha256/expect.simple-main-to-end delete mode 100644 third_party/git/t/t4211/sha256/expect.two-ranges delete mode 100644 third_party/git/t/t4211/sha256/expect.vanishes-early delete mode 100755 third_party/git/t/t4215-log-skewed-merges.sh delete mode 100755 third_party/git/t/t5553-set-upstream.sh create mode 100755 third_party/git/t/t5580-clone-push-unc.sh delete mode 100755 third_party/git/t/t5580-unc-paths.sh delete mode 100755 third_party/git/t/t6047-diff3-conflict-markers.sh delete mode 100755 third_party/git/t/t6113-rev-list-bitmap-filters.sh delete mode 100755 third_party/git/t/t6136-pathspec-in-bare.sh delete mode 100755 third_party/git/t/t7008-filter-branch-null-sha1.sh create mode 100755 third_party/git/t/t7008-grep-binary.sh create mode 100755 third_party/git/t/t7009-filter-branch-null-sha1.sh delete mode 100755 third_party/git/t/t7107-reset-pathspec-file.sh create mode 100755 third_party/git/t/t7410-submodule-checkout-to.sh delete mode 100755 third_party/git/t/t7420-submodule-set-url.sh delete mode 100755 third_party/git/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh create mode 100755 third_party/git/t/t7503-pre-commit-hook.sh delete mode 100755 third_party/git/t/t7519/fsmonitor-all-v2 delete mode 100755 third_party/git/t/t7519/fsmonitor-env delete mode 100755 third_party/git/t/t7519/fsmonitor-watchman-v2 delete mode 100755 third_party/git/t/t7526-commit-pathspec-file.sh delete mode 100755 third_party/git/t/t7815-grep-binary.sh delete mode 100755 third_party/git/t/t7816-grep-binary-pattern.sh (limited to 'third_party/git/t') diff --git a/third_party/git/t/README b/third_party/git/t/README index 9afd61e3ca0d..60d5b77bccd9 100644 --- a/third_party/git/t/README +++ b/third_party/git/t/README @@ -352,8 +352,8 @@ details. GIT_TEST_SPLIT_INDEX= forces split-index mode on the whole test suite. Accept any boolean values that are accepted by git-config. -GIT_TEST_PROTOCOL_VERSION=, when set, makes 'protocol.version' -default to n. +GIT_TEST_PROTOCOL_VERSION=, when set, overrides the +'protocol.version' setting to n if it is less than n. GIT_TEST_FULL_IN_PACK_ARRAY= exercises the uncommon pack-objects code path where there are more than 1024 packs even if @@ -397,10 +397,6 @@ GIT_TEST_STASH_USE_BUILTIN=, when false, disables the built-in version of git-stash. See 'stash.useBuiltin' in git-config(1). -GIT_TEST_ADD_I_USE_BUILTIN=, when true, enables the -built-in version of git add -i. See 'add.interactive.useBuiltin' in -git-config(1). - GIT_TEST_INDEX_THREADS= enables exercising the multi-threaded loading of the index for the whole test suite by bypassing the default number of cache entries and thread minimums. Setting this to 1 will make the @@ -982,15 +978,6 @@ library for your script to use. output to the downstream---unlike the real version, it generates only up to 99 lines. - - test_bool_env - - Given the name of an environment variable with a bool value, - normalize its value to a 0 (true) or 1 (false or empty string) - return code. Return with code corresponding to the given default - value if the variable is unset. - Abort the test script if either the value of the variable or the - default are not valid bool values. - Prerequisites ------------- diff --git a/third_party/git/t/check-non-portable-shell.pl b/third_party/git/t/check-non-portable-shell.pl index fd3303552bec..38bfeebd881a 100755 --- a/third_party/git/t/check-non-portable-shell.pl +++ b/third_party/git/t/check-non-portable-shell.pl @@ -46,7 +46,7 @@ while (<>) { /(?:\$\(seq|^\s*seq\b)/ and err 'seq is not portable (use test_seq)'; /\bgrep\b.*--file\b/ and err 'grep --file FILE is not portable (use grep -f FILE)'; /\bexport\s+[A-Za-z0-9_]*=/ and err '"export FOO=bar" is not portable (use FOO=bar && export FOO)'; - /^\s*([A-Z0-9_]+=(\w*|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and + /^\s*([A-Z0-9_]+=(\w+|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and err '"FOO=bar shell_func" assignment extends beyond "shell_func"'; $line = ''; # this resets our $. for each file diff --git a/third_party/git/t/gitweb-lib.sh b/third_party/git/t/gitweb-lib.sh index 1f32ca66ea51..006d2a8152dc 100644 --- a/third_party/git/t/gitweb-lib.sh +++ b/third_party/git/t/gitweb-lib.sh @@ -58,11 +58,10 @@ gitweb_run () { GATEWAY_INTERFACE='CGI/1.1' HTTP_ACCEPT='*/*' REQUEST_METHOD='GET' - QUERY_STRING=$1 - PATH_INFO=$2 - REQUEST_URI=/gitweb.cgi$PATH_INFO + QUERY_STRING=""$1"" + PATH_INFO=""$2"" export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD \ - QUERY_STRING PATH_INFO REQUEST_URI + QUERY_STRING PATH_INFO GITWEB_CONFIG=$(pwd)/gitweb_config.perl export GITWEB_CONFIG diff --git a/third_party/git/t/helper/.gitignore b/third_party/git/t/helper/.gitignore index 48c7bb0bbb1d..2bad28af9241 100644 --- a/third_party/git/t/helper/.gitignore +++ b/third_party/git/t/helper/.gitignore @@ -1,4 +1,5 @@ -/test-tool -/test-fake-ssh -/test-line-buffer -/test-svn-fe +* +!*.sh +!*.[ch] +!*.gitignore + diff --git a/third_party/git/t/helper/test-config.c b/third_party/git/t/helper/test-config.c index 234c722b485e..214003d5b2f9 100644 --- a/third_party/git/t/helper/test-config.c +++ b/third_party/git/t/helper/test-config.c @@ -37,6 +37,21 @@ * */ +static const char *scope_name(enum config_scope scope) +{ + switch (scope) { + case CONFIG_SCOPE_SYSTEM: + return "system"; + case CONFIG_SCOPE_GLOBAL: + return "global"; + case CONFIG_SCOPE_REPO: + return "repo"; + case CONFIG_SCOPE_CMDLINE: + return "cmdline"; + default: + return "unknown"; + } +} static int iterate_cb(const char *var, const char *value, void *data) { static int nr; @@ -48,8 +63,7 @@ static int iterate_cb(const char *var, const char *value, void *data) printf("value=%s\n", value ? value : "(null)"); printf("origin=%s\n", current_config_origin_type()); printf("name=%s\n", current_config_name()); - printf("lno=%d\n", current_config_line()); - printf("scope=%s\n", config_scope_name(current_config_scope())); + printf("scope=%s\n", scope_name(current_config_scope())); return 0; } diff --git a/third_party/git/t/helper/test-date.c b/third_party/git/t/helper/test-date.c index 099eff4f0fc8..585347ea487a 100644 --- a/third_party/git/t/helper/test-date.c +++ b/third_party/git/t/helper/test-date.c @@ -12,13 +12,13 @@ static const char *usage_msg = "\n" " test-tool date is64bit\n" " test-tool date time_t-is64bit\n"; -static void show_relative_dates(const char **argv) +static void show_relative_dates(const char **argv, struct timeval *now) { struct strbuf buf = STRBUF_INIT; for (; *argv; argv++) { time_t t = atoi(*argv); - show_date_relative(t, &buf); + show_date_relative(t, now, &buf); printf("%s -> %s\n", *argv, buf.buf); } strbuf_release(&buf); @@ -74,20 +74,20 @@ static void parse_dates(const char **argv) strbuf_release(&result); } -static void parse_approxidate(const char **argv) +static void parse_approxidate(const char **argv, struct timeval *now) { for (; *argv; argv++) { timestamp_t t; - t = approxidate_relative(*argv); + t = approxidate_relative(*argv, now); printf("%s -> %s\n", *argv, show_date(t, 0, DATE_MODE(ISO8601))); } } -static void parse_approx_timestamp(const char **argv) +static void parse_approx_timestamp(const char **argv, struct timeval *now) { for (; *argv; argv++) { timestamp_t t; - t = approxidate_relative(*argv); + t = approxidate_relative(*argv, now); printf("%s -> %"PRItime"\n", *argv, t); } } @@ -103,13 +103,22 @@ static void getnanos(const char **argv) int cmd__date(int argc, const char **argv) { + struct timeval now; const char *x; + x = getenv("GIT_TEST_DATE_NOW"); + if (x) { + now.tv_sec = atoi(x); + now.tv_usec = 0; + } + else + gettimeofday(&now, NULL); + argv++; if (!*argv) usage(usage_msg); if (!strcmp(*argv, "relative")) - show_relative_dates(argv+1); + show_relative_dates(argv+1, &now); else if (!strcmp(*argv, "human")) show_human_dates(argv+1); else if (skip_prefix(*argv, "show:", &x)) @@ -117,9 +126,9 @@ int cmd__date(int argc, const char **argv) else if (!strcmp(*argv, "parse")) parse_dates(argv+1); else if (!strcmp(*argv, "approxidate")) - parse_approxidate(argv+1); + parse_approxidate(argv+1, &now); else if (!strcmp(*argv, "timestamp")) - parse_approx_timestamp(argv+1); + parse_approx_timestamp(argv+1, &now); else if (!strcmp(*argv, "getnanos")) getnanos(argv+1); else if (!strcmp(*argv, "is64bit")) diff --git a/third_party/git/t/helper/test-drop-caches.c b/third_party/git/t/helper/test-drop-caches.c index 7b4278462bb7..f65e301f9ddc 100644 --- a/third_party/git/t/helper/test-drop-caches.c +++ b/third_party/git/t/helper/test-drop-caches.c @@ -8,21 +8,18 @@ static int cmd_sync(void) { char Buffer[MAX_PATH]; DWORD dwRet; - char szVolumeAccessPath[] = "\\\\.\\XXXX:"; + char szVolumeAccessPath[] = "\\\\.\\X:"; HANDLE hVolWrite; - int success = 0, dos_drive_prefix; + int success = 0; dwRet = GetCurrentDirectory(MAX_PATH, Buffer); if ((0 == dwRet) || (dwRet > MAX_PATH)) return error("Error getting current directory"); - dos_drive_prefix = has_dos_drive_prefix(Buffer); - if (!dos_drive_prefix) + if (!has_dos_drive_prefix(Buffer)) return error("'%s': invalid drive letter", Buffer); - memcpy(szVolumeAccessPath, Buffer, dos_drive_prefix); - szVolumeAccessPath[dos_drive_prefix] = '\0'; - + szVolumeAccessPath[4] = Buffer[0]; hVolWrite = CreateFile(szVolumeAccessPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (INVALID_HANDLE_VALUE == hVolWrite) diff --git a/third_party/git/t/helper/test-dump-fsmonitor.c b/third_party/git/t/helper/test-dump-fsmonitor.c index 975f0ac89051..2786f47088e9 100644 --- a/third_party/git/t/helper/test-dump-fsmonitor.c +++ b/third_party/git/t/helper/test-dump-fsmonitor.c @@ -13,7 +13,7 @@ int cmd__dump_fsmonitor(int ac, const char **av) printf("no fsmonitor\n"); return 0; } - printf("fsmonitor last update %s\n", istate->fsmonitor_last_update); + printf("fsmonitor last update %"PRIuMAX"\n", (uintmax_t)istate->fsmonitor_last_update); for (i = 0; i < istate->cache_nr; i++) printf((istate->cache[i]->ce_flags & CE_FSMONITOR_VALID) ? "+" : "-"); diff --git a/third_party/git/t/helper/test-hashmap.c b/third_party/git/t/helper/test-hashmap.c index f38706216f44..aaf17b0ddf9e 100644 --- a/third_party/git/t/helper/test-hashmap.c +++ b/third_party/git/t/helper/test-hashmap.c @@ -5,7 +5,6 @@ struct test_entry { - int padding; /* hashmap entry no longer needs to be the first member */ struct hashmap_entry ent; /* key and value as two \0-terminated strings */ char key[FLEX_ARRAY]; @@ -17,17 +16,15 @@ static const char *get_value(const struct test_entry *e) } static int test_entry_cmp(const void *cmp_data, - const struct hashmap_entry *eptr, - const struct hashmap_entry *entry_or_key, + const void *entry, + const void *entry_or_key, const void *keydata) { const int ignore_case = cmp_data ? *((int *)cmp_data) : 0; - const struct test_entry *e1, *e2; + const struct test_entry *e1 = entry; + const struct test_entry *e2 = entry_or_key; const char *key = keydata; - e1 = container_of(eptr, const struct test_entry, ent); - e2 = container_of(entry_or_key, const struct test_entry, ent); - if (ignore_case) return strcasecmp(e1->key, key ? key : e2->key); else @@ -40,7 +37,7 @@ static struct test_entry *alloc_test_entry(unsigned int hash, size_t klen = strlen(key); size_t vlen = strlen(value); struct test_entry *entry = xmalloc(st_add4(sizeof(*entry), klen, vlen, 2)); - hashmap_entry_init(&entry->ent, hash); + hashmap_entry_init(entry, hash); memcpy(entry->key, key, klen + 1); memcpy(entry->key + klen + 1, value, vlen + 1); return entry; @@ -106,11 +103,11 @@ static void perf_hashmap(unsigned int method, unsigned int rounds) /* add entries */ for (i = 0; i < TEST_SIZE; i++) { - hashmap_entry_init(&entries[i]->ent, hashes[i]); - hashmap_add(&map, &entries[i]->ent); + hashmap_entry_init(entries[i], hashes[i]); + hashmap_add(&map, entries[i]); } - hashmap_free(&map); + hashmap_free(&map, 0); } } else { /* test map lookups */ @@ -119,8 +116,8 @@ static void perf_hashmap(unsigned int method, unsigned int rounds) /* fill the map (sparsely if specified) */ j = (method & TEST_SPARSE) ? TEST_SIZE / 10 : TEST_SIZE; for (i = 0; i < j; i++) { - hashmap_entry_init(&entries[i]->ent, hashes[i]); - hashmap_add(&map, &entries[i]->ent); + hashmap_entry_init(entries[i], hashes[i]); + hashmap_add(&map, entries[i]); } for (j = 0; j < rounds; j++) { @@ -130,7 +127,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds) } } - hashmap_free(&map); + hashmap_free(&map, 0); } } @@ -182,7 +179,7 @@ int cmd__hashmap(int argc, const char **argv) entry = alloc_test_entry(hash, p1, p2); /* add to hashmap */ - hashmap_add(&map, &entry->ent); + hashmap_add(&map, entry); } else if (!strcmp("put", cmd) && p1 && p2) { @@ -190,44 +187,43 @@ int cmd__hashmap(int argc, const char **argv) entry = alloc_test_entry(hash, p1, p2); /* add / replace entry */ - entry = hashmap_put_entry(&map, entry, ent); + entry = hashmap_put(&map, entry); /* print and free replaced entry, if any */ puts(entry ? get_value(entry) : "NULL"); free(entry); } else if (!strcmp("get", cmd) && p1) { + /* lookup entry in hashmap */ - entry = hashmap_get_entry_from_hash(&map, hash, p1, - struct test_entry, ent); + entry = hashmap_get_from_hash(&map, hash, p1); /* print result */ if (!entry) puts("NULL"); - hashmap_for_each_entry_from(&map, entry, ent) + while (entry) { puts(get_value(entry)); + entry = hashmap_get_next(&map, entry); + } } else if (!strcmp("remove", cmd) && p1) { /* setup static key */ struct hashmap_entry key; - struct hashmap_entry *rm; hashmap_entry_init(&key, hash); /* remove entry from hashmap */ - rm = hashmap_remove(&map, &key, p1); - entry = rm ? container_of(rm, struct test_entry, ent) - : NULL; + entry = hashmap_remove(&map, &key, p1); /* print result and free entry*/ puts(entry ? get_value(entry) : "NULL"); free(entry); } else if (!strcmp("iterate", cmd)) { - struct hashmap_iter iter; - hashmap_for_each_entry(&map, &iter, entry, - ent /* member name */) + struct hashmap_iter iter; + hashmap_iter_init(&map, &iter); + while ((entry = hashmap_iter_next(&iter))) printf("%s %s\n", entry->key, get_value(entry)); } else if (!strcmp("size", cmd)) { @@ -262,6 +258,6 @@ int cmd__hashmap(int argc, const char **argv) } strbuf_release(&line); - hashmap_free_entries(&map, struct test_entry, ent); + hashmap_free(&map, 1); return 0; } diff --git a/third_party/git/t/helper/test-lazy-init-name-hash.c b/third_party/git/t/helper/test-lazy-init-name-hash.c index cd1b4c9736ef..b99a37080d93 100644 --- a/third_party/git/t/helper/test-lazy-init-name-hash.c +++ b/third_party/git/t/helper/test-lazy-init-name-hash.c @@ -41,13 +41,17 @@ static void dump_run(void) die("non-threaded code path used"); } - hashmap_for_each_entry(&the_index.dir_hash, &iter_dir, dir, - ent /* member name */) + dir = hashmap_iter_first(&the_index.dir_hash, &iter_dir); + while (dir) { printf("dir %08x %7d %s\n", dir->ent.hash, dir->nr, dir->name); + dir = hashmap_iter_next(&iter_dir); + } - hashmap_for_each_entry(&the_index.name_hash, &iter_cache, ce, - ent /* member name */) + ce = hashmap_iter_first(&the_index.name_hash, &iter_cache); + while (ce) { printf("name %08x %s\n", ce->ent.hash, ce->name); + ce = hashmap_iter_next(&iter_cache); + } discard_cache(); } diff --git a/third_party/git/t/helper/test-parse-options.c b/third_party/git/t/helper/test-parse-options.c index 2051ce57db73..af82db06ac59 100644 --- a/third_party/git/t/helper/test-parse-options.c +++ b/third_party/git/t/helper/test-parse-options.c @@ -121,8 +121,6 @@ int cmd__parse_options(int argc, const char **argv) OPT_INTEGER('j', NULL, &integer, "get a integer, too"), OPT_MAGNITUDE('m', "magnitude", &magnitude, "get a magnitude"), OPT_SET_INT(0, "set23", &integer, "set integer to 23", 23), - OPT_CMDMODE(0, "mode1", &integer, "set integer to 1 (cmdmode option)", 1), - OPT_CMDMODE(0, "mode2", &integer, "set integer to 2 (cmdmode option)", 2), OPT_CALLBACK('L', "length", &integer, "str", "get length of ", length_callback), OPT_FILENAME('F', "file", &file, "set file to "), diff --git a/third_party/git/t/helper/test-parse-pathspec-file.c b/third_party/git/t/helper/test-parse-pathspec-file.c deleted file mode 100644 index 02f4ccfd2a2d..000000000000 --- a/third_party/git/t/helper/test-parse-pathspec-file.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "test-tool.h" -#include "parse-options.h" -#include "pathspec.h" -#include "gettext.h" - -int cmd__parse_pathspec_file(int argc, const char **argv) -{ - struct pathspec pathspec; - const char *pathspec_from_file = 0; - int pathspec_file_nul = 0, i; - - static const char *const usage[] = { - "test-tool parse-pathspec-file --pathspec-from-file [--pathspec-file-nul]", - NULL - }; - - struct option options[] = { - OPT_PATHSPEC_FROM_FILE(&pathspec_from_file), - OPT_PATHSPEC_FILE_NUL(&pathspec_file_nul), - OPT_END() - }; - - parse_options(argc, argv, 0, options, usage, 0); - - parse_pathspec_file(&pathspec, 0, 0, 0, pathspec_from_file, - pathspec_file_nul); - - for (i = 0; i < pathspec.nr; i++) - printf("%s\n", pathspec.items[i].original); - - clear_pathspec(&pathspec); - return 0; -} diff --git a/third_party/git/t/helper/test-path-utils.c b/third_party/git/t/helper/test-path-utils.c index 409034cf4eef..5d543ad21f89 100644 --- a/third_party/git/t/helper/test-path-utils.c +++ b/third_party/git/t/helper/test-path-utils.c @@ -185,99 +185,6 @@ static int cmp_by_st_size(const void *a, const void *b) return x > y ? -1 : (x < y ? +1 : 0); } -/* - * A very simple, reproducible pseudo-random generator. Copied from - * `test-genrandom.c`. - */ -static uint64_t my_random_value = 1234; - -static uint64_t my_random(void) -{ - my_random_value = my_random_value * 1103515245 + 12345; - return my_random_value; -} - -/* - * A fast approximation of the square root, without requiring math.h. - * - * It uses Newton's method to approximate the solution of 0 = x^2 - value. - */ -static double my_sqrt(double value) -{ - const double epsilon = 1e-6; - double x = value; - - if (value == 0) - return 0; - - for (;;) { - double delta = (value / x - x) / 2; - if (delta < epsilon && delta > -epsilon) - return x + delta; - x += delta; - } -} - -static int protect_ntfs_hfs_benchmark(int argc, const char **argv) -{ - size_t i, j, nr, min_len = 3, max_len = 20; - char **names; - int repetitions = 15, file_mode = 0100644; - uint64_t begin, end; - double m[3][2], v[3][2]; - uint64_t cumul; - double cumul2; - - if (argc > 1 && !strcmp(argv[1], "--with-symlink-mode")) { - file_mode = 0120000; - argc--; - argv++; - } - - nr = argc > 1 ? strtoul(argv[1], NULL, 0) : 1000000; - ALLOC_ARRAY(names, nr); - - if (argc > 2) { - min_len = strtoul(argv[2], NULL, 0); - if (argc > 3) - max_len = strtoul(argv[3], NULL, 0); - if (min_len > max_len) - die("min_len > max_len"); - } - - for (i = 0; i < nr; i++) { - size_t len = min_len + (my_random() % (max_len + 1 - min_len)); - - names[i] = xmallocz(len); - while (len > 0) - names[i][--len] = (char)(' ' + (my_random() % ('\x7f' - ' '))); - } - - for (protect_ntfs = 0; protect_ntfs < 2; protect_ntfs++) - for (protect_hfs = 0; protect_hfs < 2; protect_hfs++) { - cumul = 0; - cumul2 = 0; - for (i = 0; i < repetitions; i++) { - begin = getnanotime(); - for (j = 0; j < nr; j++) - verify_path(names[j], file_mode); - end = getnanotime(); - printf("protect_ntfs = %d, protect_hfs = %d: %lfms\n", protect_ntfs, protect_hfs, (end-begin) / (double)1e6); - cumul += end - begin; - cumul2 += (end - begin) * (end - begin); - } - m[protect_ntfs][protect_hfs] = cumul / (double)repetitions; - v[protect_ntfs][protect_hfs] = my_sqrt(cumul2 / (double)repetitions - m[protect_ntfs][protect_hfs] * m[protect_ntfs][protect_hfs]); - printf("mean: %lfms, stddev: %lfms\n", m[protect_ntfs][protect_hfs] / (double)1e6, v[protect_ntfs][protect_hfs] / (double)1e6); - } - - for (protect_ntfs = 0; protect_ntfs < 2; protect_ntfs++) - for (protect_hfs = 0; protect_hfs < 2; protect_hfs++) - printf("ntfs=%d/hfs=%d: %lf%% slower\n", protect_ntfs, protect_hfs, (m[protect_ntfs][protect_hfs] - m[0][0]) * 100 / m[0][0]); - - return 0; -} - int cmd__path_utils(int argc, const char **argv) { if (argc == 3 && !strcmp(argv[1], "normalize_path_copy")) { @@ -448,26 +355,6 @@ int cmd__path_utils(int argc, const char **argv) return !!res; } - if (argc > 1 && !strcmp(argv[1], "protect_ntfs_hfs")) - return !!protect_ntfs_hfs_benchmark(argc - 1, argv + 1); - - if (argc > 1 && !strcmp(argv[1], "is_valid_path")) { - int res = 0, expect = 1, i; - - for (i = 2; i < argc; i++) - if (!strcmp("--not", argv[i])) - expect = 0; - else if (expect != is_valid_path(argv[i])) - res = error("'%s' is%s a valid path", - argv[i], expect ? " not" : ""); - else - fprintf(stderr, - "'%s' is%s a valid path\n", - argv[i], expect ? "" : " not"); - - return !!res; - } - fprintf(stderr, "%s: unknown function name: %s\n", argv[0], argv[1] ? argv[1] : "(there was none)"); return 1; diff --git a/third_party/git/t/helper/test-progress.c b/third_party/git/t/helper/test-progress.c deleted file mode 100644 index 42b96cb103c6..000000000000 --- a/third_party/git/t/helper/test-progress.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * A test helper to exercise the progress display. - * - * Reads instructions from standard input, one instruction per line: - * - * "progress " - Call display_progress() with the given item count - * as parameter. - * "throughput - Call display_throughput() with the given - * byte count as parameter. The 'millis' - * specify the time elapsed since the - * start_progress() call. - * "update" - Set the 'progress_update' flag. - * - * See 't0500-progress-display.sh' for examples. - */ -#include "test-tool.h" -#include "gettext.h" -#include "parse-options.h" -#include "progress.h" -#include "strbuf.h" - -/* - * These are defined in 'progress.c', but are not exposed in 'progress.h', - * because they are exclusively for testing. - */ -extern int progress_testing; -extern uint64_t progress_test_ns; -void progress_test_force_update(void); - -int cmd__progress(int argc, const char **argv) -{ - int total = 0; - const char *title; - struct strbuf line = STRBUF_INIT; - struct progress *progress; - - const char *usage[] = { - "test-tool progress [--total=] ", - NULL - }; - struct option options[] = { - OPT_INTEGER(0, "total", &total, "total number of items"), - OPT_END(), - }; - - argc = parse_options(argc, argv, NULL, options, usage, 0); - if (argc != 1) - die("need a title for the progress output"); - title = argv[0]; - - progress_testing = 1; - progress = start_progress(title, total); - while (strbuf_getline(&line, stdin) != EOF) { - char *end; - - if (skip_prefix(line.buf, "progress ", (const char **) &end)) { - uint64_t item_count = strtoull(end, &end, 10); - if (*end != '\0') - die("invalid input: '%s'\n", line.buf); - display_progress(progress, item_count); - } else if (skip_prefix(line.buf, "throughput ", - (const char **) &end)) { - uint64_t byte_count, test_ms; - - byte_count = strtoull(end, &end, 10); - if (*end != ' ') - die("invalid input: '%s'\n", line.buf); - test_ms = strtoull(end + 1, &end, 10); - if (*end != '\0') - die("invalid input: '%s'\n", line.buf); - progress_test_ns = test_ms * 1000 * 1000; - display_throughput(progress, byte_count); - } else if (!strcmp(line.buf, "update")) - progress_test_force_update(); - else - die("invalid input: '%s'\n", line.buf); - } - stop_progress(&progress); - - return 0; -} diff --git a/third_party/git/t/helper/test-read-cache.c b/third_party/git/t/helper/test-read-cache.c index 244977a29bdf..7e79b555de80 100644 --- a/third_party/git/t/helper/test-read-cache.c +++ b/third_party/git/t/helper/test-read-cache.c @@ -4,10 +4,11 @@ int cmd__read_cache(int argc, const char **argv) { - int i, cnt = 1; + int i, cnt = 1, namelen; const char *name = NULL; if (argc > 1 && skip_prefix(argv[1], "--print-and-refresh=", &name)) { + namelen = strlen(name); argc--; argv++; } @@ -23,7 +24,7 @@ int cmd__read_cache(int argc, const char **argv) refresh_index(&the_index, REFRESH_QUIET, NULL, NULL, NULL); - pos = index_name_pos(&the_index, name, strlen(name)); + pos = index_name_pos(&the_index, name, namelen); if (pos < 0) die("%s not in index", name); printf("%s is%s up to date\n", name, diff --git a/third_party/git/t/helper/test-read-graph.c b/third_party/git/t/helper/test-read-graph.c deleted file mode 100644 index f8a461767ca4..000000000000 --- a/third_party/git/t/helper/test-read-graph.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "test-tool.h" -#include "cache.h" -#include "commit-graph.h" -#include "repository.h" -#include "object-store.h" - -int cmd__read_graph(int argc, const char **argv) -{ - struct commit_graph *graph = NULL; - char *graph_name; - int open_ok; - int fd; - struct stat st; - struct object_directory *odb; - - setup_git_directory(); - odb = the_repository->objects->odb; - - graph_name = get_commit_graph_filename(odb); - - open_ok = open_commit_graph(graph_name, &fd, &st); - if (!open_ok) - die_errno(_("Could not open commit-graph '%s'"), graph_name); - - graph = load_commit_graph_one_fd_st(fd, &st, odb); - if (!graph) - return 1; - - FREE_AND_NULL(graph_name); - - printf("header: %08x %d %d %d %d\n", - ntohl(*(uint32_t*)graph->data), - *(unsigned char*)(graph->data + 4), - *(unsigned char*)(graph->data + 5), - *(unsigned char*)(graph->data + 6), - *(unsigned char*)(graph->data + 7)); - printf("num_commits: %u\n", graph->num_commits); - printf("chunks:"); - - if (graph->chunk_oid_fanout) - printf(" oid_fanout"); - if (graph->chunk_oid_lookup) - printf(" oid_lookup"); - if (graph->chunk_commit_data) - printf(" commit_metadata"); - if (graph->chunk_extra_edges) - printf(" extra_edges"); - printf("\n"); - - UNLEAK(graph); - - return 0; -} diff --git a/third_party/git/t/helper/test-run-command.c b/third_party/git/t/helper/test-run-command.c index 1646aa25d82f..2cc93bb69c52 100644 --- a/third_party/git/t/helper/test-run-command.c +++ b/third_party/git/t/helper/test-run-command.c @@ -10,16 +10,11 @@ #include "test-tool.h" #include "git-compat-util.h" -#include "cache.h" #include "run-command.h" #include "argv-array.h" #include "strbuf.h" -#include "parse-options.h" -#include "string-list.h" -#include "thread-utils.h" -#include "wildmatch.h" -#include "gettext.h" -#include "parse-options.h" +#include +#include static int number_callbacks; static int parallel_next(struct child_process *cp, @@ -55,337 +50,11 @@ static int task_finished(int result, return 1; } -struct testsuite { - struct string_list tests, failed; - int next; - int quiet, immediate, verbose, verbose_log, trace, write_junit_xml; -}; -#define TESTSUITE_INIT \ - { STRING_LIST_INIT_DUP, STRING_LIST_INIT_DUP, -1, 0, 0, 0, 0, 0, 0 } - -static int next_test(struct child_process *cp, struct strbuf *err, void *cb, - void **task_cb) -{ - struct testsuite *suite = cb; - const char *test; - if (suite->next >= suite->tests.nr) - return 0; - - test = suite->tests.items[suite->next++].string; - argv_array_pushl(&cp->args, "sh", test, NULL); - if (suite->quiet) - argv_array_push(&cp->args, "--quiet"); - if (suite->immediate) - argv_array_push(&cp->args, "-i"); - if (suite->verbose) - argv_array_push(&cp->args, "-v"); - if (suite->verbose_log) - argv_array_push(&cp->args, "-V"); - if (suite->trace) - argv_array_push(&cp->args, "-x"); - if (suite->write_junit_xml) - argv_array_push(&cp->args, "--write-junit-xml"); - - strbuf_addf(err, "Output of '%s':\n", test); - *task_cb = (void *)test; - - return 1; -} - -static int test_finished(int result, struct strbuf *err, void *cb, - void *task_cb) -{ - struct testsuite *suite = cb; - const char *name = (const char *)task_cb; - - if (result) - string_list_append(&suite->failed, name); - - strbuf_addf(err, "%s: '%s'\n", result ? "FAIL" : "SUCCESS", name); - - return 0; -} - -static int test_failed(struct strbuf *out, void *cb, void *task_cb) -{ - struct testsuite *suite = cb; - const char *name = (const char *)task_cb; - - string_list_append(&suite->failed, name); - strbuf_addf(out, "FAILED TO START: '%s'\n", name); - - return 0; -} - -static const char * const testsuite_usage[] = { - "test-run-command testsuite [] [...]", - NULL -}; - -static int testsuite(int argc, const char **argv) -{ - struct testsuite suite = TESTSUITE_INIT; - int max_jobs = 1, i, ret; - DIR *dir; - struct dirent *d; - struct option options[] = { - OPT_BOOL('i', "immediate", &suite.immediate, - "stop at first failed test case(s)"), - OPT_INTEGER('j', "jobs", &max_jobs, "run jobs in parallel"), - OPT_BOOL('q', "quiet", &suite.quiet, "be terse"), - OPT_BOOL('v', "verbose", &suite.verbose, "be verbose"), - OPT_BOOL('V', "verbose-log", &suite.verbose_log, - "be verbose, redirected to a file"), - OPT_BOOL('x', "trace", &suite.trace, "trace shell commands"), - OPT_BOOL(0, "write-junit-xml", &suite.write_junit_xml, - "write JUnit-style XML files"), - OPT_END() - }; - - memset(&suite, 0, sizeof(suite)); - suite.tests.strdup_strings = suite.failed.strdup_strings = 1; - - argc = parse_options(argc, argv, NULL, options, - testsuite_usage, PARSE_OPT_STOP_AT_NON_OPTION); - - if (max_jobs <= 0) - max_jobs = online_cpus(); - - dir = opendir("."); - if (!dir) - die("Could not open the current directory"); - while ((d = readdir(dir))) { - const char *p = d->d_name; - - if (*p != 't' || !isdigit(p[1]) || !isdigit(p[2]) || - !isdigit(p[3]) || !isdigit(p[4]) || p[5] != '-' || - !ends_with(p, ".sh")) - continue; - - /* No pattern: match all */ - if (!argc) { - string_list_append(&suite.tests, p); - continue; - } - - for (i = 0; i < argc; i++) - if (!wildmatch(argv[i], p, 0)) { - string_list_append(&suite.tests, p); - break; - } - } - closedir(dir); - - if (!suite.tests.nr) - die("No tests match!"); - if (max_jobs > suite.tests.nr) - max_jobs = suite.tests.nr; - - fprintf(stderr, "Running %d tests (%d at a time)\n", - suite.tests.nr, max_jobs); - - ret = run_processes_parallel(max_jobs, next_test, test_failed, - test_finished, &suite); - - if (suite.failed.nr > 0) { - ret = 1; - fprintf(stderr, "%d tests failed:\n\n", suite.failed.nr); - for (i = 0; i < suite.failed.nr; i++) - fprintf(stderr, "\t%s\n", suite.failed.items[i].string); - } - - string_list_clear(&suite.tests, 0); - string_list_clear(&suite.failed, 0); - - return !!ret; -} - -static uint64_t my_random_next = 1234; - -static uint64_t my_random(void) -{ - uint64_t res = my_random_next; - my_random_next = my_random_next * 1103515245 + 12345; - return res; -} - -static int quote_stress_test(int argc, const char **argv) -{ - /* - * We are running a quote-stress test. - * spawn a subprocess that runs quote-stress with a - * special option that echoes back the arguments that - * were passed in. - */ - char special[] = ".?*\\^_\"'`{}()[]<>@~&+:;$%"; // \t\r\n\a"; - int i, j, k, trials = 100, skip = 0, msys2 = 0; - struct strbuf out = STRBUF_INIT; - struct argv_array args = ARGV_ARRAY_INIT; - struct option options[] = { - OPT_INTEGER('n', "trials", &trials, "Number of trials"), - OPT_INTEGER('s', "skip", &skip, "Skip trials"), - OPT_BOOL('m', "msys2", &msys2, "Test quoting for MSYS2's sh"), - OPT_END() - }; - const char * const usage[] = { - "test-tool run-command quote-stress-test ", - NULL - }; - - argc = parse_options(argc, argv, NULL, options, usage, 0); - - setenv("MSYS_NO_PATHCONV", "1", 0); - - for (i = 0; i < trials; i++) { - struct child_process cp = CHILD_PROCESS_INIT; - size_t arg_count, arg_offset; - int ret = 0; - - argv_array_clear(&args); - if (msys2) - argv_array_pushl(&args, "sh", "-c", - "printf %s\\\\0 \"$@\"", "skip", NULL); - else - argv_array_pushl(&args, "test-tool", "run-command", - "quote-echo", NULL); - arg_offset = args.argc; - - if (argc > 0) { - trials = 1; - arg_count = argc; - for (j = 0; j < arg_count; j++) - argv_array_push(&args, argv[j]); - } else { - arg_count = 1 + (my_random() % 5); - for (j = 0; j < arg_count; j++) { - char buf[20]; - size_t min_len = 1; - size_t arg_len = min_len + - (my_random() % (ARRAY_SIZE(buf) - min_len)); - - for (k = 0; k < arg_len; k++) - buf[k] = special[my_random() % - ARRAY_SIZE(special)]; - buf[arg_len] = '\0'; - - argv_array_push(&args, buf); - } - } - - if (i < skip) - continue; - - cp.argv = args.argv; - strbuf_reset(&out); - if (pipe_command(&cp, NULL, 0, &out, 0, NULL, 0) < 0) - return error("Failed to spawn child process"); - - for (j = 0, k = 0; j < arg_count; j++) { - const char *arg = args.argv[j + arg_offset]; - - if (strcmp(arg, out.buf + k)) - ret = error("incorrectly quoted arg: '%s', " - "echoed back as '%s'", - arg, out.buf + k); - k += strlen(out.buf + k) + 1; - } - - if (k != out.len) - ret = error("got %d bytes, but consumed only %d", - (int)out.len, (int)k); - - if (ret) { - fprintf(stderr, "Trial #%d failed. Arguments:\n", i); - for (j = 0; j < arg_count; j++) - fprintf(stderr, "arg #%d: '%s'\n", - (int)j, args.argv[j + arg_offset]); - - strbuf_release(&out); - argv_array_clear(&args); - - return ret; - } - - if (i && (i % 100) == 0) - fprintf(stderr, "Trials completed: %d\n", (int)i); - } - - strbuf_release(&out); - argv_array_clear(&args); - - return 0; -} - -static int quote_echo(int argc, const char **argv) -{ - while (argc > 1) { - fwrite(argv[1], strlen(argv[1]), 1, stdout); - fputc('\0', stdout); - argv++; - argc--; - } - - return 0; -} - -static int inherit_handle(const char *argv0) -{ - struct child_process cp = CHILD_PROCESS_INIT; - char path[PATH_MAX]; - int tmp; - - /* First, open an inheritable handle */ - xsnprintf(path, sizeof(path), "out-XXXXXX"); - tmp = xmkstemp(path); - - argv_array_pushl(&cp.args, - "test-tool", argv0, "inherited-handle-child", NULL); - cp.in = -1; - cp.no_stdout = cp.no_stderr = 1; - if (start_command(&cp) < 0) - die("Could not start child process"); - - /* Then close it, and try to delete it. */ - close(tmp); - if (unlink(path)) - die("Could not delete '%s'", path); - - if (close(cp.in) < 0 || finish_command(&cp) < 0) - die("Child did not finish"); - - return 0; -} - -static int inherit_handle_child(void) -{ - struct strbuf buf = STRBUF_INIT; - - if (strbuf_read(&buf, 0, 0) < 0) - die("Could not read stdin"); - printf("Received %s\n", buf.buf); - strbuf_release(&buf); - - return 0; -} - int cmd__run_command(int argc, const char **argv) { struct child_process proc = CHILD_PROCESS_INIT; int jobs; - if (argc > 1 && !strcmp(argv[1], "testsuite")) - exit(testsuite(argc - 1, argv + 1)); - if (!strcmp(argv[1], "inherited-handle")) - exit(inherit_handle(argv[0])); - if (!strcmp(argv[1], "inherited-handle-child")) - exit(inherit_handle_child()); - - if (argc >= 2 && !strcmp(argv[1], "quote-stress-test")) - return !!quote_stress_test(argc - 1, argv + 1); - - if (argc >= 2 && !strcmp(argv[1], "quote-echo")) - return !!quote_echo(argc - 1, argv + 1); - if (argc < 3) return 1; while (!strcmp(argv[1], "env")) { diff --git a/third_party/git/t/helper/test-tool.c b/third_party/git/t/helper/test-tool.c index c9a232d23897..ce7e89028c4a 100644 --- a/third_party/git/t/helper/test-tool.c +++ b/third_party/git/t/helper/test-tool.c @@ -39,14 +39,11 @@ static struct test_cmd cmds[] = { { "oidmap", cmd__oidmap }, { "online-cpus", cmd__online_cpus }, { "parse-options", cmd__parse_options }, - { "parse-pathspec-file", cmd__parse_pathspec_file }, { "path-utils", cmd__path_utils }, { "pkt-line", cmd__pkt_line }, { "prio-queue", cmd__prio_queue }, - { "progress", cmd__progress }, { "reach", cmd__reach }, { "read-cache", cmd__read_cache }, - { "read-graph", cmd__read_graph }, { "read-midx", cmd__read_midx }, { "ref-store", cmd__ref_store }, { "regex", cmd__regex }, diff --git a/third_party/git/t/helper/test-tool.h b/third_party/git/t/helper/test-tool.h index c8549fd87f23..f805bb39ae9e 100644 --- a/third_party/git/t/helper/test-tool.h +++ b/third_party/git/t/helper/test-tool.h @@ -29,14 +29,11 @@ int cmd__mktemp(int argc, const char **argv); int cmd__oidmap(int argc, const char **argv); int cmd__online_cpus(int argc, const char **argv); int cmd__parse_options(int argc, const char **argv); -int cmd__parse_pathspec_file(int argc, const char** argv); int cmd__path_utils(int argc, const char **argv); int cmd__pkt_line(int argc, const char **argv); int cmd__prio_queue(int argc, const char **argv); -int cmd__progress(int argc, const char **argv); int cmd__reach(int argc, const char **argv); int cmd__read_cache(int argc, const char **argv); -int cmd__read_graph(int argc, const char **argv); int cmd__read_midx(int argc, const char **argv); int cmd__ref_store(int argc, const char **argv); int cmd__regex(int argc, const char **argv); diff --git a/third_party/git/t/helper/test-windows-named-pipe.c b/third_party/git/t/helper/test-windows-named-pipe.c index ae52183e6344..b4b752b01aaf 100644 --- a/third_party/git/t/helper/test-windows-named-pipe.c +++ b/third_party/git/t/helper/test-windows-named-pipe.c @@ -19,7 +19,7 @@ int cmd__windows_named_pipe(int argc, const char **argv) if (argc < 2) goto print_usage; filename = argv[1]; - if (strpbrk(filename, "/\\")) + if (strchr(filename, '/') || strchr(filename, '\\')) goto print_usage; strbuf_addf(&pathname, "//./pipe/%s", filename); diff --git a/third_party/git/t/lib-bash.sh b/third_party/git/t/lib-bash.sh index b0b6060929ce..2be955fafba6 100644 --- a/third_party/git/t/lib-bash.sh +++ b/third_party/git/t/lib-bash.sh @@ -2,12 +2,10 @@ # to run under Bash; primarily intended for tests of the completion # script. -if test -n "$BASH" && test -z "$POSIXLY_CORRECT" -then +if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then # we are in full-on bash mode true -elif type bash >/dev/null 2>&1 -then +elif type bash >/dev/null 2>&1; then # execute in full-on bash mode unset POSIXLY_CORRECT exec bash "$0" "$@" diff --git a/third_party/git/t/lib-credential.sh b/third_party/git/t/lib-credential.sh index bb88cc01087b..937b831ea675 100755 --- a/third_party/git/t/lib-credential.sh +++ b/third_party/git/t/lib-credential.sh @@ -19,7 +19,7 @@ check() { false fi && test_cmp expect-stdout stdout && - test_i18ncmp expect-stderr stderr + test_cmp expect-stderr stderr } read_chunk() { diff --git a/third_party/git/t/lib-git-daemon.sh b/third_party/git/t/lib-git-daemon.sh index e62569222b55..fb8f8870801e 100644 --- a/third_party/git/t/lib-git-daemon.sh +++ b/third_party/git/t/lib-git-daemon.sh @@ -15,7 +15,7 @@ # # test_done -if ! test_bool_env GIT_TEST_GIT_DAEMON true +if ! git env--helper --type=bool --default=true --exit-code GIT_TEST_GIT_DAEMON then skip_all="git-daemon testing disabled (unset GIT_TEST_GIT_DAEMON to enable)" test_done diff --git a/third_party/git/t/lib-git-p4.sh b/third_party/git/t/lib-git-p4.sh index 5aff2abe8b54..547b9f88e123 100644 --- a/third_party/git/t/lib-git-p4.sh +++ b/third_party/git/t/lib-git-p4.sh @@ -175,7 +175,7 @@ stop_and_cleanup_p4d () { cleanup_git () { retry_until_success rm -r "$git" - test_path_is_missing "$git" && + test_must_fail test -d "$git" && retry_until_success mkdir "$git" } diff --git a/third_party/git/t/lib-git-svn.sh b/third_party/git/t/lib-git-svn.sh index 7d248e658806..5d4ae629e14e 100644 --- a/third_party/git/t/lib-git-svn.sh +++ b/third_party/git/t/lib-git-svn.sh @@ -69,7 +69,7 @@ svn_cmd () { maybe_start_httpd () { loc=${1-svn} - if test_bool_env GIT_TEST_SVN_HTTPD false + if git env--helper --type=bool --default=false --exit-code GIT_TEST_HTTPD then . "$TEST_DIRECTORY"/lib-httpd.sh LIB_HTTPD_SVN="$loc" @@ -104,7 +104,7 @@ EOF } require_svnserve () { - if ! test_bool_env GIT_TEST_SVNSERVE false + if ! git env--helper --type=bool --default=false --exit-code GIT_TEST_SVNSERVE then skip_all='skipping svnserve test. (set $GIT_TEST_SVNSERVE to enable)' test_done diff --git a/third_party/git/t/lib-httpd.sh b/third_party/git/t/lib-httpd.sh index 1449ee95e9ea..0d985758c6dd 100644 --- a/third_party/git/t/lib-httpd.sh +++ b/third_party/git/t/lib-httpd.sh @@ -41,7 +41,7 @@ then test_done fi -if ! test_bool_env GIT_TEST_HTTPD true +if ! git env--helper --type=bool --default=true --exit-code GIT_TEST_HTTPD then skip_all="Network testing disabled (unset GIT_TEST_HTTPD to enable)" test_done @@ -132,7 +132,7 @@ prepare_httpd() { install_script broken-smart-http.sh install_script error-smart-http.sh install_script error.sh - install_script apply-one-time-perl.sh + install_script apply-one-time-sed.sh ln -s "$LIB_HTTPD_MODULE_PATH" "$HTTPD_ROOT_PATH/modules" diff --git a/third_party/git/t/lib-httpd/apache.conf b/third_party/git/t/lib-httpd/apache.conf index 994e5290d63b..5c1c86c193ab 100644 --- a/third_party/git/t/lib-httpd/apache.conf +++ b/third_party/git/t/lib-httpd/apache.conf @@ -113,7 +113,7 @@ Alias /auth/dumb/ www/auth/dumb/ SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH} SetEnv GIT_HTTP_EXPORT_ALL - + SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH} SetEnv GIT_HTTP_EXPORT_ALL @@ -122,7 +122,7 @@ ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1 ScriptAlias /broken_smart/ broken-smart-http.sh/ ScriptAlias /error_smart/ error-smart-http.sh/ ScriptAlias /error/ error.sh/ -ScriptAliasMatch /one_time_perl/(.*) apply-one-time-perl.sh/$1 +ScriptAliasMatch /one_time_sed/(.*) apply-one-time-sed.sh/$1 Options FollowSymlinks @@ -135,7 +135,7 @@ ScriptAliasMatch /one_time_perl/(.*) apply-one-time-perl.sh/$1 Options ExecCGI - + Options ExecCGI diff --git a/third_party/git/t/lib-httpd/apply-one-time-perl.sh b/third_party/git/t/lib-httpd/apply-one-time-perl.sh deleted file mode 100644 index 09a0abdff7c4..000000000000 --- a/third_party/git/t/lib-httpd/apply-one-time-perl.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# If "one-time-perl" exists in $HTTPD_ROOT_PATH, run perl on the HTTP response, -# using the contents of "one-time-perl" as the perl command to be run. If the -# response was modified as a result, delete "one-time-perl" so that subsequent -# HTTP responses are no longer modified. -# -# This can be used to simulate the effects of the repository changing in -# between HTTP request-response pairs. -if test -f one-time-perl -then - LC_ALL=C - export LC_ALL - - "$GIT_EXEC_PATH/git-http-backend" >out - perl -pe "$(cat one-time-perl)" out >out_modified - - if cmp -s out out_modified - then - cat out - else - cat out_modified - rm one-time-perl - fi -else - "$GIT_EXEC_PATH/git-http-backend" -fi diff --git a/third_party/git/t/lib-httpd/apply-one-time-sed.sh b/third_party/git/t/lib-httpd/apply-one-time-sed.sh new file mode 100644 index 000000000000..fcef72892547 --- /dev/null +++ b/third_party/git/t/lib-httpd/apply-one-time-sed.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# If "one-time-sed" exists in $HTTPD_ROOT_PATH, run sed on the HTTP response, +# using the contents of "one-time-sed" as the sed command to be run. If the +# response was modified as a result, delete "one-time-sed" so that subsequent +# HTTP responses are no longer modified. +# +# This can be used to simulate the effects of the repository changing in +# between HTTP request-response pairs. +if [ -e one-time-sed ]; then + "$GIT_EXEC_PATH/git-http-backend" >out + sed "$(cat one-time-sed)" out_modified + + if diff out out_modified >/dev/null; then + cat out + else + cat out_modified + rm one-time-sed + fi +else + "$GIT_EXEC_PATH/git-http-backend" +fi diff --git a/third_party/git/t/lib-log-graph.sh b/third_party/git/t/lib-log-graph.sh deleted file mode 100755 index 1184cceef262..000000000000 --- a/third_party/git/t/lib-log-graph.sh +++ /dev/null @@ -1,28 +0,0 @@ -# Helps shared by the test scripts for comparing log graphs. - -sanitize_log_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/index [0-9a-f]*\.\.[0-9a-f]*/index BEFORE..AFTER/' -} - -lib_test_cmp_graph () { - git log --graph "$@" >output && - sed 's/ *$//' >output.sanitized output && - sanitize_log_output >output.sanitized output.colors.raw && - test_decode_color output.colors && - test_cmp expect.colors output.colors -} diff --git a/third_party/git/t/lib-pack.sh b/third_party/git/t/lib-pack.sh index f3463170b39f..c4d907a450a7 100644 --- a/third_party/git/t/lib-pack.sh +++ b/third_party/git/t/lib-pack.sh @@ -35,11 +35,9 @@ pack_header () { # have hardcoded some well-known objects. See the case statements below for the # complete list. pack_obj () { - test_oid_init - case "$1" in # empty blob - $EMPTY_BLOB) + e69de29bb2d1d6434b8b29ae775ad8c2e48c5391) case "$2" in '') printf '\060\170\234\003\0\0\0\0\1' @@ -49,7 +47,7 @@ pack_obj () { ;; # blob containing "\7\76" - $(test_oid packlib_7_76)) + e68fe8129b546b101aee9510c5328e7f21ca1d18) case "$2" in '') printf '\062\170\234\143\267\3\0\0\116\0\106' @@ -61,18 +59,11 @@ pack_obj () { printf '\234\143\142\142\142\267\003\0\0\151\0\114' return ;; - 37c8e2c15bb22b912e59b43fd51a4f7e9465ed0b5084c5a1411d991cbe630683) - printf '\165\67\310\342\301\133\262\53\221\56\131' && - printf '\264\77\325\32\117\176\224\145\355\13\120' && - printf '\204\305\241\101\35\231\34\276\143\6\203\170' && - printf '\234\143\142\142\142\267\003\0\0\151\0\114' - return - ;; esac ;; # blob containing "\7\0" - $(test_oid packlib_7_0)) + 01d7713666f4de822776c7622c10f1b07de280dc) case "$2" in '') printf '\062\170\234\143\147\0\0\0\20\0\10' @@ -84,13 +75,6 @@ pack_obj () { printf '\143\142\142\142\147\0\0\0\53\0\16' return ;; - 5d8e6fc40f2dab00e6983a48523fe57e621f46434cb58dbd4422fba03380d886) - printf '\165\135\216\157\304\17\55\253\0\346\230\72' && - printf '\110\122\77\345\176\142\37\106\103\114\265' && - printf '\215\275\104\42\373\240\63\200\330\206\170\234' && - printf '\143\142\142\142\147\0\0\0\53\0\16' - return - ;; esac ;; esac @@ -102,7 +86,7 @@ pack_obj () { then echo "$1" | git pack-objects --stdout >pack_obj.tmp && size=$(wc -c trailer.tmp && + test-tool sha1 -b <"$1" >trailer.tmp && cat trailer.tmp >>"$1" && rm -f trailer.tmp } @@ -125,11 +108,3 @@ pack_trailer () { clear_packs () { rm -f .git/objects/pack/* } - -test_oid_cache <<-EOF -packlib_7_0 sha1:01d7713666f4de822776c7622c10f1b07de280dc -packlib_7_0 sha256:37c8e2c15bb22b912e59b43fd51a4f7e9465ed0b5084c5a1411d991cbe630683 - -packlib_7_76 sha1:e68fe8129b546b101aee9510c5328e7f21ca1d18 -packlib_7_76 sha256:5d8e6fc40f2dab00e6983a48523fe57e621f46434cb58dbd4422fba03380d886 -EOF diff --git a/third_party/git/t/lib-rebase.sh b/third_party/git/t/lib-rebase.sh index b72c051f4761..7ea30e50068b 100644 --- a/third_party/git/t/lib-rebase.sh +++ b/third_party/git/t/lib-rebase.sh @@ -44,10 +44,10 @@ set_fake_editor () { rm -f "$1" echo 'rebase -i script before editing:' cat "$1".tmp - action=\& + action=pick for line in $FAKE_LINES; do case $line in - pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d|label|l|reset|r|merge|m) + pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d) action="$line";; exec_*|x_*|break|b) echo "$line" | sed 's/_/ /g' >> "$1";; @@ -58,12 +58,11 @@ set_fake_editor () { bad) action="badcmd";; fakesha) - test \& != "$action" || action=pick echo "$action XXXXXXX False commit" >> "$1" action=pick;; *) - sed -n "${line}s/^[a-z][a-z]*/$action/p" < "$1".tmp >> "$1" - action=\&;; + sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1" + action=pick;; esac done echo 'rebase -i script after editing:' @@ -119,31 +118,3 @@ make_empty () { git commit --allow-empty -m "$1" && git tag "$1" } - -# Call this (inside test_expect_success) at the end of a test file to -# check that no tests have changed editor related environment -# variables or config settings -test_editor_unchanged () { - # We're only interested in exported variables hence 'sh -c' - sh -c 'cat >actual <<-EOF - EDITOR=$EDITOR - FAKE_COMMIT_AMEND=$FAKE_COMMIT_AMEND - FAKE_COMMIT_MESSAGE=$FAKE_COMMIT_MESSAGE - FAKE_LINES=$FAKE_LINES - GIT_EDITOR=$GIT_EDITOR - GIT_SEQUENCE_EDITOR=$GIT_SEQUENCE_EDITOR - core.editor=$(git config core.editor) - sequence.editor=$(git config sequence.editor) - EOF' - cat >expect <<-\EOF - EDITOR=: - FAKE_COMMIT_AMEND= - FAKE_COMMIT_MESSAGE= - FAKE_LINES= - GIT_EDITOR= - GIT_SEQUENCE_EDITOR= - core.editor= - sequence.editor= - EOF - test_cmp expect actual -} diff --git a/third_party/git/t/oid-info/hash-info b/third_party/git/t/oid-info/hash-info index d0736dd1a00d..ccdbfdf9743d 100644 --- a/third_party/git/t/oid-info/hash-info +++ b/third_party/git/t/oid-info/hash-info @@ -6,12 +6,3 @@ hexsz sha256:64 zero sha1:0000000000000000000000000000000000000000 zero sha256:0000000000000000000000000000000000000000000000000000000000000000 - -algo sha1:sha1 -algo sha256:sha256 - -empty_blob sha1:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 -empty_blob sha256:473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813 - -empty_tree sha1:4b825dc642cb6eb9a060e54bf8d69288fbee4904 -empty_tree sha256:6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321 diff --git a/third_party/git/t/perf/aggregate.perl b/third_party/git/t/perf/aggregate.perl index 14e4cda287d7..66554d216122 100755 --- a/third_party/git/t/perf/aggregate.perl +++ b/third_party/git/t/perf/aggregate.perl @@ -4,6 +4,7 @@ use lib '../../perl/build/lib'; use strict; use warnings; use Getopt::Long; +use Git; use Cwd qw(realpath); sub get_times { @@ -84,11 +85,6 @@ sub format_size { return $out; } -sub sane_backticks { - open(my $fh, '-|', @_); - return <$fh>; -} - my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests, $codespeed, $sortby, $subsection, $reponame); @@ -106,8 +102,7 @@ while (scalar @ARGV) { my $prefix = ''; last if -f $arg or $arg eq "--"; if (! -d $arg) { - my $rev = sane_backticks(qw(git rev-parse --verify), $arg); - chomp $rev; + my $rev = Git::command_oneline(qw(rev-parse --verify), $arg); $dir = "build/".$rev; } elsif ($arg eq '.') { $dir = '.'; @@ -224,7 +219,13 @@ sub print_default_results { for my $i (0..$#dirs) { my $d = $dirs[$i]; my $base = "$resultsdir/$prefixes{$d}$t"; - $times{$prefixes{$d}.$t} = [get_times("$base.result")]; + $times{$prefixes{$d}.$t} = []; + foreach my $type (qw(times size)) { + if (-e "$base.$type") { + $times{$prefixes{$d}.$t} = [get_times("$base.$type")]; + last; + } + } my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}}; my $w = length format_times($r,$u,$s,$firstr); $colwidth[$i] = $w if $w > $colwidth[$i]; @@ -266,7 +267,7 @@ sub print_sorted_results { my ($prevr, $prevu, $prevs, $prevrev); for my $i (0..$#dirs) { my $d = $dirs[$i]; - my ($r, $u, $s) = get_times("$resultsdir/$prefixes{$d}$t.result"); + my ($r, $u, $s) = get_times("$resultsdir/$prefixes{$d}$t.times"); if ($i > 0 and defined $r and defined $prevr and $prevr > 0) { my $percent = 100.0 * ($r - $prevr) / $prevr; push @evolutions, { "percent" => $percent, @@ -326,7 +327,7 @@ sub print_codespeed_results { my $commitid = $prefixes{$d}; $commitid =~ s/^build_//; $commitid =~ s/\.$//; - my ($result_value, $u, $s) = get_times("$resultsdir/$prefixes{$d}$t.result"); + my ($result_value, $u, $s) = get_times("$resultsdir/$prefixes{$d}$t.times"); my %vals = ( "commitid" => $commitid, diff --git a/third_party/git/t/perf/bisect_regression b/third_party/git/t/perf/bisect_regression index ce47e1662a92..a94d9955d012 100755 --- a/third_party/git/t/perf/bisect_regression +++ b/third_party/git/t/perf/bisect_regression @@ -51,7 +51,7 @@ oldtime=$(echo "$oldtime" | sed -e 's/^\([0-9]\+\.[0-9]\+\).*$/\1/') newtime=$(echo "$newtime" | sed -e 's/^\([0-9]\+\.[0-9]\+\).*$/\1/') test $(echo "$newtime" "$oldtime" | awk '{ print ($1 > $2) }') = 1 || - die "New time '$newtime' should be greater than old time '$oldtime'" + die "New time '$newtime' shoud be greater than old time '$oldtime'" tmpdir=$(mktemp -d -t bisect_regression_XXXXXX) || die "Failed to create temp directory" echo "$oldtime" >"$tmpdir/oldtime" || die "Failed to write to '$tmpdir/oldtime'" diff --git a/third_party/git/t/perf/p5303-many-packs.sh b/third_party/git/t/perf/p5303-many-packs.sh index 7ee791669a15..377985194116 100755 --- a/third_party/git/t/perf/p5303-many-packs.sh +++ b/third_party/git/t/perf/p5303-many-packs.sh @@ -77,7 +77,6 @@ do # actual pack generation, without smudging the on-disk setup # between trials. test_perf "repack ($nr_packs)" ' - GIT_TEST_FULL_IN_PACK_ARRAY=1 \ git pack-objects --keep-true-parents \ --honor-pack-keep --non-empty --all \ --reflog --indexed-objects --delta-base-offset \ @@ -85,22 +84,4 @@ do ' done -# Measure pack loading with 10,000 packs. -test_expect_success 'generate lots of packs' ' - for i in $(test_seq 10000); do - echo "blob" - echo "data </dev/null ' -test_perf 'rev-list (commits)' ' - git rev-list --all --use-bitmap-index >/dev/null -' - -test_perf 'rev-list (objects)' ' - git rev-list --all --use-bitmap-index --objects >/dev/null -' - -test_perf 'rev-list count with blob:none' ' - git rev-list --use-bitmap-index --count --objects --all \ - --filter=blob:none >/dev/null -' - -test_perf 'rev-list count with blob:limit=1k' ' - git rev-list --use-bitmap-index --count --objects --all \ - --filter=blob:limit=1k >/dev/null -' - -test_perf 'simulated partial clone' ' - git pack-objects --stdout --all --filter=blob:none /dev/null -' - test_expect_success 'create partial bitmap state' ' # pick a commit to represent the repo tip in the past cutoff=$(git rev-list HEAD~100 -1) && diff --git a/third_party/git/t/perf/p5600-clone-reference.sh b/third_party/git/t/perf/p5600-clone-reference.sh new file mode 100755 index 000000000000..68fed663479d --- /dev/null +++ b/third_party/git/t/perf/p5600-clone-reference.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +test_description='speed of clone --reference' +. ./perf-lib.sh + +test_perf_default_repo + +test_expect_success 'create shareable repository' ' + git clone --bare . shared.git +' + +test_expect_success 'advance base repository' ' + # Do not use test_commit here; its test_tick will + # use some ancient hard-coded date. The resulting clock + # skew will cause pack-objects to traverse in a very + # sub-optimal order, skewing the results. + echo content >new-file-that-does-not-exist && + git add new-file-that-does-not-exist && + git commit -m "new commit" +' + +test_perf 'clone --reference' ' + rm -rf dst.git && + git clone --no-local --bare --reference shared.git . dst.git +' + +test_done diff --git a/third_party/git/t/perf/p5601-clone-reference.sh b/third_party/git/t/perf/p5601-clone-reference.sh deleted file mode 100755 index 68fed663479d..000000000000 --- a/third_party/git/t/perf/p5601-clone-reference.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -test_description='speed of clone --reference' -. ./perf-lib.sh - -test_perf_default_repo - -test_expect_success 'create shareable repository' ' - git clone --bare . shared.git -' - -test_expect_success 'advance base repository' ' - # Do not use test_commit here; its test_tick will - # use some ancient hard-coded date. The resulting clock - # skew will cause pack-objects to traverse in a very - # sub-optimal order, skewing the results. - echo content >new-file-that-does-not-exist && - git add new-file-that-does-not-exist && - git commit -m "new commit" -' - -test_perf 'clone --reference' ' - rm -rf dst.git && - git clone --no-local --bare --reference shared.git . dst.git -' - -test_done diff --git a/third_party/git/t/perf/perf-lib.sh b/third_party/git/t/perf/perf-lib.sh index 13e389367a4e..b58a43ea4364 100644 --- a/third_party/git/t/perf/perf-lib.sh +++ b/third_party/git/t/perf/perf-lib.sh @@ -214,7 +214,7 @@ test_perf_ () { else test_ok_ "$1" fi - "$TEST_DIRECTORY"/perf/min_time.perl test_time.* >"$base".result + "$TEST_DIRECTORY"/perf/min_time.perl test_time.* >"$base".times } test_perf () { @@ -223,7 +223,7 @@ test_perf () { test_size_ () { say >&3 "running: $2" - if test_eval_ "$2" 3>"$base".result; then + if test_eval_ "$2" 3>"$base".size; then test_ok_ "$1" else test_failure_ "$@" diff --git a/third_party/git/t/t0000-basic.sh b/third_party/git/t/t0000-basic.sh index 3e440c078d57..9ca0818cbe4c 100755 --- a/third_party/git/t/t0000-basic.sh +++ b/third_party/git/t/t0000-basic.sh @@ -20,9 +20,9 @@ modification *should* take notice and update the test vectors here. . ./test-lib.sh -try_local_xy () { - local x="local" y="alsolocal" && - echo "$x $y" +try_local_x () { + local x="local" && + echo "$x" } # Check whether the shell supports the "local" keyword. "local" is not @@ -35,12 +35,11 @@ try_local_xy () { # relying on "local". test_expect_success 'verify that the running shell supports "local"' ' x="notlocal" && - y="alsonotlocal" && - echo "local alsolocal" >expected1 && - try_local_xy >actual1 && + echo "local" >expected1 && + try_local_x >actual1 && test_cmp expected1 actual1 && - echo "notlocal alsonotlocal" >expected2 && - echo "$x $y" >actual2 && + echo "notlocal" >expected2 && + echo "$x" >actual2 && test_cmp expected2 actual2 ' @@ -127,7 +126,7 @@ check_sub_test_lib_test () { check_sub_test_lib_test_err () { name="$1" # stdin is the expected output from the test - # expected error output is in descriptor 3 + # expected error output is in descriptior 3 ( cd "$name" && sed -e 's/^> //' -e 's/Z$//' >expect.out && @@ -155,7 +154,7 @@ test_expect_success 'pretend we have a fully passing test suite' " " test_expect_success 'pretend we have a partially passing test suite' " - run_sub_test_lib_test_err \ + test_must_fail run_sub_test_lib_test \ partial-pass '2/3 tests passing' <<-\\EOF && test_expect_success 'passing test #1' 'true' test_expect_success 'failing test #2' 'false' @@ -219,7 +218,7 @@ test_expect_success 'pretend we have fixed one of two known breakages (run in su " test_expect_success 'pretend we have a pass, fail, and known breakage' " - run_sub_test_lib_test_err \ + test_must_fail run_sub_test_lib_test \ mixed-results1 'mixed results #1' <<-\\EOF && test_expect_success 'passing test' 'true' test_expect_success 'failing test' 'false' @@ -238,7 +237,7 @@ test_expect_success 'pretend we have a pass, fail, and known breakage' " " test_expect_success 'pretend we have a mix of all possible results' " - run_sub_test_lib_test_err \ + test_must_fail run_sub_test_lib_test \ mixed-results2 'mixed results #2' <<-\\EOF && test_expect_success 'passing test' 'true' test_expect_success 'passing test' 'true' @@ -274,24 +273,24 @@ test_expect_success 'pretend we have a mix of all possible results' " " test_expect_success C_LOCALE_OUTPUT 'test --verbose' ' - run_sub_test_lib_test_err \ - t1234-verbose "test verbose" --verbose <<-\EOF && + test_must_fail run_sub_test_lib_test \ + test-verbose "test verbose" --verbose <<-\EOF && test_expect_success "passing test" true test_expect_success "test with output" "echo foo" test_expect_success "failing test" false test_done EOF - mv t1234-verbose/out t1234-verbose/out+ && - grep -v "^Initialized empty" t1234-verbose/out+ >t1234-verbose/out && - check_sub_test_lib_test t1234-verbose <<-\EOF - > expecting success of 1234.1 '\''passing test'\'': true + mv test-verbose/out test-verbose/out+ && + grep -v "^Initialized empty" test-verbose/out+ >test-verbose/out && + check_sub_test_lib_test test-verbose <<-\EOF + > expecting success: true > ok 1 - passing test > Z - > expecting success of 1234.2 '\''test with output'\'': echo foo + > expecting success: echo foo > foo > ok 2 - test with output > Z - > expecting success of 1234.3 '\''failing test'\'': false + > expecting success: false > not ok 3 - failing test > # false > Z @@ -301,18 +300,18 @@ test_expect_success C_LOCALE_OUTPUT 'test --verbose' ' ' test_expect_success 'test --verbose-only' ' - run_sub_test_lib_test_err \ - t2345-verbose-only-2 "test verbose-only=2" \ + test_must_fail run_sub_test_lib_test \ + test-verbose-only-2 "test verbose-only=2" \ --verbose-only=2 <<-\EOF && test_expect_success "passing test" true test_expect_success "test with output" "echo foo" test_expect_success "failing test" false test_done EOF - check_sub_test_lib_test t2345-verbose-only-2 <<-\EOF + check_sub_test_lib_test test-verbose-only-2 <<-\EOF > ok 1 - passing test > Z - > expecting success of 2345.2 '\''test with output'\'': echo foo + > expecting success: echo foo > foo > ok 2 - test with output > Z @@ -392,44 +391,6 @@ test_expect_success 'GIT_SKIP_TESTS sh pattern' " ) " -test_expect_success 'GIT_SKIP_TESTS entire suite' " - ( - GIT_SKIP_TESTS='git' && export GIT_SKIP_TESTS && - run_sub_test_lib_test git-skip-tests-entire-suite \ - 'GIT_SKIP_TESTS entire suite' <<-\\EOF && - for i in 1 2 3 - do - test_expect_success \"passing test #\$i\" 'true' - done - test_done - EOF - check_sub_test_lib_test git-skip-tests-entire-suite <<-\\EOF - > 1..0 # SKIP skip all tests in git - EOF - ) -" - -test_expect_success 'GIT_SKIP_TESTS does not skip unmatched suite' " - ( - GIT_SKIP_TESTS='notgit' && export GIT_SKIP_TESTS && - run_sub_test_lib_test git-skip-tests-unmatched-suite \ - 'GIT_SKIP_TESTS does not skip unmatched suite' <<-\\EOF && - for i in 1 2 3 - do - test_expect_success \"passing test #\$i\" 'true' - done - test_done - EOF - check_sub_test_lib_test git-skip-tests-unmatched-suite <<-\\EOF - > ok 1 - passing test #1 - > ok 2 - passing test #2 - > ok 3 - passing test #3 - > # passed all 3 test(s) - > 1..3 - EOF - ) -" - test_expect_success '--run basic' " run_sub_test_lib_test run-basic \ '--run basic' --run='1 3 5' <<-\\EOF && @@ -834,7 +795,7 @@ then fi test_expect_success 'tests clean up even on failures' " - run_sub_test_lib_test_err \ + test_must_fail run_sub_test_lib_test \ failing-cleanup 'Failing tests with cleanup commands' <<-\\EOF && test_expect_success 'tests clean up even after a failure' ' touch clean-after-failure && @@ -863,7 +824,7 @@ test_expect_success 'tests clean up even on failures' " " test_expect_success 'test_atexit is run' " - run_sub_test_lib_test_err \ + test_must_fail run_sub_test_lib_test \ atexit-cleanup 'Run atexit commands' -i <<-\\EOF && test_expect_success 'tests clean up even after a failure' ' > ../../clean-atexit && @@ -917,40 +878,6 @@ test_expect_success 'test_oid can look up data for SHA-256' ' test "$hexsz" -eq 64 ' -test_expect_success 'test_bool_env' ' - ( - sane_unset envvar && - - test_bool_env envvar true && - ! test_bool_env envvar false && - - envvar= && - export envvar && - ! test_bool_env envvar true && - ! test_bool_env envvar false && - - envvar=true && - test_bool_env envvar true && - test_bool_env envvar false && - - envvar=false && - ! test_bool_env envvar true && - ! test_bool_env envvar false && - - envvar=invalid && - # When encountering an invalid bool value, test_bool_env - # prints its error message to the original stderr of the - # test script, hence the redirection of fd 7, and aborts - # with "exit 1", hence the subshell. - ! ( test_bool_env envvar true ) 7>err && - grep "error: test_bool_env requires bool values" err && - - envvar=true && - ! ( test_bool_env envvar invalid ) 7>err && - grep "error: test_bool_env requires bool values" err - ) -' - ################################################################ # Basics of the basics diff --git a/third_party/git/t/t0003-attributes.sh b/third_party/git/t/t0003-attributes.sh index b660593c20f8..71e63d8b509d 100755 --- a/third_party/git/t/t0003-attributes.sh +++ b/third_party/git/t/t0003-attributes.sh @@ -5,16 +5,19 @@ test_description=gitattributes . ./test-lib.sh attr_check () { - path="$1" expect="$2" git_opts="$3" && + path="$1" expect="$2" - git $git_opts check-attr test -- "$path" >actual 2>err && - echo "$path: test: $expect" >expect && + git $3 check-attr test -- "$path" >actual 2>err && + echo "$path: test: $2" >expect && test_cmp expect actual && - test_must_be_empty err + test_line_count = 0 err } attr_check_quote () { - path="$1" quoted_path="$2" expect="$3" && + + path="$1" + quoted_path="$2" + expect="$3" git check-attr test -- "$path" >actual && echo "\"$quoted_path\": test: $expect" >expect && @@ -24,7 +27,7 @@ attr_check_quote () { test_expect_success 'open-quoted pathname' ' echo "\"a test=a" >.gitattributes && - attr_check a unspecified + test_must_fail attr_check a a ' @@ -109,20 +112,20 @@ test_expect_success 'attribute test' ' test_expect_success 'attribute matching is case sensitive when core.ignorecase=0' ' - attr_check F unspecified "-c core.ignorecase=0" && - attr_check a/F unspecified "-c core.ignorecase=0" && - attr_check a/c/F unspecified "-c core.ignorecase=0" && - attr_check a/G unspecified "-c core.ignorecase=0" && - attr_check a/B/g a/g "-c core.ignorecase=0" && - attr_check a/b/G unspecified "-c core.ignorecase=0" && - attr_check a/b/H unspecified "-c core.ignorecase=0" && - attr_check a/b/D/g a/g "-c core.ignorecase=0" && - attr_check oNoFf unspecified "-c core.ignorecase=0" && - attr_check oFfOn unspecified "-c core.ignorecase=0" && + test_must_fail attr_check F f "-c core.ignorecase=0" && + test_must_fail attr_check a/F f "-c core.ignorecase=0" && + test_must_fail attr_check a/c/F f "-c core.ignorecase=0" && + test_must_fail attr_check a/G a/g "-c core.ignorecase=0" && + test_must_fail attr_check a/B/g a/b/g "-c core.ignorecase=0" && + test_must_fail attr_check a/b/G a/b/g "-c core.ignorecase=0" && + test_must_fail attr_check a/b/H a/b/h "-c core.ignorecase=0" && + test_must_fail attr_check a/b/D/g "a/b/d/*" "-c core.ignorecase=0" && + test_must_fail attr_check oNoFf unset "-c core.ignorecase=0" && + test_must_fail attr_check oFfOn set "-c core.ignorecase=0" && attr_check NO unspecified "-c core.ignorecase=0" && - attr_check a/b/D/NO unspecified "-c core.ignorecase=0" && + test_must_fail attr_check a/b/D/NO "a/b/d/*" "-c core.ignorecase=0" && attr_check a/b/d/YES a/b/d/* "-c core.ignorecase=0" && - attr_check a/E/f f "-c core.ignorecase=0" + test_must_fail attr_check a/E/f "A/e/F" "-c core.ignorecase=0" ' @@ -146,8 +149,8 @@ test_expect_success 'attribute matching is case insensitive when core.ignorecase ' test_expect_success CASE_INSENSITIVE_FS 'additional case insensitivity tests' ' - attr_check a/B/D/g a/g "-c core.ignorecase=0" && - attr_check A/B/D/NO unspecified "-c core.ignorecase=0" && + test_must_fail attr_check a/B/D/g "a/b/d/*" "-c core.ignorecase=0" && + test_must_fail attr_check A/B/D/NO "a/b/d/*" "-c core.ignorecase=0" && attr_check A/b/h a/b/h "-c core.ignorecase=1" && attr_check a/B/D/g "a/b/d/*" "-c core.ignorecase=1" && attr_check A/B/D/NO "a/b/d/*" "-c core.ignorecase=1" @@ -241,7 +244,7 @@ EOF git check-attr foo -- "a/b/f" >>actual 2>>err && git check-attr foo -- "a/b/c/f" >>actual 2>>err && test_cmp expect actual && - test_must_be_empty err + test_line_count = 0 err ' test_expect_success '"**" with no slashes test' ' @@ -262,7 +265,7 @@ EOF git check-attr foo -- "a/b/f" >>actual 2>>err && git check-attr foo -- "a/b/c/f" >>actual 2>>err && test_cmp expect actual && - test_must_be_empty err + test_line_count = 0 err ' test_expect_success 'using --git-dir and --work-tree' ' diff --git a/third_party/git/t/t0008-ignores.sh b/third_party/git/t/t0008-ignores.sh index 370a389e5c5c..1744cee5e996 100755 --- a/third_party/git/t/t0008-ignores.sh +++ b/third_party/git/t/t0008-ignores.sh @@ -424,24 +424,9 @@ test_expect_success 'local ignore inside a sub-directory with --verbose' ' ) ' -test_expect_success 'nested include of negated pattern' ' - expect "" && - test_check_ignore "a/b/one" 1 -' - -test_expect_success 'nested include of negated pattern with -q' ' - expect "" && - test_check_ignore "-q a/b/one" 1 -' - -test_expect_success 'nested include of negated pattern with -v' ' - expect "a/b/.gitignore:8:!on* a/b/one" && - test_check_ignore "-v a/b/one" 0 -' - -test_expect_success 'nested include of negated pattern with -v -n' ' - expect "a/b/.gitignore:8:!on* a/b/one" && - test_check_ignore "-v -n a/b/one" 0 +test_expect_success_multi 'nested include' \ + 'a/b/.gitignore:8:!on* a/b/one' ' + test_check_ignore "a/b/one" ' ############################################################################ @@ -475,6 +460,7 @@ test_expect_success 'cd to ignored sub-directory' ' expect_from_stdin <<-\EOF && foo twoooo + ../one seven ../../one EOF @@ -557,6 +543,7 @@ test_expect_success 'global ignore' ' globalthree a/globalthree a/per-repo + globaltwo EOF test_check_ignore "globalone per-repo globalthree a/globalthree a/per-repo not-ignored globaltwo" ' @@ -599,7 +586,17 @@ EOF cat <<-\EOF >expected-default one a/one + a/b/on + a/b/one + a/b/one one + a/b/one two + "a/b/one\"three" + a/b/two a/b/twooo + globaltwo + a/globaltwo + a/b/globaltwo + b/globaltwo EOF cat <<-EOF >expected-verbose .gitignore:1:one one @@ -699,12 +696,8 @@ cat <<-EOF >expected-all $global_excludes:2:!globaltwo ../b/globaltwo :: c/not-ignored EOF -cat <<-EOF >expected-default -../one -one -b/twooo -EOF grep -v '^:: ' expected-all >expected-verbose +sed -e 's/.* //' expected-verbose >expected-default broken_c_unquote stdin >stdin0 diff --git a/third_party/git/t/t0014-alias.sh b/third_party/git/t/t0014-alias.sh index 8d3d9144c06d..a070e645d7fb 100755 --- a/third_party/git/t/t0014-alias.sh +++ b/third_party/git/t/t0014-alias.sh @@ -37,11 +37,4 @@ test_expect_success 'looping aliases - internal execution' ' # test_i18ngrep "^fatal: alias loop detected: expansion of" output #' -test_expect_success 'run-command formats empty args properly' ' - test_must_fail env GIT_TRACE=1 git frotz a "" b " " c 2>actual.raw && - sed -ne "/run_command:/s/.*trace: run_command: //p" actual.raw >actual && - echo "git-frotz a '\'''\'' b '\'' '\'' c" >expect && - test_cmp expect actual -' - test_done diff --git a/third_party/git/t/t0020-crlf.sh b/third_party/git/t/t0020-crlf.sh index b63ba62e5db4..854da0ae16f8 100755 --- a/third_party/git/t/t0020-crlf.sh +++ b/third_party/git/t/t0020-crlf.sh @@ -159,8 +159,8 @@ test_expect_success 'checkout with autocrlf=input' ' rm -f tmp one dir/two three && git config core.autocrlf input && git read-tree --reset -u HEAD && - ! has_cr one && - ! has_cr dir/two && + test_must_fail has_cr one && + test_must_fail has_cr dir/two && git update-index -- one dir/two && test "$one" = $(git hash-object --stdin .gitattributes && git read-tree --reset -u HEAD && - ! has_cr dir/two + test_must_fail has_cr dir/two ' test_expect_success '.gitattributes says two and three are text' ' @@ -270,7 +270,7 @@ test_expect_success 'in-tree .gitattributes (1)' ' rm -rf tmp one dir .gitattributes patch.file three && git read-tree --reset -u HEAD && - ! has_cr one && + test_must_fail has_cr one && verbose has_cr three ' @@ -280,7 +280,7 @@ test_expect_success 'in-tree .gitattributes (2)' ' git read-tree --reset HEAD && git checkout-index -f -q -u -a && - ! has_cr one && + test_must_fail has_cr one && verbose has_cr three ' @@ -291,7 +291,7 @@ test_expect_success 'in-tree .gitattributes (3)' ' git checkout-index -u .gitattributes && git checkout-index -u one dir/two three && - ! has_cr one && + test_must_fail has_cr one && verbose has_cr three ' @@ -302,7 +302,7 @@ test_expect_success 'in-tree .gitattributes (4)' ' git checkout-index -u one dir/two three && git checkout-index -u .gitattributes && - ! has_cr one && + test_must_fail has_cr one && verbose has_cr three ' diff --git a/third_party/git/t/t0021-conversion.sh b/third_party/git/t/t0021-conversion.sh index dc664da551a3..e10f5f787fca 100755 --- a/third_party/git/t/t0021-conversion.sh +++ b/third_party/git/t/t0021-conversion.sh @@ -35,7 +35,7 @@ filter_git () { # Compare two files and ensure that `clean` and `smudge` respectively are # called at least once if specified in the `expect` file. The actual # invocation count is not relevant because their number can vary. -# c.f. http://lore.kernel.org/git/xmqqshv18i8i.fsf@gitster.mtv.corp.google.com/ +# c.f. http://public-inbox.org/git/xmqqshv18i8i.fsf@gitster.mtv.corp.google.com/ test_cmp_count () { expect=$1 actual=$2 @@ -50,7 +50,7 @@ test_cmp_count () { # Compare two files but exclude all `clean` invocations because Git can # call `clean` zero or more times. -# c.f. http://lore.kernel.org/git/xmqqshv18i8i.fsf@gitster.mtv.corp.google.com/ +# c.f. http://public-inbox.org/git/xmqqshv18i8i.fsf@gitster.mtv.corp.google.com/ test_cmp_exclude_clean () { expect=$1 actual=$2 @@ -390,9 +390,6 @@ test_expect_success PERL 'required process filter should filter data' ' EOF test_cmp_exclude_clean expected.log debug.log && - # Make sure that the file appears dirty, so checkout below has to - # run the configured filter. - touch test.r && filter_git checkout --quiet --no-progress empty-branch && cat >expected.log <<-EOF && START @@ -795,6 +792,7 @@ test_expect_success PERL 'missing file in delayed checkout' ' rm -rf repo-cloned && test_must_fail git clone repo repo-cloned 2>git-stderr.log && + cat git-stderr.log && grep "error: .missing-delay\.a. was not filtered properly" git-stderr.log ' diff --git a/third_party/git/t/t0027-auto-crlf.sh b/third_party/git/t/t0027-auto-crlf.sh index 9fcd56fab373..959b6da44900 100755 --- a/third_party/git/t/t0027-auto-crlf.sh +++ b/third_party/git/t/t0027-auto-crlf.sh @@ -215,7 +215,7 @@ stats_ascii () { } -# construct the attr/ returned by git ls-files --eol +# contruct the attr/ returned by git ls-files --eol # Take none (=empty), one or two args # convert.c: eol=XX overrides text=auto attr_ascii () { diff --git a/third_party/git/t/t0028-working-tree-encoding.sh b/third_party/git/t/t0028-working-tree-encoding.sh index bfc4fb9af5f2..1090e650edb7 100755 --- a/third_party/git/t/t0028-working-tree-encoding.sh +++ b/third_party/git/t/t0028-working-tree-encoding.sh @@ -17,7 +17,7 @@ test_lazy_prereq NO_UTF32_BOM ' write_utf16 () { if test_have_prereq NO_UTF16_BOM then - printf '\376\377' + printf '\xfe\xff' fi && iconv -f UTF-8 -t UTF-16 } @@ -25,7 +25,7 @@ write_utf16 () { write_utf32 () { if test_have_prereq NO_UTF32_BOM then - printf '\0\0\376\377' + printf '\x00\x00\xfe\xff' fi && iconv -f UTF-8 -t UTF-32 } @@ -40,7 +40,7 @@ test_expect_success 'setup test files' ' printf "$text" | write_utf16 >test.utf16.raw && printf "$text" | write_utf32 >test.utf32.raw && printf "\377\376" >test.utf16lebom.raw && - printf "$text" | iconv -f UTF-8 -t UTF-16LE >>test.utf16lebom.raw && + printf "$text" | iconv -f UTF-8 -t UTF-32LE >>test.utf16lebom.raw && # Line ending tests printf "one\ntwo\nthree\n" >lf.utf8.raw && @@ -280,43 +280,4 @@ test_expect_success ICONV_SHIFT_JIS 'check roundtrip encoding' ' git reset ' -# $1: checkout encoding -# $2: test string -# $3: binary test string in checkout encoding -test_commit_utf8_checkout_other () { - encoding="$1" - orig_string="$2" - expect_bytes="$3" - - test_expect_success "Commit UTF-8, checkout $encoding" ' - test_when_finished "git checkout HEAD -- .gitattributes" && - - test_ext="commit_utf8_checkout_$encoding" && - test_file="test.$test_ext" && - - # Commit as UTF-8 - echo "*.$test_ext text working-tree-encoding=UTF-8" >.gitattributes && - printf "$orig_string" >$test_file && - git add $test_file && - git commit -m "Test data" && - - # Checkout in tested encoding - rm $test_file && - echo "*.$test_ext text working-tree-encoding=$encoding" >.gitattributes && - git checkout HEAD -- $test_file && - - # Test - printf $expect_bytes >$test_file.raw && - test_cmp_bin $test_file.raw $test_file - ' -} - -test_commit_utf8_checkout_other "UTF-8" "Test Тест" "\124\145\163\164\040\320\242\320\265\321\201\321\202" -test_commit_utf8_checkout_other "UTF-16LE" "Test Тест" "\124\000\145\000\163\000\164\000\040\000\042\004\065\004\101\004\102\004" -test_commit_utf8_checkout_other "UTF-16BE" "Test Тест" "\000\124\000\145\000\163\000\164\000\040\004\042\004\065\004\101\004\102" -test_commit_utf8_checkout_other "UTF-16LE-BOM" "Test Тест" "\377\376\124\000\145\000\163\000\164\000\040\000\042\004\065\004\101\004\102\004" -test_commit_utf8_checkout_other "UTF-16BE-BOM" "Test Тест" "\376\377\000\124\000\145\000\163\000\164\000\040\004\042\004\065\004\101\004\102" -test_commit_utf8_checkout_other "UTF-32LE" "Test Тест" "\124\000\000\000\145\000\000\000\163\000\000\000\164\000\000\000\040\000\000\000\042\004\000\000\065\004\000\000\101\004\000\000\102\004\000\000" -test_commit_utf8_checkout_other "UTF-32BE" "Test Тест" "\000\000\000\124\000\000\000\145\000\000\000\163\000\000\000\164\000\000\000\040\000\000\004\042\000\000\004\065\000\000\004\101\000\000\004\102" - test_done diff --git a/third_party/git/t/t0040-parse-options.sh b/third_party/git/t/t0040-parse-options.sh index 3483b72db42a..cebc77fab0b2 100755 --- a/third_party/git/t/t0040-parse-options.sh +++ b/third_party/git/t/t0040-parse-options.sh @@ -23,8 +23,6 @@ usage: test-tool parse-options -j get a integer, too -m, --magnitude get a magnitude --set23 set integer to 23 - --mode1 set integer to 1 (cmdmode option) - --mode2 set integer to 2 (cmdmode option) -L, --length get length of -F, --file set file to @@ -244,7 +242,7 @@ test_expect_success 'Alias options do not contribute to abbreviation' ' ' cat >typo.err <<\EOF -error: did you mean `--boolean` (with two dashes)? +error: did you mean `--boolean` (with two dashes ?) EOF test_expect_success 'detect possible typos' ' @@ -254,7 +252,7 @@ test_expect_success 'detect possible typos' ' ' cat >typo.err <<\EOF -error: did you mean `--ambiguous` (with two dashes)? +error: did you mean `--ambiguous` (with two dashes ?) EOF test_expect_success 'detect possible typos' ' @@ -326,22 +324,6 @@ test_expect_success 'OPT_NEGBIT() works' ' test-tool parse-options --expect="boolean: 6" -bb --no-neg-or4 ' -test_expect_success 'OPT_CMDMODE() works' ' - test-tool parse-options --expect="integer: 1" --mode1 -' - -test_expect_success 'OPT_CMDMODE() detects incompatibility' ' - test_must_fail test-tool parse-options --mode1 --mode2 >output 2>output.err && - test_must_be_empty output && - test_i18ngrep "incompatible with --mode" output.err -' - -test_expect_success 'OPT_CMDMODE() detects incompatibility with something else' ' - test_must_fail test-tool parse-options --set23 --mode2 >output 2>output.err && - test_must_be_empty output && - test_i18ngrep "incompatible with something else" output.err -' - test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' ' test-tool parse-options --expect="boolean: 6" + + + + + + ' @@ -417,11 +399,4 @@ test_expect_success 'GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS works' ' test-tool parse-options --ye ' -test_expect_success '--end-of-options treats remainder as args' ' - test-tool parse-options \ - --expect="verbose: -1" \ - --expect="arg 00: --verbose" \ - --end-of-options --verbose -' - test_done diff --git a/third_party/git/t/t0050-filesystem.sh b/third_party/git/t/t0050-filesystem.sh index 608673fb775d..192c94eccd13 100755 --- a/third_party/git/t/t0050-filesystem.sh +++ b/third_party/git/t/t0050-filesystem.sh @@ -131,24 +131,4 @@ $test_unicode 'merge (silent unicode normalization)' ' git merge topic ' -test_expect_success CASE_INSENSITIVE_FS 'checkout with no pathspec and a case insensitive fs' ' - git init repo && - ( - cd repo && - - >Gitweb && - git add Gitweb && - git commit -m "add Gitweb" && - - git checkout --orphan todo && - git reset --hard && - mkdir -p gitweb/subdir && - >gitweb/subdir/file && - git add gitweb && - git commit -m "add gitweb/subdir/file" && - - git checkout master - ) -' - test_done diff --git a/third_party/git/t/t0060-path-utils.sh b/third_party/git/t/t0060-path-utils.sh index 2ea2d00c39a6..c7b53e494ba4 100755 --- a/third_party/git/t/t0060-path-utils.sh +++ b/third_party/git/t/t0060-path-utils.sh @@ -165,15 +165,6 @@ test_expect_success 'absolute path rejects the empty string' ' test_must_fail test-tool path-utils absolute_path "" ' -test_expect_success MINGW ':\\abc is an absolute path' ' - for letter in : \" C Z 1 ä - do - path=$letter:\\abc && - absolute="$(test-tool path-utils absolute_path "$path")" && - test "$path" = "$absolute" || return 1 - done -' - test_expect_success 'real path rejects the empty string' ' test_must_fail test-tool path-utils real_path "" ' @@ -294,13 +285,9 @@ test_git_path GIT_OBJECT_DIRECTORY=foo objects/foo foo/foo test_git_path GIT_OBJECT_DIRECTORY=foo objects2 .git/objects2 test_expect_success 'setup common repository' 'git --git-dir=bar init' test_git_path GIT_COMMON_DIR=bar index .git/index -test_git_path GIT_COMMON_DIR=bar index.lock .git/index.lock test_git_path GIT_COMMON_DIR=bar HEAD .git/HEAD test_git_path GIT_COMMON_DIR=bar logs/HEAD .git/logs/HEAD -test_git_path GIT_COMMON_DIR=bar logs/HEAD.lock .git/logs/HEAD.lock test_git_path GIT_COMMON_DIR=bar logs/refs/bisect/foo .git/logs/refs/bisect/foo -test_git_path GIT_COMMON_DIR=bar logs/refs bar/logs/refs -test_git_path GIT_COMMON_DIR=bar logs/refs/ bar/logs/refs/ test_git_path GIT_COMMON_DIR=bar logs/refs/bisec/foo bar/logs/refs/bisec/foo test_git_path GIT_COMMON_DIR=bar logs/refs/bisec bar/logs/refs/bisec test_git_path GIT_COMMON_DIR=bar logs/refs/bisectfoo bar/logs/refs/bisectfoo @@ -436,9 +423,6 @@ test_expect_success 'match .gitmodules' ' ~1000000 \ ~9999999 \ \ - .gitmodules:\$DATA \ - "gitmod~4 . :\$DATA" \ - \ --not \ ".gitmodules x" \ ".gitmodules .x" \ @@ -463,34 +447,7 @@ test_expect_success 'match .gitmodules' ' \ GI7EB~1 \ GI7EB~01 \ - GI7EB~1X \ - \ - .gitmodules,:\$DATA -' - -test_expect_success MINGW 'is_valid_path() on Windows' ' - test-tool path-utils is_valid_path \ - win32 \ - "win32 x" \ - ../hello.txt \ - C:\\git \ - comm \ - conout.c \ - lptN \ - \ - --not \ - "win32 " \ - "win32 /x " \ - "win32." \ - "win32 . ." \ - .../hello.txt \ - colon:test \ - "AUX.c" \ - "abc/conOut\$ .xyz/test" \ - lpt8 \ - "lpt*" \ - Nul \ - "PRN./abc" + GI7EB~1X ' test_done diff --git a/third_party/git/t/t0061-run-command.sh b/third_party/git/t/t0061-run-command.sh index 7d599675e35a..015fac8b5d07 100755 --- a/third_party/git/t/t0061-run-command.sh +++ b/third_party/git/t/t0061-run-command.sh @@ -12,10 +12,6 @@ cat >hello-script <<-EOF cat hello-script EOF -test_expect_success MINGW 'subprocess inherits only std handles' ' - test-tool run-command inherited-handle -' - test_expect_success 'start_command reports ENOENT (slash)' ' test-tool run-command start-command-ENOENT ./does-not-exist 2>err && test_i18ngrep "\./does-not-exist" err @@ -214,23 +210,10 @@ test_expect_success MINGW 'verify curlies are quoted properly' ' test_cmp expect actual ' -test_expect_success MINGW 'can spawn .bat with argv[0] containing spaces' ' - bat="$TRASH_DIRECTORY/bat with spaces in name.bat" && - - # Every .bat invocation will log its arguments to file "out" - rm -f out && - echo "echo %* >>out" >"$bat" && - - # Ask git to invoke .bat; clone will fail due to fake SSH helper - test_must_fail env GIT_SSH="$bat" git clone myhost:src ssh-clone && - - # Spawning .bat can fail if there are two quoted cmd.exe arguments. - # .bat itself is first (due to spaces in name), so just one more is - # needed to verify. GIT_SSH will invoke .bat multiple times: - # 1) -G myhost - # 2) myhost "git-upload-pack src" - # First invocation will always succeed. Test the second one. - grep "git-upload-pack" out +test_expect_success MINGW 'can spawn with argv[0] containing spaces' ' + cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" ./ && + test_must_fail "$PWD/test-fake-ssh$X" 2>err && + grep TRASH_DIRECTORY err ' test_done diff --git a/third_party/git/t/t0067-parse_pathspec_file.sh b/third_party/git/t/t0067-parse_pathspec_file.sh deleted file mode 100755 index 7bab49f361a9..000000000000 --- a/third_party/git/t/t0067-parse_pathspec_file.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/sh - -test_description='Test parse_pathspec_file()' - -. ./test-lib.sh - -test_expect_success 'one item from stdin' ' - cat >expect <<-\EOF && - fileA.t - EOF - - echo fileA.t | - test-tool parse-pathspec-file --pathspec-from-file=- >actual && - - test_cmp expect actual -' - -test_expect_success 'one item from file' ' - cat >expect <<-\EOF && - fileA.t - EOF - - echo fileA.t >list && - test-tool parse-pathspec-file --pathspec-from-file=list >actual && - - test_cmp expect actual -' - -test_expect_success 'NUL delimiters' ' - cat >expect <<-\EOF && - fileA.t - fileB.t - EOF - - printf "fileA.t\0fileB.t\0" | - test-tool parse-pathspec-file --pathspec-from-file=- --pathspec-file-nul >actual && - - test_cmp expect actual -' - -test_expect_success 'LF delimiters' ' - cat >expect <<-\EOF && - fileA.t - fileB.t - EOF - - printf "fileA.t\nfileB.t\n" | - test-tool parse-pathspec-file --pathspec-from-file=- >actual && - - test_cmp expect actual -' - -test_expect_success 'no trailing delimiter' ' - cat >expect <<-\EOF && - fileA.t - fileB.t - EOF - - printf "fileA.t\nfileB.t" | - test-tool parse-pathspec-file --pathspec-from-file=- >actual && - - test_cmp expect actual -' - -test_expect_success 'CRLF delimiters' ' - cat >expect <<-\EOF && - fileA.t - fileB.t - EOF - - printf "fileA.t\r\nfileB.t\r\n" | - test-tool parse-pathspec-file --pathspec-from-file=- >actual && - - test_cmp expect actual -' - -test_expect_success 'quotes' ' - cat >expect <<-\EOF && - fileA.t - EOF - - cat >list <<-\EOF && - "file\101.t" - EOF - - test-tool parse-pathspec-file --pathspec-from-file=list >actual && - - test_cmp expect actual -' - -test_expect_success '--pathspec-file-nul takes quotes literally' ' - # Note: there is an extra newline because --pathspec-file-nul takes - # input \n literally, too - cat >expect <<-\EOF && - "file\101.t" - - EOF - - cat >list <<-\EOF && - "file\101.t" - EOF - - test-tool parse-pathspec-file --pathspec-from-file=list --pathspec-file-nul >actual && - - test_cmp expect actual -' - -test_done diff --git a/third_party/git/t/t0090-cache-tree.sh b/third_party/git/t/t0090-cache-tree.sh index 5a633690bffc..ce9a4a5f324b 100755 --- a/third_party/git/t/t0090-cache-tree.sh +++ b/third_party/git/t/t0090-cache-tree.sh @@ -21,10 +21,9 @@ generate_expected_cache_tree_rec () { parent="$2" && # ls-files might have foo/bar, foo/bar/baz, and foo/bar/quux # We want to count only foo because it's the only direct child - git ls-files >files && - subtrees=$(grep / files|cut -d / -f 1|uniq) && + subtrees=$(git ls-files|grep /|cut -d / -f 1|uniq) && subtree_count=$(echo "$subtrees"|awk -v c=0 '$1 != "" {++c} END {print c}') && - entries=$(wc -l ../expected_filenames.txt && - xargs touch <../expected_filenames.txt && - cd .. && - GIT_TRACE2_EVENT="$(pwd)/trace_target_dir" test-tool trace2 001return 0 - ) && - echo git-trace2-discard >>expected_filenames.txt && - ls trace_target_dir >ls_output.txt && - test_cmp expected_filenames.txt ls_output.txt && - head -n1 trace_target_dir/git-trace2-discard | grep \"event\":\"version\" && - head -n2 trace_target_dir/git-trace2-discard | tail -n1 | grep \"event\":\"too_many_files\" -' - test_done diff --git a/third_party/git/t/t0300-credentials.sh b/third_party/git/t/t0300-credentials.sh index 5555a1524f1d..82eaaea0f495 100755 --- a/third_party/git/t/t0300-credentials.sh +++ b/third_party/git/t/t0300-credentials.sh @@ -22,11 +22,6 @@ test_expect_success 'setup helper scripts' ' exit 0 EOF - write_script git-credential-quit <<-\EOF && - . ./dump - echo quit=1 - EOF - write_script git-credential-verbatim <<-\EOF && user=$1; shift pass=$1; shift @@ -40,71 +35,43 @@ test_expect_success 'setup helper scripts' ' test_expect_success 'credential_fill invokes helper' ' check fill "verbatim foo bar" <<-\EOF - protocol=http - host=example.com -- - protocol=http - host=example.com username=foo password=bar -- verbatim: get - verbatim: protocol=http - verbatim: host=example.com EOF ' test_expect_success 'credential_fill invokes multiple helpers' ' check fill useless "verbatim foo bar" <<-\EOF - protocol=http - host=example.com -- - protocol=http - host=example.com username=foo password=bar -- useless: get - useless: protocol=http - useless: host=example.com verbatim: get - verbatim: protocol=http - verbatim: host=example.com EOF ' test_expect_success 'credential_fill stops when we get a full response' ' check fill "verbatim one two" "verbatim three four" <<-\EOF - protocol=http - host=example.com -- - protocol=http - host=example.com username=one password=two -- verbatim: get - verbatim: protocol=http - verbatim: host=example.com EOF ' test_expect_success 'credential_fill continues through partial response' ' check fill "verbatim one \"\"" "verbatim two three" <<-\EOF - protocol=http - host=example.com -- - protocol=http - host=example.com username=two password=three -- verbatim: get - verbatim: protocol=http - verbatim: host=example.com verbatim: get - verbatim: protocol=http - verbatim: host=example.com verbatim: username=one EOF ' @@ -130,20 +97,14 @@ test_expect_success 'credential_fill passes along metadata' ' test_expect_success 'credential_approve calls all helpers' ' check approve useless "verbatim one two" <<-\EOF - protocol=http - host=example.com username=foo password=bar -- -- useless: store - useless: protocol=http - useless: host=example.com useless: username=foo useless: password=bar verbatim: store - verbatim: protocol=http - verbatim: host=example.com verbatim: username=foo verbatim: password=bar EOF @@ -151,8 +112,6 @@ test_expect_success 'credential_approve calls all helpers' ' test_expect_success 'do not bother storing password-less credential' ' check approve useless <<-\EOF - protocol=http - host=example.com username=foo -- -- @@ -162,20 +121,14 @@ test_expect_success 'do not bother storing password-less credential' ' test_expect_success 'credential_reject calls all helpers' ' check reject useless "verbatim one two" <<-\EOF - protocol=http - host=example.com username=foo password=bar -- -- useless: erase - useless: protocol=http - useless: host=example.com useless: username=foo useless: password=bar verbatim: erase - verbatim: protocol=http - verbatim: host=example.com verbatim: username=foo verbatim: password=bar EOF @@ -183,49 +136,33 @@ test_expect_success 'credential_reject calls all helpers' ' test_expect_success 'usernames can be preserved' ' check fill "verbatim \"\" three" <<-\EOF - protocol=http - host=example.com username=one -- - protocol=http - host=example.com username=one password=three -- verbatim: get - verbatim: protocol=http - verbatim: host=example.com verbatim: username=one EOF ' test_expect_success 'usernames can be overridden' ' check fill "verbatim two three" <<-\EOF - protocol=http - host=example.com username=one -- - protocol=http - host=example.com username=two password=three -- verbatim: get - verbatim: protocol=http - verbatim: host=example.com verbatim: username=one EOF ' test_expect_success 'do not bother completing already-full credential' ' check fill "verbatim three four" <<-\EOF - protocol=http - host=example.com username=one password=two -- - protocol=http - host=example.com username=one password=two -- @@ -237,31 +174,23 @@ test_expect_success 'do not bother completing already-full credential' ' # askpass helper is run, we know the internal getpass is working. test_expect_success 'empty helper list falls back to internal getpass' ' check fill <<-\EOF - protocol=http - host=example.com -- - protocol=http - host=example.com username=askpass-username password=askpass-password -- - askpass: Username for '\''http://example.com'\'': - askpass: Password for '\''http://askpass-username@example.com'\'': + askpass: Username: + askpass: Password: EOF ' test_expect_success 'internal getpass does not ask for known username' ' check fill <<-\EOF - protocol=http - host=example.com username=foo -- - protocol=http - host=example.com username=foo password=askpass-password -- - askpass: Password for '\''http://foo@example.com'\'': + askpass: Password: EOF ' @@ -273,11 +202,7 @@ HELPER="!f() { test_expect_success 'respect configured credentials' ' test_config credential.helper "$HELPER" && check fill <<-\EOF - protocol=http - host=example.com -- - protocol=http - host=example.com username=foo password=bar -- @@ -315,57 +240,6 @@ test_expect_success 'do not match configured credential' ' EOF ' -test_expect_success 'match multiple configured helpers' ' - test_config credential.helper "verbatim \"\" \"\"" && - test_config credential.https://example.com.helper "$HELPER" && - check fill <<-\EOF - protocol=https - host=example.com - path=repo.git - -- - protocol=https - host=example.com - username=foo - password=bar - -- - verbatim: get - verbatim: protocol=https - verbatim: host=example.com - EOF -' - -test_expect_success 'match multiple configured helpers with URLs' ' - test_config credential.https://example.com/repo.git.helper "verbatim \"\" \"\"" && - test_config credential.https://example.com.helper "$HELPER" && - check fill <<-\EOF - protocol=https - host=example.com - path=repo.git - -- - protocol=https - host=example.com - username=foo - password=bar - -- - verbatim: get - verbatim: protocol=https - verbatim: host=example.com - EOF -' - -test_expect_success 'match percent-encoded values' ' - test_config credential.https://example.com/%2566.git.helper "$HELPER" && - check fill <<-\EOF - url=https://example.com/%2566.git - -- - protocol=https - host=example.com - username=foo - password=bar - -- - EOF -' - test_expect_success 'pull username from config' ' test_config credential.https://example.com.username foo && check fill <<-\EOF @@ -381,63 +255,6 @@ test_expect_success 'pull username from config' ' EOF ' -test_expect_success 'honors username from URL over helper (URL)' ' - test_config credential.https://example.com.username bob && - test_config credential.https://example.com.helper "verbatim \"\" bar" && - check fill <<-\EOF - url=https://alice@example.com - -- - protocol=https - host=example.com - username=alice - password=bar - -- - verbatim: get - verbatim: protocol=https - verbatim: host=example.com - verbatim: username=alice - EOF -' - -test_expect_success 'honors username from URL over helper (components)' ' - test_config credential.https://example.com.username bob && - test_config credential.https://example.com.helper "verbatim \"\" bar" && - check fill <<-\EOF - protocol=https - host=example.com - username=alice - -- - protocol=https - host=example.com - username=alice - password=bar - -- - verbatim: get - verbatim: protocol=https - verbatim: host=example.com - verbatim: username=alice - EOF -' - -test_expect_success 'last matching username wins' ' - test_config credential.https://example.com/path.git.username bob && - test_config credential.https://example.com.username alice && - test_config credential.https://example.com.helper "verbatim \"\" bar" && - check fill <<-\EOF - url=https://example.com/path.git - -- - protocol=https - host=example.com - username=alice - password=bar - -- - verbatim: get - verbatim: protocol=https - verbatim: host=example.com - verbatim: username=alice - EOF -' - test_expect_success 'http paths can be part of context' ' check fill "verbatim foo bar" <<-\EOF && protocol=https @@ -472,107 +289,23 @@ test_expect_success 'http paths can be part of context' ' EOF ' -test_expect_success 'context uses urlmatch' ' - test_config "credential.https://*.org.useHttpPath" true && - check fill "verbatim foo bar" <<-\EOF - protocol=https - host=example.org - path=foo.git - -- - protocol=https - host=example.org - path=foo.git - username=foo - password=bar - -- - verbatim: get - verbatim: protocol=https - verbatim: host=example.org - verbatim: path=foo.git - EOF -' - test_expect_success 'helpers can abort the process' ' test_must_fail git \ - -c credential.helper=quit \ + -c credential.helper="!f() { echo quit=1; }; f" \ -c credential.helper="verbatim foo bar" \ - credential fill >stdout 2>stderr <<-\EOF && - protocol=http - host=example.com - EOF - test_must_be_empty stdout && - cat >expect <<-\EOF && - quit: get - quit: protocol=http - quit: host=example.com - fatal: credential helper '\''quit'\'' told us to quit - EOF - test_i18ncmp expect stderr + credential fill >stdout && + test_must_be_empty stdout ' test_expect_success 'empty helper spec resets helper list' ' test_config credential.helper "verbatim file file" && check fill "" "verbatim cmdline cmdline" <<-\EOF - protocol=http - host=example.com -- - protocol=http - host=example.com username=cmdline password=cmdline -- verbatim: get - verbatim: protocol=http - verbatim: host=example.com - EOF -' - -test_expect_success 'url parser rejects embedded newlines' ' - test_must_fail git credential fill 2>stderr <<-\EOF && - url=https://one.example.com?%0ahost=two.example.com/ - EOF - cat >expect <<-\EOF && - warning: url contains a newline in its host component: https://one.example.com?%0ahost=two.example.com/ - fatal: credential url cannot be parsed: https://one.example.com?%0ahost=two.example.com/ - EOF - test_i18ncmp expect stderr -' - -test_expect_success 'host-less URLs are parsed as empty host' ' - check fill "verbatim foo bar" <<-\EOF - url=cert:///path/to/cert.pem - -- - protocol=cert - host= - path=path/to/cert.pem - username=foo - password=bar - -- - verbatim: get - verbatim: protocol=cert - verbatim: host= - verbatim: path=path/to/cert.pem - EOF -' - -test_expect_success 'credential system refuses to work with missing host' ' - test_must_fail git credential fill 2>stderr <<-\EOF && - protocol=http - EOF - cat >expect <<-\EOF && - fatal: refusing to work with credential missing host field - EOF - test_i18ncmp expect stderr -' - -test_expect_success 'credential system refuses to work with missing protocol' ' - test_must_fail git credential fill 2>stderr <<-\EOF && - host=example.com - EOF - cat >expect <<-\EOF && - fatal: refusing to work with credential missing protocol field EOF - test_i18ncmp expect stderr ' test_done diff --git a/third_party/git/t/t0410-partial-clone.sh b/third_party/git/t/t0410-partial-clone.sh index a3988bd4b8c8..5bd892f2f7a9 100755 --- a/third_party/git/t/t0410-partial-clone.sh +++ b/third_party/git/t/t0410-partial-clone.sh @@ -26,7 +26,7 @@ promise_and_delete () { test_expect_success 'extensions.partialclone without filter' ' test_create_repo server && git clone --filter="blob:none" "file://$(pwd)/server" client && - git -C client config --unset remote.origin.partialclonefilter && + git -C client config --unset core.partialclonefilter && git -C client fetch origin ' @@ -166,9 +166,8 @@ test_expect_success 'fetching of missing objects' ' # associated packfile contains the object ls repo/.git/objects/pack/pack-*.promisor >promisorlist && test_line_count = 1 promisorlist && - IDX=$(sed "s/promisor$/idx/" promisorlist) && - git verify-pack --verbose "$IDX" >out && - grep "$HASH" out + IDX=$(cat promisorlist | sed "s/promisor$/idx/") && + git verify-pack --verbose "$IDX" | grep "$HASH" ' test_expect_success 'fetching of missing objects works with ref-in-want enabled' ' @@ -183,55 +182,8 @@ test_expect_success 'fetching of missing objects works with ref-in-want enabled' grep "git< fetch=.*ref-in-want" trace ' -test_expect_success 'fetching of missing objects from another promisor remote' ' - git clone "file://$(pwd)/server" server2 && - test_commit -C server2 bar && - git -C server2 repack -a -d --write-bitmap-index && - HASH2=$(git -C server2 rev-parse bar) && - - git -C repo remote add server2 "file://$(pwd)/server2" && - git -C repo config remote.server2.promisor true && - git -C repo cat-file -p "$HASH2" && - - git -C repo fetch server2 && - rm -rf repo/.git/objects/* && - git -C repo cat-file -p "$HASH2" && - - # Ensure that the .promisor file is written, and check that its - # associated packfile contains the object - ls repo/.git/objects/pack/pack-*.promisor >promisorlist && - test_line_count = 1 promisorlist && - IDX=$(sed "s/promisor$/idx/" promisorlist) && - git verify-pack --verbose "$IDX" >out && - grep "$HASH2" out -' - -test_expect_success 'fetching of missing objects configures a promisor remote' ' - git clone "file://$(pwd)/server" server3 && - test_commit -C server3 baz && - git -C server3 repack -a -d --write-bitmap-index && - HASH3=$(git -C server3 rev-parse baz) && - git -C server3 config uploadpack.allowfilter 1 && - - rm repo/.git/objects/pack/pack-*.promisor && - - git -C repo remote add server3 "file://$(pwd)/server3" && - git -C repo fetch --filter="blob:none" server3 $HASH3 && - - test_cmp_config -C repo true remote.server3.promisor && - - # Ensure that the .promisor file is written, and check that its - # associated packfile contains the object - ls repo/.git/objects/pack/pack-*.promisor >promisorlist && - test_line_count = 1 promisorlist && - IDX=$(sed "s/promisor$/idx/" promisorlist) && - git verify-pack --verbose "$IDX" >out && - grep "$HASH3" out -' - test_expect_success 'fetching of missing blobs works' ' - rm -rf server server2 repo && - rm -rf server server3 repo && + rm -rf server repo && test_create_repo server && test_commit -C server foo && git -C server repack -a -d --write-bitmap-index && @@ -282,7 +234,7 @@ test_expect_success 'rev-list stops traversal at missing and promised commit' ' git -C repo config core.repositoryformatversion 1 && git -C repo config extensions.partialclone "arbitrary string" && - GIT_TEST_COMMIT_GRAPH=0 git -C repo -c core.commitGraph=false rev-list --exclude-promisor-objects --objects bar >out && + GIT_TEST_COMMIT_GRAPH=0 git -C repo rev-list --exclude-promisor-objects --objects bar >out && grep $(git -C repo rev-parse bar) out && ! grep $FOO out ' @@ -429,19 +381,6 @@ test_expect_success 'rev-list dies for missing objects on cmd line' ' done ' -test_expect_success 'single promisor remote can be re-initialized gracefully' ' - # ensure one promisor is in the promisors list - rm -rf repo && - test_create_repo repo && - test_create_repo other && - git -C repo remote add foo "file://$(pwd)/other" && - git -C repo config remote.foo.promisor true && - git -C repo config extensions.partialclone foo && - - # reinitialize the promisors list - git -C repo fetch --filter=blob:none foo -' - test_expect_success 'gc repacks promisor objects separately from non-promisor objects' ' rm -rf repo && test_create_repo repo && @@ -553,20 +492,6 @@ test_expect_success 'gc stops traversal when a missing but promised object is re ! grep "$TREE_HASH" out ' -test_expect_success 'do not fetch when checking existence of tree we construct ourselves' ' - rm -rf repo && - test_create_repo repo && - test_commit -C repo base && - test_commit -C repo side1 && - git -C repo checkout base && - test_commit -C repo side2 && - - git -C repo config core.repositoryformatversion 1 && - git -C repo config extensions.partialclone "arbitrary string" && - - git -C repo cherry-pick side1 -' - . "$TEST_DIRECTORY"/lib-httpd.sh start_httpd @@ -589,12 +514,8 @@ test_expect_success 'fetching of missing objects from an HTTP server' ' # associated packfile contains the object ls repo/.git/objects/pack/pack-*.promisor >promisorlist && test_line_count = 1 promisorlist && - IDX=$(sed "s/promisor$/idx/" promisorlist) && - git verify-pack --verbose "$IDX" >out && - grep "$HASH" out + IDX=$(cat promisorlist | sed "s/promisor$/idx/") && + git verify-pack --verbose "$IDX" | grep "$HASH" ' -# DO NOT add non-httpd-specific tests here, because the last part of this -# test script is only executed when httpd is available and enabled. - test_done diff --git a/third_party/git/t/t0500-progress-display.sh b/third_party/git/t/t0500-progress-display.sh deleted file mode 100755 index d2d088d9a0c3..000000000000 --- a/third_party/git/t/t0500-progress-display.sh +++ /dev/null @@ -1,286 +0,0 @@ -#!/bin/sh - -test_description='progress display' - -. ./test-lib.sh - -show_cr () { - tr '\015' Q | sed -e "s/Q/\\$LF/g" -} - -test_expect_success 'simple progress display' ' - cat >expect <<-\EOF && - Working hard: 1 - Working hard: 2 - Working hard: 5 - Working hard: 5, done. - EOF - - cat >in <<-\EOF && - update - progress 1 - update - progress 2 - progress 3 - progress 4 - update - progress 5 - EOF - test-tool progress "Working hard" stderr && - - show_cr out && - test_i18ncmp expect out -' - -test_expect_success 'progress display with total' ' - cat >expect <<-\EOF && - Working hard: 33% (1/3) - Working hard: 66% (2/3) - Working hard: 100% (3/3) - Working hard: 100% (3/3), done. - EOF - - cat >in <<-\EOF && - progress 1 - progress 2 - progress 3 - EOF - test-tool progress --total=3 "Working hard" stderr && - - show_cr out && - test_i18ncmp expect out -' - -test_expect_success 'progress display breaks long lines #1' ' - sed -e "s/Z$//" >expect <<\EOF && -Working hard.......2.........3.........4.........5.........6: 0% (100/100000) -Working hard.......2.........3.........4.........5.........6: 1% (1000/100000) -Working hard.......2.........3.........4.........5.........6: Z - 10% (10000/100000) - 100% (100000/100000) - 100% (100000/100000), done. -EOF - - cat >in <<-\EOF && - progress 100 - progress 1000 - progress 10000 - progress 100000 - EOF - test-tool progress --total=100000 \ - "Working hard.......2.........3.........4.........5.........6" \ - stderr && - - show_cr out && - test_i18ncmp expect out -' - -test_expect_success 'progress display breaks long lines #2' ' - # Note: we do not need that many spaces after the title to cover up - # the last line before breaking the progress line. - sed -e "s/Z$//" >expect <<\EOF && -Working hard.......2.........3.........4.........5.........6: 0% (1/100000) -Working hard.......2.........3.........4.........5.........6: 0% (2/100000) -Working hard.......2.........3.........4.........5.........6: Z - 10% (10000/100000) - 100% (100000/100000) - 100% (100000/100000), done. -EOF - - cat >in <<-\EOF && - update - progress 1 - update - progress 2 - progress 10000 - progress 100000 - EOF - test-tool progress --total=100000 \ - "Working hard.......2.........3.........4.........5.........6" \ - stderr && - - show_cr out && - test_i18ncmp expect out -' - -test_expect_success 'progress display breaks long lines #3 - even the first is too long' ' - # Note: we do not actually need any spaces at the end of the title - # line, because there is no previous progress line to cover up. - sed -e "s/Z$//" >expect <<\EOF && -Working hard.......2.........3.........4.........5.........6: Z - 25% (25000/100000) - 50% (50000/100000) - 75% (75000/100000) - 100% (100000/100000) - 100% (100000/100000), done. -EOF - - cat >in <<-\EOF && - progress 25000 - progress 50000 - progress 75000 - progress 100000 - EOF - test-tool progress --total=100000 \ - "Working hard.......2.........3.........4.........5.........6" \ - stderr && - - show_cr out && - test_i18ncmp expect out -' - -test_expect_success 'progress display breaks long lines #4 - title line matches terminal width' ' - cat >expect <<\EOF && -Working hard.......2.........3.........4.........5.........6.........7.........: - 25% (25000/100000) - 50% (50000/100000) - 75% (75000/100000) - 100% (100000/100000) - 100% (100000/100000), done. -EOF - - cat >in <<-\EOF && - progress 25000 - progress 50000 - progress 75000 - progress 100000 - EOF - test-tool progress --total=100000 \ - "Working hard.......2.........3.........4.........5.........6.........7........." \ - stderr && - - show_cr out && - test_i18ncmp expect out -' - -# Progress counter goes backwards, this should not happen in practice. -test_expect_success 'progress shortens - crazy caller' ' - cat >expect <<-\EOF && - Working hard: 10% (100/1000) - Working hard: 20% (200/1000) - Working hard: 0% (1/1000) - Working hard: 100% (1000/1000) - Working hard: 100% (1000/1000), done. - EOF - - cat >in <<-\EOF && - progress 100 - progress 200 - progress 1 - progress 1000 - EOF - test-tool progress --total=1000 "Working hard" stderr && - - show_cr out && - test_i18ncmp expect out -' - -test_expect_success 'progress display with throughput' ' - cat >expect <<-\EOF && - Working hard: 10 - Working hard: 20, 200.00 KiB | 100.00 KiB/s - Working hard: 30, 300.00 KiB | 100.00 KiB/s - Working hard: 40, 400.00 KiB | 100.00 KiB/s - Working hard: 40, 400.00 KiB | 100.00 KiB/s, done. - EOF - - cat >in <<-\EOF && - throughput 102400 1000 - update - progress 10 - throughput 204800 2000 - update - progress 20 - throughput 307200 3000 - update - progress 30 - throughput 409600 4000 - update - progress 40 - EOF - test-tool progress "Working hard" stderr && - - show_cr out && - test_i18ncmp expect out -' - -test_expect_success 'progress display with throughput and total' ' - cat >expect <<-\EOF && - Working hard: 25% (10/40) - Working hard: 50% (20/40), 200.00 KiB | 100.00 KiB/s - Working hard: 75% (30/40), 300.00 KiB | 100.00 KiB/s - Working hard: 100% (40/40), 400.00 KiB | 100.00 KiB/s - Working hard: 100% (40/40), 400.00 KiB | 100.00 KiB/s, done. - EOF - - cat >in <<-\EOF && - throughput 102400 1000 - progress 10 - throughput 204800 2000 - progress 20 - throughput 307200 3000 - progress 30 - throughput 409600 4000 - progress 40 - EOF - test-tool progress --total=40 "Working hard" stderr && - - show_cr out && - test_i18ncmp expect out -' - -test_expect_success 'cover up after throughput shortens' ' - cat >expect <<-\EOF && - Working hard: 1 - Working hard: 2, 800.00 KiB | 400.00 KiB/s - Working hard: 3, 1.17 MiB | 400.00 KiB/s - Working hard: 4, 1.56 MiB | 400.00 KiB/s - Working hard: 4, 1.56 MiB | 400.00 KiB/s, done. - EOF - - cat >in <<-\EOF && - throughput 409600 1000 - update - progress 1 - throughput 819200 2000 - update - progress 2 - throughput 1228800 3000 - update - progress 3 - throughput 1638400 4000 - update - progress 4 - EOF - test-tool progress "Working hard" stderr && - - show_cr out && - test_i18ncmp expect out -' - -test_expect_success 'cover up after throughput shortens a lot' ' - cat >expect <<-\EOF && - Working hard: 1 - Working hard: 2, 1000.00 KiB | 1000.00 KiB/s - Working hard: 3, 3.00 MiB | 1.50 MiB/s - Working hard: 3, 3.00 MiB | 1024.00 KiB/s, done. - EOF - - cat >in <<-\EOF && - throughput 1 1000 - update - progress 1 - throughput 1024000 2000 - update - progress 2 - throughput 3145728 3000 - update - progress 3 - EOF - test-tool progress "Working hard" stderr && - - show_cr out && - test_i18ncmp expect out -' - -test_done diff --git a/third_party/git/t/t1011-read-tree-sparse-checkout.sh b/third_party/git/t/t1011-read-tree-sparse-checkout.sh index eb44bafb5937..ba71b159ba8c 100755 --- a/third_party/git/t/t1011-read-tree-sparse-checkout.sh +++ b/third_party/git/t/t1011-read-tree-sparse-checkout.sh @@ -215,6 +215,7 @@ test_expect_success 'read-tree adds to worktree, dirty case' ' ' test_expect_success 'index removal and worktree narrowing at the same time' ' + >empty && echo init.t >.git/info/sparse-checkout && echo sub/added >>.git/info/sparse-checkout && git checkout -f top && @@ -222,7 +223,7 @@ test_expect_success 'index removal and worktree narrowing at the same time' ' git checkout removed && git ls-files sub/added >result && test ! -f sub/added && - test_must_be_empty result + test_cmp empty result ' test_expect_success 'read-tree --reset removes outside worktree' ' diff --git a/third_party/git/t/t1014-read-tree-confusing.sh b/third_party/git/t/t1014-read-tree-confusing.sh index da3376b3bb27..2f5a25d50386 100755 --- a/third_party/git/t/t1014-read-tree-confusing.sh +++ b/third_party/git/t/t1014-read-tree-confusing.sh @@ -49,7 +49,6 @@ git~1 .git.SPACE .git.{space} .\\\\.GIT\\\\foobar backslashes .git\\\\foobar backslashes2 -.git...:alternate-stream EOF test_expect_success 'utf-8 paths allowed with core.protectHFS off' ' diff --git a/third_party/git/t/t1050-large.sh b/third_party/git/t/t1050-large.sh index 184b479a2111..dcb4dbba673e 100755 --- a/third_party/git/t/t1050-large.sh +++ b/third_party/git/t/t1050-large.sh @@ -53,8 +53,7 @@ test_expect_success 'add a large file or two' ' for p in .git/objects/pack/pack-*.pack do count=$(( $count + 1 )) - if test_path_is_file "$p" && - idx=${p%.pack}.idx && test_path_is_file "$idx" + if test -f "$p" && idx=${p%.pack}.idx && test -f "$idx" then continue fi @@ -66,7 +65,7 @@ test_expect_success 'add a large file or two' ' test $cnt = 2 && for l in .git/objects/??/?????????????????????????????????????? do - test_path_is_file "$l" || continue + test -f "$l" || continue bad=t done && test -z "$bad" && @@ -77,8 +76,7 @@ test_expect_success 'add a large file or two' ' for p in .git/objects/pack/pack-*.pack do count=$(( $count + 1 )) - if test_path_is_file "$p" && - idx=${p%.pack}.idx && test_path_is_file "$idx" + if test -f "$p" && idx=${p%.pack}.idx && test -f "$idx" then continue fi @@ -113,7 +111,7 @@ test_expect_success 'packsize limit' ' count=0 && for pi in .git/objects/pack/pack-*.idx do - test_path_is_file "$pi" && count=$(( $count + 1 )) + test -f "$pi" && count=$(( $count + 1 )) done && test $count = 2 && @@ -196,15 +194,15 @@ test_expect_success 'pack-objects with large loose object' ' test_cmp huge actual ' -test_expect_success 'tar archiving' ' +test_expect_success 'tar achiving' ' git archive --format=tar HEAD >/dev/null ' -test_expect_success 'zip archiving, store only' ' +test_expect_success 'zip achiving, store only' ' git archive --format=zip -0 HEAD >/dev/null ' -test_expect_success 'zip archiving, deflate' ' +test_expect_success 'zip achiving, deflate' ' git archive --format=zip HEAD >/dev/null ' diff --git a/third_party/git/t/t1091-sparse-checkout-builtin.sh b/third_party/git/t/t1091-sparse-checkout-builtin.sh deleted file mode 100755 index 44a91205d600..000000000000 --- a/third_party/git/t/t1091-sparse-checkout-builtin.sh +++ /dev/null @@ -1,524 +0,0 @@ -#!/bin/sh - -test_description='sparse checkout builtin tests' - -. ./test-lib.sh - -list_files() { - # Do not replace this with 'ls "$1"', as "ls" with BSD-lineage - # enables "-A" by default for root and ends up including ".git" and - # such in its output. (Note, though, that running the test suite as - # root is generally not recommended.) - (cd "$1" && printf '%s\n' *) -} - -check_files() { - list_files "$1" >actual && - shift && - printf "%s\n" $@ >expect && - test_cmp expect actual -} - -test_expect_success 'setup' ' - git init repo && - ( - cd repo && - echo "initial" >a && - mkdir folder1 folder2 deep && - mkdir deep/deeper1 deep/deeper2 && - mkdir deep/deeper1/deepest && - cp a folder1 && - cp a folder2 && - cp a deep && - cp a deep/deeper1 && - cp a deep/deeper2 && - cp a deep/deeper1/deepest && - git add . && - git commit -m "initial commit" - ) -' - -test_expect_success 'git sparse-checkout list (empty)' ' - git -C repo sparse-checkout list >list 2>err && - test_must_be_empty list && - test_i18ngrep "this worktree is not sparse (sparse-checkout file may not exist)" err -' - -test_expect_success 'git sparse-checkout list (populated)' ' - test_when_finished rm -f repo/.git/info/sparse-checkout && - cat >repo/.git/info/sparse-checkout <<-\EOF && - /folder1/* - /deep/ - **/a - !*bin* - EOF - cp repo/.git/info/sparse-checkout expect && - git -C repo sparse-checkout list >list && - test_cmp expect list -' - -test_expect_success 'git sparse-checkout init' ' - git -C repo sparse-checkout init && - cat >expect <<-\EOF && - /* - !/*/ - EOF - test_cmp expect repo/.git/info/sparse-checkout && - test_cmp_config -C repo true core.sparsecheckout && - check_files repo a -' - -test_expect_success 'git sparse-checkout list after init' ' - git -C repo sparse-checkout list >actual && - cat >expect <<-\EOF && - /* - !/*/ - EOF - test_cmp expect actual -' - -test_expect_success 'init with existing sparse-checkout' ' - echo "*folder*" >> repo/.git/info/sparse-checkout && - git -C repo sparse-checkout init && - cat >expect <<-\EOF && - /* - !/*/ - *folder* - EOF - test_cmp expect repo/.git/info/sparse-checkout && - check_files repo a folder1 folder2 -' - -test_expect_success 'clone --sparse' ' - git clone --sparse "file://$(pwd)/repo" clone && - git -C clone sparse-checkout list >actual && - cat >expect <<-\EOF && - /* - !/*/ - EOF - test_cmp expect actual && - check_files clone a -' - -test_expect_success 'set enables config' ' - git init empty-config && - ( - cd empty-config && - test_commit test file && - test_path_is_missing .git/config.worktree && - test_must_fail git sparse-checkout set nothing && - test_path_is_file .git/config.worktree && - test_must_fail git config core.sparseCheckout && - git sparse-checkout set "/*" && - test_cmp_config true core.sparseCheckout - ) -' - -test_expect_success 'set sparse-checkout using builtin' ' - git -C repo sparse-checkout set "/*" "!/*/" "*folder*" && - cat >expect <<-\EOF && - /* - !/*/ - *folder* - EOF - git -C repo sparse-checkout list >actual && - test_cmp expect actual && - test_cmp expect repo/.git/info/sparse-checkout && - check_files repo a folder1 folder2 -' - -test_expect_success 'set sparse-checkout using --stdin' ' - cat >expect <<-\EOF && - /* - !/*/ - /folder1/ - /folder2/ - EOF - git -C repo sparse-checkout set --stdin actual && - test_cmp expect actual && - test_cmp expect repo/.git/info/sparse-checkout && - check_files repo "a folder1 folder2" -' - -test_expect_success 'add to sparse-checkout' ' - cat repo/.git/info/sparse-checkout >expect && - cat >add <<-\EOF && - pattern1 - /folder1/ - pattern2 - EOF - cat add >>expect && - git -C repo sparse-checkout add --stdin actual && - test_cmp expect actual && - test_cmp expect repo/.git/info/sparse-checkout && - check_files repo "a folder1 folder2" -' - -test_expect_success 'cone mode: match patterns' ' - git -C repo config --worktree core.sparseCheckoutCone true && - rm -rf repo/a repo/folder1 repo/folder2 && - git -C repo read-tree -mu HEAD 2>err && - test_i18ngrep ! "disabling cone patterns" err && - git -C repo reset --hard && - check_files repo a folder1 folder2 -' - -test_expect_success 'cone mode: warn on bad pattern' ' - test_when_finished mv sparse-checkout repo/.git/info/ && - cp repo/.git/info/sparse-checkout . && - echo "!/deep/deeper/*" >>repo/.git/info/sparse-checkout && - git -C repo read-tree -mu HEAD 2>err && - test_i18ngrep "unrecognized negative pattern" err -' - -test_expect_success 'sparse-checkout disable' ' - test_when_finished rm -rf repo/.git/info/sparse-checkout && - git -C repo sparse-checkout disable && - test_path_is_file repo/.git/info/sparse-checkout && - git -C repo config --list >config && - test_must_fail git config core.sparseCheckout && - check_files repo a deep folder1 folder2 -' - -test_expect_success 'cone mode: init and set' ' - git -C repo sparse-checkout init --cone && - git -C repo config --list >config && - test_i18ngrep "core.sparsecheckoutcone=true" config && - list_files repo >dir && - echo a >expect && - test_cmp expect dir && - git -C repo sparse-checkout set deep/deeper1/deepest/ 2>err && - test_must_be_empty err && - check_files repo a deep && - check_files repo/deep a deeper1 && - check_files repo/deep/deeper1 a deepest && - cat >expect <<-\EOF && - /* - !/*/ - /deep/ - !/deep/*/ - /deep/deeper1/ - !/deep/deeper1/*/ - /deep/deeper1/deepest/ - EOF - test_cmp expect repo/.git/info/sparse-checkout && - git -C repo sparse-checkout set --stdin 2>err <<-\EOF && - folder1 - folder2 - EOF - test_must_be_empty err && - check_files repo a folder1 folder2 -' - -test_expect_success 'cone mode: list' ' - cat >expect <<-\EOF && - folder1 - folder2 - EOF - git -C repo sparse-checkout set --stdin actual 2>err && - test_must_be_empty err && - test_cmp expect actual -' - -test_expect_success 'cone mode: set with nested folders' ' - git -C repo sparse-checkout set deep deep/deeper1/deepest 2>err && - test_line_count = 0 err && - cat >expect <<-\EOF && - /* - !/*/ - /deep/ - EOF - test_cmp repo/.git/info/sparse-checkout expect -' - -test_expect_success 'cone mode: add independent path' ' - git -C repo sparse-checkout set deep/deeper1 && - git -C repo sparse-checkout add folder1 && - cat >expect <<-\EOF && - /* - !/*/ - /deep/ - !/deep/*/ - /deep/deeper1/ - /folder1/ - EOF - test_cmp expect repo/.git/info/sparse-checkout && - check_files repo a deep folder1 -' - -test_expect_success 'cone mode: add sibling path' ' - git -C repo sparse-checkout set deep/deeper1 && - git -C repo sparse-checkout add deep/deeper2 && - cat >expect <<-\EOF && - /* - !/*/ - /deep/ - !/deep/*/ - /deep/deeper1/ - /deep/deeper2/ - EOF - test_cmp expect repo/.git/info/sparse-checkout && - check_files repo a deep -' - -test_expect_success 'cone mode: add parent path' ' - git -C repo sparse-checkout set deep/deeper1 folder1 && - git -C repo sparse-checkout add deep && - cat >expect <<-\EOF && - /* - !/*/ - /deep/ - /folder1/ - EOF - test_cmp expect repo/.git/info/sparse-checkout && - check_files repo a deep folder1 -' - -test_expect_success 'revert to old sparse-checkout on bad update' ' - test_when_finished git -C repo reset --hard && - git -C repo sparse-checkout set deep && - echo update >repo/deep/deeper2/a && - cp repo/.git/info/sparse-checkout expect && - test_must_fail git -C repo sparse-checkout set deep/deeper1 2>err && - test_i18ngrep "cannot set sparse-checkout patterns" err && - test_cmp repo/.git/info/sparse-checkout expect && - check_files repo/deep a deeper1 deeper2 -' - -test_expect_success 'revert to old sparse-checkout on empty update' ' - git init empty-test && - ( - echo >file && - git add file && - git commit -m "test" && - test_must_fail git sparse-checkout set nothing 2>err && - test_i18ngrep "Sparse checkout leaves no entry on working directory" err && - test_i18ngrep ! ".git/index.lock" err && - git sparse-checkout set file - ) -' - -test_expect_success 'fail when lock is taken' ' - test_when_finished rm -rf repo/.git/info/sparse-checkout.lock && - touch repo/.git/info/sparse-checkout.lock && - test_must_fail git -C repo sparse-checkout set deep 2>err && - test_i18ngrep "Unable to create .*\.lock" err -' - -test_expect_success '.gitignore should not warn about cone mode' ' - git -C repo config --worktree core.sparseCheckoutCone true && - echo "**/bin/*" >repo/.gitignore && - git -C repo reset --hard 2>err && - test_i18ngrep ! "disabling cone patterns" err -' - -test_expect_success 'sparse-checkout (init|set|disable) fails with dirty status' ' - git clone repo dirty && - echo dirty >dirty/folder1/a && - test_must_fail git -C dirty sparse-checkout init && - test_must_fail git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* && - test_must_fail git -C dirty sparse-checkout disable && - git -C dirty reset --hard && - git -C dirty sparse-checkout init && - git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* && - git -C dirty sparse-checkout disable -' - -test_expect_success 'cone mode: set with core.ignoreCase=true' ' - git -C repo sparse-checkout init --cone && - git -C repo -c core.ignoreCase=true sparse-checkout set folder1 && - cat >expect <<-\EOF && - /* - !/*/ - /folder1/ - EOF - test_cmp expect repo/.git/info/sparse-checkout && - check_files repo a folder1 -' - -test_expect_success 'interaction with submodules' ' - git clone repo super && - ( - cd super && - mkdir modules && - git submodule add ../repo modules/child && - git add . && - git commit -m "add submodule" && - git sparse-checkout init --cone && - git sparse-checkout set folder1 - ) && - check_files super a folder1 modules && - check_files super/modules/child a deep folder1 folder2 -' - -test_expect_success 'different sparse-checkouts with worktrees' ' - git -C repo worktree add --detach ../worktree && - check_files worktree "a deep folder1 folder2" && - git -C worktree sparse-checkout init --cone && - git -C repo sparse-checkout set folder1 && - git -C worktree sparse-checkout set deep/deeper1 && - check_files repo a folder1 && - check_files worktree a deep -' - -test_expect_success 'set using filename keeps file on-disk' ' - git -C repo sparse-checkout set a deep && - cat >expect <<-\EOF && - /* - !/*/ - /a/ - /deep/ - EOF - test_cmp expect repo/.git/info/sparse-checkout && - check_files repo a deep -' - -check_read_tree_errors () { - REPO=$1 - FILES=$2 - ERRORS=$3 - git -C $REPO -c core.sparseCheckoutCone=false read-tree -mu HEAD 2>err && - test_must_be_empty err && - check_files $REPO "$FILES" && - git -C $REPO read-tree -mu HEAD 2>err && - if test -z "$ERRORS" - then - test_must_be_empty err - else - test_i18ngrep "$ERRORS" err - fi && - check_files $REPO $FILES -} - -test_expect_success 'pattern-checks: /A/**' ' - cat >repo/.git/info/sparse-checkout <<-\EOF && - /* - !/*/ - /folder1/** - EOF - check_read_tree_errors repo "a folder1" "disabling cone pattern matching" -' - -test_expect_success 'pattern-checks: /A/**/B/' ' - cat >repo/.git/info/sparse-checkout <<-\EOF && - /* - !/*/ - /deep/**/deepest - EOF - check_read_tree_errors repo "a deep" "disabling cone pattern matching" && - check_files repo/deep "deeper1" && - check_files repo/deep/deeper1 "deepest" -' - -test_expect_success 'pattern-checks: too short' ' - cat >repo/.git/info/sparse-checkout <<-\EOF && - /* - !/*/ - / - EOF - check_read_tree_errors repo "a" "disabling cone pattern matching" -' -test_expect_success 'pattern-checks: not too short' ' - cat >repo/.git/info/sparse-checkout <<-\EOF && - /* - !/*/ - /b/ - EOF - git -C repo read-tree -mu HEAD 2>err && - test_must_be_empty err && - check_files repo a -' - -test_expect_success 'pattern-checks: trailing "*"' ' - cat >repo/.git/info/sparse-checkout <<-\EOF && - /* - !/*/ - /a* - EOF - check_read_tree_errors repo "a" "disabling cone pattern matching" -' - -test_expect_success 'pattern-checks: starting "*"' ' - cat >repo/.git/info/sparse-checkout <<-\EOF && - /* - !/*/ - *eep/ - EOF - check_read_tree_errors repo "a deep" "disabling cone pattern matching" -' - -test_expect_success 'pattern-checks: contained glob characters' ' - for c in "[a]" "\\" "?" "*" - do - cat >repo/.git/info/sparse-checkout <<-EOF && - /* - !/*/ - something$c-else/ - EOF - check_read_tree_errors repo "a" "disabling cone pattern matching" - done -' - -test_expect_success BSLASHPSPEC 'pattern-checks: escaped characters' ' - git clone repo escaped && - TREEOID=$(git -C escaped rev-parse HEAD:folder1) && - NEWTREE=$(git -C escaped mktree <<-EOF - $(git -C escaped ls-tree HEAD) - 040000 tree $TREEOID zbad\\dir - 040000 tree $TREEOID zdoes*exist - 040000 tree $TREEOID zglob[!a]? - EOF - ) && - COMMIT=$(git -C escaped commit-tree $NEWTREE -p HEAD) && - git -C escaped reset --hard $COMMIT && - check_files escaped "a deep folder1 folder2 zbad\\dir zdoes*exist" zglob[!a]? && - git -C escaped sparse-checkout init --cone && - git -C escaped sparse-checkout set zbad\\dir/bogus "zdoes*not*exist" "zdoes*exist" "zglob[!a]?" && - cat >expect <<-\EOF && - /* - !/*/ - /zbad\\dir/ - !/zbad\\dir/*/ - /zbad\\dir/bogus/ - /zdoes\*exist/ - /zdoes\*not\*exist/ - /zglob\[!a]\?/ - EOF - test_cmp expect escaped/.git/info/sparse-checkout && - check_read_tree_errors escaped "a zbad\\dir zdoes*exist zglob[!a]?" && - git -C escaped ls-tree -d --name-only HEAD >list-expect && - git -C escaped sparse-checkout set --stdin expect <<-\EOF && - /* - !/*/ - /deep/ - /folder1/ - /folder2/ - /zbad\\dir/ - /zdoes\*exist/ - /zglob\[!a]\?/ - EOF - test_cmp expect escaped/.git/info/sparse-checkout && - check_files escaped "a deep folder1 folder2 zbad\\dir zdoes*exist" zglob[!a]? && - git -C escaped sparse-checkout list >list-actual && - test_cmp list-expect list-actual -' - -test_expect_success MINGW 'cone mode replaces backslashes with slashes' ' - git -C repo sparse-checkout set deep\\deeper1 && - cat >expect <<-\EOF && - /* - !/*/ - /deep/ - !/deep/*/ - /deep/deeper1/ - EOF - test_cmp expect repo/.git/info/sparse-checkout && - check_files repo a deep && - check_files repo/deep a deeper1 -' - -test_done diff --git a/third_party/git/t/t1300-config.sh b/third_party/git/t/t1300-config.sh index 97ebfe1f9d5c..428177c390db 100755 --- a/third_party/git/t/t1300-config.sh +++ b/third_party/git/t/t1300-config.sh @@ -1191,47 +1191,47 @@ test_expect_success 'old-fashioned settings are case insensitive' ' test_when_finished "rm -f testConfig testConfig_expect testConfig_actual" && cat >testConfig_actual <<-EOF && - [V.A] - r = value1 + [V.A] + r = value1 EOF q_to_tab >testConfig_expect <<-EOF && - [V.A] - Qr = value2 + [V.A] + Qr = value2 EOF git config -f testConfig_actual "v.a.r" value2 && test_cmp testConfig_expect testConfig_actual && cat >testConfig_actual <<-EOF && - [V.A] - r = value1 + [V.A] + r = value1 EOF q_to_tab >testConfig_expect <<-EOF && - [V.A] - QR = value2 + [V.A] + QR = value2 EOF git config -f testConfig_actual "V.a.R" value2 && test_cmp testConfig_expect testConfig_actual && cat >testConfig_actual <<-EOF && - [V.A] - r = value1 + [V.A] + r = value1 EOF q_to_tab >testConfig_expect <<-EOF && - [V.A] - r = value1 - Qr = value2 + [V.A] + r = value1 + Qr = value2 EOF git config -f testConfig_actual "V.A.r" value2 && test_cmp testConfig_expect testConfig_actual && cat >testConfig_actual <<-EOF && - [V.A] - r = value1 + [V.A] + r = value1 EOF q_to_tab >testConfig_expect <<-EOF && - [V.A] - r = value1 - Qr = value2 + [V.A] + r = value1 + Qr = value2 EOF git config -f testConfig_actual "v.A.r" value2 && test_cmp testConfig_expect testConfig_actual @@ -1241,26 +1241,26 @@ test_expect_success 'setting different case sensitive subsections ' ' test_when_finished "rm -f testConfig testConfig_expect testConfig_actual" && cat >testConfig_actual <<-EOF && - [V "A"] - R = v1 - [K "E"] - Y = v1 - [a "b"] - c = v1 - [d "e"] - f = v1 + [V "A"] + R = v1 + [K "E"] + Y = v1 + [a "b"] + c = v1 + [d "e"] + f = v1 EOF q_to_tab >testConfig_expect <<-EOF && - [V "A"] - Qr = v2 - [K "E"] - Qy = v2 - [a "b"] - Qc = v2 - [d "e"] - f = v1 - [d "E"] - Qf = v2 + [V "A"] + Qr = v2 + [K "E"] + Qy = v2 + [a "b"] + Qc = v2 + [d "e"] + f = v1 + [d "E"] + Qf = v2 EOF # exact match git config -f testConfig_actual a.b.c v2 && @@ -1294,25 +1294,26 @@ test_expect_success 'git -c is not confused by empty environment' ' GIT_CONFIG_PARAMETERS="" git -c x.one=1 config --list ' +sq="'" test_expect_success 'detect bogus GIT_CONFIG_PARAMETERS' ' cat >expect <<-\EOF && env.one one env.two two EOF - GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ} ${SQ}env.two=two${SQ}" \ + GIT_CONFIG_PARAMETERS="${sq}env.one=one${sq} ${sq}env.two=two${sq}" \ git config --get-regexp "env.*" >actual && test_cmp expect actual && cat >expect <<-EOF && - env.one one${SQ} + env.one one${sq} env.two two EOF - GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ}\\$SQ$SQ$SQ ${SQ}env.two=two${SQ}" \ + GIT_CONFIG_PARAMETERS="${sq}env.one=one${sq}\\$sq$sq$sq ${sq}env.two=two${sq}" \ git config --get-regexp "env.*" >actual && test_cmp expect actual && test_must_fail env \ - GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ}\\$SQ ${SQ}env.two=two${SQ}" \ + GIT_CONFIG_PARAMETERS="${sq}env.one=one${sq}\\$sq ${sq}env.two=two${sq}" \ git config --get-regexp "env.*" ' @@ -1408,8 +1409,6 @@ test_expect_success 'urlmatch favors more specific URLs' ' cookieFile = /tmp/wildcard.txt [http "https://*.example.com/wildcardwithsubdomain"] cookieFile = /tmp/wildcardwithsubdomain.txt - [http "https://*.example.*"] - cookieFile = /tmp/multiwildcard.txt [http "https://trailing.example.com"] cookieFile = /tmp/trailing.txt [http "https://user@*.example.com/"] @@ -1456,10 +1455,6 @@ test_expect_success 'urlmatch favors more specific URLs' ' echo http.cookiefile /tmp/sub.txt >expect && git config --get-urlmatch HTTP https://user@sub.example.com >actual && - test_cmp expect actual && - - echo http.cookiefile /tmp/multiwildcard.txt >expect && - git config --get-urlmatch HTTP https://wildcard.example.org >actual && test_cmp expect actual ' @@ -1628,40 +1623,40 @@ test_expect_success 'set up --show-origin tests' ' INCLUDE_DIR="$HOME/include" && mkdir -p "$INCLUDE_DIR" && cat >"$INCLUDE_DIR"/absolute.include <<-\EOF && - [user] - absolute = include + [user] + absolute = include EOF cat >"$INCLUDE_DIR"/relative.include <<-\EOF && - [user] - relative = include + [user] + relative = include EOF cat >"$HOME"/.gitconfig <<-EOF && - [user] - global = true - override = global - [include] - path = "$INCLUDE_DIR/absolute.include" + [user] + global = true + override = global + [include] + path = "$INCLUDE_DIR/absolute.include" EOF cat >.git/config <<-\EOF - [user] - local = true - override = local - [include] - path = ../include/relative.include + [user] + local = true + override = local + [include] + path = ../include/relative.include EOF ' test_expect_success '--show-origin with --list' ' cat >expect <<-EOF && - file:$HOME/.gitconfig user.global=true - file:$HOME/.gitconfig user.override=global - file:$HOME/.gitconfig include.path=$INCLUDE_DIR/absolute.include - file:$INCLUDE_DIR/absolute.include user.absolute=include - file:.git/config user.local=true - file:.git/config user.override=local - file:.git/config include.path=../include/relative.include - file:.git/../include/relative.include user.relative=include - command line: user.cmdline=true + file:$HOME/.gitconfig user.global=true + file:$HOME/.gitconfig user.override=global + file:$HOME/.gitconfig include.path=$INCLUDE_DIR/absolute.include + file:$INCLUDE_DIR/absolute.include user.absolute=include + file:.git/config user.local=true + file:.git/config user.override=local + file:.git/config include.path=../include/relative.include + file:.git/../include/relative.include user.relative=include + command line: user.cmdline=true EOF git -c user.cmdline=true config --list --show-origin >output && test_cmp expect output @@ -1669,16 +1664,16 @@ test_expect_success '--show-origin with --list' ' test_expect_success '--show-origin with --list --null' ' cat >expect <<-EOF && - file:$HOME/.gitconfigQuser.global - trueQfile:$HOME/.gitconfigQuser.override - globalQfile:$HOME/.gitconfigQinclude.path - $INCLUDE_DIR/absolute.includeQfile:$INCLUDE_DIR/absolute.includeQuser.absolute - includeQfile:.git/configQuser.local - trueQfile:.git/configQuser.override - localQfile:.git/configQinclude.path - ../include/relative.includeQfile:.git/../include/relative.includeQuser.relative - includeQcommand line:Quser.cmdline - trueQ + file:$HOME/.gitconfigQuser.global + trueQfile:$HOME/.gitconfigQuser.override + globalQfile:$HOME/.gitconfigQinclude.path + $INCLUDE_DIR/absolute.includeQfile:$INCLUDE_DIR/absolute.includeQuser.absolute + includeQfile:.git/configQuser.local + trueQfile:.git/configQuser.override + localQfile:.git/configQinclude.path + ../include/relative.includeQfile:.git/../include/relative.includeQuser.relative + includeQcommand line:Quser.cmdline + trueQ EOF git -c user.cmdline=true config --null --list --show-origin >output.raw && nul_to_q output && @@ -1690,9 +1685,9 @@ test_expect_success '--show-origin with --list --null' ' test_expect_success '--show-origin with single file' ' cat >expect <<-\EOF && - file:.git/config user.local=true - file:.git/config user.override=local - file:.git/config include.path=../include/relative.include + file:.git/config user.local=true + file:.git/config user.override=local + file:.git/config include.path=../include/relative.include EOF git config --local --list --show-origin >output && test_cmp expect output @@ -1700,8 +1695,8 @@ test_expect_success '--show-origin with single file' ' test_expect_success '--show-origin with --get-regexp' ' cat >expect <<-EOF && - file:$HOME/.gitconfig user.global true - file:.git/config user.local true + file:$HOME/.gitconfig user.global true + file:.git/config user.local true EOF git config --show-origin --get-regexp "user\.[g|l].*" >output && test_cmp expect output @@ -1709,36 +1704,31 @@ test_expect_success '--show-origin with --get-regexp' ' test_expect_success '--show-origin getting a single key' ' cat >expect <<-\EOF && - file:.git/config local + file:.git/config local EOF git config --show-origin user.override >output && test_cmp expect output ' test_expect_success 'set up custom config file' ' - CUSTOM_CONFIG_FILE="custom.conf" && + CUSTOM_CONFIG_FILE="file\" (dq) and spaces.conf" && cat >"$CUSTOM_CONFIG_FILE" <<-\EOF - [user] - custom = true + [user] + custom = true EOF ' -test_expect_success !MINGW 'set up custom config file with special name characters' ' - WEIRDLY_NAMED_FILE="file\" (dq) and spaces.conf" && - cp "$CUSTOM_CONFIG_FILE" "$WEIRDLY_NAMED_FILE" -' - test_expect_success !MINGW '--show-origin escape special file name characters' ' cat >expect <<-\EOF && - file:"file\" (dq) and spaces.conf" user.custom=true + file:"file\" (dq) and spaces.conf" user.custom=true EOF - git config --file "$WEIRDLY_NAMED_FILE" --show-origin --list >output && + git config --file "$CUSTOM_CONFIG_FILE" --show-origin --list >output && test_cmp expect output ' test_expect_success '--show-origin stdin' ' cat >expect <<-\EOF && - standard input: user.custom=true + standard input: user.custom=true EOF git config --file - --show-origin --list <"$CUSTOM_CONFIG_FILE" >output && test_cmp expect output @@ -1746,11 +1736,11 @@ test_expect_success '--show-origin stdin' ' test_expect_success '--show-origin stdin with file include' ' cat >"$INCLUDE_DIR"/stdin.include <<-EOF && - [user] - stdin = include + [user] + stdin = include EOF cat >expect <<-EOF && - file:$INCLUDE_DIR/stdin.include include + file:$INCLUDE_DIR/stdin.include include EOF echo "[include]path=\"$INCLUDE_DIR\"/stdin.include" | git config --show-origin --includes --file - user.stdin >output && @@ -1758,18 +1748,18 @@ test_expect_success '--show-origin stdin with file include' ' test_cmp expect output ' -test_expect_success '--show-origin blob' ' +test_expect_success !MINGW '--show-origin blob' ' blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") && cat >expect <<-EOF && - blob:$blob user.custom=true + blob:$blob user.custom=true EOF git config --blob=$blob --show-origin --list >output && test_cmp expect output ' -test_expect_success '--show-origin blob ref' ' +test_expect_success !MINGW '--show-origin blob ref' ' cat >expect <<-\EOF && - blob:master:custom.conf user.custom=true + blob:"master:file\" (dq) and spaces.conf" user.custom=true EOF git add "$CUSTOM_CONFIG_FILE" && git commit -m "new config file" && @@ -1777,65 +1767,6 @@ test_expect_success '--show-origin blob ref' ' test_cmp expect output ' -test_expect_success '--show-scope with --list' ' - cat >expect <<-EOF && - global user.global=true - global user.override=global - global include.path=$INCLUDE_DIR/absolute.include - global user.absolute=include - local user.local=true - local user.override=local - local include.path=../include/relative.include - local user.relative=include - command user.cmdline=true - EOF - git -c user.cmdline=true config --list --show-scope >output && - test_cmp expect output -' - -test_expect_success !MINGW '--show-scope with --blob' ' - blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") && - cat >expect <<-EOF && - command user.custom=true - EOF - git config --blob=$blob --show-scope --list >output && - test_cmp expect output -' - -test_expect_success '--show-scope with --local' ' - cat >expect <<-\EOF && - local user.local=true - local user.override=local - local include.path=../include/relative.include - EOF - git config --local --list --show-scope >output && - test_cmp expect output -' - -test_expect_success '--show-scope getting a single value' ' - cat >expect <<-\EOF && - local true - EOF - git config --show-scope --get user.local >output && - test_cmp expect output -' - -test_expect_success '--show-scope with --show-origin' ' - cat >expect <<-EOF && - global file:$HOME/.gitconfig user.global=true - global file:$HOME/.gitconfig user.override=global - global file:$HOME/.gitconfig include.path=$INCLUDE_DIR/absolute.include - global file:$INCLUDE_DIR/absolute.include user.absolute=include - local file:.git/config user.local=true - local file:.git/config user.override=local - local file:.git/config include.path=../include/relative.include - local file:.git/../include/relative.include user.relative=include - command command line: user.cmdline=true - EOF - git -c user.cmdline=true config --list --show-origin --show-scope >output && - test_cmp expect output -' - test_expect_success '--local requires a repo' ' # we expect 128 to ensure that we do not simply # fail to find anything and return code "1" diff --git a/third_party/git/t/t1305-config-include.sh b/third_party/git/t/t1305-config-include.sh index f1e1b289f989..d20b4d150d42 100755 --- a/third_party/git/t/t1305-config-include.sh +++ b/third_party/git/t/t1305-config-include.sh @@ -63,7 +63,7 @@ test_expect_success 'listing includes option and expansion' ' test.one=1 EOF git config --list >actual.full && - grep -v -e ^core -e ^extensions actual.full >actual && + grep -v ^core actual.full >actual && test_cmp expect actual ' diff --git a/third_party/git/t/t1306-xdg-files.sh b/third_party/git/t/t1306-xdg-files.sh index dd87b43be1a6..21e139a313be 100755 --- a/third_party/git/t/t1306-xdg-files.sh +++ b/third_party/git/t/t1306-xdg-files.sh @@ -153,7 +153,7 @@ test_expect_success 'Checking attributes in both XDG and local attributes files' test_expect_success 'Checking attributes in a non-XDG global attributes file' ' - rm -f .gitattributes && + test_might_fail rm .gitattributes && echo "f attr_f=test" >"$HOME"/my_gitattributes && git config core.attributesfile "$HOME"/my_gitattributes && echo "f: attr_f: test" >expected && @@ -165,7 +165,7 @@ test_expect_success 'Checking attributes in a non-XDG global attributes file' ' test_expect_success 'write: xdg file exists and ~/.gitconfig doesn'\''t' ' mkdir -p "$HOME"/.config/git && >"$HOME"/.config/git/config && - rm -f "$HOME"/.gitconfig && + test_might_fail rm "$HOME"/.gitconfig && git config --global user.name "write_config" && echo "[user]" >expected && echo " name = write_config" >>expected && @@ -183,8 +183,8 @@ test_expect_success 'write: xdg file exists and ~/.gitconfig exists' ' test_expect_success 'write: ~/.config/git/ exists and config file doesn'\''t' ' - rm -f "$HOME"/.gitconfig && - rm -f "$HOME"/.config/git/config && + test_might_fail rm "$HOME"/.gitconfig && + test_might_fail rm "$HOME"/.config/git/config && git config --global user.name "write_gitconfig" && echo "[user]" >expected && echo " name = write_gitconfig" >>expected && diff --git a/third_party/git/t/t1307-config-blob.sh b/third_party/git/t/t1307-config-blob.sh index 002e6d3388e2..37dc689d8c98 100755 --- a/third_party/git/t/t1307-config-blob.sh +++ b/third_party/git/t/t1307-config-blob.sh @@ -74,7 +74,7 @@ test_expect_success 'can parse blob ending with CR' ' ' test_expect_success 'config --blob outside of a repository is an error' ' - nongit test_must_fail git config --blob=foo --list + test_must_fail nongit git config --blob=foo --list ' test_done diff --git a/third_party/git/t/t1308-config-set.sh b/third_party/git/t/t1308-config-set.sh index 3a527e3a8438..d0a2727b850a 100755 --- a/third_party/git/t/t1308-config-set.sh +++ b/third_party/git/t/t1308-config-set.sh @@ -166,14 +166,14 @@ test_expect_success 'find value with highest priority from a configset' ' ' test_expect_success 'find value_list for a key from a configset' ' - cat >expect <<-\EOF && - lama - ball + cat >except <<-\EOF && sam bat hask + lama + ball EOF - test-tool config configset_get_value_multi case.baz config2 .git/config >actual && + test-tool config configset_get_value case.baz config2 .git/config >actual && test_cmp expect actual ' @@ -238,8 +238,8 @@ test_expect_success 'error on modifying repo config without repo' ' cmdline_config="'foo.bar=from-cmdline'" test_expect_success 'iteration shows correct origins' ' - printf "[ignore]\n\tthis = please\n[foo]bar = from-repo\n" >.git/config && - printf "[foo]\n\tbar = from-home\n" >.gitconfig && + echo "[foo]bar = from-repo" >.git/config && + echo "[foo]bar = from-home" >.gitconfig && if test_have_prereq MINGW then # Use Windows path (i.e. *not* $HOME) @@ -253,29 +253,19 @@ test_expect_success 'iteration shows correct origins' ' value=from-home origin=file name=$HOME_GITCONFIG - lno=2 scope=global - key=ignore.this - value=please - origin=file - name=.git/config - lno=2 - scope=local - key=foo.bar value=from-repo origin=file name=.git/config - lno=3 - scope=local + scope=repo key=foo.bar value=from-cmdline origin=command line name= - lno=-1 - scope=command + scope=cmdline EOF GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config iterate >actual && test_cmp expect actual diff --git a/third_party/git/t/t1309-early-config.sh b/third_party/git/t/t1309-early-config.sh index ebb8e1aecbf4..0c37e7180d1c 100755 --- a/third_party/git/t/t1309-early-config.sh +++ b/third_party/git/t/t1309-early-config.sh @@ -29,7 +29,7 @@ test_expect_success 'ceiling' ' cd sub && test-tool config read_early_config early.config ) >output && - test_must_be_empty output + test -z "$(cat output)" ' test_expect_success 'ceiling #2' ' @@ -91,12 +91,7 @@ test_expect_failure 'ignore .git/ with invalid config' ' test_expect_success 'early config and onbranch' ' echo "[broken" >broken && - test_with_config "[includeif \"onbranch:master\"]path=../broken" -' - -test_expect_success 'onbranch config outside of git repo' ' - test_config_global includeIf.onbranch:master.path non-existent && - nongit git help + test_with_config "[includeif \"onbranch:refs/heads/master\"]path=../broken" ' test_done diff --git a/third_party/git/t/t1400-update-ref.sh b/third_party/git/t/t1400-update-ref.sh index a6224ef65fe9..1fbd94040818 100755 --- a/third_party/git/t/t1400-update-ref.sh +++ b/third_party/git/t/t1400-update-ref.sh @@ -344,16 +344,14 @@ test_expect_success "verifying $m's log (logged by config)" ' test_cmp expect .git/logs/$m ' -test_expect_success 'set up for querying the reflog' ' - git update-ref $m $D && - cat >.git/logs/$m <<-EOF - $Z $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500 - $C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500 - $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500 - $F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500 - $Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500 - EOF -' +git update-ref $m $D +cat >.git/logs/$m < 1117150320 -0500 +$C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500 +$A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500 +$F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500 +$Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500 +EOF ed="Thu, 26 May 2005 18:32:00 -0500" gd="Thu, 26 May 2005 18:33:00 -0500" @@ -361,67 +359,55 @@ ld="Thu, 26 May 2005 18:43:00 -0500" test_expect_success 'Query "master@{May 25 2005}" (before history)' ' test_when_finished "rm -f o e" && git rev-parse --verify "master@{May 25 2005}" >o 2>e && - echo "$C" >expect && - test_cmp expect o && - echo "warning: log for '\''master'\'' only goes back to $ed" >expect && - test_i18ncmp expect e + test $C = $(cat o) && + test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)" ' test_expect_success 'Query master@{2005-05-25} (before history)' ' test_when_finished "rm -f o e" && git rev-parse --verify master@{2005-05-25} >o 2>e && - echo "$C" >expect && - test_cmp expect o && - echo "warning: log for '\''master'\'' only goes back to $ed" >expect && - test_i18ncmp expect e + test $C = $(cat o) && + test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)" ' test_expect_success 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' ' test_when_finished "rm -f o e" && git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e && - echo "$C" >expect && - test_cmp expect o && - echo "warning: log for '\''master'\'' only goes back to $ed" >expect && - test_i18ncmp expect e + test $C = $(cat o) && + test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)" ' test_expect_success 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' ' test_when_finished "rm -f o e" && git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e && - echo "$C" >expect && - test_cmp expect o && - test_must_be_empty e + test $C = $(cat o) && + test "" = "$(cat e)" ' test_expect_success 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' ' test_when_finished "rm -f o e" && git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e && - echo "$A" >expect && - test_cmp expect o && - test_must_be_empty e + test $A = $(cat o) && + test "" = "$(cat e)" ' test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' ' test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e && - echo "$B" >expect && - test_cmp expect o && + test $B = $(cat o) && test_i18ngrep -F "warning: log for ref $m has gap after $gd" e ' test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' ' test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e && - echo "$Z" >expect && - test_cmp expect o && - test_must_be_empty e + test $Z = $(cat o) && + test "" = "$(cat e)" ' test_expect_success 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' ' test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e && - echo "$E" >expect && - test_cmp expect o && - test_must_be_empty e + test $E = $(cat o) && + test "" = "$(cat e)" ' test_expect_success 'Query "master@{2005-05-28}" (past end of history)' ' test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-28}" >o 2>e && - echo "$D" >expect && - test_cmp expect o && + test $D = $(cat o) && test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e ' diff --git a/third_party/git/t/t1404-update-ref-errors.sh b/third_party/git/t/t1404-update-ref-errors.sh index 2d142e5535e5..970c5c36b9b5 100755 --- a/third_party/git/t/t1404-update-ref-errors.sh +++ b/third_party/git/t/t1404-update-ref-errors.sh @@ -32,6 +32,8 @@ test_update_rejected () { test_cmp unchanged actual } +Q="'" + # Test adding and deleting D/F-conflicting references in a single # transaction. df_test() { @@ -91,7 +93,7 @@ df_test() { delname="$delref" fi && cat >expected-err <<-EOF && - fatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ + fatal: cannot lock ref $Q$addname$Q: $Q$delref$Q exists; cannot create $Q$addref$Q EOF $pack && if $add_del @@ -121,7 +123,7 @@ test_expect_success 'existing loose ref is a simple prefix of new' ' prefix=refs/1l && test_update_rejected "a c e" false "b c/x d" \ - "$SQ$prefix/c$SQ exists; cannot create $SQ$prefix/c/x$SQ" + "$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x$Q" ' @@ -129,7 +131,7 @@ test_expect_success 'existing packed ref is a simple prefix of new' ' prefix=refs/1p && test_update_rejected "a c e" true "b c/x d" \ - "$SQ$prefix/c$SQ exists; cannot create $SQ$prefix/c/x$SQ" + "$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x$Q" ' @@ -137,7 +139,7 @@ test_expect_success 'existing loose ref is a deeper prefix of new' ' prefix=refs/2l && test_update_rejected "a c e" false "b c/x/y d" \ - "$SQ$prefix/c$SQ exists; cannot create $SQ$prefix/c/x/y$SQ" + "$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x/y$Q" ' @@ -145,7 +147,7 @@ test_expect_success 'existing packed ref is a deeper prefix of new' ' prefix=refs/2p && test_update_rejected "a c e" true "b c/x/y d" \ - "$SQ$prefix/c$SQ exists; cannot create $SQ$prefix/c/x/y$SQ" + "$Q$prefix/c$Q exists; cannot create $Q$prefix/c/x/y$Q" ' @@ -153,7 +155,7 @@ test_expect_success 'new ref is a simple prefix of existing loose' ' prefix=refs/3l && test_update_rejected "a c/x e" false "b c d" \ - "$SQ$prefix/c/x$SQ exists; cannot create $SQ$prefix/c$SQ" + "$Q$prefix/c/x$Q exists; cannot create $Q$prefix/c$Q" ' @@ -161,7 +163,7 @@ test_expect_success 'new ref is a simple prefix of existing packed' ' prefix=refs/3p && test_update_rejected "a c/x e" true "b c d" \ - "$SQ$prefix/c/x$SQ exists; cannot create $SQ$prefix/c$SQ" + "$Q$prefix/c/x$Q exists; cannot create $Q$prefix/c$Q" ' @@ -169,7 +171,7 @@ test_expect_success 'new ref is a deeper prefix of existing loose' ' prefix=refs/4l && test_update_rejected "a c/x/y e" false "b c d" \ - "$SQ$prefix/c/x/y$SQ exists; cannot create $SQ$prefix/c$SQ" + "$Q$prefix/c/x/y$Q exists; cannot create $Q$prefix/c$Q" ' @@ -177,7 +179,7 @@ test_expect_success 'new ref is a deeper prefix of existing packed' ' prefix=refs/4p && test_update_rejected "a c/x/y e" true "b c d" \ - "$SQ$prefix/c/x/y$SQ exists; cannot create $SQ$prefix/c$SQ" + "$Q$prefix/c/x/y$Q exists; cannot create $Q$prefix/c$Q" ' @@ -185,7 +187,7 @@ test_expect_success 'one new ref is a simple prefix of another' ' prefix=refs/5 && test_update_rejected "a e" false "b c c/x d" \ - "cannot process $SQ$prefix/c$SQ and $SQ$prefix/c/x$SQ at the same time" + "cannot process $Q$prefix/c$Q and $Q$prefix/c/x$Q at the same time" ' @@ -332,7 +334,7 @@ test_expect_success 'D/F conflict prevents indirect delete long packed + indirec test_expect_success 'missing old value blocks update' ' prefix=refs/missing-update && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ + fatal: cannot lock ref $Q$prefix/foo$Q: unable to resolve reference $Q$prefix/foo$Q EOF printf "%s\n" "update $prefix/foo $E $D" | test_must_fail git update-ref --stdin 2>output.err && @@ -343,7 +345,7 @@ test_expect_success 'incorrect old value blocks update' ' prefix=refs/incorrect-update && git update-ref $prefix/foo $C && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: is at $C but expected $D + fatal: cannot lock ref $Q$prefix/foo$Q: is at $C but expected $D EOF printf "%s\n" "update $prefix/foo $E $D" | test_must_fail git update-ref --stdin 2>output.err && @@ -354,7 +356,7 @@ test_expect_success 'existing old value blocks create' ' prefix=refs/existing-create && git update-ref $prefix/foo $C && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: reference already exists + fatal: cannot lock ref $Q$prefix/foo$Q: reference already exists EOF printf "%s\n" "create $prefix/foo $E" | test_must_fail git update-ref --stdin 2>output.err && @@ -365,7 +367,7 @@ test_expect_success 'incorrect old value blocks delete' ' prefix=refs/incorrect-delete && git update-ref $prefix/foo $C && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: is at $C but expected $D + fatal: cannot lock ref $Q$prefix/foo$Q: is at $C but expected $D EOF printf "%s\n" "delete $prefix/foo $D" | test_must_fail git update-ref --stdin 2>output.err && @@ -376,7 +378,7 @@ test_expect_success 'missing old value blocks indirect update' ' prefix=refs/missing-indirect-update && git symbolic-ref $prefix/symref $prefix/foo && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ + fatal: cannot lock ref $Q$prefix/symref$Q: unable to resolve reference $Q$prefix/foo$Q EOF printf "%s\n" "update $prefix/symref $E $D" | test_must_fail git update-ref --stdin 2>output.err && @@ -388,7 +390,7 @@ test_expect_success 'incorrect old value blocks indirect update' ' git symbolic-ref $prefix/symref $prefix/foo && git update-ref $prefix/foo $C && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: is at $C but expected $D + fatal: cannot lock ref $Q$prefix/symref$Q: is at $C but expected $D EOF printf "%s\n" "update $prefix/symref $E $D" | test_must_fail git update-ref --stdin 2>output.err && @@ -400,7 +402,7 @@ test_expect_success 'existing old value blocks indirect create' ' git symbolic-ref $prefix/symref $prefix/foo && git update-ref $prefix/foo $C && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: reference already exists + fatal: cannot lock ref $Q$prefix/symref$Q: reference already exists EOF printf "%s\n" "create $prefix/symref $E" | test_must_fail git update-ref --stdin 2>output.err && @@ -412,7 +414,7 @@ test_expect_success 'incorrect old value blocks indirect delete' ' git symbolic-ref $prefix/symref $prefix/foo && git update-ref $prefix/foo $C && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: is at $C but expected $D + fatal: cannot lock ref $Q$prefix/symref$Q: is at $C but expected $D EOF printf "%s\n" "delete $prefix/symref $D" | test_must_fail git update-ref --stdin 2>output.err && @@ -423,7 +425,7 @@ test_expect_success 'missing old value blocks indirect no-deref update' ' prefix=refs/missing-noderef-update && git symbolic-ref $prefix/symref $prefix/foo && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: reference is missing but expected $D + fatal: cannot lock ref $Q$prefix/symref$Q: reference is missing but expected $D EOF printf "%s\n" "option no-deref" "update $prefix/symref $E $D" | test_must_fail git update-ref --stdin 2>output.err && @@ -435,7 +437,7 @@ test_expect_success 'incorrect old value blocks indirect no-deref update' ' git symbolic-ref $prefix/symref $prefix/foo && git update-ref $prefix/foo $C && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: is at $C but expected $D + fatal: cannot lock ref $Q$prefix/symref$Q: is at $C but expected $D EOF printf "%s\n" "option no-deref" "update $prefix/symref $E $D" | test_must_fail git update-ref --stdin 2>output.err && @@ -447,7 +449,7 @@ test_expect_success 'existing old value blocks indirect no-deref create' ' git symbolic-ref $prefix/symref $prefix/foo && git update-ref $prefix/foo $C && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: reference already exists + fatal: cannot lock ref $Q$prefix/symref$Q: reference already exists EOF printf "%s\n" "option no-deref" "create $prefix/symref $E" | test_must_fail git update-ref --stdin 2>output.err && @@ -459,7 +461,7 @@ test_expect_success 'incorrect old value blocks indirect no-deref delete' ' git symbolic-ref $prefix/symref $prefix/foo && git update-ref $prefix/foo $C && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: is at $C but expected $D + fatal: cannot lock ref $Q$prefix/symref$Q: is at $C but expected $D EOF printf "%s\n" "option no-deref" "delete $prefix/symref $D" | test_must_fail git update-ref --stdin 2>output.err && @@ -472,13 +474,13 @@ test_expect_success 'non-empty directory blocks create' ' : >.git/$prefix/foo/bar/baz.lock && test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ + fatal: cannot lock ref $Q$prefix/foo$Q: there is a non-empty directory $Q.git/$prefix/foo$Q blocking reference $Q$prefix/foo$Q EOF printf "%s\n" "update $prefix/foo $C" | test_must_fail git update-ref --stdin 2>output.err && test_cmp expected output.err && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ + fatal: cannot lock ref $Q$prefix/foo$Q: unable to resolve reference $Q$prefix/foo$Q EOF printf "%s\n" "update $prefix/foo $D $C" | test_must_fail git update-ref --stdin 2>output.err && @@ -491,13 +493,13 @@ test_expect_success 'broken reference blocks create' ' echo "gobbledigook" >.git/$prefix/foo && test_when_finished "rm -f .git/$prefix/foo" && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + fatal: cannot lock ref $Q$prefix/foo$Q: unable to resolve reference $Q$prefix/foo$Q: reference broken EOF printf "%s\n" "update $prefix/foo $C" | test_must_fail git update-ref --stdin 2>output.err && test_cmp expected output.err && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + fatal: cannot lock ref $Q$prefix/foo$Q: unable to resolve reference $Q$prefix/foo$Q: reference broken EOF printf "%s\n" "update $prefix/foo $D $C" | test_must_fail git update-ref --stdin 2>output.err && @@ -511,13 +513,13 @@ test_expect_success 'non-empty directory blocks indirect create' ' : >.git/$prefix/foo/bar/baz.lock && test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ + fatal: cannot lock ref $Q$prefix/symref$Q: there is a non-empty directory $Q.git/$prefix/foo$Q blocking reference $Q$prefix/foo$Q EOF printf "%s\n" "update $prefix/symref $C" | test_must_fail git update-ref --stdin 2>output.err && test_cmp expected output.err && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ + fatal: cannot lock ref $Q$prefix/symref$Q: unable to resolve reference $Q$prefix/foo$Q EOF printf "%s\n" "update $prefix/symref $D $C" | test_must_fail git update-ref --stdin 2>output.err && @@ -530,13 +532,13 @@ test_expect_success 'broken reference blocks indirect create' ' echo "gobbledigook" >.git/$prefix/foo && test_when_finished "rm -f .git/$prefix/foo" && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + fatal: cannot lock ref $Q$prefix/symref$Q: unable to resolve reference $Q$prefix/foo$Q: reference broken EOF printf "%s\n" "update $prefix/symref $C" | test_must_fail git update-ref --stdin 2>output.err && test_cmp expected output.err && cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + fatal: cannot lock ref $Q$prefix/symref$Q: unable to resolve reference $Q$prefix/foo$Q: reference broken EOF printf "%s\n" "update $prefix/symref $D $C" | test_must_fail git update-ref --stdin 2>output.err && @@ -612,7 +614,7 @@ test_expect_success 'delete fails cleanly if packed-refs file is locked' ' test_when_finished "rm -f .git/packed-refs.lock" && test_must_fail git update-ref -d $prefix/foo >out 2>err && git for-each-ref $prefix >actual && - test_i18ngrep "Unable to create $SQ.*packed-refs.lock$SQ: " err && + test_i18ngrep "Unable to create $Q.*packed-refs.lock$Q: " err && test_cmp unchanged actual ' diff --git a/third_party/git/t/t1406-submodule-ref-store.sh b/third_party/git/t/t1406-submodule-ref-store.sh index 36b7ef504687..d199d872fb19 100755 --- a/third_party/git/t/t1406-submodule-ref-store.sh +++ b/third_party/git/t/t1406-submodule-ref-store.sh @@ -75,7 +75,7 @@ test_expect_success 'for_each_reflog()' ' ' test_expect_success 'for_each_reflog_ent()' ' - $RUN for-each-reflog-ent HEAD >actual && + $RUN for-each-reflog-ent HEAD >actual && cat actual && head -n1 actual | grep first && tail -n2 actual | head -n1 | grep master.to.new ' diff --git a/third_party/git/t/t1409-avoid-packing-refs.sh b/third_party/git/t/t1409-avoid-packing-refs.sh index be12fb63506e..e5cb8a252dd1 100755 --- a/third_party/git/t/t1409-avoid-packing-refs.sh +++ b/third_party/git/t/t1409-avoid-packing-refs.sh @@ -8,7 +8,7 @@ test_description='avoid rewriting packed-refs unnecessarily' # shouldn't upset readers, and it should be omitted if the file is # ever rewritten. mark_packed_refs () { - sed -e "s/^\(#.*\)/\1 t1409 /" .git/packed-refs >.git/packed-refs.new && + sed -e "s/^\(#.*\)/\1 t1409 /" <.git/packed-refs >.git/packed-refs.new && mv .git/packed-refs.new .git/packed-refs } @@ -27,15 +27,15 @@ test_expect_success 'setup' ' ' test_expect_success 'do not create packed-refs file gratuitously' ' - test_path_is_missing .git/packed-refs && + test_must_fail test -f .git/packed-refs && git update-ref refs/heads/foo $A && - test_path_is_missing .git/packed-refs && + test_must_fail test -f .git/packed-refs && git update-ref refs/heads/foo $B && - test_path_is_missing .git/packed-refs && + test_must_fail test -f .git/packed-refs && git update-ref refs/heads/foo $C $B && - test_path_is_missing .git/packed-refs && + test_must_fail test -f .git/packed-refs && git update-ref -d refs/heads/foo && - test_path_is_missing .git/packed-refs + test_must_fail test -f .git/packed-refs ' test_expect_success 'check that marking the packed-refs file works' ' @@ -46,7 +46,7 @@ test_expect_success 'check that marking the packed-refs file works' ' git for-each-ref >actual && test_cmp expected actual && git pack-refs --all && - ! check_packed_refs_marked && + test_must_fail check_packed_refs_marked && git for-each-ref >actual2 && test_cmp expected actual2 ' @@ -80,7 +80,7 @@ test_expect_success 'touch packed-refs on delete of packed' ' git pack-refs --all && mark_packed_refs && git update-ref -d refs/heads/packed-delete && - ! check_packed_refs_marked + test_must_fail check_packed_refs_marked ' test_expect_success 'leave packed-refs untouched on update of loose' ' diff --git a/third_party/git/t/t1410-reflog.sh b/third_party/git/t/t1410-reflog.sh index 76d9b744a64b..82950c02825c 100755 --- a/third_party/git/t/t1410-reflog.sh +++ b/third_party/git/t/t1410-reflog.sh @@ -195,7 +195,7 @@ test_expect_success 'delete' ' git reflog delete master@{1} && git reflog show master > output && - test_line_count = $(($master_entry_count - 1)) output && + test $(($master_entry_count - 1)) = $(wc -l < output) && test $HEAD_entry_count = $(git reflog | wc -l) && ! grep ox < output && @@ -209,7 +209,7 @@ test_expect_success 'delete' ' git reflog delete master@{07.04.2005.15:15:00.-0700} && git reflog show master > output && - test_line_count = $(($master_entry_count - 1)) output && + test $(($master_entry_count - 1)) = $(wc -l < output) && ! grep dragon < output ' diff --git a/third_party/git/t/t1414-reflog-walk.sh b/third_party/git/t/t1414-reflog-walk.sh index 1181a9fb28e3..feb1efd8ff99 100755 --- a/third_party/git/t/t1414-reflog-walk.sh +++ b/third_party/git/t/t1414-reflog-walk.sh @@ -18,9 +18,10 @@ do_walk () { git log -g --format="%gd %gs" "$@" } +sq="'" test_expect_success 'set up expected reflog' ' cat >expect.all <<-EOF - HEAD@{0} commit (merge): Merge branch ${SQ}master${SQ} into side + HEAD@{0} commit (merge): Merge branch ${sq}master${sq} into side HEAD@{1} commit: three HEAD@{2} checkout: moving from master to side HEAD@{3} commit: two diff --git a/third_party/git/t/t1450-fsck.sh b/third_party/git/t/t1450-fsck.sh index d09eff503c65..b36e0528d07b 100755 --- a/third_party/git/t/t1450-fsck.sh +++ b/third_party/git/t/t1450-fsck.sh @@ -70,6 +70,7 @@ test_expect_success 'object with bad sha1' ' test_when_finished "git update-ref -d refs/heads/bogus" && test_must_fail git fsck 2>out && + cat out && test_i18ngrep "$sha.*corrupt" out ' @@ -77,6 +78,7 @@ test_expect_success 'branch pointing to non-commit' ' git rev-parse HEAD^{tree} >.git/refs/heads/invalid && test_when_finished "git update-ref -d refs/heads/invalid" && test_must_fail git fsck 2>out && + cat out && test_i18ngrep "not a commit" out ' @@ -86,6 +88,7 @@ test_expect_success 'HEAD link pointing at a funny object' ' echo $ZERO_OID >.git/HEAD && # avoid corrupt/broken HEAD from interfering with repo discovery test_must_fail env GIT_DIR=.git git fsck 2>out && + cat out && test_i18ngrep "detached HEAD points" out ' @@ -95,6 +98,7 @@ test_expect_success 'HEAD link pointing at a funny place' ' echo "ref: refs/funny/place" >.git/HEAD && # avoid corrupt/broken HEAD from interfering with repo discovery test_must_fail env GIT_DIR=.git git fsck 2>out && + cat out && test_i18ngrep "HEAD points to something strange" out ' @@ -141,6 +145,7 @@ test_expect_success 'email without @ is okay' ' git update-ref refs/heads/bogus "$new" && test_when_finished "git update-ref -d refs/heads/bogus" && git fsck 2>out && + cat out && ! grep "commit $new" out ' @@ -152,6 +157,7 @@ test_expect_success 'email with embedded > is not okay' ' git update-ref refs/heads/bogus "$new" && test_when_finished "git update-ref -d refs/heads/bogus" && test_must_fail git fsck 2>out && + cat out && test_i18ngrep "error in commit $new" out ' @@ -163,6 +169,7 @@ test_expect_success 'missing < email delimiter is reported nicely' ' git update-ref refs/heads/bogus "$new" && test_when_finished "git update-ref -d refs/heads/bogus" && test_must_fail git fsck 2>out && + cat out && test_i18ngrep "error in commit $new.* - bad name" out ' @@ -174,6 +181,7 @@ test_expect_success 'missing email is reported nicely' ' git update-ref refs/heads/bogus "$new" && test_when_finished "git update-ref -d refs/heads/bogus" && test_must_fail git fsck 2>out && + cat out && test_i18ngrep "error in commit $new.* - missing email" out ' @@ -185,6 +193,7 @@ test_expect_success '> in name is reported' ' git update-ref refs/heads/bogus "$new" && test_when_finished "git update-ref -d refs/heads/bogus" && test_must_fail git fsck 2>out && + cat out && test_i18ngrep "error in commit $new" out ' @@ -198,6 +207,7 @@ test_expect_success 'integer overflow in timestamps is reported' ' git update-ref refs/heads/bogus "$new" && test_when_finished "git update-ref -d refs/heads/bogus" && test_must_fail git fsck 2>out && + cat out && test_i18ngrep "error in commit $new.*integer overflow" out ' @@ -209,6 +219,7 @@ test_expect_success 'commit with NUL in header' ' git update-ref refs/heads/bogus "$new" && test_when_finished "git update-ref -d refs/heads/bogus" && test_must_fail git fsck 2>out && + cat out && test_i18ngrep "error in commit $new.*unterminated header: NUL at offset" out ' @@ -286,6 +297,7 @@ test_expect_success 'tag pointing to nonexistent' ' echo $tag >.git/refs/tags/invalid && test_when_finished "git update-ref -d refs/tags/invalid" && test_must_fail git fsck --tags >out && + cat out && test_i18ngrep "broken link" out ' @@ -366,6 +378,7 @@ test_expect_success 'tag with NUL in header' ' echo $tag >.git/refs/tags/wrong && test_when_finished "git update-ref -d refs/tags/wrong" && test_must_fail git fsck --tags 2>out && + cat out && test_i18ngrep "error in tag $tag.*unterminated header: NUL at offset" out ' @@ -396,6 +409,7 @@ test_expect_success 'rev-list --verify-objects with bad sha1' ' test_when_finished "git update-ref -d refs/heads/bogus" && test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out && + cat out && test_i18ngrep -q "error: hash mismatch $(dirname $new)$(test_oid ff_2)" out ' @@ -419,6 +433,7 @@ test_expect_success 'fsck notices blob entry pointing to null sha1' ' sha=$(printf "100644 file$_bz$_bzoid" | git hash-object -w --stdin -t tree) && git fsck 2>out && + cat out && test_i18ngrep "warning.*null sha1" out ) ' @@ -429,6 +444,7 @@ test_expect_success 'fsck notices submodule entry pointing to null sha1' ' sha=$(printf "160000 submodule$_bz$_bzoid" | git hash-object -w --stdin -t tree) && git fsck 2>out && + cat out && test_i18ngrep "warning.*null sha1" out ) ' @@ -440,7 +456,6 @@ while read name path pretty; do ( git init $name-$type && cd $name-$type && - git config core.protectNTFS false && echo content >file && git add file && git commit -m base && @@ -450,6 +465,7 @@ while read name path pretty; do printf "$mode $type %s\t%s" "$value" "$path" >bad && bad_tree=$(git mktree out && + cat out && test_i18ngrep "warning.*tree $bad_tree" out )' done <<-\EOF @@ -616,7 +632,7 @@ test_expect_success 'fsck --name-objects' ' remove_object $(git rev-parse julius:caesar.t) && test_must_fail git fsck --name-objects >out && tree=$(git rev-parse --verify julius:) && - test_i18ngrep "$tree (refs/tags/julius:" out + test_i18ngrep -E "$tree \((refs/heads/master|HEAD)@\{[0-9]*\}:" out ) ' diff --git a/third_party/git/t/t1500-rev-parse.sh b/third_party/git/t/t1500-rev-parse.sh index 603019b54167..01abee533ded 100755 --- a/third_party/git/t/t1500-rev-parse.sh +++ b/third_party/git/t/t1500-rev-parse.sh @@ -59,7 +59,6 @@ test_rev_parse () { ROOT=$(pwd) test_expect_success 'setup' ' - test_oid_init && mkdir -p sub/dir work && cp -R .git repo.git ' @@ -132,30 +131,6 @@ test_expect_success 'rev-parse --is-shallow-repository in non-shallow repo' ' test_cmp expect actual ' -test_expect_success 'rev-parse --show-object-format in repo' ' - echo "$(test_oid algo)" >expect && - git rev-parse --show-object-format >actual && - test_cmp expect actual && - git rev-parse --show-object-format=storage >actual && - test_cmp expect actual && - git rev-parse --show-object-format=input >actual && - test_cmp expect actual && - git rev-parse --show-object-format=output >actual && - test_cmp expect actual && - test_must_fail git rev-parse --show-object-format=squeamish-ossifrage 2>err && - grep "unknown mode for --show-object-format: squeamish-ossifrage" err -' - -test_expect_success '--show-toplevel from subdir of working tree' ' - pwd >expect && - git -C sub/dir rev-parse --show-toplevel >actual && - test_cmp expect actual -' - -test_expect_success '--show-toplevel from inside .git' ' - test_must_fail git -C .git rev-parse --show-toplevel -' - test_expect_success 'showing the superproject correctly' ' git rev-parse --show-superproject-working-tree >out && test_must_be_empty out && diff --git a/third_party/git/t/t1501-work-tree.sh b/third_party/git/t/t1501-work-tree.sh index b75558040ffd..3498d3d55e9e 100755 --- a/third_party/git/t/t1501-work-tree.sh +++ b/third_party/git/t/t1501-work-tree.sh @@ -350,7 +350,7 @@ test_expect_success 'Multi-worktree setup' ' mkdir work && mkdir -p repo.git/repos/foo && cp repo.git/HEAD repo.git/index repo.git/repos/foo && - { cp repo.git/sharedindex.* repo.git/repos/foo || :; } && + test_might_fail cp repo.git/sharedindex.* repo.git/repos/foo && sane_unset GIT_DIR GIT_CONFIG GIT_WORK_TREE ' diff --git a/third_party/git/t/t1506-rev-parse-diagnosis.sh b/third_party/git/t/t1506-rev-parse-diagnosis.sh index 52edcbdcc327..4ee009da666f 100755 --- a/third_party/git/t/t1506-rev-parse-diagnosis.sh +++ b/third_party/git/t/t1506-rev-parse-diagnosis.sh @@ -8,11 +8,12 @@ exec expected <<-EOF && - fatal: path '$2$3' $4, but not ${5:-$SQ$3$SQ} - hint: Did you mean '$1:$2$3'${2:+ aka $SQ$1:./$3$SQ}? + fatal: Path '$2$3' $4, but not ${5:-$sq$3$sq}. + Did you mean '$1:$2$3'${2:+ aka $sq$1:./$3$sq}? EOF - test_i18ncmp expected error + test_cmp expected error } HASH_file= @@ -103,66 +104,66 @@ test_expect_success 'correct relative file objects (6)' ' test_expect_success 'incorrect revision id' ' test_must_fail git rev-parse foobar:file.txt 2>error && - test_i18ngrep "invalid object name .foobar." error && - test_must_fail git rev-parse foobar 2>error && + grep "Invalid object name '"'"'foobar'"'"'." error && + test_must_fail git rev-parse foobar 2> error && test_i18ngrep "unknown revision or path not in the working tree." error ' test_expect_success 'incorrect file in sha1:path' ' - test_must_fail git rev-parse HEAD:nothing.txt 2>error && - test_i18ngrep "path .nothing.txt. does not exist in .HEAD." error && - test_must_fail git rev-parse HEAD:index-only.txt 2>error && - test_i18ngrep "path .index-only.txt. exists on disk, but not in .HEAD." error && + test_must_fail git rev-parse HEAD:nothing.txt 2> error && + grep "fatal: Path '"'"'nothing.txt'"'"' does not exist in '"'"'HEAD'"'"'" error && + test_must_fail git rev-parse HEAD:index-only.txt 2> error && + grep "fatal: Path '"'"'index-only.txt'"'"' exists on disk, but not in '"'"'HEAD'"'"'." error && (cd subdir && - test_must_fail git rev-parse HEAD:file2.txt 2>error && + test_must_fail git rev-parse HEAD:file2.txt 2> error && test_did_you_mean HEAD subdir/ file2.txt exists ) ' test_expect_success 'incorrect file in :path and :N:path' ' - test_must_fail git rev-parse :nothing.txt 2>error && - test_i18ngrep "path .nothing.txt. does not exist (neither on disk nor in the index)" error && - test_must_fail git rev-parse :1:nothing.txt 2>error && - test_i18ngrep "path .nothing.txt. does not exist (neither on disk nor in the index)" error && - test_must_fail git rev-parse :1:file.txt 2>error && + test_must_fail git rev-parse :nothing.txt 2> error && + grep "fatal: Path '"'"'nothing.txt'"'"' does not exist (neither on disk nor in the index)." error && + test_must_fail git rev-parse :1:nothing.txt 2> error && + grep "Path '"'"'nothing.txt'"'"' does not exist (neither on disk nor in the index)." error && + test_must_fail git rev-parse :1:file.txt 2> error && test_did_you_mean ":0" "" file.txt "is in the index" "at stage 1" && (cd subdir && - test_must_fail git rev-parse :1:file.txt 2>error && + test_must_fail git rev-parse :1:file.txt 2> error && test_did_you_mean ":0" "" file.txt "is in the index" "at stage 1" && - test_must_fail git rev-parse :file2.txt 2>error && + test_must_fail git rev-parse :file2.txt 2> error && test_did_you_mean ":0" subdir/ file2.txt "is in the index" && - test_must_fail git rev-parse :2:file2.txt 2>error && + test_must_fail git rev-parse :2:file2.txt 2> error && test_did_you_mean :0 subdir/ file2.txt "is in the index") && - test_must_fail git rev-parse :disk-only.txt 2>error && - test_i18ngrep "path .disk-only.txt. exists on disk, but not in the index" error + test_must_fail git rev-parse :disk-only.txt 2> error && + grep "fatal: Path '"'"'disk-only.txt'"'"' exists on disk, but not in the index." error ' test_expect_success 'invalid @{n} reference' ' test_must_fail git rev-parse master@{99999} >output 2>error && - test_must_be_empty output && - test_i18ngrep "log for [^ ]* only has [0-9][0-9]* entries" error && + test -z "$(cat output)" && + grep "fatal: Log for [^ ]* only has [0-9][0-9]* entries." error && test_must_fail git rev-parse --verify master@{99999} >output 2>error && - test_must_be_empty output && - test_i18ngrep "log for [^ ]* only has [0-9][0-9]* entries" error + test -z "$(cat output)" && + grep "fatal: Log for [^ ]* only has [0-9][0-9]* entries." error ' test_expect_success 'relative path not found' ' ( cd subdir && test_must_fail git rev-parse HEAD:./nonexistent.txt 2>error && - test_i18ngrep subdir/nonexistent.txt error + grep subdir/nonexistent.txt error ) ' test_expect_success 'relative path outside worktree' ' test_must_fail git rev-parse HEAD:../file.txt >output 2>error && - test_must_be_empty output && + test -z "$(cat output)" && test_i18ngrep "outside repository" error ' test_expect_success 'relative path when cwd is outside worktree' ' test_must_fail git --git-dir=.git --work-tree=subdir rev-parse HEAD:./file.txt >output 2>error && - test_must_be_empty output && - test_i18ngrep "relative path syntax can.t be used outside working tree" error + test -z "$(cat output)" && + grep "relative path syntax can.t be used outside working tree." error ' test_expect_success ':file correctly diagnosed after a pathname' ' @@ -214,26 +215,4 @@ test_expect_success 'arg before dashdash must be a revision (ambiguous)' ' test_cmp expect actual ' -test_expect_success 'reject Nth parent if N is too high' ' - test_must_fail git rev-parse HEAD^100000000000000000000000000000000 -' - -test_expect_success 'reject Nth ancestor if N is too high' ' - test_must_fail git rev-parse HEAD~100000000000000000000000000000000 -' - -test_expect_success 'pathspecs with wildcards are not ambiguous' ' - echo "*.c" >expect && - git rev-parse "*.c" >actual && - test_cmp expect actual -' - -test_expect_success 'backslash does not trigger wildcard rule' ' - test_must_fail git rev-parse "foo\\bar" -' - -test_expect_success 'escaped char does not trigger wildcard rule' ' - test_must_fail git rev-parse "foo\\*bar" -' - test_done diff --git a/third_party/git/t/t1507-rev-parse-upstream.sh b/third_party/git/t/t1507-rev-parse-upstream.sh index dfc0d96d8a8a..fa3e4996418d 100755 --- a/third_party/git/t/t1507-rev-parse-upstream.sh +++ b/third_party/git/t/t1507-rev-parse-upstream.sh @@ -28,9 +28,16 @@ test_expect_success 'setup' ' ) ' +sq="'" + +full_name () { + (cd clone && + git rev-parse --symbolic-full-name "$@") +} + commit_subject () { (cd clone && - git show -s --pretty=tformat:%s "$@") + git show -s --pretty=format:%s "$@") } error_message () { @@ -39,78 +46,63 @@ error_message () { } test_expect_success '@{upstream} resolves to correct full name' ' - echo refs/remotes/origin/master >expect && - git -C clone rev-parse --symbolic-full-name @{upstream} >actual && - test_cmp expect actual && - git -C clone rev-parse --symbolic-full-name @{UPSTREAM} >actual && - test_cmp expect actual && - git -C clone rev-parse --symbolic-full-name @{UpSTReam} >actual && - test_cmp expect actual + test refs/remotes/origin/master = "$(full_name @{upstream})" && + test refs/remotes/origin/master = "$(full_name @{UPSTREAM})" && + test refs/remotes/origin/master = "$(full_name @{UpSTReam})" ' test_expect_success '@{u} resolves to correct full name' ' - echo refs/remotes/origin/master >expect && - git -C clone rev-parse --symbolic-full-name @{u} >actual && - test_cmp expect actual && - git -C clone rev-parse --symbolic-full-name @{U} >actual && - test_cmp expect actual + test refs/remotes/origin/master = "$(full_name @{u})" && + test refs/remotes/origin/master = "$(full_name @{U})" ' test_expect_success 'my-side@{upstream} resolves to correct full name' ' - echo refs/remotes/origin/side >expect && - git -C clone rev-parse --symbolic-full-name my-side@{u} >actual && - test_cmp expect actual + test refs/remotes/origin/side = "$(full_name my-side@{u})" ' test_expect_success 'upstream of branch with @ in middle' ' - git -C clone rev-parse --symbolic-full-name fun@ny@{u} >actual && + full_name fun@ny@{u} >actual && echo refs/remotes/origin/side >expect && test_cmp expect actual && - git -C clone rev-parse --symbolic-full-name fun@ny@{U} >actual && + full_name fun@ny@{U} >actual && test_cmp expect actual ' test_expect_success 'upstream of branch with @ at start' ' - git -C clone rev-parse --symbolic-full-name @funny@{u} >actual && + full_name @funny@{u} >actual && echo refs/remotes/origin/side >expect && test_cmp expect actual ' test_expect_success 'upstream of branch with @ at end' ' - git -C clone rev-parse --symbolic-full-name funny@@{u} >actual && + full_name funny@@{u} >actual && echo refs/remotes/origin/side >expect && test_cmp expect actual ' test_expect_success 'refs/heads/my-side@{upstream} does not resolve to my-side{upstream}' ' - test_must_fail git -C clone rev-parse --symbolic-full-name refs/heads/my-side@{upstream} + test_must_fail full_name refs/heads/my-side@{upstream} ' test_expect_success 'my-side@{u} resolves to correct commit' ' git checkout side && test_commit 5 && (cd clone && git fetch) && - echo 2 >expect && - commit_subject my-side >actual && - test_cmp expect actual && - echo 5 >expect && - commit_subject my-side@{u} >actual + test 2 = "$(commit_subject my-side)" && + test 5 = "$(commit_subject my-side@{u})" ' test_expect_success 'not-tracking@{u} fails' ' - test_must_fail git -C clone rev-parse --symbolic-full-name non-tracking@{u} && + test_must_fail full_name non-tracking@{u} && (cd clone && git checkout --no-track -b non-tracking) && - test_must_fail git -C clone rev-parse --symbolic-full-name non-tracking@{u} + test_must_fail full_name non-tracking@{u} ' test_expect_success '@{u}@{1} resolves correctly' ' test_commit 6 && (cd clone && git fetch) && - echo 5 >expect && - commit_subject my-side@{u}@{1} >actual && - test_cmp expect actual && - commit_subject my-side@{U}@{1} >actual && - test_cmp expect actual + test 5 = $(commit_subject my-side@{u}@{1}) && + test 5 = $(commit_subject my-side@{U}@{1}) ' test_expect_success '@{u} without specifying branch fails on a detached HEAD' ' @@ -137,7 +129,7 @@ test_expect_success 'merge my-side@{u} records the correct name' ' git branch -t new my-side@{u} && git merge -s ours new@{u} && git show -s --pretty=tformat:%s >actual && - echo "Merge remote-tracking branch ${SQ}origin/side${SQ}" >expect && + echo "Merge remote-tracking branch ${sq}origin/side${sq}" >expect && test_cmp expect actual ) ' @@ -159,14 +151,12 @@ test_expect_success 'checkout other@{u}' ' ' test_expect_success 'branch@{u} works when tracking a local branch' ' - echo refs/heads/master >expect && - git -C clone rev-parse --symbolic-full-name local-master@{u} >actual && - test_cmp expect actual + test refs/heads/master = "$(full_name local-master@{u})" ' test_expect_success 'branch@{u} error message when no upstream' ' cat >expect <<-EOF && - fatal: no upstream configured for branch ${SQ}non-tracking${SQ} + fatal: no upstream configured for branch ${sq}non-tracking${sq} EOF error_message non-tracking@{u} && test_i18ncmp expect error @@ -174,7 +164,7 @@ test_expect_success 'branch@{u} error message when no upstream' ' test_expect_success '@{u} error message when no upstream' ' cat >expect <<-EOF && - fatal: no upstream configured for branch ${SQ}master${SQ} + fatal: no upstream configured for branch ${sq}master${sq} EOF test_must_fail git rev-parse --verify @{u} 2>actual && test_i18ncmp expect actual @@ -182,7 +172,7 @@ test_expect_success '@{u} error message when no upstream' ' test_expect_success 'branch@{u} error message with misspelt branch' ' cat >expect <<-EOF && - fatal: no such branch: ${SQ}no-such-branch${SQ} + fatal: no such branch: ${sq}no-such-branch${sq} EOF error_message no-such-branch@{u} && test_i18ncmp expect error @@ -199,7 +189,7 @@ test_expect_success '@{u} error message when not on a branch' ' test_expect_success 'branch@{u} error message if upstream branch not fetched' ' cat >expect <<-EOF && - fatal: upstream branch ${SQ}refs/heads/side${SQ} not stored as a remote-tracking branch + fatal: upstream branch ${sq}refs/heads/side${sq} not stored as a remote-tracking branch EOF error_message bad-upstream@{u} && test_i18ncmp expect error @@ -215,37 +205,35 @@ test_expect_success 'pull works when tracking a local branch' ' # makes sense if the previous one succeeded test_expect_success '@{u} works when tracking a local branch' ' - echo refs/heads/master >expect && - git -C clone rev-parse --symbolic-full-name @{u} >actual && - test_cmp expect actual + test refs/heads/master = "$(full_name @{u})" ' -test_expect_success 'log -g other@{u}' ' - commit=$(git rev-parse HEAD) && - cat >expect <<-EOF && - commit $commit - Reflog: master@{0} (C O Mitter ) - Reflog message: branch: Created from HEAD - Author: A U Thor - Date: Thu Apr 7 15:15:13 2005 -0700 +commit=$(git rev-parse HEAD) +cat >expect <) +Reflog message: branch: Created from HEAD +Author: A U Thor +Date: Thu Apr 7 15:15:13 2005 -0700 - 3 - EOF + 3 +EOF +test_expect_success 'log -g other@{u}' ' git log -1 -g other@{u} >actual && test_cmp expect actual ' -test_expect_success 'log -g other@{u}@{now}' ' - commit=$(git rev-parse HEAD) && - cat >expect <<-EOF && - commit $commit - Reflog: master@{Thu Apr 7 15:17:13 2005 -0700} (C O Mitter ) - Reflog message: branch: Created from HEAD - Author: A U Thor - Date: Thu Apr 7 15:15:13 2005 -0700 +cat >expect <) +Reflog message: branch: Created from HEAD +Author: A U Thor +Date: Thu Apr 7 15:15:13 2005 -0700 - 3 - EOF + 3 +EOF + +test_expect_success 'log -g other@{u}@{now}' ' git log -1 -g other@{u}@{now} >actual && test_cmp expect actual ' diff --git a/third_party/git/t/t1512-rev-parse-disambiguation.sh b/third_party/git/t/t1512-rev-parse-disambiguation.sh index 18fa6cf40d37..c19fb500cb22 100755 --- a/third_party/git/t/t1512-rev-parse-disambiguation.sh +++ b/third_party/git/t/t1512-rev-parse-disambiguation.sh @@ -282,7 +282,7 @@ test_expect_success 'rev-parse --disambiguate' ' # commits created by commit-tree in earlier tests share a # different prefix. git rev-parse --disambiguate=000000000 >actual && - test_line_count = 16 actual && + test $(wc -l stderr && grep ^hint: stderr >hints && - # 5 commits, 1 tag (which is a committish), plus intro line + # 5 commits, 1 tag (which is a commitish), plus intro line test_line_count = 7 hints ' diff --git a/third_party/git/t/t1600-index.sh b/third_party/git/t/t1600-index.sh index b7c31aa86a11..42962ed7d46f 100755 --- a/third_party/git/t/t1600-index.sh +++ b/third_party/git/t/t1600-index.sh @@ -59,42 +59,17 @@ test_expect_success 'out of bounds index.version issues warning' ' ) ' -test_index_version () { - INDEX_VERSION_CONFIG=$1 && - FEATURE_MANY_FILES=$2 && - ENV_VAR_VERSION=$3 - EXPECTED_OUTPUT_VERSION=$4 && +test_expect_success 'GIT_INDEX_VERSION takes precedence over config' ' ( rm -f .git/index && - rm -f .git/config && - if test "$INDEX_VERSION_CONFIG" -ne 0 - then - git config --add index.version $INDEX_VERSION_CONFIG - fi && - git config --add feature.manyFiles $FEATURE_MANY_FILES - if test "$ENV_VAR_VERSION" -ne 0 - then - GIT_INDEX_VERSION=$ENV_VAR_VERSION && - export GIT_INDEX_VERSION - else - unset GIT_INDEX_VERSION - fi && + GIT_INDEX_VERSION=4 && + export GIT_INDEX_VERSION && + git config --add index.version 2 && git add a 2>&1 && - echo $EXPECTED_OUTPUT_VERSION >expect && + echo 4 >expect && test-tool index-version <.git/index >actual && test_cmp expect actual ) -} - -test_expect_success 'index version config precedence' ' - test_index_version 0 false 0 2 && - test_index_version 2 false 0 2 && - test_index_version 3 false 0 2 && - test_index_version 4 false 0 4 && - test_index_version 2 false 4 4 && - test_index_version 2 true 0 2 && - test_index_version 0 true 0 4 && - test_index_version 0 true 2 2 ' test_done diff --git a/third_party/git/t/t2018-checkout-branch.sh b/third_party/git/t/t2018-checkout-branch.sh index bbca7ef8da6d..822381dd9df6 100755 --- a/third_party/git/t/t2018-checkout-branch.sh +++ b/third_party/git/t/t2018-checkout-branch.sh @@ -1,76 +1,50 @@ #!/bin/sh -test_description='checkout' +test_description='checkout ' . ./test-lib.sh -# Arguments: [!] [] +# Arguments: [] # # Runs "git checkout" to switch to , testing that # # 1) we are on the specified branch, ; -# 2) HEAD is ; if is not specified, the old HEAD is used. +# 2) HEAD is ; if is not specified, the old HEAD is used. # # If is not specified, "git checkout" is run with -b. -# -# If the first argument is `!`, "git checkout" is expected to fail when -# it is run. -do_checkout () { - should_fail= && - if test "x$1" = "x!" - then - should_fail=yes && - shift - fi && +do_checkout() { exp_branch=$1 && exp_ref="refs/heads/$exp_branch" && - # if is not specified, use HEAD. - exp_oid=${2:-$(git rev-parse --verify HEAD)} && + # if is not specified, use HEAD. + exp_sha=${2:-$(git rev-parse --verify HEAD)} && # default options for git checkout: -b - if test -z "$3" - then + if [ -z "$3" ]; then opts="-b" else opts="$3" fi - if test -n "$should_fail" - then - test_must_fail git checkout $opts $exp_branch $exp_oid - else - git checkout $opts $exp_branch $exp_oid && - echo "$exp_ref" >ref.expect && - git rev-parse --symbolic-full-name HEAD >ref.actual && - test_cmp ref.expect ref.actual && - echo "$exp_oid" >oid.expect && - git rev-parse --verify HEAD >oid.actual && - test_cmp oid.expect oid.actual - fi -} + git checkout $opts $exp_branch $exp_sha && -test_dirty_unmergeable () { - test_expect_code 1 git diff --exit-code + test $exp_ref = $(git rev-parse --symbolic-full-name HEAD) && + test $exp_sha = $(git rev-parse --verify HEAD) } -test_dirty_unmergeable_discards_changes () { - git diff --exit-code +test_dirty_unmergeable() { + ! git diff --exit-code >/dev/null } -setup_dirty_unmergeable () { +setup_dirty_unmergeable() { echo >>file1 change2 } -test_dirty_mergeable () { - test_expect_code 1 git diff --cached --exit-code -} - -test_dirty_mergeable_discards_changes () { - git diff --cached --exit-code +test_dirty_mergeable() { + ! git diff --cached --exit-code >/dev/null } -setup_dirty_mergeable () { +setup_dirty_mergeable() { echo >file2 file2 && git add file2 } @@ -108,7 +82,7 @@ test_expect_success 'checkout -b to a new branch, set to an explicit ref' ' test_expect_success 'checkout -b to a new branch with unmergeable changes fails' ' setup_dirty_unmergeable && - do_checkout ! branch2 $HEAD1 && + test_must_fail do_checkout branch2 $HEAD1 && test_dirty_unmergeable ' @@ -119,7 +93,7 @@ test_expect_success 'checkout -f -b to a new branch with unmergeable changes dis # still dirty and on branch1 do_checkout branch2 $HEAD1 "-f -b" && - test_dirty_unmergeable_discards_changes + test_must_fail test_dirty_unmergeable ' test_expect_success 'checkout -b to a new branch preserves mergeable changes' ' @@ -137,12 +111,12 @@ test_expect_success 'checkout -f -b to a new branch with mergeable changes disca test_when_finished git reset --hard HEAD && setup_dirty_mergeable && do_checkout branch2 $HEAD1 "-f -b" && - test_dirty_mergeable_discards_changes + test_must_fail test_dirty_mergeable ' test_expect_success 'checkout -b to an existing branch fails' ' test_when_finished git reset --hard HEAD && - do_checkout ! branch2 $HEAD2 + test_must_fail do_checkout branch2 $HEAD2 ' test_expect_success 'checkout -b to @{-1} fails with the right branch name' ' @@ -166,8 +140,7 @@ test_expect_success 'checkout -B to a merge base' ' ' test_expect_success 'checkout -B to an existing branch from detached HEAD resets branch to HEAD' ' - head=$(git rev-parse --verify HEAD) && - git checkout "$head" && + git checkout $(git rev-parse --verify HEAD) && do_checkout branch2 "" -B ' @@ -182,14 +155,14 @@ test_expect_success 'checkout -B to an existing branch with unmergeable changes git checkout branch1 && setup_dirty_unmergeable && - do_checkout ! branch2 $HEAD1 -B && + test_must_fail do_checkout branch2 $HEAD1 -B && test_dirty_unmergeable ' test_expect_success 'checkout -f -B to an existing branch with unmergeable changes discards changes' ' # still dirty and on branch1 do_checkout branch2 $HEAD1 "-f -B" && - test_dirty_unmergeable_discards_changes + test_must_fail test_dirty_unmergeable ' test_expect_success 'checkout -B to an existing branch preserves mergeable changes' ' @@ -206,7 +179,7 @@ test_expect_success 'checkout -f -B to an existing branch with mergeable changes setup_dirty_mergeable && do_checkout branch2 $HEAD1 "-f -B" && - test_dirty_mergeable_discards_changes + test_must_fail test_dirty_mergeable ' test_expect_success 'checkout -b ' ' diff --git a/third_party/git/t/t2022-checkout-paths.sh b/third_party/git/t/t2022-checkout-paths.sh index 6844afafc0eb..fc3eb43b8909 100755 --- a/third_party/git/t/t2022-checkout-paths.sh +++ b/third_party/git/t/t2022-checkout-paths.sh @@ -78,15 +78,4 @@ test_expect_success 'do not touch files that are already up-to-date' ' test_cmp expect actual ' -test_expect_success 'checkout HEAD adds deleted intent-to-add file back to index' ' - echo "nonempty" >nonempty && - >empty && - git add nonempty empty && - git commit -m "create files to be deleted" && - git rm --cached nonempty empty && - git add -N nonempty empty && - git checkout HEAD nonempty empty && - git diff --cached --exit-code -' - test_done diff --git a/third_party/git/t/t2024-checkout-dwim.sh b/third_party/git/t/t2024-checkout-dwim.sh index accfa9aa4bd8..fa0718c730c3 100755 --- a/third_party/git/t/t2024-checkout-dwim.sh +++ b/third_party/git/t/t2024-checkout-dwim.sh @@ -37,9 +37,7 @@ test_expect_success 'setup' ' git checkout -b foo && test_commit a_foo && git checkout -b bar && - test_commit a_bar && - git checkout -b ambiguous_branch_and_file && - test_commit a_ambiguous_branch_and_file + test_commit a_bar ) && git init repo_b && ( @@ -48,9 +46,7 @@ test_expect_success 'setup' ' git checkout -b foo && test_commit b_foo && git checkout -b baz && - test_commit b_baz && - git checkout -b ambiguous_branch_and_file && - test_commit b_ambiguous_branch_and_file + test_commit b_baz ) && git remote add repo_a repo_a && git remote add repo_b repo_b && @@ -79,26 +75,6 @@ test_expect_success 'checkout of branch from multiple remotes fails #1' ' test_branch master ' -test_expect_success 'when arg matches multiple remotes, do not fallback to interpreting as pathspec' ' - # create a file with name matching remote branch name - git checkout -b t_ambiguous_branch_and_file && - >ambiguous_branch_and_file && - git add ambiguous_branch_and_file && - git commit -m "ambiguous_branch_and_file" && - - # modify file to verify that it will not be touched by checkout - test_when_finished "git checkout -- ambiguous_branch_and_file" && - echo "file contents" >ambiguous_branch_and_file && - cp ambiguous_branch_and_file expect && - - test_must_fail git checkout ambiguous_branch_and_file 2>err && - - test_i18ngrep "matched multiple (2) remote tracking branches" err && - - # file must not be altered - test_cmp expect ambiguous_branch_and_file -' - test_expect_success 'checkout of branch from multiple remotes fails with advice' ' git checkout -B master && test_might_fail git branch -D foo && diff --git a/third_party/git/t/t2026-checkout-pathspec-file.sh b/third_party/git/t/t2026-checkout-pathspec-file.sh deleted file mode 100755 index 43d31d794853..000000000000 --- a/third_party/git/t/t2026-checkout-pathspec-file.sh +++ /dev/null @@ -1,163 +0,0 @@ -#!/bin/sh - -test_description='checkout --pathspec-from-file' - -. ./test-lib.sh - -test_tick - -test_expect_success setup ' - test_commit file0 && - - echo 1 >fileA.t && - echo 1 >fileB.t && - echo 1 >fileC.t && - echo 1 >fileD.t && - git add fileA.t fileB.t fileC.t fileD.t && - git commit -m "files 1" && - - echo 2 >fileA.t && - echo 2 >fileB.t && - echo 2 >fileC.t && - echo 2 >fileD.t && - git add fileA.t fileB.t fileC.t fileD.t && - git commit -m "files 2" && - - git tag checkpoint -' - -restore_checkpoint () { - git reset --hard checkpoint -} - -verify_expect () { - git status --porcelain --untracked-files=no -- fileA.t fileB.t fileC.t fileD.t >actual && - test_cmp expect actual -} - -test_expect_success '--pathspec-from-file from stdin' ' - restore_checkpoint && - - echo fileA.t | git checkout --pathspec-from-file=- HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - EOF - verify_expect -' - -test_expect_success '--pathspec-from-file from file' ' - restore_checkpoint && - - echo fileA.t >list && - git checkout --pathspec-from-file=list HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - EOF - verify_expect -' - -test_expect_success 'NUL delimiters' ' - restore_checkpoint && - - printf "fileA.t\0fileB.t\0" | git checkout --pathspec-from-file=- --pathspec-file-nul HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - M fileB.t - EOF - verify_expect -' - -test_expect_success 'LF delimiters' ' - restore_checkpoint && - - printf "fileA.t\nfileB.t\n" | git checkout --pathspec-from-file=- HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - M fileB.t - EOF - verify_expect -' - -test_expect_success 'no trailing delimiter' ' - restore_checkpoint && - - printf "fileA.t\nfileB.t" | git checkout --pathspec-from-file=- HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - M fileB.t - EOF - verify_expect -' - -test_expect_success 'CRLF delimiters' ' - restore_checkpoint && - - printf "fileA.t\r\nfileB.t\r\n" | git checkout --pathspec-from-file=- HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - M fileB.t - EOF - verify_expect -' - -test_expect_success 'quotes' ' - restore_checkpoint && - - cat >list <<-\EOF && - "file\101.t" - EOF - - git checkout --pathspec-from-file=list HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - EOF - verify_expect -' - -test_expect_success 'quotes not compatible with --pathspec-file-nul' ' - restore_checkpoint && - - cat >list <<-\EOF && - "file\101.t" - EOF - - test_must_fail git checkout --pathspec-from-file=list --pathspec-file-nul HEAD^1 -' - -test_expect_success 'only touches what was listed' ' - restore_checkpoint && - - printf "fileB.t\nfileC.t\n" | git checkout --pathspec-from-file=- HEAD^1 && - - cat >expect <<-\EOF && - M fileB.t - M fileC.t - EOF - verify_expect -' - -test_expect_success 'error conditions' ' - restore_checkpoint && - echo fileA.t >list && - - test_must_fail git checkout --pathspec-from-file=list --detach 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with --detach" err && - - test_must_fail git checkout --pathspec-from-file=list --patch 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with --patch" err && - - test_must_fail git checkout --pathspec-from-file=list -- fileA.t 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err && - - test_must_fail git checkout --pathspec-file-nul 2>err && - test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err -' - -test_done diff --git a/third_party/git/t/t2070-restore.sh b/third_party/git/t/t2070-restore.sh index 076d0df7fc06..2650df196670 100755 --- a/third_party/git/t/t2070-restore.sh +++ b/third_party/git/t/t2070-restore.sh @@ -95,32 +95,4 @@ test_expect_success 'restore --ignore-unmerged ignores unmerged entries' ' ) ' -test_expect_success 'restore --staged adds deleted intent-to-add file back to index' ' - echo "nonempty" >nonempty && - >empty && - git add nonempty empty && - git commit -m "create files to be deleted" && - git rm --cached nonempty empty && - git add -N nonempty empty && - git restore --staged nonempty empty && - git diff --cached --exit-code -' - -test_expect_success 'restore --staged invalidates cache tree for deletions' ' - test_when_finished git reset --hard && - >new1 && - >new2 && - git add new1 new2 && - - # It is important to commit and then reset here, so that the index - # contains a valid cache-tree for the "both" tree. - git commit -m both && - git reset --soft HEAD^ && - - git restore --staged new1 && - git commit -m "just new2" && - git rev-parse HEAD:new2 && - test_must_fail git rev-parse HEAD:new1 -' - test_done diff --git a/third_party/git/t/t2072-restore-pathspec-file.sh b/third_party/git/t/t2072-restore-pathspec-file.sh deleted file mode 100755 index 0d47946e8a9b..000000000000 --- a/third_party/git/t/t2072-restore-pathspec-file.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh - -test_description='restore --pathspec-from-file' - -. ./test-lib.sh - -test_tick - -test_expect_success setup ' - test_commit file0 && - - echo 1 >fileA.t && - echo 1 >fileB.t && - echo 1 >fileC.t && - echo 1 >fileD.t && - git add fileA.t fileB.t fileC.t fileD.t && - git commit -m "files 1" && - - echo 2 >fileA.t && - echo 2 >fileB.t && - echo 2 >fileC.t && - echo 2 >fileD.t && - git add fileA.t fileB.t fileC.t fileD.t && - git commit -m "files 2" && - - git tag checkpoint -' - -restore_checkpoint () { - git reset --hard checkpoint -} - -verify_expect () { - git status --porcelain --untracked-files=no -- fileA.t fileB.t fileC.t fileD.t >actual && - test_cmp expect actual -} - -test_expect_success '--pathspec-from-file from stdin' ' - restore_checkpoint && - - echo fileA.t | git restore --pathspec-from-file=- --source=HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - EOF - verify_expect -' - -test_expect_success '--pathspec-from-file from file' ' - restore_checkpoint && - - echo fileA.t >list && - git restore --pathspec-from-file=list --source=HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - EOF - verify_expect -' - -test_expect_success 'NUL delimiters' ' - restore_checkpoint && - - printf "fileA.t\0fileB.t\0" | git restore --pathspec-from-file=- --pathspec-file-nul --source=HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - M fileB.t - EOF - verify_expect -' - -test_expect_success 'LF delimiters' ' - restore_checkpoint && - - printf "fileA.t\nfileB.t\n" | git restore --pathspec-from-file=- --source=HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - M fileB.t - EOF - verify_expect -' - -test_expect_success 'no trailing delimiter' ' - restore_checkpoint && - - printf "fileA.t\nfileB.t" | git restore --pathspec-from-file=- --source=HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - M fileB.t - EOF - verify_expect -' - -test_expect_success 'CRLF delimiters' ' - restore_checkpoint && - - printf "fileA.t\r\nfileB.t\r\n" | git restore --pathspec-from-file=- --source=HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - M fileB.t - EOF - verify_expect -' - -test_expect_success 'quotes' ' - restore_checkpoint && - - cat >list <<-\EOF && - "file\101.t" - EOF - - git restore --pathspec-from-file=list --source=HEAD^1 && - - cat >expect <<-\EOF && - M fileA.t - EOF - verify_expect -' - -test_expect_success 'quotes not compatible with --pathspec-file-nul' ' - restore_checkpoint && - - cat >list <<-\EOF && - "file\101.t" - EOF - - test_must_fail git restore --pathspec-from-file=list --pathspec-file-nul --source=HEAD^1 -' - -test_expect_success 'only touches what was listed' ' - restore_checkpoint && - - printf "fileB.t\nfileC.t\n" | git restore --pathspec-from-file=- --source=HEAD^1 && - - cat >expect <<-\EOF && - M fileB.t - M fileC.t - EOF - verify_expect -' - -test_expect_success 'error conditions' ' - restore_checkpoint && - echo fileA.t >list && - >empty_list && - - test_must_fail git restore --pathspec-from-file=list --patch --source=HEAD^1 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with --patch" err && - - test_must_fail git restore --pathspec-from-file=list --source=HEAD^1 -- fileA.t 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err && - - test_must_fail git restore --pathspec-file-nul --source=HEAD^1 2>err && - test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err && - - test_must_fail git restore --pathspec-from-file=empty_list --source=HEAD^1 2>err && - test_i18ngrep -e "you must specify path(s) to restore" err -' - -test_done diff --git a/third_party/git/t/t2107-update-index-basic.sh b/third_party/git/t/t2107-update-index-basic.sh index a30b7ca6bc90..2242cd098ec4 100755 --- a/third_party/git/t/t2107-update-index-basic.sh +++ b/third_party/git/t/t2107-update-index-basic.sh @@ -9,6 +9,7 @@ Tests for command-line parsing and basic operation. test_expect_success 'update-index --nonsense fails' ' test_must_fail git update-index --nonsense 2>msg && + cat msg && test -s msg ' diff --git a/third_party/git/t/t2400-worktree-add.sh b/third_party/git/t/t2400-worktree-add.sh index 5a7495474aa8..e819ba741ec9 100755 --- a/third_party/git/t/t2400-worktree-add.sh +++ b/third_party/git/t/t2400-worktree-add.sh @@ -438,7 +438,7 @@ test_expect_success 'git worktree add does not match remote' ' cd foo && test_must_fail git config "branch.foo.remote" && test_must_fail git config "branch.foo.merge" && - test_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo + ! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo ) ' @@ -483,7 +483,7 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' ' cd foo && test_must_fail git config "branch.foo.remote" && test_must_fail git config "branch.foo.merge" && - test_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo + ! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo ) ' @@ -570,15 +570,6 @@ test_expect_success '"add" an existing locked but missing worktree' ' git worktree add --force --force --detach gnoo ' -test_expect_success '"add" not tripped up by magic worktree matching"' ' - # if worktree "sub1/bar" exists, "git worktree add bar" in distinct - # directory `sub2` should not mistakenly complain that `bar` is an - # already-registered worktree - mkdir sub1 sub2 && - git -C sub1 --git-dir=../.git worktree add --detach bozo && - git -C sub2 --git-dir=../.git worktree add --detach bozo -' - test_expect_success FUNNYNAMES 'sanitize generated worktree name' ' git worktree add --detach ". weird*..?.lock.lock" && test -d .git/worktrees/---weird-.- @@ -596,28 +587,4 @@ test_expect_success '"add" should not fail because of another bad worktree' ' ) ' -test_expect_success '"add" with uninitialized submodule, with submodule.recurse unset' ' - test_create_repo submodule && - test_commit -C submodule first && - test_create_repo project && - git -C project submodule add ../submodule && - git -C project add submodule && - test_tick && - git -C project commit -m add_sub && - git clone project project-clone && - git -C project-clone worktree add ../project-2 -' -test_expect_success '"add" with uninitialized submodule, with submodule.recurse set' ' - git -C project-clone -c submodule.recurse worktree add ../project-3 -' - -test_expect_success '"add" with initialized submodule, with submodule.recurse unset' ' - git -C project-clone submodule update --init && - git -C project-clone worktree add ../project-4 -' - -test_expect_success '"add" with initialized submodule, with submodule.recurse set' ' - git -C project-clone -c submodule.recurse worktree add ../project-5 -' - test_done diff --git a/third_party/git/t/t2402-worktree-list.sh b/third_party/git/t/t2402-worktree-list.sh index 69ffe865b439..bb6fb9b12cb7 100755 --- a/third_party/git/t/t2402-worktree-list.sh +++ b/third_party/git/t/t2402-worktree-list.sh @@ -151,10 +151,4 @@ test_expect_success 'linked worktrees are sorted' ' test_cmp expected sorted/main/actual ' -test_expect_success 'worktree path when called in .git directory' ' - git worktree list >list1&& - git -C .git worktree list >list2 && - test_cmp list1 list2 -' - test_done diff --git a/third_party/git/t/t2405-worktree-submodule.sh b/third_party/git/t/t2405-worktree-submodule.sh deleted file mode 100755 index e1b2bfd87e0d..000000000000 --- a/third_party/git/t/t2405-worktree-submodule.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh - -test_description='Combination of submodules and multiple worktrees' - -. ./test-lib.sh - -base_path=$(pwd -P) - -test_expect_success 'setup: create origin repos' ' - git init origin/sub && - test_commit -C origin/sub file1 && - git init origin/main && - test_commit -C origin/main first && - git -C origin/main submodule add ../sub && - git -C origin/main commit -m "add sub" && - test_commit -C origin/sub "file1 updated" file1 file1updated file1updated && - git -C origin/main/sub pull && - git -C origin/main add sub && - git -C origin/main commit -m "sub updated" -' - -test_expect_success 'setup: clone superproject to create main worktree' ' - git clone --recursive "$base_path/origin/main" main -' - -rev1_hash_main=$(git --git-dir=origin/main/.git show --pretty=format:%h -q "HEAD~1") -rev1_hash_sub=$(git --git-dir=origin/sub/.git show --pretty=format:%h -q "HEAD~1") - -test_expect_success 'add superproject worktree' ' - git -C main worktree add "$base_path/worktree" "$rev1_hash_main" -' - -test_expect_failure 'submodule is checked out just after worktree add' ' - git -C worktree diff --submodule master"^!" >out && - grep "file1 updated" out -' - -test_expect_success 'add superproject worktree and initialize submodules' ' - git -C main worktree add "$base_path/worktree-submodule-update" "$rev1_hash_main" && - git -C worktree-submodule-update submodule update -' - -test_expect_success 'submodule is checked out just after submodule update in linked worktree' ' - git -C worktree-submodule-update diff --submodule master"^!" >out && - grep "file1 updated" out -' - -test_expect_success 'add superproject worktree and manually add submodule worktree' ' - git -C main worktree add "$base_path/linked_submodule" "$rev1_hash_main" && - git -C main/sub worktree add "$base_path/linked_submodule/sub" "$rev1_hash_sub" -' - -test_expect_success 'submodule is checked out after manually adding submodule worktree' ' - git -C linked_submodule diff --submodule master"^!" >out && - grep "file1 updated" out -' - -test_expect_success 'checkout --recurse-submodules uses $GIT_DIR for submodules in a linked worktree' ' - git -C main worktree add "$base_path/checkout-recurse" --detach && - git -C checkout-recurse submodule update --init && - echo "gitdir: ../../main/.git/worktrees/checkout-recurse/modules/sub" >expect-gitfile && - cat checkout-recurse/sub/.git >actual-gitfile && - test_cmp expect-gitfile actual-gitfile && - git -C main/sub rev-parse HEAD >expect-head-main && - git -C checkout-recurse checkout --recurse-submodules HEAD~1 && - cat checkout-recurse/sub/.git >actual-gitfile && - git -C main/sub rev-parse HEAD >actual-head-main && - test_cmp expect-gitfile actual-gitfile && - test_cmp expect-head-main actual-head-main -' - -test_expect_success 'core.worktree is removed in $GIT_DIR/modules//config, not in $GIT_COMMON_DIR/modules//config' ' - echo "../../../sub" >expect-main && - git -C main/sub config --get core.worktree >actual-main && - test_cmp expect-main actual-main && - echo "../../../../../../checkout-recurse/sub" >expect-linked && - git -C checkout-recurse/sub config --get core.worktree >actual-linked && - test_cmp expect-linked actual-linked && - git -C checkout-recurse checkout --recurse-submodules first && - test_expect_code 1 git -C main/.git/worktrees/checkout-recurse/modules/sub config --get core.worktree >linked-config && - test_must_be_empty linked-config && - git -C main/sub config --get core.worktree >actual-main && - test_cmp expect-main actual-main -' - -test_expect_success 'unsetting core.worktree does not prevent running commands directly against the submodule repository' ' - git -C main/.git/worktrees/checkout-recurse/modules/sub log -' - -test_done diff --git a/third_party/git/t/t3005-ls-files-relative.sh b/third_party/git/t/t3005-ls-files-relative.sh index 2ec69a8a266f..209b4c7cd8c6 100755 --- a/third_party/git/t/t3005-ls-files-relative.sh +++ b/third_party/git/t/t3005-ls-files-relative.sh @@ -7,6 +7,10 @@ This test runs git ls-files with various relative path arguments. . ./test-lib.sh +new_line=' +' +sq=\' + test_expect_success 'prepare' ' : >never-mind-me && git add never-mind-me && @@ -40,9 +44,9 @@ test_expect_success 'ls-files -c' ' cd top/sub && for f in ../y* do - echo "error: pathspec $SQ$f$SQ did not match any file(s) known to git" + echo "error: pathspec $sq$f$sq did not match any file(s) known to git" done >expect.err && - echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err && + echo "Did you forget to ${sq}git add${sq}?" >>expect.err && ls ../x* >expect.out && test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err && test_cmp expect.out actual.out && @@ -55,9 +59,9 @@ test_expect_success 'ls-files -o' ' cd top/sub && for f in ../x* do - echo "error: pathspec $SQ$f$SQ did not match any file(s) known to git" + echo "error: pathspec $sq$f$sq did not match any file(s) known to git" done >expect.err && - echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err && + echo "Did you forget to ${sq}git add${sq}?" >>expect.err && ls ../y* >expect.out && test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err && test_cmp expect.out actual.out && diff --git a/third_party/git/t/t3007-ls-files-recurse-submodules.sh b/third_party/git/t/t3007-ls-files-recurse-submodules.sh index 4a0800071379..318b5bce7ebe 100755 --- a/third_party/git/t/t3007-ls-files-recurse-submodules.sh +++ b/third_party/git/t/t3007-ls-files-recurse-submodules.sh @@ -130,6 +130,7 @@ test_expect_success '--recurse-submodules and pathspecs setup' ' git ls-files --recurse-submodules >actual && test_cmp expect actual && + cat actual && git ls-files --recurse-submodules "*" >actual && test_cmp expect actual ' diff --git a/third_party/git/t/t3008-ls-files-lazy-init-name-hash.sh b/third_party/git/t/t3008-ls-files-lazy-init-name-hash.sh index 85f370495876..64f047332b51 100755 --- a/third_party/git/t/t3008-ls-files-lazy-init-name-hash.sh +++ b/third_party/git/t/t3008-ls-files-lazy-init-name-hash.sh @@ -4,7 +4,7 @@ test_description='Test the lazy init name hash with various folder structures' . ./test-lib.sh -if test 1 -eq $(test-tool online-cpus) +if test 1 -eq $($GIT_BUILD_DIR/t/helper/test-tool online-cpus) then skip_all='skipping lazy-init tests, single cpu' test_done diff --git a/third_party/git/t/t3011-common-prefixes-and-directory-traversal.sh b/third_party/git/t/t3011-common-prefixes-and-directory-traversal.sh deleted file mode 100755 index 3da5b2b6e795..000000000000 --- a/third_party/git/t/t3011-common-prefixes-and-directory-traversal.sh +++ /dev/null @@ -1,209 +0,0 @@ -#!/bin/sh - -test_description='directory traversal handling, especially with common prefixes' - -. ./test-lib.sh - -test_expect_success 'setup' ' - test_commit hello && - - >empty && - mkdir untracked_dir && - >untracked_dir/empty && - git init untracked_repo && - >untracked_repo/empty && - - cat <<-EOF >.gitignore && - ignored - an_ignored_dir/ - EOF - mkdir an_ignored_dir && - mkdir an_untracked_dir && - >an_ignored_dir/ignored && - >an_ignored_dir/untracked && - >an_untracked_dir/ignored && - >an_untracked_dir/untracked -' - -test_expect_success 'git ls-files -o shows the right entries' ' - cat <<-EOF >expect && - .gitignore - actual - an_ignored_dir/ignored - an_ignored_dir/untracked - an_untracked_dir/ignored - an_untracked_dir/untracked - empty - expect - untracked_dir/empty - untracked_repo/ - EOF - git ls-files -o >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o --exclude-standard shows the right entries' ' - cat <<-EOF >expect && - .gitignore - actual - an_untracked_dir/untracked - empty - expect - untracked_dir/empty - untracked_repo/ - EOF - git ls-files -o --exclude-standard >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o untracked_dir recurses' ' - echo untracked_dir/empty >expect && - git ls-files -o untracked_dir >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o untracked_dir/ recurses' ' - echo untracked_dir/empty >expect && - git ls-files -o untracked_dir/ >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o --directory untracked_dir does not recurse' ' - echo untracked_dir/ >expect && - git ls-files -o --directory untracked_dir >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o --directory untracked_dir/ does not recurse' ' - echo untracked_dir/ >expect && - git ls-files -o --directory untracked_dir/ >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o untracked_repo does not recurse' ' - echo untracked_repo/ >expect && - git ls-files -o untracked_repo >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o untracked_repo/ does not recurse' ' - echo untracked_repo/ >expect && - git ls-files -o untracked_repo/ >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o untracked_dir untracked_repo recurses into untracked_dir only' ' - cat <<-EOF >expect && - untracked_dir/empty - untracked_repo/ - EOF - git ls-files -o untracked_dir untracked_repo >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o untracked_dir/ untracked_repo/ recurses into untracked_dir only' ' - cat <<-EOF >expect && - untracked_dir/empty - untracked_repo/ - EOF - git ls-files -o untracked_dir/ untracked_repo/ >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o --directory untracked_dir untracked_repo does not recurse' ' - cat <<-EOF >expect && - untracked_dir/ - untracked_repo/ - EOF - git ls-files -o --directory untracked_dir untracked_repo >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o --directory untracked_dir/ untracked_repo/ does not recurse' ' - cat <<-EOF >expect && - untracked_dir/ - untracked_repo/ - EOF - git ls-files -o --directory untracked_dir/ untracked_repo/ >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o .git shows nothing' ' - git ls-files -o .git >actual && - test_must_be_empty actual -' - -test_expect_success 'git ls-files -o .git/ shows nothing' ' - git ls-files -o .git/ >actual && - test_must_be_empty actual -' - -test_expect_success FUNNYNAMES 'git ls-files -o untracked_* recurses appropriately' ' - mkdir "untracked_*" && - >"untracked_*/empty" && - - cat <<-EOF >expect && - untracked_*/empty - untracked_dir/empty - untracked_repo/ - EOF - git ls-files -o "untracked_*" >actual && - test_cmp expect actual -' - -# It turns out fill_directory returns the right paths, but ls-files' post-call -# filtering in show_dir_entry() via calling dir_path_match() which ends up -# in git_fnmatch() has logic for PATHSPEC_ONESTAR that assumes the pathspec -# must match the full path; it doesn't check it for matching a leading -# directory. -test_expect_failure FUNNYNAMES 'git ls-files -o untracked_*/ recurses appropriately' ' - cat <<-EOF >expect && - untracked_*/empty - untracked_dir/empty - untracked_repo/ - EOF - git ls-files -o "untracked_*/" >actual && - test_cmp expect actual -' - -test_expect_success FUNNYNAMES 'git ls-files -o --directory untracked_* does not recurse' ' - cat <<-EOF >expect && - untracked_*/ - untracked_dir/ - untracked_repo/ - EOF - git ls-files -o --directory "untracked_*" >actual && - test_cmp expect actual -' - -test_expect_success FUNNYNAMES 'git ls-files -o --directory untracked_*/ does not recurse' ' - cat <<-EOF >expect && - untracked_*/ - untracked_dir/ - untracked_repo/ - EOF - git ls-files -o --directory "untracked_*/" >actual && - test_cmp expect actual -' - -test_expect_success 'git ls-files -o consistent between one or two dirs' ' - git ls-files -o --exclude-standard an_ignored_dir/ an_untracked_dir/ >tmp && - ! grep ^an_ignored_dir/ tmp >expect && - git ls-files -o --exclude-standard an_ignored_dir/ >actual && - test_cmp expect actual -' - -# ls-files doesn't have a way to request showing both untracked and ignored -# files at the same time, so use `git status --ignored` -test_expect_success 'git status --ignored shows same files under dir with or without pathspec' ' - cat <<-EOF >expect && - ?? an_untracked_dir/ - !! an_untracked_dir/ignored - EOF - git status --porcelain --ignored >output && - grep an_untracked_dir output >expect && - git status --porcelain --ignored an_untracked_dir/ >actual && - test_cmp expect actual -' - -test_done diff --git a/third_party/git/t/t3030-merge-recursive.sh b/third_party/git/t/t3030-merge-recursive.sh index d48d211a9540..ff641b348a1b 100755 --- a/third_party/git/t/t3030-merge-recursive.sh +++ b/third_party/git/t/t3030-merge-recursive.sh @@ -452,34 +452,6 @@ test_expect_success 'merge-recursive d/f conflict result' ' ' -test_expect_success SYMLINKS 'dir in working tree with symlink ancestor does not produce d/f conflict' ' - git init sym && - ( - cd sym && - ln -s . foo && - mkdir bar && - >bar/file && - git add foo bar/file && - git commit -m "foo symlink" && - - git checkout -b branch1 && - git commit --allow-empty -m "empty commit" && - - git checkout master && - git rm foo && - mkdir foo && - >foo/bar && - git add foo/bar && - git commit -m "replace foo symlink with real foo dir and foo/bar file" && - - git checkout branch1 && - - git cherry-pick master && - test_path_is_dir foo && - test_path_is_file foo/bar - ) -' - test_expect_success 'reset and 3-way merge' ' git reset --hard "$c2" && @@ -604,7 +576,7 @@ test_expect_success 'merge removes empty directories' ' git commit -mremoved-d/e && git checkout master && git merge -s recursive rm && - test_path_is_missing d + test_must_fail test -d d ' test_expect_success 'merge-recursive simple w/submodule' ' @@ -695,22 +667,15 @@ test_expect_success 'merging with triple rename across D/F conflict' ' test_expect_success 'merge-recursive remembers the names of all base trees' ' git reset --hard HEAD && - # make the index match $c1 so that merge-recursive below does not - # fail early - git diff --binary HEAD $c1 -- | git apply --cached && - # more trees than static slots used by oid_to_hex() for commit in $c0 $c2 $c4 $c5 $c6 $c7 do git rev-parse "$commit^{tree}" done >trees && - # ignore the return code; it only fails because the input is weird... + # ignore the return code -- it only fails because the input is weird test_must_fail git -c merge.verbosity=5 merge-recursive $(cat trees) -- $c1 $c3 >out && - # ...but make sure it fails in the expected way - test_i18ngrep CONFLICT.*rename/rename out && - # merge-recursive prints in reverse order, but we do not care sort expect && sed -n "s/^virtual //p" out | sort >actual && diff --git a/third_party/git/t/t3035-merge-sparse.sh b/third_party/git/t/t3035-merge-sparse.sh index 74562e123566..c4b4a94324a2 100755 --- a/third_party/git/t/t3035-merge-sparse.sh +++ b/third_party/git/t/t3035-merge-sparse.sh @@ -28,7 +28,7 @@ test_expect_success 'setup' ' git config core.sparseCheckout true && echo "/checked-out" >.git/info/sparse-checkout && git reset --hard && - test_must_fail git merge theirs + ! git merge theirs ' test_expect_success 'reset --hard works after the conflict' ' @@ -42,7 +42,7 @@ test_expect_success 'is reset properly' ' ' test_expect_success 'setup: conflict back' ' - test_must_fail git merge theirs + ! git merge theirs ' test_expect_success 'Merge abort works after the conflict' ' diff --git a/third_party/git/t/t3060-ls-files-with-tree.sh b/third_party/git/t/t3060-ls-files-with-tree.sh index 52ed665fcd2d..44f378ce41d2 100755 --- a/third_party/git/t/t3060-ls-files-with-tree.sh +++ b/third_party/git/t/t3060-ls-files-with-tree.sh @@ -47,7 +47,7 @@ test_expect_success setup ' git add . ' -test_expect_success 'git ls-files --with-tree should succeed from subdir' ' +test_expect_success 'git -ls-files --with-tree should succeed from subdir' ' # We have to run from a sub-directory to trigger prune_path # Then we finally get to run our --with-tree test ( @@ -57,7 +57,7 @@ test_expect_success 'git ls-files --with-tree should succeed from subdir' ' ' test_expect_success \ - 'git ls-files --with-tree should add entries from named tree.' \ + 'git -ls-files --with-tree should add entries from named tree.' \ 'test_cmp expected output' test_done diff --git a/third_party/git/t/t3201-branch-contains.sh b/third_party/git/t/t3201-branch-contains.sh index 40251c9f8f68..0ea4fc46949d 100755 --- a/third_party/git/t/t3201-branch-contains.sh +++ b/third_party/git/t/t3201-branch-contains.sh @@ -192,10 +192,10 @@ test_expect_success 'branch --merged with --verbose' ' EOF test_cmp expect actual && git branch --verbose --merged topic >actual && - cat >expect <<-EOF && - master $(git rev-parse --short master) second on master - * topic $(git rev-parse --short topic ) [ahead 1] foo - zzz $(git rev-parse --short zzz ) second on master + cat >expect <<-\EOF && + master c77a0a9 second on master + * topic 2c939f4 [ahead 1] foo + zzz c77a0a9 second on master EOF test_i18ncmp expect actual ' diff --git a/third_party/git/t/t3206-range-diff.sh b/third_party/git/t/t3206-range-diff.sh index bd808f87ed5b..ec548654ce1c 100755 --- a/third_party/git/t/t3206-range-diff.sh +++ b/third_party/git/t/t3206-range-diff.sh @@ -8,212 +8,97 @@ test_description='range-diff tests' # harm than good. We need some real history. test_expect_success 'setup' ' - git fast-import <"$TEST_DIRECTORY"/t3206/history.export && - test_oid_cache <<-\EOF - # topic - t1 sha1:4de457d - t2 sha1:fccce22 - t3 sha1:147e64e - t4 sha1:a63e992 - t1 sha256:b89f8b9 - t2 sha256:5f12aad - t3 sha256:ea8b273 - t4 sha256:14b7336 - - # unmodified - u1 sha1:35b9b25 - u2 sha1:de345ab - u3 sha1:9af6654 - u4 sha1:2901f77 - u1 sha256:e3731be - u2 sha256:14fadf8 - u3 sha256:736c4bc - u4 sha256:673e77d - - # reordered - r1 sha1:aca177a - r2 sha1:14ad629 - r3 sha1:ee58208 - r4 sha1:307b27a - r1 sha256:f59d3aa - r2 sha256:fb261a8 - r3 sha256:cb2649b - r4 sha256:958577e - - # removed (deleted) - d1 sha1:7657159 - d2 sha1:43d84d3 - d3 sha1:a740396 - d1 sha256:e312513 - d2 sha256:eb19258 - d3 sha256:1ccb3c1 - - # added - a1 sha1:2716022 - a2 sha1:b62accd - a3 sha1:df46cfa - a4 sha1:3e64548 - a5 sha1:12b4063 - a1 sha256:d724f4d - a2 sha256:1de7762 - a3 sha256:e159431 - a4 sha256:b3e483c - a5 sha256:90866a7 - - # rebased - b1 sha1:cc9c443 - b2 sha1:c5d9641 - b3 sha1:28cc2b6 - b4 sha1:5628ab7 - b5 sha1:a31b12e - b1 sha256:a1a8717 - b2 sha256:20a5862 - b3 sha256:587172a - b4 sha256:2721c5d - b5 sha256:7b57864 - - # changed - c1 sha1:a4b3333 - c2 sha1:f51d370 - c3 sha1:0559556 - c4 sha1:d966c5c - c1 sha256:f8c2b9d - c2 sha256:3fb6318 - c3 sha256:168ab68 - c4 sha256:3526539 - - # changed-message - m1 sha1:f686024 - m2 sha1:4ab067d - m3 sha1:b9cb956 - m4 sha1:8add5f1 - m1 sha256:31e6281 - m2 sha256:a06bf1b - m3 sha256:82dc654 - m4 sha256:48470c5 - - # renamed - n1 sha1:f258d75 - n2 sha1:017b62d - n3 sha1:3ce7af6 - n4 sha1:1e6226b - n1 sha256:ad52114 - n2 sha256:3b54c8f - n3 sha256:3b0a644 - n4 sha256:e461653 - - # mode change - o1 sha1:4d39cb3 - o2 sha1:26c107f - o3 sha1:4c1e0f5 - o1 sha256:d0dd598 - o2 sha256:c4a279e - o3 sha256:78459d7 - - # added and removed - s1 sha1:096b1ba - s2 sha1:d92e698 - s3 sha1:9a1db4d - s4 sha1:fea3b5c - s1 sha256:a7f9134 - s2 sha256:b4c2580 - s3 sha256:1d62aa2 - s4 sha256:48160e8 - - # Empty delimiter (included so lines match neatly) - __ sha1:------- - __ sha256:------- - EOF + git fast-import < "$TEST_DIRECTORY"/t3206/history.export ' test_expect_success 'simple A..B A..C (unmodified)' ' git range-diff --no-color master..topic master..unmodified \ >actual && - cat >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ - 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ - 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ - 4: $(test_oid t4) = 4: $(test_oid u4) s/12/B/ + cat >expected <<-EOF && + 1: 4de457d = 1: 35b9b25 s/5/A/ + 2: fccce22 = 2: de345ab s/4/A/ + 3: 147e64e = 3: 9af6654 s/11/B/ + 4: a63e992 = 4: 2901f77 s/12/B/ EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'simple B...C (unmodified)' ' git range-diff --no-color topic...unmodified >actual && - # same "expect" as above - test_cmp expect actual + # same "expected" as above + test_cmp expected actual ' test_expect_success 'simple A B C (unmodified)' ' git range-diff --no-color master topic unmodified >actual && - # same "expect" as above - test_cmp expect actual + # same "expected" as above + test_cmp expected actual ' test_expect_success 'trivial reordering' ' git range-diff --no-color master topic reordered >actual && - cat >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid r1) s/5/A/ - 3: $(test_oid t3) = 2: $(test_oid r2) s/11/B/ - 4: $(test_oid t4) = 3: $(test_oid r3) s/12/B/ - 2: $(test_oid t2) = 4: $(test_oid r4) s/4/A/ + cat >expected <<-EOF && + 1: 4de457d = 1: aca177a s/5/A/ + 3: 147e64e = 2: 14ad629 s/11/B/ + 4: a63e992 = 3: ee58208 s/12/B/ + 2: fccce22 = 4: 307b27a s/4/A/ EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'removed a commit' ' git range-diff --no-color master topic removed >actual && - cat >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid d1) s/5/A/ - 2: $(test_oid t2) < -: $(test_oid __) s/4/A/ - 3: $(test_oid t3) = 2: $(test_oid d2) s/11/B/ - 4: $(test_oid t4) = 3: $(test_oid d3) s/12/B/ + cat >expected <<-EOF && + 1: 4de457d = 1: 7657159 s/5/A/ + 2: fccce22 < -: ------- s/4/A/ + 3: 147e64e = 2: 43d84d3 s/11/B/ + 4: a63e992 = 3: a740396 s/12/B/ EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'added a commit' ' git range-diff --no-color master topic added >actual && - cat >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid a1) s/5/A/ - 2: $(test_oid t2) = 2: $(test_oid a2) s/4/A/ - -: $(test_oid __) > 3: $(test_oid a3) s/6/A/ - 3: $(test_oid t3) = 4: $(test_oid a4) s/11/B/ - 4: $(test_oid t4) = 5: $(test_oid a5) s/12/B/ + cat >expected <<-EOF && + 1: 4de457d = 1: 2716022 s/5/A/ + 2: fccce22 = 2: b62accd s/4/A/ + -: ------- > 3: df46cfa s/6/A/ + 3: 147e64e = 4: 3e64548 s/11/B/ + 4: a63e992 = 5: 12b4063 s/12/B/ EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'new base, A B C' ' git range-diff --no-color master topic rebased >actual && - cat >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid b1) s/5/A/ - 2: $(test_oid t2) = 2: $(test_oid b2) s/4/A/ - 3: $(test_oid t3) = 3: $(test_oid b3) s/11/B/ - 4: $(test_oid t4) = 4: $(test_oid b4) s/12/B/ + cat >expected <<-EOF && + 1: 4de457d = 1: cc9c443 s/5/A/ + 2: fccce22 = 2: c5d9641 s/4/A/ + 3: 147e64e = 3: 28cc2b6 s/11/B/ + 4: a63e992 = 4: 5628ab7 s/12/B/ EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'new base, B...C' ' # this syntax includes the commits from master! git range-diff --no-color topic...rebased >actual && - cat >expect <<-EOF && - -: $(test_oid __) > 1: $(test_oid b5) unrelated - 1: $(test_oid t1) = 2: $(test_oid b1) s/5/A/ - 2: $(test_oid t2) = 3: $(test_oid b2) s/4/A/ - 3: $(test_oid t3) = 4: $(test_oid b3) s/11/B/ - 4: $(test_oid t4) = 5: $(test_oid b4) s/12/B/ + cat >expected <<-EOF && + -: ------- > 1: a31b12e unrelated + 1: 4de457d = 2: cc9c443 s/5/A/ + 2: fccce22 = 3: c5d9641 s/4/A/ + 3: 147e64e = 4: 28cc2b6 s/11/B/ + 4: a63e992 = 5: 5628ab7 s/12/B/ EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'changed commit' ' git range-diff --no-color topic...changed >actual && - cat >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ - 2: $(test_oid t2) = 2: $(test_oid c2) s/4/A/ - 3: $(test_oid t3) ! 3: $(test_oid c3) s/11/B/ + cat >expected <<-EOF && + 1: 4de457d = 1: a4b3333 s/5/A/ + 2: fccce22 = 2: f51d370 s/4/A/ + 3: 147e64e ! 3: 0559556 s/11/B/ @@ file: A 9 10 @@ -223,7 +108,7 @@ test_expect_success 'changed commit' ' 12 13 14 - 4: $(test_oid t4) ! 4: $(test_oid c4) s/12/B/ + 4: a63e992 ! 4: d966c5c s/12/B/ @@ file @@ file: A 9 @@ -234,45 +119,45 @@ test_expect_success 'changed commit' ' +B 13 EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'changed commit with --no-patch diff option' ' git range-diff --no-color --no-patch topic...changed >actual && - cat >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ - 2: $(test_oid t2) = 2: $(test_oid c2) s/4/A/ - 3: $(test_oid t3) ! 3: $(test_oid c3) s/11/B/ - 4: $(test_oid t4) ! 4: $(test_oid c4) s/12/B/ + cat >expected <<-EOF && + 1: 4de457d = 1: a4b3333 s/5/A/ + 2: fccce22 = 2: f51d370 s/4/A/ + 3: 147e64e ! 3: 0559556 s/11/B/ + 4: a63e992 ! 4: d966c5c s/12/B/ EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'changed commit with --stat diff option' ' git range-diff --no-color --stat topic...changed >actual && - cat >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ + cat >expected <<-EOF && + 1: 4de457d = 1: a4b3333 s/5/A/ a => b | 0 1 file changed, 0 insertions(+), 0 deletions(-) - 2: $(test_oid t2) = 2: $(test_oid c2) s/4/A/ + 2: fccce22 = 2: f51d370 s/4/A/ a => b | 0 1 file changed, 0 insertions(+), 0 deletions(-) - 3: $(test_oid t3) ! 3: $(test_oid c3) s/11/B/ + 3: 147e64e ! 3: 0559556 s/11/B/ a => b | 0 1 file changed, 0 insertions(+), 0 deletions(-) - 4: $(test_oid t4) ! 4: $(test_oid c4) s/12/B/ + 4: a63e992 ! 4: d966c5c s/12/B/ a => b | 0 1 file changed, 0 insertions(+), 0 deletions(-) EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'changed commit with sm config' ' git range-diff --no-color --submodule=log topic...changed >actual && - cat >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ - 2: $(test_oid t2) = 2: $(test_oid c2) s/4/A/ - 3: $(test_oid t3) ! 3: $(test_oid c3) s/11/B/ + cat >expected <<-EOF && + 1: 4de457d = 1: a4b3333 s/5/A/ + 2: fccce22 = 2: f51d370 s/4/A/ + 3: 147e64e ! 3: 0559556 s/11/B/ @@ file: A 9 10 @@ -282,7 +167,7 @@ test_expect_success 'changed commit with sm config' ' 12 13 14 - 4: $(test_oid t4) ! 4: $(test_oid c4) s/12/B/ + 4: a63e992 ! 4: d966c5c s/12/B/ @@ file @@ file: A 9 @@ -293,14 +178,14 @@ test_expect_success 'changed commit with sm config' ' +B 13 EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'renamed file' ' git range-diff --no-color --submodule=log topic...renamed-file >actual && - sed s/Z/\ /g >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid n1) s/5/A/ - 2: $(test_oid t2) ! 2: $(test_oid n2) s/4/A/ + sed s/Z/\ /g >expected <<-EOF && + 1: 4de457d = 1: f258d75 s/5/A/ + 2: fccce22 ! 2: 017b62d s/4/A/ @@ Metadata ZAuthor: Thomas Rast Z @@ -313,7 +198,7 @@ test_expect_success 'renamed file' ' Z@@ Z 1 Z 2 - 3: $(test_oid t3) ! 3: $(test_oid n3) s/11/B/ + 3: 147e64e ! 3: 3ce7af6 s/11/B/ @@ Metadata Z ## Commit message ## Z s/11/B/ @@ -325,7 +210,7 @@ test_expect_success 'renamed file' ' Z 8 Z 9 Z 10 - 4: $(test_oid t4) ! 4: $(test_oid n4) s/12/B/ + 4: a63e992 ! 4: 1e6226b s/12/B/ @@ Metadata Z ## Commit message ## Z s/12/B/ @@ -338,54 +223,14 @@ test_expect_success 'renamed file' ' Z 10 Z B EOF - test_cmp expect actual -' - -test_expect_success 'file with mode only change' ' - git range-diff --no-color --submodule=log topic...mode-only-change >actual && - sed s/Z/\ /g >expect <<-EOF && - 1: $(test_oid t2) ! 1: $(test_oid o1) s/4/A/ - @@ Metadata - ZAuthor: Thomas Rast - Z - Z ## Commit message ## - - s/4/A/ - + s/4/A/ + add other-file - Z - Z ## file ## - Z@@ - @@ file - Z A - Z 6 - Z 7 - + - + ## other-file (new) ## - 2: $(test_oid t3) ! 2: $(test_oid o2) s/11/B/ - @@ Metadata - ZAuthor: Thomas Rast - Z - Z ## Commit message ## - - s/11/B/ - + s/11/B/ + mode change other-file - Z - Z ## file ## - Z@@ file: A - @@ file: A - Z 12 - Z 13 - Z 14 - + - + ## other-file (mode change 100644 => 100755) ## - 3: $(test_oid t4) = 3: $(test_oid o3) s/12/B/ - EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'file added and later removed' ' git range-diff --no-color --submodule=log topic...added-removed >actual && - sed s/Z/\ /g >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid s1) s/5/A/ - 2: $(test_oid t2) ! 2: $(test_oid s2) s/4/A/ + sed s/Z/\ /g >expected <<-EOF && + 1: 4de457d = 1: 096b1ba s/5/A/ + 2: fccce22 ! 2: d92e698 s/4/A/ @@ Metadata ZAuthor: Thomas Rast Z @@ -401,7 +246,7 @@ test_expect_success 'file added and later removed' ' Z 7 + + ## new-file (new) ## - 3: $(test_oid t3) ! 3: $(test_oid s3) s/11/B/ + 3: 147e64e ! 3: 9a1db4d s/11/B/ @@ Metadata ZAuthor: Thomas Rast Z @@ -417,9 +262,9 @@ test_expect_success 'file added and later removed' ' Z 14 + + ## new-file (deleted) ## - 4: $(test_oid t4) = 4: $(test_oid s4) s/12/B/ + 4: a63e992 = 4: fea3b5c s/12/B/ EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'no commits on one side' ' @@ -429,9 +274,9 @@ test_expect_success 'no commits on one side' ' test_expect_success 'changed message' ' git range-diff --no-color topic...changed-message >actual && - sed s/Z/\ /g >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid m1) s/5/A/ - 2: $(test_oid t2) ! 2: $(test_oid m2) s/4/A/ + sed s/Z/\ /g >expected <<-EOF && + 1: 4de457d = 1: f686024 s/5/A/ + 2: fccce22 ! 2: 4ab067d s/4/A/ @@ Metadata Z ## Commit message ## Z s/4/A/ @@ -441,16 +286,16 @@ test_expect_success 'changed message' ' Z ## file ## Z@@ Z 1 - 3: $(test_oid t3) = 3: $(test_oid m3) s/11/B/ - 4: $(test_oid t4) = 4: $(test_oid m4) s/12/B/ + 3: 147e64e = 3: b9cb956 s/11/B/ + 4: a63e992 = 4: 8add5f1 s/12/B/ EOF - test_cmp expect actual + test_cmp expected actual ' test_expect_success 'dual-coloring' ' - sed -e "s|^:||" >expect <<-EOF && - :1: $(test_oid c1) = 1: $(test_oid m1) s/5/A/ - :2: $(test_oid c2) ! 2: $(test_oid m2) s/4/A/ + sed -e "s|^:||" >expect <<-\EOF && + :1: a4b3333 = 1: f686024 s/5/A/ + :2: f51d370 ! 2: 4ab067d s/4/A/ : @@ Metadata : ## Commit message ## : s/4/A/ @@ -460,7 +305,7 @@ test_expect_success 'dual-coloring' ' : ## file ## : @@ : 1 - :3: $(test_oid c3) ! 3: $(test_oid m3) s/11/B/ + :3: 0559556 ! 3: b9cb956 s/11/B/ : @@ file: A : 9 : 10 @@ -470,7 +315,7 @@ test_expect_success 'dual-coloring' ' : 12 : 13 : 14 - :4: $(test_oid c4) ! 4: $(test_oid m4) s/12/B/ + :4: d966c5c ! 4: 8add5f1 s/12/B/ : @@ file : @@ file: A : 9 @@ -509,206 +354,4 @@ test_expect_success 'format-patch --range-diff as commentary' ' grep "> 1: .* new message" 0001-* ' -test_expect_success 'range-diff overrides diff.noprefix internally' ' - git -c diff.noprefix=true range-diff HEAD^... -' - -test_expect_success 'range-diff compares notes by default' ' - git notes add -m "topic note" topic && - git notes add -m "unmodified note" unmodified && - test_when_finished git notes remove topic unmodified && - git range-diff --no-color master..topic master..unmodified \ - >actual && - sed s/Z/\ /g >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ - 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ - 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ - 4: $(test_oid t4) ! 4: $(test_oid u4) s/12/B/ - @@ Commit message - Z - Z - Z ## Notes ## - - topic note - + unmodified note - Z - Z ## file ## - Z@@ file: A - EOF - test_cmp expect actual -' - -test_expect_success 'range-diff with --no-notes' ' - git notes add -m "topic note" topic && - git notes add -m "unmodified note" unmodified && - test_when_finished git notes remove topic unmodified && - git range-diff --no-color --no-notes master..topic master..unmodified \ - >actual && - cat >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ - 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ - 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ - 4: $(test_oid t4) = 4: $(test_oid u4) s/12/B/ - EOF - test_cmp expect actual -' - -test_expect_success 'range-diff with multiple --notes' ' - git notes --ref=note1 add -m "topic note1" topic && - git notes --ref=note1 add -m "unmodified note1" unmodified && - test_when_finished git notes --ref=note1 remove topic unmodified && - git notes --ref=note2 add -m "topic note2" topic && - git notes --ref=note2 add -m "unmodified note2" unmodified && - test_when_finished git notes --ref=note2 remove topic unmodified && - git range-diff --no-color --notes=note1 --notes=note2 master..topic master..unmodified \ - >actual && - sed s/Z/\ /g >expect <<-EOF && - 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ - 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ - 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ - 4: $(test_oid t4) ! 4: $(test_oid u4) s/12/B/ - @@ Commit message - Z - Z - Z ## Notes (note1) ## - - topic note1 - + unmodified note1 - Z - Z - Z ## Notes (note2) ## - - topic note2 - + unmodified note2 - Z - Z ## file ## - Z@@ file: A - EOF - test_cmp expect actual -' - -test_expect_success 'format-patch --range-diff does not compare notes by default' ' - git notes add -m "topic note" topic && - git notes add -m "unmodified note" unmodified && - test_when_finished git notes remove topic unmodified && - git format-patch --cover-letter --range-diff=$prev \ - master..unmodified >actual && - test_when_finished "rm 000?-*" && - test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && - grep "= 1: .* s/5/A" 0000-* && - grep "= 2: .* s/4/A" 0000-* && - grep "= 3: .* s/11/B" 0000-* && - grep "= 4: .* s/12/B" 0000-* && - ! grep "Notes" 0000-* && - ! grep "note" 0000-* -' - -test_expect_success 'format-patch --range-diff with --no-notes' ' - git notes add -m "topic note" topic && - git notes add -m "unmodified note" unmodified && - test_when_finished git notes remove topic unmodified && - git format-patch --no-notes --cover-letter --range-diff=$prev \ - master..unmodified >actual && - test_when_finished "rm 000?-*" && - test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && - grep "= 1: .* s/5/A" 0000-* && - grep "= 2: .* s/4/A" 0000-* && - grep "= 3: .* s/11/B" 0000-* && - grep "= 4: .* s/12/B" 0000-* && - ! grep "Notes" 0000-* && - ! grep "note" 0000-* -' - -test_expect_success 'format-patch --range-diff with --notes' ' - git notes add -m "topic note" topic && - git notes add -m "unmodified note" unmodified && - test_when_finished git notes remove topic unmodified && - git format-patch --notes --cover-letter --range-diff=$prev \ - master..unmodified >actual && - test_when_finished "rm 000?-*" && - test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && - grep "= 1: .* s/5/A" 0000-* && - grep "= 2: .* s/4/A" 0000-* && - grep "= 3: .* s/11/B" 0000-* && - grep "! 4: .* s/12/B" 0000-* && - sed s/Z/\ /g >expect <<-EOF && - @@ Commit message - Z - Z - Z ## Notes ## - - topic note - + unmodified note - Z - Z ## file ## - Z@@ file: A - EOF - sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual && - test_cmp expect actual -' - -test_expect_success 'format-patch --range-diff with format.notes config' ' - git notes add -m "topic note" topic && - git notes add -m "unmodified note" unmodified && - test_when_finished git notes remove topic unmodified && - test_config format.notes true && - git format-patch --cover-letter --range-diff=$prev \ - master..unmodified >actual && - test_when_finished "rm 000?-*" && - test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && - grep "= 1: .* s/5/A" 0000-* && - grep "= 2: .* s/4/A" 0000-* && - grep "= 3: .* s/11/B" 0000-* && - grep "! 4: .* s/12/B" 0000-* && - sed s/Z/\ /g >expect <<-EOF && - @@ Commit message - Z - Z - Z ## Notes ## - - topic note - + unmodified note - Z - Z ## file ## - Z@@ file: A - EOF - sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual && - test_cmp expect actual -' - -test_expect_success 'format-patch --range-diff with multiple notes' ' - git notes --ref=note1 add -m "topic note1" topic && - git notes --ref=note1 add -m "unmodified note1" unmodified && - test_when_finished git notes --ref=note1 remove topic unmodified && - git notes --ref=note2 add -m "topic note2" topic && - git notes --ref=note2 add -m "unmodified note2" unmodified && - test_when_finished git notes --ref=note2 remove topic unmodified && - git format-patch --notes=note1 --notes=note2 --cover-letter --range-diff=$prev \ - master..unmodified >actual && - test_when_finished "rm 000?-*" && - test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && - grep "= 1: .* s/5/A" 0000-* && - grep "= 2: .* s/4/A" 0000-* && - grep "= 3: .* s/11/B" 0000-* && - grep "! 4: .* s/12/B" 0000-* && - sed s/Z/\ /g >expect <<-EOF && - @@ Commit message - Z - Z - Z ## Notes (note1) ## - - topic note1 - + unmodified note1 - Z - Z - Z ## Notes (note2) ## - - topic note2 - + unmodified note2 - Z - Z ## file ## - Z@@ file: A - EOF - sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual && - test_cmp expect actual -' - test_done diff --git a/third_party/git/t/t3206/history.export b/third_party/git/t/t3206/history.export index 4c808e5b3b8d..7bb381496227 100644 --- a/third_party/git/t/t3206/history.export +++ b/third_party/git/t/t3206/history.export @@ -55,7 +55,7 @@ A 19 20 -commit refs/heads/mode-only-change +commit refs/heads/topic mark :4 author Thomas Rast 1374485014 +0200 committer Thomas Rast 1374485014 +0200 @@ -678,32 +678,3 @@ s/12/B/ from :55 M 100644 :9 renamed-file -commit refs/heads/mode-only-change -mark :57 -author Thomas Rast 1374485024 +0200 -committer Thomas Gummerer 1570473767 +0100 -data 24 -s/4/A/ + add other-file -from :4 -M 100644 :5 file -M 100644 :49 other-file - -commit refs/heads/mode-only-change -mark :58 -author Thomas Rast 1374485036 +0200 -committer Thomas Gummerer 1570473768 +0100 -data 33 -s/11/B/ + mode change other-file -from :57 -M 100644 :7 file -M 100755 :49 other-file - -commit refs/heads/mode-only-change -mark :59 -author Thomas Rast 1374485044 +0200 -committer Thomas Gummerer 1570473768 +0100 -data 8 -s/12/B/ -from :58 -M 100644 :9 file - diff --git a/third_party/git/t/t3210-pack-refs.sh b/third_party/git/t/t3210-pack-refs.sh index f41b2afb9964..9ea5fa4fd246 100755 --- a/third_party/git/t/t3210-pack-refs.sh +++ b/third_party/git/t/t3210-pack-refs.sh @@ -240,7 +240,7 @@ test_expect_success 'retry acquiring packed-refs.lock' ' test_expect_success SYMLINKS 'pack symlinked packed-refs' ' # First make sure that symlinking works when reading: - git update-ref refs/heads/lossy refs/heads/master && + git update-ref refs/heads/loosy refs/heads/master && git for-each-ref >all-refs-before && mv .git/packed-refs .git/my-deviant-packed-refs && ln -s my-deviant-packed-refs .git/packed-refs && diff --git a/third_party/git/t/t3301-notes.sh b/third_party/git/t/t3301-notes.sh index 8f4330300707..704bbc65419c 100755 --- a/third_party/git/t/t3301-notes.sh +++ b/third_party/git/t/t3301-notes.sh @@ -54,9 +54,7 @@ test_expect_success 'create notes' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - echo b4 >expect && - git notes show >actual && - test_cmp expect actual && + test "b4" = "$(git notes show)" && git show HEAD^ && test_must_fail git notes show HEAD^ ' @@ -68,9 +66,8 @@ test_expect_success 'show notes entry with %N' ' ' test_expect_success 'create reflog entry' ' - ref=$(git rev-parse --short refs/notes/commits) && cat <<-EOF >expect && - $ref refs/notes/commits@{0}: notes: Notes added by '\''git notes add'\'' + a1d8fa6 refs/notes/commits@{0}: notes: Notes added by '\''git notes add'\'' EOF git reflog show refs/notes/commits >actual && test_cmp expect actual @@ -81,21 +78,14 @@ test_expect_success 'edit existing notes' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - echo b3 >expect && - git notes show >actual && - test_cmp expect actual && + test "b3" = "$(git notes show)" && git show HEAD^ && test_must_fail git notes show HEAD^ ' test_expect_success 'show notes from treeish' ' - echo b3 >expect && - git notes --ref commits^{tree} show >actual && - test_cmp expect actual && - - echo b4 >expect && - git notes --ref commits@{1} show >actual && - test_cmp expect actual + test "b3" = "$(git notes --ref commits^{tree} show)" && + test "b4" = "$(git notes --ref commits@{1} show)" ' test_expect_success 'cannot edit notes from non-ref' ' @@ -108,9 +98,7 @@ test_expect_success 'cannot "git notes add -m" where notes already exists' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - echo b3 >expect && - git notes show >actual && - test_cmp expect actual && + test "b3" = "$(git notes show)" && git show HEAD^ && test_must_fail git notes show HEAD^ ' @@ -120,9 +108,7 @@ test_expect_success 'can overwrite existing note with "git notes add -f -m"' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - echo b1 >expect && - git notes show >actual && - test_cmp expect actual && + test "b1" = "$(git notes show)" && git show HEAD^ && test_must_fail git notes show HEAD^ ' @@ -132,9 +118,7 @@ test_expect_success 'add w/no options on existing note morphs into edit' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - echo b2 >expect && - git notes show >actual && - test_cmp expect actual && + test "b2" = "$(git notes show)" && git show HEAD^ && test_must_fail git notes show HEAD^ ' @@ -144,17 +128,14 @@ test_expect_success 'can overwrite existing note with "git notes add -f"' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - echo b1 >expect && - git notes show >actual && - test_cmp expect actual && + test "b1" = "$(git notes show)" && git show HEAD^ && test_must_fail git notes show HEAD^ ' test_expect_success 'show notes' ' - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit 7a4ca6ee52a974a66cbaa78e33214535dff1d691 Author: A U Thor Date: Thu Apr 7 15:14:13 2005 -0700 @@ -163,8 +144,7 @@ test_expect_success 'show notes' ' Notes: ${indent}b1 EOF - git cat-file commit HEAD >commits && - ! grep b1 commits && + ! (git cat-file commit HEAD | grep b1) && git log -1 >actual && test_cmp expect actual ' @@ -172,9 +152,8 @@ test_expect_success 'show notes' ' test_expect_success 'show multi-line notes' ' test_commit 3rd && MSG="b3${LF}c3c3c3c3${LF}d3d3d3" git notes add && - commit=$(git rev-parse HEAD) && cat >expect-multiline <<-EOF && - commit $commit + commit d07d62e5208f22eb5695e7eb47667dc8b9860290 Author: A U Thor Date: Thu Apr 7 15:15:13 2005 -0700 @@ -195,9 +174,8 @@ test_expect_success 'show -F notes' ' test_commit 4th && echo "xyzzy" >note5 && git notes add -F note5 && - commit=$(git rev-parse HEAD) && cat >expect-F <<-EOF && - commit $commit + commit 0f7aa3ec6325aeb88b910453bb3eb37c49d75c11 Author: A U Thor Date: Thu Apr 7 15:16:13 2005 -0700 @@ -220,13 +198,10 @@ test_expect_success 'Re-adding -F notes without -f fails' ' ' test_expect_success 'git log --pretty=raw does not show notes' ' - commit=$(git rev-parse HEAD) && - tree=$(git rev-parse HEAD^{tree}) && - parent=$(git rev-parse HEAD^) && cat >expect <<-EOF && - commit $commit - tree $tree - parent $parent + commit 0f7aa3ec6325aeb88b910453bb3eb37c49d75c11 + tree 05ac65288c4c4b3b709a020ae94b2ece2f2201ae + parent d07d62e5208f22eb5695e7eb47667dc8b9860290 author A U Thor 1112912173 -0700 committer C O Mitter 1112912173 -0700 @@ -316,9 +291,8 @@ test_expect_success 'git log --no-notes resets ref list' ' test_expect_success 'show -m notes' ' test_commit 5th && git notes add -m spam -m "foo${LF}bar${LF}baz" && - commit=$(git rev-parse HEAD) && cat >expect-m <<-EOF && - commit $commit + commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361 Author: A U Thor Date: Thu Apr 7 15:17:13 2005 -0700 @@ -339,9 +313,8 @@ test_expect_success 'show -m notes' ' test_expect_success 'remove note with add -f -F /dev/null' ' git notes add -f -F /dev/null && - commit=$(git rev-parse HEAD) && cat >expect-rm-F <<-EOF && - commit $commit + commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361 Author: A U Thor Date: Thu Apr 7 15:17:13 2005 -0700 @@ -383,16 +356,14 @@ test_expect_success 'create note with combination of -m and -F' ' test_expect_success 'remove note with "git notes remove"' ' git notes remove HEAD^ && git notes remove && - commit=$(git rev-parse HEAD) && - parent=$(git rev-parse HEAD^) && cat >expect-rm-remove <<-EOF && - commit $commit + commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361 Author: A U Thor Date: Thu Apr 7 15:17:13 2005 -0700 ${indent}5th - commit $parent + commit 0f7aa3ec6325aeb88b910453bb3eb37c49d75c11 Author: A U Thor Date: Thu Apr 7 15:16:13 2005 -0700 @@ -488,13 +459,9 @@ test_expect_success 'removing with --stdin --ignore-missing' ' ' test_expect_success 'list notes with "git notes list"' ' - commit_2=$(git rev-parse 2nd) && - commit_3=$(git rev-parse 3rd) && - note_2=$(git rev-parse refs/notes/commits:$commit_2) && - note_3=$(git rev-parse refs/notes/commits:$commit_3) && - sort -t" " -k2 >expect <<-EOF && - $note_2 $commit_2 - $note_3 $commit_3 + cat >expect <<-EOF && + c9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 7a4ca6ee52a974a66cbaa78e33214535dff1d691 + c18dc024e14f08d18d14eea0d747ff692d66d6a3 d07d62e5208f22eb5695e7eb47667dc8b9860290 EOF git notes list >actual && test_cmp expect actual @@ -506,7 +473,9 @@ test_expect_success 'list notes with "git notes"' ' ' test_expect_success 'list specific note with "git notes list "' ' - git rev-parse refs/notes/commits:$commit_3 >expect && + cat >expect <<-EOF && + c18dc024e14f08d18d14eea0d747ff692d66d6a3 + EOF git notes list HEAD^^ >actual && test_cmp expect actual ' @@ -529,12 +498,10 @@ test_expect_success 'append to existing note with "git notes append"' ' ' test_expect_success '"git notes list" does not expand to "git notes list HEAD"' ' - commit_5=$(git rev-parse 5th) && - note_5=$(git rev-parse refs/notes/commits:$commit_5) && - sort -t" " -k2 >expect_list <<-EOF && - $note_2 $commit_2 - $note_3 $commit_3 - $note_5 $commit_5 + cat >expect_list <<-EOF && + c9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 7a4ca6ee52a974a66cbaa78e33214535dff1d691 + 4b6ad22357cc8a1296720574b8d2fbc22fab0671 7f9ad8836c775acb134c0a055fc55fb4cd1ba361 + c18dc024e14f08d18d14eea0d747ff692d66d6a3 d07d62e5208f22eb5695e7eb47667dc8b9860290 EOF git notes list >actual && test_cmp expect_list actual @@ -564,9 +531,8 @@ test_expect_success 'appending empty string to non-existing note does not create test_expect_success 'create other note on a different notes ref (setup)' ' test_commit 6th && GIT_NOTES_REF="refs/notes/other" git notes add -m "other note" && - commit=$(git rev-parse HEAD) && cat >expect-not-other <<-EOF && - commit $commit + commit 2c125331118caba0ff8238b7f4958ac6e93fe39c Author: A U Thor Date: Thu Apr 7 15:18:13 2005 -0700 @@ -603,10 +569,8 @@ test_expect_success 'Do not show note when core.notesRef is overridden' ' ' test_expect_success 'Show all notes when notes.displayRef=refs/notes/*' ' - commit=$(git rev-parse HEAD) && - parent=$(git rev-parse HEAD^) && cat >expect-both <<-EOF && - commit $commit + commit 2c125331118caba0ff8238b7f4958ac6e93fe39c Author: A U Thor Date: Thu Apr 7 15:18:13 2005 -0700 @@ -618,7 +582,7 @@ test_expect_success 'Show all notes when notes.displayRef=refs/notes/*' ' Notes (other): ${indent}other note - commit $parent + commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361 Author: A U Thor Date: Thu Apr 7 15:17:13 2005 -0700 @@ -652,9 +616,8 @@ test_expect_success 'notes.displayRef can be given more than once' ' ' test_expect_success 'notes.displayRef respects order' ' - commit=$(git rev-parse HEAD) && cat >expect-both-reversed <<-EOF && - commit $commit + commit 2c125331118caba0ff8238b7f4958ac6e93fe39c Author: A U Thor Date: Thu Apr 7 15:18:13 2005 -0700 @@ -679,16 +642,14 @@ test_expect_success 'GIT_NOTES_DISPLAY_REF works' ' ' test_expect_success 'GIT_NOTES_DISPLAY_REF overrides config' ' - commit=$(git rev-parse HEAD) && - parent=$(git rev-parse HEAD^) && cat >expect-none <<-EOF && - commit $commit + commit 2c125331118caba0ff8238b7f4958ac6e93fe39c Author: A U Thor Date: Thu Apr 7 15:18:13 2005 -0700 ${indent}6th - commit $parent + commit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361 Author: A U Thor Date: Thu Apr 7 15:17:13 2005 -0700 @@ -705,9 +666,8 @@ test_expect_success '--show-notes=* adds to GIT_NOTES_DISPLAY_REF' ' ' test_expect_success '--no-standard-notes' ' - commit=$(git rev-parse HEAD) && cat >expect-commits <<-EOF && - commit $commit + commit 2c125331118caba0ff8238b7f4958ac6e93fe39c Author: A U Thor Date: Thu Apr 7 15:18:13 2005 -0700 @@ -740,8 +700,7 @@ test_expect_success 'Allow notes on non-commits (trees, blobs, tags)' ' git notes show HEAD: >actual && test_cmp expect actual && echo "Note on a blob" >expect && - git ls-tree --name-only HEAD >files && - filename=$(head -n1 files) && + filename=$(git ls-tree --name-only HEAD | head -n1) && git notes add -m "Note on a blob" HEAD:$filename && git notes show HEAD:$filename >actual && test_cmp expect actual && @@ -753,10 +712,8 @@ test_expect_success 'Allow notes on non-commits (trees, blobs, tags)' ' ' test_expect_success 'create note from other note with "git notes add -C"' ' - test_commit 7th && - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit fb01e0ca8c33b6cc0c6451dde747f97df567cb5c Author: A U Thor Date: Thu Apr 7 15:19:13 2005 -0700 @@ -765,13 +722,11 @@ test_expect_success 'create note from other note with "git notes add -C"' ' Notes: ${indent}order test EOF - note=$(git notes list HEAD^) && - git notes add -C $note && + test_commit 7th && + git notes add -C $(git notes list HEAD^) && git log -1 >actual && test_cmp expect actual && - git notes list HEAD^ >expect && - git notes list HEAD >actual && - test_cmp expect actual + test "$(git notes list HEAD)" = "$(git notes list HEAD^)" ' test_expect_success 'create note from non-existing note with "git notes add -C" fails' ' @@ -789,9 +744,8 @@ test_expect_success 'create note from non-blob with "git notes add -C" fails' ' ' test_expect_success 'create note from blob with "git notes add -C" reuses blob id' ' - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit 9a4c31c7f722b5d517e92c64e932dd751e1413bf Author: A U Thor Date: Thu Apr 7 15:20:13 2005 -0700 @@ -800,19 +754,16 @@ test_expect_success 'create note from blob with "git notes add -C" reuses blob i Notes: ${indent}This is a blob object EOF - echo "This is a blob object" | git hash-object -w --stdin >blob && - git notes add -C $(cat blob) && + blob=$(echo "This is a blob object" | git hash-object -w --stdin) && + git notes add -C $blob && git log -1 >actual && test_cmp expect actual && - git notes list HEAD >actual && - test_cmp blob actual + test "$(git notes list HEAD)" = "$blob" ' test_expect_success 'create note from other note with "git notes add -c"' ' - test_commit 9th && - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit 2e0db4bc649e174d667a1cde19e725cf897a5bd2 Author: A U Thor Date: Thu Apr 7 15:21:13 2005 -0700 @@ -821,8 +772,8 @@ test_expect_success 'create note from other note with "git notes add -c"' ' Notes: ${indent}yet another note EOF - note=$(git notes list HEAD^^) && - MSG="yet another note" git notes add -c $note && + test_commit 9th && + MSG="yet another note" git notes add -c $(git notes list HEAD^^) && git log -1 >actual && test_cmp expect actual ' @@ -834,9 +785,8 @@ test_expect_success 'create note from non-existing note with "git notes add -c" ' test_expect_success 'append to note from other note with "git notes append -C"' ' - commit=$(git rev-parse HEAD^) && cat >expect <<-EOF && - commit $commit + commit 2e0db4bc649e174d667a1cde19e725cf897a5bd2 Author: A U Thor Date: Thu Apr 7 15:21:13 2005 -0700 @@ -847,16 +797,14 @@ test_expect_success 'append to note from other note with "git notes append -C"' ${indent} ${indent}yet another note EOF - note=$(git notes list HEAD^) && - git notes append -C $note HEAD^ && + git notes append -C $(git notes list HEAD^) HEAD^ && git log -1 HEAD^ >actual && test_cmp expect actual ' test_expect_success 'create note from other note with "git notes append -c"' ' - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit 7c3b87ab368f81e11b1ea87b2ab99a71ccd25406 Author: A U Thor Date: Thu Apr 7 15:22:13 2005 -0700 @@ -865,16 +813,14 @@ test_expect_success 'create note from other note with "git notes append -c"' ' Notes: ${indent}other note EOF - note=$(git notes list HEAD^) && - MSG="other note" git notes append -c $note && + MSG="other note" git notes append -c $(git notes list HEAD^) && git log -1 >actual && test_cmp expect actual ' test_expect_success 'append to note from other note with "git notes append -c"' ' - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit 7c3b87ab368f81e11b1ea87b2ab99a71ccd25406 Author: A U Thor Date: Thu Apr 7 15:22:13 2005 -0700 @@ -885,37 +831,14 @@ test_expect_success 'append to note from other note with "git notes append -c"' ${indent} ${indent}yet another note EOF - note=$(git notes list HEAD) && - MSG="yet another note" git notes append -c $note && + MSG="yet another note" git notes append -c $(git notes list HEAD) && git log -1 >actual && test_cmp expect actual ' test_expect_success 'copy note with "git notes copy"' ' - commit=$(git rev-parse 4th) && cat >expect <<-EOF && - commit $commit - Author: A U Thor - Date: Thu Apr 7 15:16:13 2005 -0700 - - ${indent}4th - - Notes: - ${indent}This is a blob object - EOF - git notes copy 8th 4th && - git log 3rd..4th >actual && - test_cmp expect actual && - git notes list 4th >expect && - git notes list 8th >actual && - test_cmp expect actual -' - -test_expect_success 'copy note with "git notes copy" with default' ' - test_commit 11th && - commit=$(git rev-parse HEAD) && - cat >expect <<-EOF && - commit $commit + commit a446fff8777efdc6eb8f4b7c8a5ff699484df0d5 Author: A U Thor Date: Thu Apr 7 15:23:13 2005 -0700 @@ -926,59 +849,23 @@ test_expect_success 'copy note with "git notes copy" with default' ' ${indent} ${indent}yet another note EOF - git notes copy HEAD^ && + test_commit 11th && + git notes copy HEAD^ HEAD && git log -1 >actual && test_cmp expect actual && - git notes list HEAD^ >expect && - git notes list HEAD >actual && - test_cmp expect actual + test "$(git notes list HEAD)" = "$(git notes list HEAD^)" ' test_expect_success 'prevent overwrite with "git notes copy"' ' test_must_fail git notes copy HEAD~2 HEAD && - cat >expect <<-EOF && - commit $commit - Author: A U Thor - Date: Thu Apr 7 15:23:13 2005 -0700 - - ${indent}11th - - Notes: - ${indent}other note - ${indent} - ${indent}yet another note - EOF git log -1 >actual && test_cmp expect actual && - git notes list HEAD^ >expect && - git notes list HEAD >actual && - test_cmp expect actual + test "$(git notes list HEAD)" = "$(git notes list HEAD^)" ' test_expect_success 'allow overwrite with "git notes copy -f"' ' - commit=$(git rev-parse HEAD) && - cat >expect <<-EOF && - commit $commit - Author: A U Thor - Date: Thu Apr 7 15:23:13 2005 -0700 - - ${indent}11th - - Notes: - ${indent}This is a blob object - EOF - git notes copy -f HEAD~3 HEAD && - git log -1 >actual && - test_cmp expect actual && - git notes list HEAD~3 >expect && - git notes list HEAD >actual && - test_cmp expect actual -' - -test_expect_success 'allow overwrite with "git notes copy -f" with default' ' - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit a446fff8777efdc6eb8f4b7c8a5ff699484df0d5 Author: A U Thor Date: Thu Apr 7 15:23:13 2005 -0700 @@ -989,12 +876,10 @@ test_expect_success 'allow overwrite with "git notes copy -f" with default' ' ${indent} ${indent}yet another note EOF - git notes copy -f HEAD~2 && + git notes copy -f HEAD~2 HEAD && git log -1 >actual && test_cmp expect actual && - git notes list HEAD~2 >expect && - git notes list HEAD >actual && - test_cmp expect actual + test "$(git notes list HEAD)" = "$(git notes list HEAD~2)" ' test_expect_success 'cannot copy note from object without notes' ' @@ -1004,10 +889,8 @@ test_expect_success 'cannot copy note from object without notes' ' ' test_expect_success 'git notes copy --stdin' ' - commit=$(git rev-parse HEAD) && - parent=$(git rev-parse HEAD^) && cat >expect <<-EOF && - commit $commit + commit e871aa61182b1d95d0a6fb75445d891722863b6b Author: A U Thor Date: Thu Apr 7 15:25:13 2005 -0700 @@ -1018,7 +901,7 @@ test_expect_success 'git notes copy --stdin' ' ${indent} ${indent}yet another note - commit $parent + commit 65e263ded02ae4e8839bc151095113737579dc12 Author: A U Thor Date: Thu Apr 7 15:24:13 2005 -0700 @@ -1029,57 +912,41 @@ test_expect_success 'git notes copy --stdin' ' ${indent} ${indent}yet another note EOF - from=$(git rev-parse HEAD~3) && - to=$(git rev-parse HEAD^) && - echo "$from" "$to" >copy && - from=$(git rev-parse HEAD~2) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >>copy && - git notes copy --stdin actual && test_cmp expect actual && - git notes list HEAD~2 >expect && - git notes list HEAD >actual && - test_cmp expect actual && - git notes list HEAD~3 >expect && - git notes list HEAD^ >actual && - test_cmp expect actual + test "$(git notes list HEAD)" = "$(git notes list HEAD~2)" && + test "$(git notes list HEAD^)" = "$(git notes list HEAD~3)" ' test_expect_success 'git notes copy --for-rewrite (unconfigured)' ' - test_commit 14th && - test_commit 15th && - commit=$(git rev-parse HEAD) && - parent=$(git rev-parse HEAD^) && cat >expect <<-EOF && - commit $commit + commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89 Author: A U Thor Date: Thu Apr 7 15:27:13 2005 -0700 ${indent}15th - commit $parent + commit 07c85d77059393ed0154b8c96906547a59dfcddd Author: A U Thor Date: Thu Apr 7 15:26:13 2005 -0700 ${indent}14th EOF - from=$(git rev-parse HEAD~3) && - to=$(git rev-parse HEAD^) && - echo "$from" "$to" >copy && - from=$(git rev-parse HEAD~2) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >>copy && - git notes copy --for-rewrite=foo actual && test_cmp expect actual ' test_expect_success 'git notes copy --for-rewrite (enabled)' ' - commit=$(git rev-parse HEAD) && - parent=$(git rev-parse HEAD^) && cat >expect <<-EOF && - commit $commit + commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89 Author: A U Thor Date: Thu Apr 7 15:27:13 2005 -0700 @@ -1090,7 +957,7 @@ test_expect_success 'git notes copy --for-rewrite (enabled)' ' ${indent} ${indent}yet another note - commit $parent + commit 07c85d77059393ed0154b8c96906547a59dfcddd Author: A U Thor Date: Thu Apr 7 15:26:13 2005 -0700 @@ -1103,31 +970,24 @@ test_expect_success 'git notes copy --for-rewrite (enabled)' ' EOF test_config notes.rewriteMode overwrite && test_config notes.rewriteRef "refs/notes/*" && - from=$(git rev-parse HEAD~3) && - to=$(git rev-parse HEAD^) && - echo "$from" "$to" >copy && - from=$(git rev-parse HEAD~2) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >>copy && - git notes copy --for-rewrite=foo actual && test_cmp expect actual ' test_expect_success 'git notes copy --for-rewrite (disabled)' ' test_config notes.rewrite.bar false && - from=$(git rev-parse HEAD~3) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >copy && - git notes copy --for-rewrite=bar actual && test_cmp expect actual ' test_expect_success 'git notes copy --for-rewrite (overwrite)' ' - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89 Author: A U Thor Date: Thu Apr 7 15:27:13 2005 -0700 @@ -1139,10 +999,8 @@ test_expect_success 'git notes copy --for-rewrite (overwrite)' ' git notes add -f -m"a fresh note" HEAD^ && test_config notes.rewriteMode overwrite && test_config notes.rewriteRef "refs/notes/*" && - from=$(git rev-parse HEAD^) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >copy && - git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1150,18 +1008,15 @@ test_expect_success 'git notes copy --for-rewrite (overwrite)' ' test_expect_success 'git notes copy --for-rewrite (ignore)' ' test_config notes.rewriteMode ignore && test_config notes.rewriteRef "refs/notes/*" && - from=$(git rev-parse HEAD^) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >copy && - git notes copy --for-rewrite=foo actual && test_cmp expect actual ' test_expect_success 'git notes copy --for-rewrite (append)' ' - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89 Author: A U Thor Date: Thu Apr 7 15:27:13 2005 -0700 @@ -1175,18 +1030,15 @@ test_expect_success 'git notes copy --for-rewrite (append)' ' git notes add -f -m"another fresh note" HEAD^ && test_config notes.rewriteMode concatenate && test_config notes.rewriteRef "refs/notes/*" && - from=$(git rev-parse HEAD^) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >copy && - git notes copy --for-rewrite=foo actual && test_cmp expect actual ' test_expect_success 'git notes copy --for-rewrite (append two to one)' ' - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89 Author: A U Thor Date: Thu Apr 7 15:27:13 2005 -0700 @@ -1205,13 +1057,9 @@ test_expect_success 'git notes copy --for-rewrite (append two to one)' ' git notes add -f -m"append 2" HEAD^^ && test_config notes.rewriteMode concatenate && test_config notes.rewriteRef "refs/notes/*" && - from=$(git rev-parse HEAD^) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >copy && - from=$(git rev-parse HEAD^^) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >>copy && - git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1220,18 +1068,15 @@ test_expect_success 'git notes copy --for-rewrite (append empty)' ' git notes remove HEAD^ && test_config notes.rewriteMode concatenate && test_config notes.rewriteRef "refs/notes/*" && - from=$(git rev-parse HEAD^) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >copy && - git notes copy --for-rewrite=foo actual && test_cmp expect actual ' test_expect_success 'GIT_NOTES_REWRITE_MODE works' ' - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89 Author: A U Thor Date: Thu Apr 7 15:27:13 2005 -0700 @@ -1243,18 +1088,15 @@ test_expect_success 'GIT_NOTES_REWRITE_MODE works' ' test_config notes.rewriteMode concatenate && test_config notes.rewriteRef "refs/notes/*" && git notes add -f -m"replacement note 1" HEAD^ && - from=$(git rev-parse HEAD^) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >copy && - GIT_NOTES_REWRITE_MODE=overwrite git notes copy --for-rewrite=foo actual && test_cmp expect actual ' test_expect_success 'GIT_NOTES_REWRITE_REF works' ' - commit=$(git rev-parse HEAD) && cat >expect <<-EOF && - commit $commit + commit 4acf42e847e7fffbbf89ee365c20ac7caf40de89 Author: A U Thor Date: Thu Apr 7 15:27:13 2005 -0700 @@ -1266,11 +1108,9 @@ test_expect_success 'GIT_NOTES_REWRITE_REF works' ' git notes add -f -m"replacement note 2" HEAD^ && test_config notes.rewriteMode overwrite && test_unconfig notes.rewriteRef && - from=$(git rev-parse HEAD^) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >copy && + echo $(git rev-parse HEAD^) $(git rev-parse HEAD) | GIT_NOTES_REWRITE_REF=refs/notes/commits:refs/notes/other \ - git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1279,55 +1119,41 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' ' git notes add -f -m"replacement note 3" HEAD^ && test_config notes.rewriteMode overwrite && test_config notes.rewriteRef refs/notes/other && - from=$(git rev-parse HEAD^) && - to=$(git rev-parse HEAD) && - echo "$from" "$to" >copy && + echo $(git rev-parse HEAD^) $(git rev-parse HEAD) | GIT_NOTES_REWRITE_REF=refs/notes/commits \ - git notes copy --for-rewrite=foo actual && grep "replacement note 3" actual ' test_expect_success 'git notes copy diagnoses too many or too few parameters' ' - test_must_fail git notes copy 2>error && - test_i18ngrep "too few parameters" error && - test_must_fail git notes copy one two three 2>error && - test_i18ngrep "too many parameters" error + test_must_fail git notes copy && + test_must_fail git notes copy one two three ' test_expect_success 'git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master' ' test_unconfig core.notesRef && sane_unset GIT_NOTES_REF && - echo refs/notes/refs/heads/master >expect && - git notes --ref=refs/heads/master get-ref >actual && - test_cmp expect actual + test "$(git notes --ref=refs/heads/master get-ref)" = "refs/notes/refs/heads/master" ' test_expect_success 'git notes get-ref (no overrides)' ' test_unconfig core.notesRef && sane_unset GIT_NOTES_REF && - echo refs/notes/commits >expect && - git notes get-ref >actual && - test_cmp expect actual + test "$(git notes get-ref)" = "refs/notes/commits" ' test_expect_success 'git notes get-ref (core.notesRef)' ' test_config core.notesRef refs/notes/foo && - echo refs/notes/foo >expect && - git notes get-ref >actual && - test_cmp expect actual + test "$(git notes get-ref)" = "refs/notes/foo" ' test_expect_success 'git notes get-ref (GIT_NOTES_REF)' ' - echo refs/notes/bar >expect && - GIT_NOTES_REF=refs/notes/bar git notes get-ref >actual && - test_cmp expect actual + test "$(GIT_NOTES_REF=refs/notes/bar git notes get-ref)" = "refs/notes/bar" ' test_expect_success 'git notes get-ref (--ref)' ' - echo refs/notes/baz >expect && - GIT_NOTES_REF=refs/notes/bar git notes --ref=baz get-ref >actual && - test_cmp expect actual + test "$(GIT_NOTES_REF=refs/notes/bar git notes --ref=baz get-ref)" = "refs/notes/baz" ' test_expect_success 'setup testing of empty notes' ' diff --git a/third_party/git/t/t3305-notes-fanout.sh b/third_party/git/t/t3305-notes-fanout.sh index 3b4753e1b479..54460beec469 100755 --- a/third_party/git/t/t3305-notes-fanout.sh +++ b/third_party/git/t/t3305-notes-fanout.sh @@ -4,38 +4,6 @@ test_description='Test that adding/removing many notes triggers automatic fanout . ./test-lib.sh -path_has_fanout() { - path=$1 && - fanout=$2 && - after_last_slash=$((40 - $fanout * 2)) && - echo $path | grep -q "^\([0-9a-f]\{2\}/\)\{$fanout\}[0-9a-f]\{$after_last_slash\}$" -} - -touched_one_note_with_fanout() { - notes_commit=$1 && - modification=$2 && # 'A' for addition, 'D' for deletion - fanout=$3 && - diff=$(git diff-tree --no-commit-id --name-status --root -r $notes_commit) && - path=$(echo $diff | sed -e "s/^$modification[\t ]//") && - path_has_fanout "$path" $fanout; -} - -all_notes_have_fanout() { - notes_commit=$1 && - fanout=$2 && - git ls-tree -r --name-only $notes_commit 2>/dev/null | - while read path - do - path_has_fanout $path $fanout || return 1 - done -} - -test_expect_success 'tweak test environment' ' - git checkout -b nondeterminism && - test_commit A && - git checkout --orphan with_notes; -' - test_expect_success 'creating many notes with git-notes' ' num_notes=300 && i=0 && @@ -52,7 +20,7 @@ test_expect_success 'creating many notes with git-notes' ' test_expect_success 'many notes created correctly with git-notes' ' git log | grep "^ " > output && - i=$num_notes && + i=300 && while test $i -gt 0 do echo " commit #$i" && @@ -62,46 +30,39 @@ test_expect_success 'many notes created correctly with git-notes' ' test_cmp expect output ' -test_expect_success 'stable fanout 0 is followed by stable fanout 1' ' - i=$num_notes && - fanout=0 && - while test $i -gt 0 +test_expect_success 'many notes created with git-notes triggers fanout' ' + # Expect entire notes tree to have a fanout == 1 + git ls-tree -r --name-only refs/notes/commits | + while read path do - i=$(($i - 1)) && - if touched_one_note_with_fanout refs/notes/commits~$i A $fanout - then - continue - elif test $fanout -eq 0 - then - fanout=1 && - if all_notes_have_fanout refs/notes/commits~$i $fanout - then - echo "Fanout 0 -> 1 at refs/notes/commits~$i" && - continue - fi - fi && - echo "Failed fanout=$fanout check at refs/notes/commits~$i" && - git ls-tree -r --name-only refs/notes/commits~$i && - return 1 - done && - all_notes_have_fanout refs/notes/commits 1 + case "$path" in + ??/??????????????????????????????????????) + : true + ;; + *) + echo "Invalid path \"$path\"" && + return 1 + ;; + esac + done ' test_expect_success 'deleting most notes with git-notes' ' - remove_notes=285 && + num_notes=250 && i=0 && git rev-list HEAD | - while test $i -lt $remove_notes && read sha1 + while test $i -lt $num_notes && read sha1 do i=$(($i + 1)) && test_tick && - git notes remove "$sha1" 2>/dev/null || return 1 + git notes remove "$sha1" || + exit 1 done ' test_expect_success 'most notes deleted correctly with git-notes' ' - git log HEAD~$remove_notes | grep "^ " > output && - i=$(($num_notes - $remove_notes)) && + git log HEAD~250 | grep "^ " > output && + i=50 && while test $i -gt 0 do echo " commit #$i" && @@ -111,29 +72,21 @@ test_expect_success 'most notes deleted correctly with git-notes' ' test_cmp expect output ' -test_expect_success 'stable fanout 1 is followed by stable fanout 0' ' - i=$remove_notes && - fanout=1 && - while test $i -gt 0 +test_expect_success 'deleting most notes triggers fanout consolidation' ' + # Expect entire notes tree to have a fanout == 0 + git ls-tree -r --name-only refs/notes/commits | + while read path do - i=$(($i - 1)) && - if touched_one_note_with_fanout refs/notes/commits~$i D $fanout - then - continue - elif test $fanout -eq 1 - then - fanout=0 && - if all_notes_have_fanout refs/notes/commits~$i $fanout - then - echo "Fanout 1 -> 0 at refs/notes/commits~$i" && - continue - fi - fi && - echo "Failed fanout=$fanout check at refs/notes/commits~$i" && - git ls-tree -r --name-only refs/notes/commits~$i && - return 1 - done && - all_notes_have_fanout refs/notes/commits 0 + case "$path" in + ????????????????????????????????????????) + : true + ;; + *) + echo "Invalid path \"$path\"" && + return 1 + ;; + esac + done ' test_done diff --git a/third_party/git/t/t3306-notes-prune.sh b/third_party/git/t/t3306-notes-prune.sh index 8f4102ff9e44..61748088ebcb 100755 --- a/third_party/git/t/t3306-notes-prune.sh +++ b/third_party/git/t/t3306-notes-prune.sh @@ -11,26 +11,23 @@ test_expect_success 'setup: create a few commits with notes' ' test_tick && git commit -m 1st && git notes add -m "Note #1" && - first=$(git rev-parse HEAD) && : > file2 && git add file2 && test_tick && git commit -m 2nd && git notes add -m "Note #2" && - second=$(git rev-parse HEAD) && : > file3 && git add file3 && test_tick && git commit -m 3rd && - third=$(git rev-parse HEAD) && - COMMIT_FILE=$(echo $third | sed "s!^..!.git/objects/&/!") && + COMMIT_FILE=.git/objects/5e/e1c35e83ea47cd3cc4f8cbee0568915fbbbd29 && test -f $COMMIT_FILE && test-tool chmtime =+0 $COMMIT_FILE && git notes add -m "Note #3" ' cat > expect < Date: Thu Apr 7 15:15:13 2005 -0700 @@ -39,7 +36,7 @@ Date: Thu Apr 7 15:15:13 2005 -0700 Notes: Note #3 -commit $second +commit 08341ad9e94faa089d60fd3f523affb25c6da189 Author: A U Thor Date: Thu Apr 7 15:14:13 2005 -0700 @@ -48,7 +45,7 @@ Date: Thu Apr 7 15:14:13 2005 -0700 Notes: Note #2 -commit $first +commit ab5f302035f2e7aaf04265f08b42034c23256e1f Author: A U Thor Date: Thu Apr 7 15:13:13 2005 -0700 @@ -73,16 +70,16 @@ test_expect_success 'remove some commits' ' test_expect_success 'verify that commits are gone' ' - test_must_fail git cat-file -p $third && - git cat-file -p $second && - git cat-file -p $first + test_must_fail git cat-file -p 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 && + git cat-file -p 08341ad9e94faa089d60fd3f523affb25c6da189 && + git cat-file -p ab5f302035f2e7aaf04265f08b42034c23256e1f ' test_expect_success 'verify that notes are still present' ' - git notes show $third && - git notes show $second && - git notes show $first + git notes show 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 && + git notes show 08341ad9e94faa089d60fd3f523affb25c6da189 && + git notes show ab5f302035f2e7aaf04265f08b42034c23256e1f ' test_expect_success 'prune -n does not remove notes' ' @@ -93,10 +90,13 @@ test_expect_success 'prune -n does not remove notes' ' test_cmp expect actual ' +cat > expect <expect && + git notes prune -n > actual && test_cmp expect actual ' @@ -109,9 +109,9 @@ test_expect_success 'prune notes' ' test_expect_success 'verify that notes are gone' ' - test_must_fail git notes show $third && - git notes show $second && - git notes show $first + test_must_fail git notes show 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 && + git notes show 08341ad9e94faa089d60fd3f523affb25c6da189 && + git notes show ab5f302035f2e7aaf04265f08b42034c23256e1f ' test_expect_success 'remove some commits' ' @@ -121,18 +121,21 @@ test_expect_success 'remove some commits' ' git gc --prune=now ' +cat > expect <expect && git notes prune -v > actual && test_cmp expect actual ' test_expect_success 'verify that notes are gone' ' - test_must_fail git notes show $third && - test_must_fail git notes show $second && - git notes show $first + test_must_fail git notes show 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 && + test_must_fail git notes show 08341ad9e94faa089d60fd3f523affb25c6da189 && + git notes show ab5f302035f2e7aaf04265f08b42034c23256e1f ' test_done diff --git a/third_party/git/t/t3308-notes-merge.sh b/third_party/git/t/t3308-notes-merge.sh index 790e292966b2..d60588ec8f00 100755 --- a/third_party/git/t/t3308-notes-merge.sh +++ b/third_party/git/t/t3308-notes-merge.sh @@ -20,34 +20,7 @@ test_expect_success setup ' git notes add -m "Notes on 3rd commit" 3rd && git notes add -m "Notes on 4th commit" 4th && # Copy notes to remote-notes - git fetch . refs/notes/*:refs/remote-notes/origin/* && - - test_oid_init && - test_oid_cache <<-EOF - hash4a sha1:5e93d24084d32e1cb61f7070505b9d2530cca987 - hash3a sha1:8366731eeee53787d2bdf8fc1eff7d94757e8da0 - hash2a sha1:eede89064cd42441590d6afec6c37b321ada3389 - hash1a sha1:daa55ffad6cb99bf64226532147ffcaf5ce8bdd1 - hash5b sha1:0f2efbd00262f2fd41dfae33df8765618eeacd99 - hash4b sha1:dec2502dac3ea161543f71930044deff93fa945c - hash3b sha1:4069cdb399fd45463ec6eef8e051a16a03592d91 - hash2c sha1:d000d30e6ddcfce3a8122c403226a2ce2fd04d9d - hash1c sha1:43add6bd0c8c0bc871ac7991e0f5573cfba27804 - hash4d sha1:1f257a3a90328557c452f0817d6cc50c89d315d4 - hash3d sha1:05a4927951bcef347f51486575b878b2b60137f2 - - hash4a sha256:eef876be1d32ac2e2e42240e0429325cec116e55e88cb2969899fac695aa762f - hash3a sha256:cf7cd1bc091d7ba4166a86df864110e42087cd893a5ae96bc50d637e0290939d - hash2a sha256:21ddde7ebce2c285213898cb04deca0fd3209610cf7aaf8222e4e2f45262fae2 - hash1a sha256:f9fe0eda16c6027732ed9d4295689a03abd16f893be69b3dcbf4037ddb191921 - hash5b sha256:20046f2244577797a9e3d3f790ea9eca4d8a6bafb2a5570bcb0e03aa02ce100b - hash4b sha256:f90563d134c61a95bb88afbd45d48ccc9e919c62aa6fbfcd483302b3e4d8dbcb - hash3b sha256:988f2aca9f2d87e93e6a73197c2bb99560cc44a2f92d18653968f956f01221e0 - hash2c sha256:84153b777b4d42827a756c6578dcdb59d8ae5d1360b874fb37c430150c825c26 - hash1c sha256:9beb2bc4eef72e4c4087be168a20573e34d993d9ab1883055f23e322afa06567 - hash4d sha256:32de39dc06e679a7abb2d4a55ede7709b3124340a4a90aa305971b1c72ac319d - hash3d sha256:fa73b20e41cbb7541c4c81d1535016131dbfbeb05bf6a71f6115e9cad31c7af5 - EOF + git fetch . refs/notes/*:refs/remote-notes/origin/* ' commit_sha1=$(git rev-parse 1st^{commit}) @@ -67,10 +40,10 @@ verify_notes () { } cat <expect_notes_x -$(test_oid hash4a) $commit_sha4 -$(test_oid hash3a) $commit_sha3 -$(test_oid hash2a) $commit_sha2 -$(test_oid hash1a) $commit_sha1 +5e93d24084d32e1cb61f7070505b9d2530cca987 $commit_sha4 +8366731eeee53787d2bdf8fc1eff7d94757e8da0 $commit_sha3 +eede89064cd42441590d6afec6c37b321ada3389 $commit_sha2 +daa55ffad6cb99bf64226532147ffcaf5ce8bdd1 $commit_sha1 EOF cat >expect_log_x < y) => No-op' ' ' cat <expect_notes_y -$(test_oid hash5b) $commit_sha5 -$(test_oid hash4b) $commit_sha4 -$(test_oid hash3b) $commit_sha3 -$(test_oid hash1a) $commit_sha1 +0f2efbd00262f2fd41dfae33df8765618eeacd99 $commit_sha5 +dec2502dac3ea161543f71930044deff93fa945c $commit_sha4 +4069cdb399fd45463ec6eef8e051a16a03592d91 $commit_sha3 +daa55ffad6cb99bf64226532147ffcaf5ce8bdd1 $commit_sha1 EOF cat >expect_log_y < y)' ' ' cat <expect_notes_y -$(test_oid hash5b) $commit_sha5 -$(test_oid hash4b) $commit_sha4 -$(test_oid hash3b) $commit_sha3 -$(test_oid hash2c) $commit_sha2 -$(test_oid hash1c) $commit_sha1 +0f2efbd00262f2fd41dfae33df8765618eeacd99 $commit_sha5 +dec2502dac3ea161543f71930044deff93fa945c $commit_sha4 +4069cdb399fd45463ec6eef8e051a16a03592d91 $commit_sha3 +d000d30e6ddcfce3a8122c403226a2ce2fd04d9d $commit_sha2 +43add6bd0c8c0bc871ac7991e0f5573cfba27804 $commit_sha1 EOF cat >expect_log_y <expect_notes_x -$(test_oid hash5b) $commit_sha5 -$(test_oid hash4d) $commit_sha4 -$(test_oid hash1a) $commit_sha1 +0f2efbd00262f2fd41dfae33df8765618eeacd99 $commit_sha5 +1f257a3a90328557c452f0817d6cc50c89d315d4 $commit_sha4 +daa55ffad6cb99bf64226532147ffcaf5ce8bdd1 $commit_sha1 EOF cat >expect_log_x <expect_notes_x -$(test_oid hash5b) $commit_sha5 -$(test_oid hash4d) $commit_sha4 -$(test_oid hash2c) $commit_sha2 -$(test_oid hash1c) $commit_sha1 +0f2efbd00262f2fd41dfae33df8765618eeacd99 $commit_sha5 +1f257a3a90328557c452f0817d6cc50c89d315d4 $commit_sha4 +d000d30e6ddcfce3a8122c403226a2ce2fd04d9d $commit_sha2 +43add6bd0c8c0bc871ac7991e0f5573cfba27804 $commit_sha1 EOF cat >expect_log_x < Non-conflicting 3-way merge' ' ' cat <expect_notes_w -$(test_oid hash3d) $commit_sha3 -$(test_oid hash2c) $commit_sha2 +05a4927951bcef347f51486575b878b2b60137f2 $commit_sha3 +d000d30e6ddcfce3a8122c403226a2ce2fd04d9d $commit_sha2 EOF cat >expect_log_w <expect_notes_x -$(test_oid hash5b) $commit_sha5 -$(test_oid hash4d) $commit_sha4 -$(test_oid hash3d) $commit_sha3 -$(test_oid hash2c) $commit_sha2 -$(test_oid hash1c) $commit_sha1 +0f2efbd00262f2fd41dfae33df8765618eeacd99 $commit_sha5 +1f257a3a90328557c452f0817d6cc50c89d315d4 $commit_sha4 +05a4927951bcef347f51486575b878b2b60137f2 $commit_sha3 +d000d30e6ddcfce3a8122c403226a2ce2fd04d9d $commit_sha2 +43add6bd0c8c0bc871ac7991e0f5573cfba27804 $commit_sha1 EOF cat >expect_log_x <expect_notes_x -$(test_oid hash15a) $commit_sha15 -$(test_oid hash14a) $commit_sha14 -$(test_oid hash13a) $commit_sha13 -$(test_oid hash12a) $commit_sha12 -$(test_oid hash11a) $commit_sha11 -$(test_oid hash10a) $commit_sha10 -$(test_oid hash09a) $commit_sha9 -$(test_oid hash08a) $commit_sha8 -$(test_oid hash07a) $commit_sha7 -$(test_oid hash06a) $commit_sha6 +457a85d6c814ea208550f15fcc48f804ac8dc023 $commit_sha15 +b0c95b954301d69da2bc3723f4cb1680d355937c $commit_sha14 +5d30216a129eeffa97d9694ffe8c74317a560315 $commit_sha13 +dd161bc149470fd890dd4ab52a4cbd79bbd18c36 $commit_sha12 +7abbc45126d680336fb24294f013a7cdfa3ed545 $commit_sha11 +b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10 +20c613c835011c48a5abe29170a2402ca6354910 $commit_sha9 +a3daf8a1e4e5dc3409a303ad8481d57bfea7f5d6 $commit_sha8 +897003322b53bc6ca098e9324ee508362347e734 $commit_sha7 +11d97fdebfa5ceee540a3da07bce6fa0222bc082 $commit_sha6 EOF cat >expect_log_x <expect_notes_y -$(test_oid hash15b) $commit_sha15 -$(test_oid hash14b) $commit_sha14 -$(test_oid hash13b) $commit_sha13 -$(test_oid hash12b) $commit_sha12 -$(test_oid hash11a) $commit_sha11 -$(test_oid hash10a) $commit_sha10 -$(test_oid hash09a) $commit_sha9 -$(test_oid hash05b) $commit_sha5 -$(test_oid hash04b) $commit_sha4 -$(test_oid hash03b) $commit_sha3 +68b8630d25516028bed862719855b3d6768d7833 $commit_sha15 +5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14 +3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13 +a66055fa82f7a03fe0c02a6aba3287a85abf7c62 $commit_sha12 +7abbc45126d680336fb24294f013a7cdfa3ed545 $commit_sha11 +b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10 +20c613c835011c48a5abe29170a2402ca6354910 $commit_sha9 +154508c7a0bcad82b6fe4b472bc4c26b3bf0825b $commit_sha5 +e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4 +5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3 EOF cat >expect_log_y <expect_notes_z -$(test_oid hash15c) $commit_sha15 -$(test_oid hash14b) $commit_sha14 -$(test_oid hash13a) $commit_sha13 -$(test_oid hash11c) $commit_sha11 -$(test_oid hash10a) $commit_sha10 -$(test_oid hash08c) $commit_sha8 -$(test_oid hash07a) $commit_sha7 -$(test_oid hash05c) $commit_sha5 -$(test_oid hash04b) $commit_sha4 -$(test_oid hash02c) $commit_sha2 +9b4b2c61f0615412da3c10f98ff85b57c04ec765 $commit_sha15 +5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14 +5d30216a129eeffa97d9694ffe8c74317a560315 $commit_sha13 +7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11 +b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10 +851e1638784a884c7dd26c5d41f3340f6387413a $commit_sha8 +897003322b53bc6ca098e9324ee508362347e734 $commit_sha7 +99fc34adfc400b95c67b013115e37e31aa9a6d23 $commit_sha5 +e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4 +283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2 EOF cat >expect_log_z < Fail/No ' cat <expect_notes_ours -$(test_oid hash15b) $commit_sha15 -$(test_oid hash14b) $commit_sha14 -$(test_oid hash13b) $commit_sha13 -$(test_oid hash12b) $commit_sha12 -$(test_oid hash11c) $commit_sha11 -$(test_oid hash10a) $commit_sha10 -$(test_oid hash05b) $commit_sha5 -$(test_oid hash04b) $commit_sha4 -$(test_oid hash03b) $commit_sha3 -$(test_oid hash02c) $commit_sha2 +68b8630d25516028bed862719855b3d6768d7833 $commit_sha15 +5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14 +3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13 +a66055fa82f7a03fe0c02a6aba3287a85abf7c62 $commit_sha12 +7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11 +b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10 +154508c7a0bcad82b6fe4b472bc4c26b3bf0825b $commit_sha5 +e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4 +5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3 +283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2 EOF cat >expect_log_ours <expect_notes_theirs -$(test_oid hash15c) $commit_sha15 -$(test_oid hash14b) $commit_sha14 -$(test_oid hash13b) $commit_sha13 -$(test_oid hash11c) $commit_sha11 -$(test_oid hash10a) $commit_sha10 -$(test_oid hash08c) $commit_sha8 -$(test_oid hash05c) $commit_sha5 -$(test_oid hash04b) $commit_sha4 -$(test_oid hash03b) $commit_sha3 -$(test_oid hash02c) $commit_sha2 +9b4b2c61f0615412da3c10f98ff85b57c04ec765 $commit_sha15 +5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14 +3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13 +7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11 +b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10 +851e1638784a884c7dd26c5d41f3340f6387413a $commit_sha8 +99fc34adfc400b95c67b013115e37e31aa9a6d23 $commit_sha5 +e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4 +5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3 +283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2 EOF cat >expect_log_theirs <expect_notes_union -$(test_oid hash15d) $commit_sha15 -$(test_oid hash14b) $commit_sha14 -$(test_oid hash13b) $commit_sha13 -$(test_oid hash12b) $commit_sha12 -$(test_oid hash11c) $commit_sha11 -$(test_oid hash10a) $commit_sha10 -$(test_oid hash08c) $commit_sha8 -$(test_oid hash05d) $commit_sha5 -$(test_oid hash04b) $commit_sha4 -$(test_oid hash03b) $commit_sha3 -$(test_oid hash02c) $commit_sha2 +7c4e546efd0fe939f876beb262ece02797880b54 $commit_sha15 +5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14 +3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13 +a66055fa82f7a03fe0c02a6aba3287a85abf7c62 $commit_sha12 +7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11 +b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10 +851e1638784a884c7dd26c5d41f3340f6387413a $commit_sha8 +6c841cc36ea496027290967ca96bd2bef54dbb47 $commit_sha5 +e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4 +5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3 +283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2 EOF cat >expect_log_union <expect_notes_union2 -$(test_oid hash15e) $commit_sha15 -$(test_oid hash14b) $commit_sha14 -$(test_oid hash13b) $commit_sha13 -$(test_oid hash12b) $commit_sha12 -$(test_oid hash11c) $commit_sha11 -$(test_oid hash10a) $commit_sha10 -$(test_oid hash08c) $commit_sha8 -$(test_oid hash05e) $commit_sha5 -$(test_oid hash04b) $commit_sha4 -$(test_oid hash03b) $commit_sha3 -$(test_oid hash02c) $commit_sha2 +d682107b8bf7a7aea1e537a8d5cb6a12b60135f1 $commit_sha15 +5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14 +3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13 +a66055fa82f7a03fe0c02a6aba3287a85abf7c62 $commit_sha12 +7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11 +b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10 +851e1638784a884c7dd26c5d41f3340f6387413a $commit_sha8 +357b6ca14c7afd59b7f8b8aaaa6b8b723771135b $commit_sha5 +e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4 +5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3 +283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2 EOF cat >expect_log_union2 <expect_notes_cat_sort_uniq -$(test_oid hash15f) $commit_sha15 -$(test_oid hash14b) $commit_sha14 -$(test_oid hash13b) $commit_sha13 -$(test_oid hash12b) $commit_sha12 -$(test_oid hash11c) $commit_sha11 -$(test_oid hash10a) $commit_sha10 -$(test_oid hash08c) $commit_sha8 -$(test_oid hash05f) $commit_sha5 -$(test_oid hash04b) $commit_sha4 -$(test_oid hash03b) $commit_sha3 -$(test_oid hash02c) $commit_sha2 +6be90240b5f54594203e25d9f2f64b7567175aee $commit_sha15 +5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14 +3a631fdb6f41b05b55d8f4baf20728ba8f6fccbc $commit_sha13 +a66055fa82f7a03fe0c02a6aba3287a85abf7c62 $commit_sha12 +7e3c53503a3db8dd996cb62e37c66e070b44b54d $commit_sha11 +b8d03e173f67f6505a76f6e00cf93440200dd9be $commit_sha10 +851e1638784a884c7dd26c5d41f3340f6387413a $commit_sha8 +660311d7f78dc53db12ac373a43fca7465381a7e $commit_sha5 +e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4 +5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3 +283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2 EOF cat >expect_log_cat_sort_uniq <output || :; } && - test_must_be_empty output -} - cat <expect_notes_x -$(test_oid hash04a) $commit_sha4 -$(test_oid hash03a) $commit_sha3 -$(test_oid hash02a) $commit_sha2 +6e8e3febca3c2bb896704335cc4d0c34cb2f8715 $commit_sha4 +e5388c10860456ee60673025345fe2e153eb8cf8 $commit_sha3 +ceefa674873670e7ecd131814d909723cce2b669 $commit_sha2 EOF cat >expect_log_x <expect_notes_y -$(test_oid hash04b) $commit_sha4 -$(test_oid hash03b) $commit_sha3 -$(test_oid hash01b) $commit_sha1 +e2bfd06a37dd2031684a59a6e2b033e212239c78 $commit_sha4 +5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3 +b0a6021ec006d07e80e9b20ec9b444cbd9d560d3 $commit_sha1 EOF cat >expect_log_y <expect_notes_z -$(test_oid hash04c) $commit_sha4 -$(test_oid hash02c) $commit_sha2 -$(test_oid hash01c) $commit_sha1 +cff59c793c20bb49a4e01bc06fb06bad642e0d54 $commit_sha4 +283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2 +0a81da8956346e19bcb27a906f04af327e03e31b $commit_sha1 EOF cat >expect_log_z < C ' cat <expect_notes_z -$(test_oid hash04d) $commit_sha4 -$(test_oid hash02c) $commit_sha2 -$(test_oid hash01c) $commit_sha1 +00494adecf2d9635a02fa431308d67993f853968 $commit_sha4 +283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2 +0a81da8956346e19bcb27a906f04af327e03e31b $commit_sha1 EOF cat >expect_log_z <expect_notes_w -$(test_oid hash02a) $commit_sha2 -$(test_oid hash01e) $commit_sha1 +ceefa674873670e7ecd131814d909723cce2b669 $commit_sha2 +f75d1df88cbfe4258d49852f26cfc83f2ad4494b $commit_sha1 EOF cat >expect_log_w <expect_notes_w -$(test_oid hash04a) $commit_sha4 -$(test_oid hash03a) $commit_sha3 -$(test_oid hash02a) $commit_sha2 -$(test_oid hash01e) $commit_sha1 +6e8e3febca3c2bb896704335cc4d0c34cb2f8715 $commit_sha4 +e5388c10860456ee60673025345fe2e153eb8cf8 $commit_sha3 +ceefa674873670e7ecd131814d909723cce2b669 $commit_sha2 +f75d1df88cbfe4258d49852f26cfc83f2ad4494b $commit_sha1 EOF cat >expect_log_w <expect_notes_m -$(test_oid hash04f) $commit_sha4 -$(test_oid hash03b) $commit_sha3 -$(test_oid hash02c) $commit_sha2 -$(test_oid hash01f) $commit_sha1 +021faa20e931fb48986ffc6282b4bb05553ac946 $commit_sha4 +5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 $commit_sha3 +283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2 +0a59e787e6d688aa6309e56e8c1b89431a0fc1c1 $commit_sha1 EOF cat >expect_log_m <output 2>/dev/null && + test_must_be_empty output && # Merge commit has pre-merge y and pre-merge z as parents test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" && test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" && @@ -433,7 +397,9 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol test_expect_success 'abort notes merge' ' git notes merge --abort && - notes_merge_files_gone && + # No .git/NOTES_MERGE_* files left + test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null && + test_must_be_empty output && # m has not moved (still == y) test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)" && # Verify that other notes refs has not changed (w, x, y and z) @@ -464,9 +430,9 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol ' cat <expect_notes_m -$(test_oid hash05g) $commit_sha5 -$(test_oid hash02c) $commit_sha2 -$(test_oid hash01f) $commit_sha1 +304dfb4325cf243025b9957486eb605a9b51c199 $commit_sha5 +283b48219aee9a4105f6cab337e789065c82c2b9 $commit_sha2 +0a59e787e6d688aa6309e56e8c1b89431a0fc1c1 $commit_sha1 EOF cat >expect_log_m < .git/NOTES_MERGE_WORKTREE/$commit_sha5 && # Finalize merge git notes merge --commit && - notes_merge_files_gone && + # No .git/NOTES_MERGE_* files left + test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null && + test_must_be_empty output && # Merge commit has pre-merge y and pre-merge z as parents test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" && test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" && @@ -585,7 +553,9 @@ EOF test_expect_success 'resolve situation by aborting the notes merge' ' git notes merge --abort && - notes_merge_files_gone && + # No .git/NOTES_MERGE_* files left + test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null && + test_must_be_empty output && # m has not moved (still == w) test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" && # Verify that other notes refs has not changed (w, x, y and z) diff --git a/third_party/git/t/t3311-notes-merge-fanout.sh b/third_party/git/t/t3311-notes-merge-fanout.sh index 5b675417e9bb..37151a3adc39 100755 --- a/third_party/git/t/t3311-notes-merge-fanout.sh +++ b/third_party/git/t/t3311-notes-merge-fanout.sh @@ -29,10 +29,15 @@ verify_fanout () { git ls-tree -r --name-only "refs/notes/$notes_ref" | while read path do - echo "$path" | grep "^../[0-9a-f]*$" || { + case "$path" in + ??/??????????????????????????????????????) + : true + ;; + *) echo "Invalid path \"$path\"" && - return 1; - } + return 1 + ;; + esac done } @@ -43,10 +48,15 @@ verify_no_fanout () { git ls-tree -r --name-only "refs/notes/$notes_ref" | while read path do - echo "$path" | grep -v "^../.*" || { + case "$path" in + ????????????????????????????????????????) + : true + ;; + *) echo "Invalid path \"$path\"" && - return 1; - } + return 1 + ;; + esac done } @@ -57,27 +67,7 @@ test_expect_success 'setup a few initial commits with notes (notes ref: x)' ' do test_commit "commit$i" >/dev/null && git notes add -m "notes for commit$i" || return 1 - done && - - git log --format=oneline && - - test_oid_cache <<-EOF - hash05a sha1:aed91155c7a72c2188e781fdf40e0f3761b299db - hash04a sha1:99fab268f9d7ee7b011e091a436c78def8eeee69 - hash03a sha1:953c20ae26c7aa0b428c20693fe38bc687f9d1a9 - hash02a sha1:6358796131b8916eaa2dde6902642942a1cb37e1 - hash01a sha1:b02d459c32f0e68f2fe0981033bb34f38776ba47 - hash03b sha1:9f506ee70e20379d7f78204c77b334f43d77410d - hash02b sha1:23a47d6ea7d589895faf800752054818e1e7627b - - hash05a sha256:3aae5d26619d96dba93795f66325716e4cbc486884f95a6adee8fb0615a76d12 - hash04a sha256:07e43dd3d89fe634d3252e253b426aacc7285a995dcdbcf94ac284060a1122cf - hash03a sha256:26fb52eaa7f4866bf735254587be7b31209ec10e525912ffd8e8ba549ba892ff - hash02a sha256:b57ebdf23634e750dcbc4b9a37991d70f90830d568a0e4529ce9de0a3f8d605c - hash01a sha256:377903b1572bd5117087a5518fcb1011b5053cccbc59e3c7c823a8615204173b - hash03b sha256:04e7b392fda7c185bfa17c9179b56db732edc2dc2b3bf887308dcaabb717270d - hash02b sha256:66099aaaec49a485ed990acadd9a9b81232ea592079964113d8f581ff69ef50b - EOF + done ' commit_sha1=$(git rev-parse commit1^{commit}) @@ -87,11 +77,11 @@ commit_sha4=$(git rev-parse commit4^{commit}) commit_sha5=$(git rev-parse commit5^{commit}) cat <expect_notes_x -$(test_oid hash05a) $commit_sha5 -$(test_oid hash04a) $commit_sha4 -$(test_oid hash03a) $commit_sha3 -$(test_oid hash02a) $commit_sha2 -$(test_oid hash01a) $commit_sha1 +aed91155c7a72c2188e781fdf40e0f3761b299db $commit_sha5 +99fab268f9d7ee7b011e091a436c78def8eeee69 $commit_sha4 +953c20ae26c7aa0b428c20693fe38bc687f9d1a9 $commit_sha3 +6358796131b8916eaa2dde6902642942a1cb37e1 $commit_sha2 +b02d459c32f0e68f2fe0981033bb34f38776ba47 $commit_sha1 EOF cat >expect_log_x < x)' ' ' cat <expect_notes_z -$(test_oid hash03b) $commit_sha3 -$(test_oid hash02b) $commit_sha2 -$(test_oid hash01a) $commit_sha1 +9f506ee70e20379d7f78204c77b334f43d77410d $commit_sha3 +23a47d6ea7d589895faf800752054818e1e7627b $commit_sha2 +b02d459c32f0e68f2fe0981033bb34f38776ba47 $commit_sha1 EOF cat >expect_log_z < and specified as :/quuxery' ' @@ -143,11 +143,11 @@ test_expect_success 'setup: recover' ' test_expect_success 'Show verbose error when HEAD could not be detached' ' >B && - test_when_finished "rm -f B" && test_must_fail git rebase topic 2>output.err >output.out && test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" output.err && test_i18ngrep B output.err ' +rm -f B test_expect_success 'fail when upstream arg is missing and not on branch' ' git checkout topic && @@ -159,43 +159,19 @@ test_expect_success 'fail when upstream arg is missing and not configured' ' test_must_fail git rebase ' -test_expect_success 'rebase works with format.useAutoBase' ' - test_config format.useAutoBase true && - git checkout topic && - git rebase master -' - -test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg (--merge)' ' +test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg' ' git checkout -b default-base master && git checkout -b default topic && git config branch.default.remote . && git config branch.default.merge refs/heads/default-base && - git rebase --merge && - git rev-parse --verify default-base >expect && - git rev-parse default~1 >actual && - test_cmp expect actual && - git checkout default-base && - git reset --hard HEAD^ && - git checkout default && - git rebase --merge && - git rev-parse --verify default-base >expect && - git rev-parse default~1 >actual && - test_cmp expect actual -' - -test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg (--apply)' ' - git checkout -B default-base master && - git checkout -B default topic && - git config branch.default.remote . && - git config branch.default.merge refs/heads/default-base && - git rebase --apply && + git rebase && git rev-parse --verify default-base >expect && git rev-parse default~1 >actual && test_cmp expect actual && git checkout default-base && git reset --hard HEAD^ && git checkout default && - git rebase --apply && + git rebase && git rev-parse --verify default-base >expect && git rev-parse default~1 >actual && test_cmp expect actual @@ -224,15 +200,9 @@ test_expect_success 'cherry-picked commits and fork-point work together' ' test_cmp expect D ' -test_expect_success 'rebase --apply -q is quiet' ' +test_expect_success 'rebase -q is quiet' ' git checkout -b quiet topic && - git rebase --apply -q master >output.out 2>&1 && - test_must_be_empty output.out -' - -test_expect_success 'rebase --merge -q is quiet' ' - git checkout -B quiet topic && - git rebase --merge -q master >output.out 2>&1 && + git rebase -q master >output.out 2>&1 && test_must_be_empty output.out ' @@ -315,7 +285,7 @@ EOF test_cmp From_.msg out ' -test_expect_success 'rebase --apply and --show-current-patch' ' +test_expect_success 'rebase --am and --show-current-patch' ' test_create_repo conflict-apply && ( cd conflict-apply && @@ -325,48 +295,12 @@ test_expect_success 'rebase --apply and --show-current-patch' ' echo two >>init.t && git commit -a -m two && git tag two && - test_must_fail git rebase --apply -f --onto init HEAD^ && + test_must_fail git rebase --onto init HEAD^ && GIT_TRACE=1 git rebase --show-current-patch >/dev/null 2>stderr && grep "show.*$(git rev-parse two)" stderr ) ' -test_expect_success 'rebase --apply and .gitattributes' ' - test_create_repo attributes && - ( - cd attributes && - test_commit init && - git config filter.test.clean "sed -e '\''s/smudged/clean/g'\''" && - git config filter.test.smudge "sed -e '\''s/clean/smudged/g'\''" && - - test_commit second && - git checkout -b test HEAD^ && - - echo "*.txt filter=test" >.gitattributes && - git add .gitattributes && - test_commit third && - - echo "This text is smudged." >a.txt && - git add a.txt && - test_commit fourth && - - git checkout -b removal HEAD^ && - git rm .gitattributes && - git add -u && - test_commit fifth && - git cherry-pick test && - - git checkout test && - git rebase master && - grep "smudged" a.txt && - - git checkout removal && - git reset --hard && - git rebase master && - grep "clean" a.txt - ) -' - test_expect_success 'rebase--merge.sh and --show-current-patch' ' test_create_repo conflict-merge && ( @@ -401,22 +335,4 @@ test_expect_success 'rebase -c rebase.useBuiltin=false warning' ' test_must_be_empty err ' -test_expect_success 'switch to branch checked out here' ' - git checkout master && - git rebase master master -' - -test_expect_success 'switch to branch not checked out' ' - git checkout master && - git branch other && - git rebase master other -' - -test_expect_success 'refuse to switch to branch checked out elsewhere' ' - git checkout master && - git worktree add wt && - test_must_fail git -C wt rebase master master 2>err && - test_i18ngrep "already checked out" err -' - test_done diff --git a/third_party/git/t/t3401-rebase-and-am-rename.sh b/third_party/git/t/t3401-rebase-and-am-rename.sh index f18bae945075..a0b9438b2286 100755 --- a/third_party/git/t/t3401-rebase-and-am-rename.sh +++ b/third_party/git/t/t3401-rebase-and-am-rename.sh @@ -52,13 +52,13 @@ test_expect_success 'rebase --interactive: directory rename detected' ' ) ' -test_expect_failure 'rebase --apply: directory rename detected' ' +test_expect_failure 'rebase (am): directory rename detected' ' ( cd dir-rename && git checkout B^0 && - git -c merge.directoryRenames=true rebase --apply A && + git -c merge.directoryRenames=true rebase A && git ls-files -s >out && test_line_count = 5 out && diff --git a/third_party/git/t/t3403-rebase-skip.sh b/third_party/git/t/t3403-rebase-skip.sh index ee8a8dba5286..1f5122b632fb 100755 --- a/third_party/git/t/t3403-rebase-skip.sh +++ b/third_party/git/t/t3403-rebase-skip.sh @@ -7,8 +7,6 @@ test_description='git rebase --merge --skip tests' . ./test-lib.sh -. "$TEST_DIRECTORY"/lib-rebase.sh - # we assume the default git am -3 --skip strategy is tested independently # and always works :) @@ -22,13 +20,6 @@ test_expect_success setup ' git commit -a -m "hello world" && echo goodbye >> hello && git commit -a -m "goodbye" && - git tag goodbye && - - git checkout --detach && - git checkout HEAD^ . && - test_tick && - git commit -m reverted-goodbye && - git tag reverted-goodbye && git checkout -f skip-reference && echo moo > hello && @@ -85,27 +76,4 @@ test_expect_success 'moved back to branch correctly' ' test_debug 'gitk --all & sleep 1' -test_expect_success 'fixup that empties commit fails' ' - test_when_finished "git rebase --abort" && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="1 fixup 2" git rebase -i \ - goodbye^ reverted-goodbye - ) -' - -test_expect_success 'squash that empties commit fails' ' - test_when_finished "git rebase --abort" && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="1 squash 2" git rebase -i \ - goodbye^ reverted-goodbye - ) -' - -# Must be the last test in this file -test_expect_success '$EDITOR and friends are unchanged' ' - test_editor_unchanged -' - test_done diff --git a/third_party/git/t/t3404-rebase-interactive.sh b/third_party/git/t/t3404-rebase-interactive.sh index c5ce3ab760ea..461dd539ffd4 100755 --- a/third_party/git/t/t3404-rebase-interactive.sh +++ b/third_party/git/t/t3404-rebase-interactive.sh @@ -29,6 +29,9 @@ Initial setup: . "$TEST_DIRECTORY"/lib-rebase.sh +# WARNING: Modifications to the initial repository can change the SHA ID used +# in the expect2 file for the 'stop on conflicting pick' test. + test_expect_success 'setup' ' test_commit A file1 && test_commit B file1 && @@ -72,16 +75,12 @@ test_expect_success 'rebase --keep-empty' ' test_line_count = 6 actual ' -test_expect_success 'rebase -i with empty todo list' ' +test_expect_success 'rebase -i with empty HEAD' ' cat >expect <<-\EOF && error: nothing to do EOF - ( - set_fake_editor && - test_must_fail env FAKE_LINES="#" \ - git rebase -i HEAD^ >output 2>&1 - ) && - tail -n 1 output >actual && # Ignore output about changing todo list + set_fake_editor && + test_must_fail env FAKE_LINES="1 exec_true" git rebase -i HEAD^ >actual 2>&1 && test_i18ncmp expect actual ' @@ -140,11 +139,8 @@ test_expect_success 'rebase -i sets work tree properly' ' test_expect_success 'rebase -i with the exec command checks tree cleanness' ' git checkout master && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="exec_echo_foo_>file1 1" \ - git rebase -i HEAD^ - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="exec_echo_foo_>file1 1" git rebase -i HEAD^ && test_cmp_rev master^ HEAD && git reset --hard && git rebase --continue @@ -159,6 +155,8 @@ test_expect_success 'rebase -x with empty command fails' ' test_i18ncmp expected actual ' +LF=' +' test_expect_success 'rebase -x with newline in command fails' ' test_when_finished "git rebase --abort ||:" && test_must_fail env git rebase -x "a${LF}b" @ 2>actual && @@ -170,11 +168,9 @@ test_expect_success 'rebase -x with newline in command fails' ' test_expect_success 'rebase -i with exec of inexistent command' ' git checkout master && test_when_finished "git rebase --abort" && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="exec_this-command-does-not-exist 1" \ - git rebase -i HEAD^ >actual 2>&1 - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="exec_this-command-does-not-exist 1" \ + git rebase -i HEAD^ >actual 2>&1 && ! grep "Maybe git-rebase is broken" actual ' @@ -185,6 +181,7 @@ test_expect_success 'implicit interactive rebase does not invoke sequence editor test_expect_success 'no changes are a nop' ' git checkout branch2 && + set_fake_editor && git rebase -i F && test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" && test $(git rev-parse I) = $(git rev-parse HEAD) @@ -194,6 +191,7 @@ test_expect_success 'test the [branch] option' ' git checkout -b dead-end && git rm file6 && git commit -m "stop here" && + set_fake_editor && git rebase -i F branch2 && test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" && test $(git rev-parse I) = $(git rev-parse branch2) && @@ -202,6 +200,7 @@ test_expect_success 'test the [branch] option' ' test_expect_success 'test --onto ' ' git checkout -b test-onto branch2 && + set_fake_editor && git rebase -i --onto branch1 F && test "$(git symbolic-ref -q HEAD)" = "refs/heads/test-onto" && test $(git rev-parse HEAD^) = $(git rev-parse branch1) && @@ -211,6 +210,7 @@ test_expect_success 'test --onto ' ' test_expect_success 'rebase on top of a non-conflicting commit' ' git checkout branch1 && git tag original-branch1 && + set_fake_editor && git rebase -i branch2 && test file6 = $(git diff --name-only original-branch1) && test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" && @@ -223,42 +223,38 @@ test_expect_success 'reflog for the branch shows state before rebase' ' ' test_expect_success 'reflog for the branch shows correct finish message' ' - printf "rebase (finish): refs/heads/branch1 onto %s\n" \ + printf "rebase -i (finish): refs/heads/branch1 onto %s\n" \ "$(git rev-parse branch2)" >expected && git log -g --pretty=%gs -1 refs/heads/branch1 >actual && test_cmp expected actual ' test_expect_success 'exchange two commits' ' - ( - set_fake_editor && - FAKE_LINES="2 1" git rebase -i HEAD~2 - ) && + set_fake_editor && + FAKE_LINES="2 1" git rebase -i HEAD~2 && test H = $(git cat-file commit HEAD^ | sed -ne \$p) && - test G = $(git cat-file commit HEAD | sed -ne \$p) && - blob1=$(git rev-parse --short HEAD^:file1) && - blob2=$(git rev-parse --short HEAD:file1) && - commit=$(git rev-parse --short HEAD) + test G = $(git cat-file commit HEAD | sed -ne \$p) ' test_expect_success 'stop on conflicting pick' ' - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/file1 b/file1 - index $blob1..$blob2 100644 + index f70f10e..fd79235 100644 --- a/file1 +++ b/file1 @@ -1 +1 @@ -A +G EOF - cat >expect2 <<-EOF && + cat >expect2 <<-\EOF && <<<<<<< HEAD D ======= G - >>>>>>> $commit... G + >>>>>>> 5d18e54... G EOF git tag new-branch1 && + set_fake_editor && test_must_fail git rebase -i master && test "$(git rev-parse HEAD~3)" = "$(git rev-parse master)" && test_cmp expect .git/rebase-merge/patch && @@ -287,6 +283,7 @@ test_expect_success 'abort' ' test_expect_success 'abort with error when new base cannot be checked out' ' git rm --cached file1 && git commit -m "remove file in base" && + set_fake_editor && test_must_fail git rebase -i master > output 2>&1 && test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" \ output && @@ -301,6 +298,7 @@ test_expect_success 'retain authorship' ' test_tick && GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" && git tag twerp && + set_fake_editor && git rebase -i --onto master HEAD^ && git show HEAD | grep "^Author: Twerp Snog" ' @@ -318,6 +316,7 @@ test_expect_success 'retain authorship w/ conflicts' ' test_commit b conflict b conflict-b && GIT_AUTHOR_NAME=$oGIT_AUTHOR_NAME && + set_fake_editor && test_must_fail git rebase -i conflict-a && echo resolved >conflict && git add conflict && @@ -333,11 +332,9 @@ test_expect_success 'squash' ' test_tick && GIT_AUTHOR_NAME="Nitfol" git commit -m "nitfol" file7 && echo "******************************" && - ( - set_fake_editor && - FAKE_LINES="1 squash 2" EXPECT_HEADER_COUNT=2 \ - git rebase -i --onto master HEAD~2 - ) && + set_fake_editor && + FAKE_LINES="1 squash 2" EXPECT_HEADER_COUNT=2 \ + git rebase -i --onto master HEAD~2 && test B = $(cat file7) && test $(git rev-parse HEAD^) = $(git rev-parse master) ' @@ -348,6 +345,7 @@ test_expect_success 'retain authorship when squashing' ' test_expect_success REBASE_P '-p handles "no changes" gracefully' ' HEAD=$(git rev-parse HEAD) && + set_fake_editor && git rebase -i -p HEAD^ && git update-index --refresh && git diff-files --quiet && @@ -357,10 +355,8 @@ test_expect_success REBASE_P '-p handles "no changes" gracefully' ' test_expect_failure REBASE_P 'exchange two commits with -p' ' git checkout H && - ( - set_fake_editor && - FAKE_LINES="2 1" git rebase -i -p HEAD~2 - ) && + set_fake_editor && + FAKE_LINES="2 1" git rebase -i -p HEAD~2 && test H = $(git cat-file commit HEAD^ | sed -ne \$p) && test G = $(git cat-file commit HEAD | sed -ne \$p) ' @@ -394,6 +390,7 @@ test_expect_success REBASE_P 'preserve merges with -p' ' git commit -m M file1 && git checkout -b to-be-rebased && test_tick && + set_fake_editor && git rebase -i -p --onto branch1 master && git update-index --refresh && git diff-files --quiet && @@ -408,10 +405,8 @@ test_expect_success REBASE_P 'preserve merges with -p' ' ' test_expect_success REBASE_P 'edit ancestor with -p' ' - ( - set_fake_editor && - FAKE_LINES="1 2 edit 3 4" git rebase -i -p HEAD~3 - ) && + set_fake_editor && + FAKE_LINES="1 2 edit 3 4" git rebase -i -p HEAD~3 && echo 2 > unrelated-file && test_tick && git commit -m L2-modified --amend unrelated-file && @@ -425,13 +420,11 @@ test_expect_success REBASE_P 'edit ancestor with -p' ' test_expect_success '--continue tries to commit' ' git reset --hard D && test_tick && - ( - set_fake_editor && - test_must_fail git rebase -i --onto new-branch1 HEAD^ && - echo resolved > file1 && - git add file1 && - FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue - ) && + set_fake_editor && + test_must_fail git rebase -i --onto new-branch1 HEAD^ && + echo resolved > file1 && + git add file1 && + FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue && test $(git rev-parse HEAD^) = $(git rev-parse new-branch1) && git show HEAD | grep chouette ' @@ -439,6 +432,7 @@ test_expect_success '--continue tries to commit' ' test_expect_success 'verbose flag is heeded, even after --continue' ' git reset --hard master@{1} && test_tick && + set_fake_editor && test_must_fail git rebase -v -i --onto new-branch1 HEAD^ && echo resolved > file1 && git add file1 && @@ -448,13 +442,10 @@ test_expect_success 'verbose flag is heeded, even after --continue' ' test_expect_success C_LOCALE_OUTPUT 'multi-squash only fires up editor once' ' base=$(git rev-parse HEAD~4) && - ( - set_fake_editor && - FAKE_COMMIT_AMEND="ONCE" \ - FAKE_LINES="1 squash 2 squash 3 squash 4" \ - EXPECT_HEADER_COUNT=4 \ - git rebase -i $base - ) && + set_fake_editor && + FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="1 squash 2 squash 3 squash 4" \ + EXPECT_HEADER_COUNT=4 \ + git rebase -i $base && test $base = $(git rev-parse HEAD^) && test 1 = $(git show | grep ONCE | wc -l) ' @@ -462,12 +453,9 @@ test_expect_success C_LOCALE_OUTPUT 'multi-squash only fires up editor once' ' test_expect_success C_LOCALE_OUTPUT 'multi-fixup does not fire up editor' ' git checkout -b multi-fixup E && base=$(git rev-parse HEAD~4) && - ( - set_fake_editor && - FAKE_COMMIT_AMEND="NEVER" \ - FAKE_LINES="1 fixup 2 fixup 3 fixup 4" \ - git rebase -i $base - ) && + set_fake_editor && + FAKE_COMMIT_AMEND="NEVER" FAKE_LINES="1 fixup 2 fixup 3 fixup 4" \ + git rebase -i $base && test $base = $(git rev-parse HEAD^) && test 0 = $(git show | grep NEVER | wc -l) && git checkout @{-1} && @@ -477,15 +465,12 @@ test_expect_success C_LOCALE_OUTPUT 'multi-fixup does not fire up editor' ' test_expect_success 'commit message used after conflict' ' git checkout -b conflict-fixup conflict-branch && base=$(git rev-parse HEAD~4) && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="1 fixup 3 fixup 4" \ - git rebase -i $base && - echo three > conflict && - git add conflict && - FAKE_COMMIT_AMEND="ONCE" EXPECT_HEADER_COUNT=2 \ - git rebase --continue - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="1 fixup 3 fixup 4" git rebase -i $base && + echo three > conflict && + git add conflict && + FAKE_COMMIT_AMEND="ONCE" EXPECT_HEADER_COUNT=2 \ + git rebase --continue && test $base = $(git rev-parse HEAD^) && test 1 = $(git show | grep ONCE | wc -l) && git checkout @{-1} && @@ -495,15 +480,12 @@ test_expect_success 'commit message used after conflict' ' test_expect_success 'commit message retained after conflict' ' git checkout -b conflict-squash conflict-branch && base=$(git rev-parse HEAD~4) && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="1 fixup 3 squash 4" \ - git rebase -i $base && - echo three > conflict && - git add conflict && - FAKE_COMMIT_AMEND="TWICE" EXPECT_HEADER_COUNT=2 \ - git rebase --continue - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="1 fixup 3 squash 4" git rebase -i $base && + echo three > conflict && + git add conflict && + FAKE_COMMIT_AMEND="TWICE" EXPECT_HEADER_COUNT=2 \ + git rebase --continue && test $base = $(git rev-parse HEAD^) && test 2 = $(git show | grep TWICE | wc -l) && git checkout @{-1} && @@ -520,13 +502,10 @@ test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messa EOF git checkout -b squash-fixup E && base=$(git rev-parse HEAD~4) && - ( - set_fake_editor && - FAKE_COMMIT_AMEND="ONCE" \ - FAKE_LINES="1 fixup 2 squash 3 fixup 4" \ - EXPECT_HEADER_COUNT=4 \ - git rebase -i $base - ) && + set_fake_editor && + FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="1 fixup 2 squash 3 fixup 4" \ + EXPECT_HEADER_COUNT=4 \ + git rebase -i $base && git cat-file commit HEAD | sed -e 1,/^\$/d > actual-squash-fixup && test_cmp expect-squash-fixup actual-squash-fixup && git cat-file commit HEAD@{2} | @@ -540,13 +519,10 @@ test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messa test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' ' git checkout -b skip-comments E && base=$(git rev-parse HEAD~4) && - ( - set_fake_editor && - FAKE_COMMIT_AMEND="ONCE" \ - FAKE_LINES="# 1 # squash 2 # squash 3 # squash 4 #" \ - EXPECT_HEADER_COUNT=4 \ - git rebase -i $base - ) && + set_fake_editor && + FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="# 1 # squash 2 # squash 3 # squash 4 #" \ + EXPECT_HEADER_COUNT=4 \ + git rebase -i $base && test $base = $(git rev-parse HEAD^) && test 1 = $(git show | grep ONCE | wc -l) && git checkout @{-1} && @@ -556,13 +532,10 @@ test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' ' test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' ' git checkout -b skip-blank-lines E && base=$(git rev-parse HEAD~4) && - ( - set_fake_editor && - FAKE_COMMIT_AMEND="ONCE" \ - FAKE_LINES="> 1 > squash 2 > squash 3 > squash 4 >" \ - EXPECT_HEADER_COUNT=4 \ - git rebase -i $base - ) && + set_fake_editor && + FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="> 1 > squash 2 > squash 3 > squash 4 >" \ + EXPECT_HEADER_COUNT=4 \ + git rebase -i $base && test $base = $(git rev-parse HEAD^) && test 1 = $(git show | grep ONCE | wc -l) && git checkout @{-1} && @@ -572,21 +545,17 @@ test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' ' test_expect_success 'squash works as expected' ' git checkout -b squash-works no-conflict-branch && one=$(git rev-parse HEAD~3) && - ( - set_fake_editor && - FAKE_LINES="1 s 3 2" EXPECT_HEADER_COUNT=2 git rebase -i HEAD~3 - ) && + set_fake_editor && + FAKE_LINES="1 s 3 2" EXPECT_HEADER_COUNT=2 \ + git rebase -i HEAD~3 && test $one = $(git rev-parse HEAD~2) ' test_expect_success 'interrupted squash works as expected' ' git checkout -b interrupted-squash conflict-branch && one=$(git rev-parse HEAD~3) && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="1 squash 3 2" \ - git rebase -i HEAD~3 - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="1 squash 3 2" git rebase -i HEAD~3 && test_write_lines one two four > conflict && git add conflict && test_must_fail git rebase --continue && @@ -599,11 +568,8 @@ test_expect_success 'interrupted squash works as expected' ' test_expect_success 'interrupted squash works as expected (case 2)' ' git checkout -b interrupted-squash2 conflict-branch && one=$(git rev-parse HEAD~3) && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="3 squash 1 2" \ - git rebase -i HEAD~3 - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="3 squash 1 2" git rebase -i HEAD~3 && test_write_lines one four > conflict && git add conflict && test_must_fail git rebase --continue && @@ -623,13 +589,11 @@ test_expect_success '--continue tries to commit, even for "edit"' ' git commit -m "unrelated change" && parent=$(git rev-parse HEAD^) && test_tick && - ( - set_fake_editor && - FAKE_LINES="edit 1" git rebase -i HEAD^ && - echo edited > file7 && - git add file7 && - FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue - ) && + set_fake_editor && + FAKE_LINES="edit 1" git rebase -i HEAD^ && + echo edited > file7 && + git add file7 && + FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue && test edited = $(git show HEAD:file7) && git show HEAD | grep chouette && test $parent = $(git rev-parse HEAD^) @@ -638,41 +602,34 @@ test_expect_success '--continue tries to commit, even for "edit"' ' test_expect_success 'aborted --continue does not squash commits after "edit"' ' old=$(git rev-parse HEAD) && test_tick && - ( - set_fake_editor && - FAKE_LINES="edit 1" git rebase -i HEAD^ && - echo "edited again" > file7 && - git add file7 && - test_must_fail env FAKE_COMMIT_MESSAGE=" " git rebase --continue - ) && + set_fake_editor && + FAKE_LINES="edit 1" git rebase -i HEAD^ && + echo "edited again" > file7 && + git add file7 && + test_must_fail env FAKE_COMMIT_MESSAGE=" " git rebase --continue && test $old = $(git rev-parse HEAD) && git rebase --abort ' test_expect_success 'auto-amend only edited commits after "edit"' ' test_tick && - ( - set_fake_editor && - FAKE_LINES="edit 1" git rebase -i HEAD^ && - echo "edited again" > file7 && - git add file7 && - FAKE_COMMIT_MESSAGE="edited file7 again" git commit && - echo "and again" > file7 && - git add file7 && - test_tick && - test_must_fail env FAKE_COMMIT_MESSAGE="and again" \ - git rebase --continue - ) && + set_fake_editor && + FAKE_LINES="edit 1" git rebase -i HEAD^ && + echo "edited again" > file7 && + git add file7 && + FAKE_COMMIT_MESSAGE="edited file7 again" git commit && + echo "and again" > file7 && + git add file7 && + test_tick && + test_must_fail env FAKE_COMMIT_MESSAGE="and again" git rebase --continue && git rebase --abort ' test_expect_success 'clean error after failed "exec"' ' test_tick && test_when_finished "git rebase --abort || :" && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="1 exec_false" git rebase -i HEAD^ - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="1 exec_false" git rebase -i HEAD^ && echo "edited again" > file7 && git add file7 && test_must_fail git rebase --continue 2>error && @@ -683,10 +640,8 @@ test_expect_success 'rebase a detached HEAD' ' grandparent=$(git rev-parse HEAD~2) && git checkout $(git rev-parse HEAD) && test_tick && - ( - set_fake_editor && - FAKE_LINES="2 1" git rebase -i HEAD~2 - ) && + set_fake_editor && + FAKE_LINES="2 1" git rebase -i HEAD~2 && test $grandparent = $(git rev-parse HEAD~2) ' @@ -701,10 +656,9 @@ test_expect_success 'rebase a commit violating pre-commit' ' test_must_fail git commit -m doesnt-verify file1 && git commit -m doesnt-verify --no-verify file1 && test_tick && - ( - set_fake_editor && - FAKE_LINES=2 git rebase -i HEAD~2 - ) + set_fake_editor && + FAKE_LINES=2 git rebase -i HEAD~2 + ' test_expect_success 'rebase with a file named HEAD in worktree' ' @@ -724,10 +678,8 @@ test_expect_success 'rebase with a file named HEAD in worktree' ' git commit -m "Add body" ) && - ( - set_fake_editor && - FAKE_LINES="1 squash 2" git rebase -i @{-1} - ) && + set_fake_editor && + FAKE_LINES="1 squash 2" git rebase -i @{-1} && test "$(git show -s --pretty=format:%an)" = "Squashed Away" ' @@ -738,6 +690,7 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' ' GIT_EDITOR=: git commit --amend \ --author="Somebody else " && test $(git rev-parse branch3) != $(git rev-parse branch4) && + set_fake_editor && git rebase -i branch3 && test $(git rev-parse branch3) = $(git rev-parse branch4) @@ -762,14 +715,13 @@ test_expect_success 'submodule rebase setup' ' git commit -a -m "submodule second" ) && test_tick && + set_fake_editor && git commit -a -m "Three changes submodule" ' test_expect_success 'submodule rebase -i' ' - ( - set_fake_editor && - FAKE_LINES="1 squash 2 3" git rebase -i A - ) + set_fake_editor && + FAKE_LINES="1 squash 2 3" git rebase -i A ' test_expect_success 'submodule conflict setup' ' @@ -786,6 +738,7 @@ test_expect_success 'submodule conflict setup' ' ' test_expect_success 'rebase -i continue with only submodule staged' ' + set_fake_editor && test_must_fail git rebase -i submodule-base && git add sub && git rebase --continue && @@ -795,6 +748,7 @@ test_expect_success 'rebase -i continue with only submodule staged' ' test_expect_success 'rebase -i continue with unstaged submodule' ' git checkout submodule-topic && git reset --hard && + set_fake_editor && test_must_fail git rebase -i submodule-base && git reset && git rebase --continue && @@ -807,6 +761,7 @@ test_expect_success 'avoid unnecessary reset' ' test-tool chmtime =123456789 file3 && git update-index --refresh && HEAD=$(git rev-parse HEAD) && + set_fake_editor && git rebase -i HEAD~4 && test $HEAD = $(git rev-parse HEAD) && MTIME=$(test-tool chmtime --get file3) && @@ -815,22 +770,16 @@ test_expect_success 'avoid unnecessary reset' ' test_expect_success 'reword' ' git checkout -b reword-branch master && - ( - set_fake_editor && - FAKE_LINES="1 2 3 reword 4" FAKE_COMMIT_MESSAGE="E changed" \ - git rebase -i A && - git show HEAD | grep "E changed" && - test $(git rev-parse master) != $(git rev-parse HEAD) && - test $(git rev-parse master^) = $(git rev-parse HEAD^) && - FAKE_LINES="1 2 reword 3 4" FAKE_COMMIT_MESSAGE="D changed" \ - git rebase -i A && - git show HEAD^ | grep "D changed" && - FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" \ - git rebase -i A && - git show HEAD~3 | grep "B changed" && - FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" \ - git rebase -i A - ) && + set_fake_editor && + FAKE_LINES="1 2 3 reword 4" FAKE_COMMIT_MESSAGE="E changed" git rebase -i A && + git show HEAD | grep "E changed" && + test $(git rev-parse master) != $(git rev-parse HEAD) && + test $(git rev-parse master^) = $(git rev-parse HEAD^) && + FAKE_LINES="1 2 reword 3 4" FAKE_COMMIT_MESSAGE="D changed" git rebase -i A && + git show HEAD^ | grep "D changed" && + FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" git rebase -i A && + git show HEAD~3 | grep "B changed" && + FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A && git show HEAD~2 | grep "C changed" ' @@ -841,6 +790,7 @@ test_expect_success 'rebase -i can copy notes' ' test_commit n2 && test_commit n3 && git notes add -m"a note" n3 && + set_fake_editor && git rebase -i --onto n1 n2 && test "a note" = "$(git notes show HEAD)" ' @@ -853,11 +803,8 @@ test_expect_success 'rebase -i can copy notes over a fixup' ' EOF git reset --hard n3 && git notes add -m"an earlier note" n2 && - ( - set_fake_editor && - GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 f 2" \ - git rebase -i n1 - ) && + set_fake_editor && + GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 f 2" git rebase -i n1 && git notes show > output && test_cmp expect output ' @@ -866,10 +813,8 @@ test_expect_success 'rebase while detaching HEAD' ' git symbolic-ref HEAD && grandparent=$(git rev-parse HEAD~2) && test_tick && - ( - set_fake_editor && - FAKE_LINES="2 1" git rebase -i HEAD~2 HEAD^0 - ) && + set_fake_editor && + FAKE_LINES="2 1" git rebase -i HEAD~2 HEAD^0 && test $grandparent = $(git rev-parse HEAD~2) && test_must_fail git symbolic-ref HEAD ' @@ -878,6 +823,7 @@ test_tick # Ensure that the rebased commits get a different timestamp. test_expect_success 'always cherry-pick with --no-ff' ' git checkout no-ff-branch && git tag original-no-ff-branch && + set_fake_editor && git rebase -i --no-ff A && for p in 0 1 2 do @@ -909,10 +855,8 @@ test_expect_success 'set up commits with funny messages' ' test_expect_success 'rebase-i history with funny messages' ' git rev-list A..funny >expect && test_tick && - ( - set_fake_editor && - FAKE_LINES="1 2 3 4" git rebase -i A - ) && + set_fake_editor && + FAKE_LINES="1 2 3 4" git rebase -i A && git rev-list A.. >actual && test_cmp expect actual ' @@ -926,9 +870,9 @@ test_expect_success 'prepare for rebase -i --exec' ' ' test_expect_success 'running "git rebase -i --exec git show HEAD"' ' + set_fake_editor && + git rebase -i --exec "git show HEAD" HEAD~2 >actual && ( - set_fake_editor && - git rebase -i --exec "git show HEAD" HEAD~2 >actual && FAKE_LINES="1 exec_git_show_HEAD 2 exec_git_show_HEAD" && export FAKE_LINES && git rebase -i HEAD~2 >expect @@ -939,9 +883,9 @@ test_expect_success 'running "git rebase -i --exec git show HEAD"' ' test_expect_success 'running "git rebase --exec git show HEAD -i"' ' git reset --hard execute && + set_fake_editor && + git rebase --exec "git show HEAD" -i HEAD~2 >actual && ( - set_fake_editor && - git rebase --exec "git show HEAD" -i HEAD~2 >actual && FAKE_LINES="1 exec_git_show_HEAD 2 exec_git_show_HEAD" && export FAKE_LINES && git rebase -i HEAD~2 >expect @@ -952,9 +896,9 @@ test_expect_success 'running "git rebase --exec git show HEAD -i"' ' test_expect_success 'running "git rebase -ix git show HEAD"' ' git reset --hard execute && + set_fake_editor && + git rebase -ix "git show HEAD" HEAD~2 >actual && ( - set_fake_editor && - git rebase -ix "git show HEAD" HEAD~2 >actual && FAKE_LINES="1 exec_git_show_HEAD 2 exec_git_show_HEAD" && export FAKE_LINES && git rebase -i HEAD~2 >expect @@ -966,9 +910,9 @@ test_expect_success 'running "git rebase -ix git show HEAD"' ' test_expect_success 'rebase -ix with several ' ' git reset --hard execute && + set_fake_editor && + git rebase -ix "git show HEAD; pwd" HEAD~2 >actual && ( - set_fake_editor && - git rebase -ix "git show HEAD; pwd" HEAD~2 >actual && FAKE_LINES="1 exec_git_show_HEAD;_pwd 2 exec_git_show_HEAD;_pwd" && export FAKE_LINES && git rebase -i HEAD~2 >expect @@ -979,9 +923,9 @@ test_expect_success 'rebase -ix with several ' ' test_expect_success 'rebase -ix with several instances of --exec' ' git reset --hard execute && + set_fake_editor && + git rebase -i --exec "git show HEAD" --exec "pwd" HEAD~2 >actual && ( - set_fake_editor && - git rebase -i --exec "git show HEAD" --exec "pwd" HEAD~2 >actual && FAKE_LINES="1 exec_git_show_HEAD exec_pwd 2 exec_git_show_HEAD exec_pwd" && export FAKE_LINES && @@ -1000,11 +944,13 @@ test_expect_success C_LOCALE_OUTPUT 'rebase -ix with --autosquash' ' echo bis >bis.txt && git add bis.txt && git commit -m "fixup! two_exec" && - git checkout -b autosquash_actual && - git rebase -i --exec "git show HEAD" --autosquash HEAD~4 >actual && + set_fake_editor && + ( + git checkout -b autosquash_actual && + git rebase -i --exec "git show HEAD" --autosquash HEAD~4 >actual + ) && git checkout autosquash && ( - set_fake_editor && git checkout -b autosquash_expected && FAKE_LINES="1 fixup 3 fixup 4 exec_git_show_HEAD 2 exec_git_show_HEAD" && export FAKE_LINES && @@ -1025,6 +971,7 @@ test_expect_success 'rebase --exec works without -i ' ' test_expect_success 'rebase -i --exec without ' ' git reset --hard execute && + set_fake_editor && test_must_fail git rebase -i --exec 2>actual && test_i18ngrep "requires a value" actual && git checkout master @@ -1032,10 +979,8 @@ test_expect_success 'rebase -i --exec without ' ' test_expect_success 'rebase -i --root re-order and drop commits' ' git checkout E && - ( - set_fake_editor && - FAKE_LINES="3 1 2 5" git rebase -i --root - ) && + set_fake_editor && + FAKE_LINES="3 1 2 5" git rebase -i --root && test E = $(git cat-file commit HEAD | sed -ne \$p) && test B = $(git cat-file commit HEAD^ | sed -ne \$p) && test A = $(git cat-file commit HEAD^^ | sed -ne \$p) && @@ -1048,59 +993,39 @@ test_expect_success 'rebase -i --root retain root commit author and message' ' echo B >file7 && git add file7 && GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" && - ( - set_fake_editor && - FAKE_LINES="2" git rebase -i --root - ) && + set_fake_editor && + FAKE_LINES="2" git rebase -i --root && git cat-file commit HEAD | grep -q "^author Twerp Snog" && git cat-file commit HEAD | grep -q "^different author$" ' test_expect_success 'rebase -i --root temporary sentinel commit' ' git checkout B && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="2" git rebase -i --root - ) && - git cat-file commit HEAD | grep "^tree $EMPTY_TREE" && + set_fake_editor && + test_must_fail env FAKE_LINES="2" git rebase -i --root && + git cat-file commit HEAD | grep "^tree 4b825dc642cb" && git rebase --abort ' test_expect_success 'rebase -i --root fixup root commit' ' git checkout B && - ( - set_fake_editor && - FAKE_LINES="1 fixup 2" git rebase -i --root - ) && + set_fake_editor && + FAKE_LINES="1 fixup 2" git rebase -i --root && test A = $(git cat-file commit HEAD | sed -ne \$p) && test B = $(git show HEAD:file1) && test 0 = $(git cat-file commit HEAD | grep -c ^parent\ ) ' -test_expect_success 'rebase -i --root reword original root commit' ' +test_expect_success 'rebase -i --root reword root commit' ' test_when_finished "test_might_fail git rebase --abort" && - git checkout -b reword-original-root-branch master && - ( - set_fake_editor && - FAKE_LINES="reword 1 2" FAKE_COMMIT_MESSAGE="A changed" \ - git rebase -i --root - ) && + git checkout -b reword-root-branch master && + set_fake_editor && + FAKE_LINES="reword 1 2" FAKE_COMMIT_MESSAGE="A changed" \ + git rebase -i --root && git show HEAD^ | grep "A changed" && test -z "$(git show -s --format=%p HEAD^)" ' -test_expect_success 'rebase -i --root reword new root commit' ' - test_when_finished "test_might_fail git rebase --abort" && - git checkout -b reword-now-root-branch master && - ( - set_fake_editor && - FAKE_LINES="reword 3 1" FAKE_COMMIT_MESSAGE="C changed" \ - git rebase -i --root - ) && - git show HEAD^ | grep "C changed" && - test -z "$(git show -s --format=%p HEAD^)" -' - test_expect_success 'rebase -i --root when root has untracked file conflict' ' test_when_finished "reset_rebase" && git checkout -b failing-root-pick A && @@ -1108,10 +1033,8 @@ test_expect_success 'rebase -i --root when root has untracked file conflict' ' git rm file1 && git commit -m "remove file 1 add file 2" && echo z >file1 && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="1 2" git rebase -i --root - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="1 2" git rebase -i --root && rm file1 && git rebase --continue && test "$(git log -1 --format=%B)" = "remove file 1 add file 2" && @@ -1121,38 +1044,32 @@ test_expect_success 'rebase -i --root when root has untracked file conflict' ' test_expect_success 'rebase -i --root reword root when root has untracked file conflict' ' test_when_finished "reset_rebase" && echo z>file1 && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="reword 1 2" \ - FAKE_COMMIT_MESSAGE="Modified A" git rebase -i --root && - rm file1 && - FAKE_COMMIT_MESSAGE="Reworded A" git rebase --continue - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="reword 1 2" \ + FAKE_COMMIT_MESSAGE="Modified A" git rebase -i --root && + rm file1 && + FAKE_COMMIT_MESSAGE="Reworded A" git rebase --continue && test "$(git log -1 --format=%B HEAD^)" = "Reworded A" && test "$(git rev-list --count HEAD)" = 2 ' test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-interactive rebase' ' - git checkout reword-original-root-branch && + git checkout reword-root-branch && git reset --hard && git checkout conflict-branch && - ( - set_fake_editor && - test_must_fail git rebase -f --apply --onto HEAD~2 HEAD~ && - test_must_fail git rebase --edit-todo - ) && + set_fake_editor && + test_must_fail git rebase --onto HEAD~2 HEAD~ && + test_must_fail git rebase --edit-todo && git rebase --abort ' test_expect_success 'rebase --edit-todo can be used to modify todo' ' git reset --hard && git checkout no-conflict-branch^0 && - ( - set_fake_editor && - FAKE_LINES="edit 1 2 3" git rebase -i HEAD~3 && - FAKE_LINES="2 1" git rebase --edit-todo && - git rebase --continue - ) && + set_fake_editor && + FAKE_LINES="edit 1 2 3" git rebase -i HEAD~3 && + FAKE_LINES="2 1" git rebase --edit-todo && + git rebase --continue && test M = $(git cat-file commit HEAD^ | sed -ne \$p) && test L = $(git cat-file commit HEAD | sed -ne \$p) ' @@ -1160,12 +1077,13 @@ test_expect_success 'rebase --edit-todo can be used to modify todo' ' test_expect_success 'rebase -i produces readable reflog' ' git reset --hard && git branch -f branch-reflog-test H && + set_fake_editor && git rebase -i --onto I F branch-reflog-test && cat >expect <<-\EOF && - rebase (finish): returning to refs/heads/branch-reflog-test - rebase (pick): H - rebase (pick): G - rebase (start): checkout I + rebase -i (finish): returning to refs/heads/branch-reflog-test + rebase -i (pick): H + rebase -i (pick): G + rebase -i (start): checkout I EOF git reflog -n4 HEAD | sed "s/[^:]*: //" >actual && @@ -1180,10 +1098,8 @@ test_expect_success 'rebase -i respects core.commentchar' ' sed -e "2,\$s/^/\\\\/" "$1" >"$1.tmp" && mv "$1.tmp" "$1" EOF - ( - test_set_editor "$(pwd)/remove-all-but-first.sh" && - git rebase -i B - ) && + test_set_editor "$(pwd)/remove-all-but-first.sh" && + git rebase -i B && test B = $(git cat-file commit HEAD^ | sed -ne \$p) ' @@ -1192,11 +1108,9 @@ test_expect_success 'rebase -i respects core.commentchar=auto' ' write_script copy-edit-script.sh <<-\EOF && cp "$1" edit-script EOF + test_set_editor "$(pwd)/copy-edit-script.sh" && test_when_finished "git rebase --abort || :" && - ( - test_set_editor "$(pwd)/copy-edit-script.sh" && - git rebase -i HEAD^ - ) && + git rebase -i HEAD^ && test -z "$(grep -ve "^#" -e "^\$" -e "^pick" edit-script)" ' @@ -1231,11 +1145,8 @@ test_expect_success 'interrupted rebase -i with --strategy and -X' ' echo five >conflict && echo Z >file1 && git commit -a -m "one file conflict" && - ( - set_fake_editor && - FAKE_LINES="edit 1 2" git rebase -i --strategy=recursive \ - -Xours conflict-branch - ) && + set_fake_editor && + FAKE_LINES="edit 1 2" git rebase -i --strategy=recursive -Xours conflict-branch && git rebase --continue && test $(git show conflict-branch:conflict) = $(cat conflict) && test $(cat file1) = Z @@ -1250,7 +1161,7 @@ test_expect_success 'rebase -i error on commits with \ in message' ' test_expect_code 1 grep " emp" error ' -test_expect_success SHA1 'short SHA-1 setup' ' +test_expect_success 'short SHA-1 setup' ' test_when_finished "git checkout master" && git checkout --orphan collide && git rm -rf . && @@ -1262,37 +1173,22 @@ test_expect_success SHA1 'short SHA-1 setup' ' ) ' -test_expect_success SHA1 'short SHA-1 collide' ' +test_expect_success 'short SHA-1 collide' ' test_when_finished "reset_rebase && git checkout master" && git checkout collide && - colliding_sha1=6bcda37 && - test $colliding_sha1 = "$(git rev-parse HEAD | cut -c 1-7)" && ( - unset test_tick && - test_tick && - set_fake_editor && - FAKE_COMMIT_MESSAGE="collide2 ac4f2ee" \ - FAKE_LINES="reword 1 break 2" git rebase -i HEAD~2 && - test $colliding_sha1 = "$(git rev-parse HEAD | cut -c 1-7)" && - grep "^pick $colliding_sha1 " \ - .git/rebase-merge/git-rebase-todo.tmp && - grep "^pick [0-9a-f]\{40\}" \ - .git/rebase-merge/git-rebase-todo && - grep "^pick [0-9a-f]\{40\}" \ - .git/rebase-merge/git-rebase-todo.backup && - git rebase --continue - ) && - collide2="$(git rev-parse HEAD~1 | cut -c 1-4)" && - collide3="$(git rev-parse collide3 | cut -c 1-4)" && - test "$collide2" = "$collide3" + unset test_tick && + test_tick && + set_fake_editor && + FAKE_COMMIT_MESSAGE="collide2 ac4f2ee" \ + FAKE_LINES="reword 1 2" git rebase -i HEAD~2 + ) ' test_expect_success 'respect core.abbrev' ' git config core.abbrev 12 && - ( - set_cat_todo_editor && - test_must_fail git rebase -i HEAD~4 >todo-list - ) && + set_cat_todo_editor && + test_must_fail git rebase -i HEAD~4 >todo-list && test 4 = $(grep -c "pick [0-9a-f]\{12,\}" todo-list) ' @@ -1300,20 +1196,16 @@ test_expect_success 'todo count' ' write_script dump-raw.sh <<-\EOF && cat "$1" EOF - ( - test_set_editor "$(pwd)/dump-raw.sh" && - git rebase -i HEAD~4 >actual - ) && + test_set_editor "$(pwd)/dump-raw.sh" && + git rebase -i HEAD~4 >actual && test_i18ngrep "^# Rebase ..* onto ..* ([0-9]" actual ' test_expect_success 'rebase -i commits that overwrite untracked files (pick)' ' git checkout --force branch2 && git clean -f && - ( - set_fake_editor && - FAKE_LINES="edit 1 2" git rebase -i A - ) && + set_fake_editor && + FAKE_LINES="edit 1 2" git rebase -i A && test_cmp_rev HEAD F && test_path_is_missing file6 && >file6 && @@ -1328,10 +1220,8 @@ test_expect_success 'rebase -i commits that overwrite untracked files (squash)' git checkout --force branch2 && git clean -f && git tag original-branch2 && - ( - set_fake_editor && - FAKE_LINES="edit 1 squash 2" git rebase -i A - ) && + set_fake_editor && + FAKE_LINES="edit 1 squash 2" git rebase -i A && test_cmp_rev HEAD F && test_path_is_missing file6 && >file6 && @@ -1346,10 +1236,8 @@ test_expect_success 'rebase -i commits that overwrite untracked files (squash)' test_expect_success 'rebase -i commits that overwrite untracked files (no ff)' ' git checkout --force branch2 && git clean -f && - ( - set_fake_editor && - FAKE_LINES="edit 1 2" git rebase -i --no-ff A - ) && + set_fake_editor && + FAKE_LINES="edit 1 2" git rebase -i --no-ff A && test $(git cat-file commit HEAD | sed -ne \$p) = F && test_path_is_missing file6 && >file6 && @@ -1372,10 +1260,8 @@ test_expect_success 'rebase --continue removes CHERRY_PICK_HEAD' ' git tag seq-onto && git reset --hard HEAD~2 && git cherry-pick seq-onto && - ( - set_fake_editor && - test_must_fail env FAKE_LINES= git rebase -i seq-onto - ) && + set_fake_editor && + test_must_fail env FAKE_LINES= git rebase -i seq-onto && test -d .git/rebase-merge && git rebase --continue && git diff --exit-code seq-onto && @@ -1394,10 +1280,8 @@ rebase_setup_and_clean () { test_expect_success 'drop' ' rebase_setup_and_clean drop-test && - ( - set_fake_editor && - FAKE_LINES="1 drop 2 3 d 4 5" git rebase -i --root - ) && + set_fake_editor && + FAKE_LINES="1 drop 2 3 d 4 5" git rebase -i --root && test E = $(git cat-file commit HEAD | sed -ne \$p) && test C = $(git cat-file commit HEAD^ | sed -ne \$p) && test A = $(git cat-file commit HEAD^^ | sed -ne \$p) @@ -1406,10 +1290,9 @@ test_expect_success 'drop' ' test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' ' test_config rebase.missingCommitsCheck ignore && rebase_setup_and_clean missing-commit && - ( - set_fake_editor && - FAKE_LINES="1 2 3 4" git rebase -i --root 2>actual - ) && + set_fake_editor && + FAKE_LINES="1 2 3 4" \ + git rebase -i --root 2>actual && test D = $(git cat-file commit HEAD | sed -ne \$p) && test_i18ngrep \ "Successfully rebased and updated refs/heads/missing-commit" \ @@ -1425,10 +1308,9 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' ' EOF test_config rebase.missingCommitsCheck warn && rebase_setup_and_clean missing-commit && - ( - set_fake_editor && - FAKE_LINES="1 2 3 4" git rebase -i --root 2>actual.2 - ) && + set_fake_editor && + FAKE_LINES="1 2 3 4" \ + git rebase -i --root 2>actual.2 && head -n4 actual.2 >actual && test_i18ncmp expect actual && test D = $(git cat-file commit HEAD | sed -ne \$p) @@ -1450,141 +1332,19 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' ' EOF test_config rebase.missingCommitsCheck error && rebase_setup_and_clean missing-commit && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="1 2 4" \ - git rebase -i --root 2>actual && - test_i18ncmp expect actual && - cp .git/rebase-merge/git-rebase-todo.backup \ - .git/rebase-merge/git-rebase-todo && - FAKE_LINES="1 2 drop 3 4 drop 5" git rebase --edit-todo - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="1 2 4" \ + git rebase -i --root 2>actual && + test_i18ncmp expect actual && + cp .git/rebase-merge/git-rebase-todo.backup \ + .git/rebase-merge/git-rebase-todo && + FAKE_LINES="1 2 drop 3 4 drop 5" \ + git rebase --edit-todo && git rebase --continue && test D = $(git cat-file commit HEAD | sed -ne \$p) && test B = $(git cat-file commit HEAD^ | sed -ne \$p) ' -test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = ignore' ' - test_config rebase.missingCommitsCheck ignore && - rebase_setup_and_clean missing-commit && - ( - set_fake_editor && - FAKE_LINES="break 1 2 3 4 5" git rebase -i --root && - FAKE_LINES="1 2 3 4" git rebase --edit-todo && - git rebase --continue 2>actual - ) && - test D = $(git cat-file commit HEAD | sed -ne \$p) && - test_i18ngrep \ - "Successfully rebased and updated refs/heads/missing-commit" \ - actual -' - -test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = warn' ' - cat >expect <<-EOF && - error: invalid line 1: badcmd $(git rev-list --pretty=oneline --abbrev-commit -1 master~4) - Warning: some commits may have been dropped accidentally. - Dropped commits (newer to older): - - $(git rev-list --pretty=oneline --abbrev-commit -1 master) - - $(git rev-list --pretty=oneline --abbrev-commit -1 master~4) - To avoid this message, use "drop" to explicitly remove a commit. - EOF - head -n4 expect >expect.2 && - tail -n1 expect >>expect.2 && - tail -n4 expect.2 >expect.3 && - test_config rebase.missingCommitsCheck warn && - rebase_setup_and_clean missing-commit && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="bad 1 2 3 4 5" \ - git rebase -i --root && - cp .git/rebase-merge/git-rebase-todo.backup orig && - FAKE_LINES="2 3 4" git rebase --edit-todo 2>actual.2 && - head -n6 actual.2 >actual && - test_i18ncmp expect actual && - cp orig .git/rebase-merge/git-rebase-todo && - FAKE_LINES="1 2 3 4" git rebase --edit-todo 2>actual.2 && - head -n4 actual.2 >actual && - test_i18ncmp expect.3 actual && - git rebase --continue 2>actual - ) && - test D = $(git cat-file commit HEAD | sed -ne \$p) && - test_i18ngrep \ - "Successfully rebased and updated refs/heads/missing-commit" \ - actual -' - -test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = error' ' - cat >expect <<-EOF && - error: invalid line 1: badcmd $(git rev-list --pretty=oneline --abbrev-commit -1 master~4) - Warning: some commits may have been dropped accidentally. - Dropped commits (newer to older): - - $(git rev-list --pretty=oneline --abbrev-commit -1 master) - - $(git rev-list --pretty=oneline --abbrev-commit -1 master~4) - To avoid this message, use "drop" to explicitly remove a commit. - - Use '\''git config rebase.missingCommitsCheck'\'' to change the level of warnings. - The possible behaviours are: ignore, warn, error. - - You can fix this with '\''git rebase --edit-todo'\'' and then run '\''git rebase --continue'\''. - Or you can abort the rebase with '\''git rebase --abort'\''. - EOF - tail -n11 expect >expect.2 && - head -n3 expect.2 >expect.3 && - tail -n7 expect.2 >>expect.3 && - test_config rebase.missingCommitsCheck error && - rebase_setup_and_clean missing-commit && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="bad 1 2 3 4 5" \ - git rebase -i --root && - cp .git/rebase-merge/git-rebase-todo.backup orig && - test_must_fail env FAKE_LINES="2 3 4" \ - git rebase --edit-todo 2>actual && - test_i18ncmp expect actual && - test_must_fail git rebase --continue 2>actual && - test_i18ncmp expect.2 actual && - test_must_fail git rebase --edit-todo && - cp orig .git/rebase-merge/git-rebase-todo && - test_must_fail env FAKE_LINES="1 2 3 4" \ - git rebase --edit-todo 2>actual && - test_i18ncmp expect.3 actual && - test_must_fail git rebase --continue 2>actual && - test_i18ncmp expect.3 actual && - cp orig .git/rebase-merge/git-rebase-todo && - FAKE_LINES="1 2 3 4 drop 5" git rebase --edit-todo && - git rebase --continue 2>actual - ) && - test D = $(git cat-file commit HEAD | sed -ne \$p) && - test_i18ngrep \ - "Successfully rebased and updated refs/heads/missing-commit" \ - actual -' - -test_expect_success 'rebase.missingCommitsCheck = error after resolving conflicts' ' - test_config rebase.missingCommitsCheck error && - ( - set_fake_editor && - FAKE_LINES="drop 1 break 2 3 4" git rebase -i A E - ) && - git rebase --edit-todo && - test_must_fail git rebase --continue && - echo x >file1 && - git add file1 && - git rebase --continue -' - -test_expect_success 'rebase.missingCommitsCheck = error when editing for a second time' ' - test_config rebase.missingCommitsCheck error && - ( - set_fake_editor && - FAKE_LINES="1 break 2 3" git rebase -i A D && - cp .git/rebase-merge/git-rebase-todo todo && - test_must_fail env FAKE_LINES=2 git rebase --edit-todo && - GIT_SEQUENCE_EDITOR="cp todo" git rebase --edit-todo && - git rebase --continue - ) -' - test_expect_success 'respects rebase.abbreviateCommands with fixup, squash and exec' ' rebase_setup_and_clean abbrevcmd && test_commit "first" file1.txt "first line" first && @@ -1600,27 +1360,21 @@ test_expect_success 'respects rebase.abbreviateCommands with fixup, squash and e x git show HEAD EOF git checkout abbrevcmd && + set_cat_todo_editor && test_config rebase.abbreviateCommands true && - ( - set_cat_todo_editor && - test_must_fail git rebase -i --exec "git show HEAD" \ - --autosquash master >actual - ) && + test_must_fail git rebase -i --exec "git show HEAD" \ + --autosquash master >actual && test_cmp expected actual ' test_expect_success 'static check of bad command' ' rebase_setup_and_clean bad-cmd && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="1 2 3 bad 4 5" \ + set_fake_editor && + test_must_fail env FAKE_LINES="1 2 3 bad 4 5" \ git rebase -i --root 2>actual && - test_i18ngrep "badcmd $(git rev-list --oneline -1 master~1)" \ - actual && - test_i18ngrep "You can fix this with .git rebase --edit-todo.." \ - actual && - FAKE_LINES="1 2 3 drop 4 5" git rebase --edit-todo - ) && + test_i18ngrep "badcmd $(git rev-list --oneline -1 master~1)" actual && + test_i18ngrep "You can fix this with .git rebase --edit-todo.." actual && + FAKE_LINES="1 2 3 drop 4 5" git rebase --edit-todo && git rebase --continue && test E = $(git cat-file commit HEAD | sed -ne \$p) && test C = $(git cat-file commit HEAD^ | sed -ne \$p) @@ -1636,24 +1390,19 @@ test_expect_success 'tabs and spaces are accepted in the todolist' ' ) >"$1.new" mv "$1.new" "$1" EOF - ( - test_set_editor "$(pwd)/add-indent.sh" && - git rebase -i HEAD^^^ - ) && + test_set_editor "$(pwd)/add-indent.sh" && + git rebase -i HEAD^^^ && test E = $(git cat-file commit HEAD | sed -ne \$p) ' test_expect_success 'static check of bad SHA-1' ' rebase_setup_and_clean bad-sha && - ( - set_fake_editor && - test_must_fail env FAKE_LINES="1 2 edit fakesha 3 4 5 #" \ - git rebase -i --root 2>actual && - test_i18ngrep "edit XXXXXXX False commit" actual && - test_i18ngrep "You can fix this with .git rebase --edit-todo.." \ - actual && - FAKE_LINES="1 2 4 5 6" git rebase --edit-todo - ) && + set_fake_editor && + test_must_fail env FAKE_LINES="1 2 edit fakesha 3 4 5 #" \ + git rebase -i --root 2>actual && + test_i18ngrep "edit XXXXXXX False commit" actual && + test_i18ngrep "You can fix this with .git rebase --edit-todo.." actual && + FAKE_LINES="1 2 4 5 6" git rebase --edit-todo && git rebase --continue && test E = $(git cat-file commit HEAD | sed -ne \$p) ' @@ -1670,73 +1419,42 @@ test_expect_success 'editor saves as CR/LF' ' ) ' +SQ="'" test_expect_success 'rebase -i --gpg-sign=' ' test_when_finished "test_might_fail git rebase --abort" && - ( - set_fake_editor && - FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" \ - HEAD^ >out 2>err - ) && + set_fake_editor && + FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" HEAD^ \ + >out 2>err && test_i18ngrep "$SQ-S\"S I Gner\"$SQ" err ' test_expect_success 'rebase -i --gpg-sign= overrides commit.gpgSign' ' test_when_finished "test_might_fail git rebase --abort" && test_config commit.gpgsign true && - ( - set_fake_editor && - FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" \ - HEAD^ >out 2>err - ) && + set_fake_editor && + FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" HEAD^ \ + >out 2>err && test_i18ngrep "$SQ-S\"S I Gner\"$SQ" err ' test_expect_success 'valid author header after --root swap' ' rebase_setup_and_clean author-header no-conflict-branch && + set_fake_editor && git commit --amend --author="Au ${SQ}thor " --no-edit && git cat-file commit HEAD | grep ^author >expected && - ( - set_fake_editor && - FAKE_LINES="5 1" git rebase -i --root - ) && + FAKE_LINES="5 1" git rebase -i --root && git cat-file commit HEAD^ | grep ^author >actual && test_cmp expected actual ' test_expect_success 'valid author header when author contains single quote' ' rebase_setup_and_clean author-header no-conflict-branch && + set_fake_editor && git commit --amend --author="Au ${SQ}thor " --no-edit && git cat-file commit HEAD | grep ^author >expected && - ( - set_fake_editor && - FAKE_LINES="2" git rebase -i HEAD~2 - ) && + FAKE_LINES="2" git rebase -i HEAD~2 && git cat-file commit HEAD | grep ^author >actual && test_cmp expected actual ' -test_expect_success 'post-commit hook is called' ' - test_when_finished "rm -f .git/hooks/post-commit" && - >actual && - mkdir -p .git/hooks && - write_script .git/hooks/post-commit <<-\EOS && - git rev-parse HEAD >>actual - EOS - ( - set_fake_editor && - FAKE_LINES="edit 4 1 reword 2 fixup 3" git rebase -i A E && - echo x>file3 && - git add file3 && - FAKE_COMMIT_MESSAGE=edited git rebase --continue - ) && - git rev-parse HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} HEAD@{1} HEAD \ - >expect && - test_cmp expect actual -' - -# This must be the last test in this file -test_expect_success '$EDITOR and friends are unchanged' ' - test_editor_unchanged -' - test_done diff --git a/third_party/git/t/t3406-rebase-message.sh b/third_party/git/t/t3406-rebase-message.sh index 61b76f330198..b393e1e9fee8 100755 --- a/third_party/git/t/t3406-rebase-message.sh +++ b/third_party/git/t/t3406-rebase-message.sh @@ -18,29 +18,32 @@ test_expect_success 'setup' ' ' test_expect_success 'rebase -m' ' - git rebase -m master >actual && - test_must_be_empty actual + git rebase -m master >report && + >expect && + sed -n -e "/^Already applied: /p" \ + -e "/^Committed: /p" report >actual && + test_cmp expect actual ' test_expect_success 'rebase against master twice' ' - git rebase --apply master >out && + git rebase master >out && test_i18ngrep "Current branch topic is up to date" out ' test_expect_success 'rebase against master twice with --force' ' - git rebase --force-rebase --apply master >out && + git rebase --force-rebase master >out && test_i18ngrep "Current branch topic is up to date, rebase forced" out ' test_expect_success 'rebase against master twice from another branch' ' git checkout topic^ && - git rebase --apply master topic >out && + git rebase master topic >out && test_i18ngrep "Current branch topic is up to date" out ' test_expect_success 'rebase fast-forward to master' ' git checkout topic^ && - git rebase --apply topic >out && + git rebase topic >out && test_i18ngrep "Fast-forwarded HEAD to topic" out ' @@ -89,7 +92,7 @@ test_expect_success 'GIT_REFLOG_ACTION' ' git checkout -b reflog-topic start && test_commit reflog-to-rebase && - git rebase --apply reflog-onto && + git rebase reflog-onto && git log -g --format=%gs -3 >actual && cat >expect <<-\EOF && rebase finished: returning to refs/heads/reflog-topic @@ -99,7 +102,7 @@ test_expect_success 'GIT_REFLOG_ACTION' ' test_cmp expect actual && git checkout -b reflog-prefix reflog-to-rebase && - GIT_REFLOG_ACTION=change-the-reflog git rebase --apply reflog-onto && + GIT_REFLOG_ACTION=change-the-reflog git rebase reflog-onto && git log -g --format=%gs -3 >actual && cat >expect <<-\EOF && rebase finished: returning to refs/heads/reflog-prefix diff --git a/third_party/git/t/t3407-rebase-abort.sh b/third_party/git/t/t3407-rebase-abort.sh index 97efea0f5697..910f21828434 100755 --- a/third_party/git/t/t3407-rebase-abort.sh +++ b/third_party/git/t/t3407-rebase-abort.sh @@ -96,14 +96,14 @@ testrebase() { ' } -testrebase " --apply" .git/rebase-apply +testrebase "" .git/rebase-apply testrebase " --merge" .git/rebase-merge -test_expect_success 'rebase --apply --quit' ' +test_expect_success 'rebase --quit' ' cd "$work_dir" && # Clean up the state from the previous one git reset --hard pre-rebase && - test_must_fail git rebase --apply master && + test_must_fail git rebase master && test_path_is_dir .git/rebase-apply && head_before=$(git rev-parse HEAD) && git rebase --quit && diff --git a/third_party/git/t/t3415-rebase-autosquash.sh b/third_party/git/t/t3415-rebase-autosquash.sh index 093de9005b76..22d218698e95 100755 --- a/third_party/git/t/t3415-rebase-autosquash.sh +++ b/third_party/git/t/t3415-rebase-autosquash.sh @@ -25,13 +25,6 @@ test_expect_success setup ' ' test_auto_fixup () { - no_squash= && - if test "x$1" = 'x!' - then - no_squash=true - shift - fi && - git reset --hard base && echo 1 >file1 && git add -u && @@ -42,19 +35,10 @@ test_auto_fixup () { test_tick && git rebase $2 -i HEAD^^^ && git log --oneline >actual && - if test -n "$no_squash" - then - test_line_count = 4 actual - else - test_line_count = 3 actual && - git diff --exit-code $1 && - echo 1 >expect && - git cat-file blob HEAD^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD^ >commit && - grep first commit >actual && - test_line_count = 1 actual - fi + test_line_count = 3 actual && + git diff --exit-code $1 && + test 1 = "$(git cat-file blob HEAD^:file1)" && + test 1 = $(git cat-file commit HEAD^ | grep first | wc -l) } test_expect_success 'auto fixup (option)' ' @@ -64,19 +48,12 @@ test_expect_success 'auto fixup (option)' ' test_expect_success 'auto fixup (config)' ' git config rebase.autosquash true && test_auto_fixup final-fixup-config-true && - test_auto_fixup ! fixup-config-true-no --no-autosquash && + test_must_fail test_auto_fixup fixup-config-true-no --no-autosquash && git config rebase.autosquash false && - test_auto_fixup ! final-fixup-config-false + test_must_fail test_auto_fixup final-fixup-config-false ' test_auto_squash () { - no_squash= && - if test "x$1" = 'x!' - then - no_squash=true - shift - fi && - git reset --hard base && echo 1 >file1 && git add -u && @@ -87,19 +64,10 @@ test_auto_squash () { test_tick && git rebase $2 -i HEAD^^^ && git log --oneline >actual && - if test -n "$no_squash" - then - test_line_count = 4 actual - else - test_line_count = 3 actual && - git diff --exit-code $1 && - echo 1 >expect && - git cat-file blob HEAD^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD^ >commit && - grep first commit >actual && - test_line_count = 2 actual - fi + test_line_count = 3 actual && + git diff --exit-code $1 && + test 1 = "$(git cat-file blob HEAD^:file1)" && + test 2 = $(git cat-file commit HEAD^ | grep first | wc -l) } test_expect_success 'auto squash (option)' ' @@ -109,9 +77,9 @@ test_expect_success 'auto squash (option)' ' test_expect_success 'auto squash (config)' ' git config rebase.autosquash true && test_auto_squash final-squash-config-true && - test_auto_squash ! squash-config-true-no --no-autosquash && + test_must_fail test_auto_squash squash-config-true-no --no-autosquash && git config rebase.autosquash false && - test_auto_squash ! final-squash-config-false + test_must_fail test_auto_squash final-squash-config-false ' test_expect_success 'misspelled auto squash' ' @@ -126,8 +94,7 @@ test_expect_success 'misspelled auto squash' ' git log --oneline >actual && test_line_count = 4 actual && git diff --exit-code final-missquash && - git rev-list final-missquash...HEAD >list && - test_must_be_empty list + test 0 = $(git rev-list final-missquash...HEAD | wc -l) ' test_expect_success 'auto squash that matches 2 commits' ' @@ -146,15 +113,9 @@ test_expect_success 'auto squash that matches 2 commits' ' git log --oneline >actual && test_line_count = 4 actual && git diff --exit-code final-multisquash && - echo 1 >expect && - git cat-file blob HEAD^^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD^^ >commit && - grep first commit >actual && - test_line_count = 2 actual && - git cat-file commit HEAD >commit && - grep first commit >actual && - test_line_count = 1 actual + test 1 = "$(git cat-file blob HEAD^^:file1)" && + test 2 = $(git cat-file commit HEAD^^ | grep first | wc -l) && + test 1 = $(git cat-file commit HEAD | grep first | wc -l) ' test_expect_success 'auto squash that matches a commit after the squash' ' @@ -173,38 +134,25 @@ test_expect_success 'auto squash that matches a commit after the squash' ' git log --oneline >actual && test_line_count = 5 actual && git diff --exit-code final-presquash && - echo 0 >expect && - git cat-file blob HEAD^^:file1 >actual && - test_cmp expect actual && - echo 1 >expect && - git cat-file blob HEAD^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD >commit && - grep third commit >actual && - test_line_count = 1 actual && - git cat-file commit HEAD^ >commit && - grep third commit >actual && - test_line_count = 1 actual + test 0 = "$(git cat-file blob HEAD^^:file1)" && + test 1 = "$(git cat-file blob HEAD^:file1)" && + test 1 = $(git cat-file commit HEAD | grep third | wc -l) && + test 1 = $(git cat-file commit HEAD^ | grep third | wc -l) ' test_expect_success 'auto squash that matches a sha1' ' git reset --hard base && echo 1 >file1 && git add -u && test_tick && - oid=$(git rev-parse --short HEAD^) && - git commit -m "squash! $oid" && + git commit -m "squash! $(git rev-parse --short HEAD^)" && git tag final-shasquash && test_tick && git rebase --autosquash -i HEAD^^^ && git log --oneline >actual && test_line_count = 3 actual && git diff --exit-code final-shasquash && - echo 1 >expect && - git cat-file blob HEAD^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD^ >commit && - grep squash commit >actual && - test_line_count = 1 actual + test 1 = "$(git cat-file blob HEAD^:file1)" && + test 1 = $(git cat-file commit HEAD^ | grep squash | wc -l) ' test_expect_success 'auto squash that matches longer sha1' ' @@ -212,20 +160,15 @@ test_expect_success 'auto squash that matches longer sha1' ' echo 1 >file1 && git add -u && test_tick && - oid=$(git rev-parse --short=11 HEAD^) && - git commit -m "squash! $oid" && + git commit -m "squash! $(git rev-parse --short=11 HEAD^)" && git tag final-longshasquash && test_tick && git rebase --autosquash -i HEAD^^^ && git log --oneline >actual && test_line_count = 3 actual && git diff --exit-code final-longshasquash && - echo 1 >expect && - git cat-file blob HEAD^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD^ >commit && - grep squash commit >actual && - test_line_count = 1 actual + test 1 = "$(git cat-file blob HEAD^:file1)" && + test 1 = $(git cat-file commit HEAD^ | grep squash | wc -l) ' test_auto_commit_flags () { @@ -240,12 +183,8 @@ test_auto_commit_flags () { git log --oneline >actual && test_line_count = 3 actual && git diff --exit-code final-commit-$1 && - echo 1 >expect && - git cat-file blob HEAD^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD^ >commit && - grep first commit >actual && - test_line_count = $2 actual + test 1 = "$(git cat-file blob HEAD^:file1)" && + test $2 = $(git cat-file commit HEAD^ | grep first | wc -l) } test_expect_success 'use commit --fixup' ' @@ -271,15 +210,11 @@ test_auto_fixup_fixup () { ( set_cat_todo_editor && test_must_fail git rebase --autosquash -i HEAD^^^^ >actual && - head=$(git rev-parse --short HEAD) && - parent1=$(git rev-parse --short HEAD^) && - parent2=$(git rev-parse --short HEAD^^) && - parent3=$(git rev-parse --short HEAD^^^) && cat >expected <<-EOF && - pick $parent3 first commit - $1 $parent1 $1! first - $1 $head $1! $2! first - pick $parent2 second commit + pick $(git rev-parse --short HEAD^^^) first commit + $1 $(git rev-parse --short HEAD^) $1! first + $1 $(git rev-parse --short HEAD) $1! $2! first + pick $(git rev-parse --short HEAD^^) second commit EOF test_cmp expected actual ) && @@ -287,17 +222,13 @@ test_auto_fixup_fixup () { git log --oneline >actual && test_line_count = 3 actual git diff --exit-code "final-$1-$2" && - echo 2 >expect && - git cat-file blob HEAD^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD^ >commit && - grep first commit >actual && + test 2 = "$(git cat-file blob HEAD^:file1)" && if test "$1" = "fixup" then - test_line_count = 1 actual + test 1 = $(git cat-file commit HEAD^ | grep first | wc -l) elif test "$1" = "squash" then - test_line_count = 3 actual + test 3 = $(git cat-file commit HEAD^ | grep first | wc -l) else false fi @@ -325,25 +256,19 @@ test_expect_success C_LOCALE_OUTPUT 'autosquash with custom inst format' ' echo 2 >file1 && git add -u && test_tick && - oid=$(git rev-parse --short HEAD^) && - git commit -m "squash! $oid" && + git commit -m "squash! $(git rev-parse --short HEAD^)" && echo 1 >file1 && git add -u && test_tick && - subject=$(git log -n 1 --format=%s HEAD~2) && - git commit -m "squash! $subject" && + git commit -m "squash! $(git log -n 1 --format=%s HEAD~2)" && git tag final-squash-instFmt && test_tick && git rebase --autosquash -i HEAD~4 && git log --oneline >actual && test_line_count = 3 actual && git diff --exit-code final-squash-instFmt && - echo 1 >expect && - git cat-file blob HEAD^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD^ >commit && - grep squash commit >actual && - test_line_count = 2 actual + test 1 = "$(git cat-file blob HEAD^:file1)" && + test 2 = $(git cat-file commit HEAD^ | grep squash | wc -l) ' test_expect_success 'autosquash with empty custom instructionFormat' ' diff --git a/third_party/git/t/t3416-rebase-onto-threedots.sh b/third_party/git/t/t3416-rebase-onto-threedots.sh index 9c2548423bce..ddf2f6485383 100755 --- a/third_party/git/t/t3416-rebase-onto-threedots.sh +++ b/third_party/git/t/t3416-rebase-onto-threedots.sh @@ -99,64 +99,7 @@ test_expect_success 'rebase -i --onto master...side' ' git checkout side && git reset --hard K && - set_fake_editor && test_must_fail git rebase -i --onto master...side J ' -test_expect_success 'rebase --keep-base --onto incompatible' ' - test_must_fail git rebase --keep-base --onto master... -' - -test_expect_success 'rebase --keep-base --root incompatible' ' - test_must_fail git rebase --keep-base --root -' - -test_expect_success 'rebase --keep-base master from topic' ' - git reset --hard && - git checkout topic && - git reset --hard G && - - git rebase --keep-base master && - git rev-parse C >base.expect && - git merge-base master HEAD >base.actual && - test_cmp base.expect base.actual && - - git rev-parse HEAD~2 >actual && - git rev-parse C^0 >expect && - test_cmp expect actual -' - -test_expect_success 'rebase --keep-base master from side' ' - git reset --hard && - git checkout side && - git reset --hard K && - - test_must_fail git rebase --keep-base master -' - -test_expect_success 'rebase -i --keep-base master from topic' ' - git reset --hard && - git checkout topic && - git reset --hard G && - - set_fake_editor && - EXPECT_COUNT=2 git rebase -i --keep-base master && - git rev-parse C >base.expect && - git merge-base master HEAD >base.actual && - test_cmp base.expect base.actual && - - git rev-parse HEAD~2 >actual && - git rev-parse C^0 >expect && - test_cmp expect actual -' - -test_expect_success 'rebase -i --keep-base master from side' ' - git reset --hard && - git checkout side && - git reset --hard K && - - set_fake_editor && - test_must_fail git rebase -i --keep-base master -' - test_done diff --git a/third_party/git/t/t3418-rebase-continue.sh b/third_party/git/t/t3418-rebase-continue.sh index 7a2da972fd37..4eff14dae532 100755 --- a/third_party/git/t/t3418-rebase-continue.sh +++ b/third_party/git/t/t3418-rebase-continue.sh @@ -120,20 +120,6 @@ test_expect_success REBASE_P 'rebase passes merge strategy options correctly' ' git rebase --continue ' -test_expect_success 'rebase -r passes merge strategy options correctly' ' - rm -fr .git/rebase-* && - git reset --hard commit-new-file-F3-on-topic-branch && - test_commit merge-theirs && - git reset --hard HEAD^ && - test_commit some-other-commit && - test_tick && - git merge --no-ff merge-theirs && - FAKE_LINES="1 3 edit 4 5 7 8 9" git rebase -i -f -r -m \ - -s recursive --strategy-option=theirs HEAD~2 && - test_commit force-change-ours && - git rebase --continue -' - test_expect_success '--skip after failed fixup cleans commit message' ' test_when_finished "test_might_fail git rebase --abort" && git checkout -b with-conflicting-fixup && diff --git a/third_party/git/t/t3419-rebase-patch-id.sh b/third_party/git/t/t3419-rebase-patch-id.sh index d93458377690..49f548cdb93d 100755 --- a/third_party/git/t/t3419-rebase-patch-id.sh +++ b/third_party/git/t/t3419-rebase-patch-id.sh @@ -80,8 +80,7 @@ do_tests () { git commit -q -m "change big file again" && git checkout -q other^{} && git rebase master && - git rev-list master...HEAD~ >revs && - test_must_be_empty revs + test_must_fail test -n "$(git rev-list master...HEAD~)" ' test_expect_success $pr 'do not drop patch' ' @@ -91,7 +90,7 @@ do_tests () { git commit -q -m squashed && git checkout -q other^{} && test_must_fail git rebase squashed && - git rebase --quit + rm -rf .git/rebase-apply ' } diff --git a/third_party/git/t/t3420-rebase-autostash.sh b/third_party/git/t/t3420-rebase-autostash.sh index b97ea6236394..b8f4d0346723 100755 --- a/third_party/git/t/t3420-rebase-autostash.sh +++ b/third_party/git/t/t3420-rebase-autostash.sh @@ -34,9 +34,10 @@ test_expect_success setup ' remove_progress_re="$(printf "s/.*\\r//")" ' -create_expected_success_apply () { +create_expected_success_am () { cat >expected <<-EOF $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual) + HEAD is now at $(git rev-parse --short feature-branch) third commit First, rewinding head to replay your work on top of it... Applying: second commit Applying: third commit @@ -44,17 +45,19 @@ create_expected_success_apply () { EOF } -create_expected_success_merge () { +create_expected_success_interactive () { q_to_cr >expected <<-EOF $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual) + HEAD is now at $(git rev-parse --short feature-branch) third commit Applied autostash. Successfully rebased and updated refs/heads/rebased-feature-branch. EOF } -create_expected_failure_apply () { +create_expected_failure_am () { cat >expected <<-EOF $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual) + HEAD is now at $(git rev-parse --short feature-branch) third commit First, rewinding head to replay your work on top of it... Applying: second commit Applying: third commit @@ -64,9 +67,10 @@ create_expected_failure_apply () { EOF } -create_expected_failure_merge () { +create_expected_failure_interactive () { cat >expected <<-EOF $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual) + HEAD is now at $(git rev-parse --short feature-branch) third commit Applying autostash resulted in conflicts. Your changes are safe in the stash. You can run "git stash pop" or "git stash drop" at any time. @@ -101,9 +105,9 @@ testrebase () { test_expect_success "rebase$type --autostash: check output" ' test_when_finished git branch -D rebased-feature-branch && - suffix=${type#\ --} && suffix=${suffix:-apply} && - if test ${suffix} = "interactive"; then - suffix=merge + suffix=${type#\ --} && suffix=${suffix:-am} && + if test ${suffix} = "merge"; then + suffix=interactive fi && create_expected_success_$suffix && sed "$remove_progress_re" actual2 && @@ -202,9 +206,9 @@ testrebase () { test_expect_success "rebase$type: check output with conflicting stash" ' test_when_finished git branch -D rebased-feature-branch && - suffix=${type#\ --} && suffix=${suffix:-apply} && - if test ${suffix} = "interactive"; then - suffix=merge + suffix=${type#\ --} && suffix=${suffix:-am} && + if test ${suffix} = "merge"; then + suffix=interactive fi && create_expected_failure_$suffix && sed "$remove_progress_re" actual2 && @@ -234,7 +238,7 @@ test_expect_success "rebase: noop rebase" ' git checkout feature-branch ' -testrebase " --apply" .git/rebase-apply +testrebase "" .git/rebase-apply testrebase " --merge" .git/rebase-merge testrebase " --interactive" .git/rebase-merge @@ -302,12 +306,4 @@ test_expect_success 'branch is left alone when possible' ' test unchanged-branch = "$(git rev-parse --abbrev-ref HEAD)" ' -test_expect_success 'never change active branch' ' - git checkout -b not-the-feature-branch unrelated-onto-branch && - test_when_finished "git reset --hard && git checkout master" && - echo changed >file0 && - git rebase --autostash not-the-feature-branch feature-branch && - test_cmp_rev not-the-feature-branch unrelated-onto-branch -' - test_done diff --git a/third_party/git/t/t3421-rebase-topology-linear.sh b/third_party/git/t/t3421-rebase-topology-linear.sh index cf8dfd6c203b..7274dca40b1c 100755 --- a/third_party/git/t/t3421-rebase-topology-linear.sh +++ b/third_party/git/t/t3421-rebase-topology-linear.sh @@ -26,21 +26,11 @@ test_run_rebase () { test_linear_range 'd e' c.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p -test_expect_success 'setup branches and remote tracking' ' - git tag -l >tags && - for tag in $(cat tags) - do - git branch branch-$tag $tag || return 1 - done && - git remote add origin "file://$PWD" && - git fetch origin -' - test_run_rebase () { result=$1 shift @@ -50,7 +40,7 @@ test_run_rebase () { test_cmp_rev e HEAD " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p @@ -61,34 +51,16 @@ test_run_rebase () { test_expect_$result "rebase $* -f rewrites even if upstream is an ancestor" " reset_rebase && git rebase $* -f b e && - test_cmp_rev ! e HEAD && + ! test_cmp_rev e HEAD && test_cmp_rev b HEAD~2 && test_linear_range 'd e' b.. " } -test_run_rebase success --apply -test_run_rebase success --fork-point +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase failure -p -test_run_rebase () { - result=$1 - shift - test_expect_$result "rebase $* -f rewrites even if remote upstream is an ancestor" " - reset_rebase && - git rebase $* -f branch-b branch-e && - test_cmp_rev ! branch-e origin/branch-e && - test_cmp_rev branch-b HEAD~2 && - test_linear_range 'd e' branch-b.. - " -} -test_run_rebase success --apply -test_run_rebase success --fork-point -test_run_rebase success -m -test_run_rebase success -i -test_have_prereq !REBASE_P || test_run_rebase success -p - test_run_rebase () { result=$1 shift @@ -98,8 +70,7 @@ test_run_rebase () { test_cmp_rev e HEAD " } -test_run_rebase success --apply -test_run_rebase success --fork-point +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p @@ -139,7 +110,7 @@ test_run_rebase () { test_linear_range 'd i' h.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p @@ -154,7 +125,7 @@ test_run_rebase () { test_linear_range 'd' h.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p @@ -169,7 +140,7 @@ test_run_rebase () { test_linear_range 'd i' f.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p @@ -184,7 +155,7 @@ test_run_rebase () { test_linear_range 'd gp i' h.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p @@ -205,17 +176,17 @@ test_expect_success 'setup of linear history for empty commit tests' ' test_run_rebase () { result=$1 shift - test_expect_$result "rebase $* keeps begin-empty commits" " + test_expect_$result "rebase $* drops empty commit" " reset_rebase && - git rebase $* j l && - test_cmp_rev c HEAD~4 && - test_linear_range 'j d k l' c.. + git rebase $* c l && + test_cmp_rev c HEAD~2 && + test_linear_range 'd l' c.. " } -test_run_rebase failure --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_have_prereq !REBASE_P || test_run_rebase failure -p +test_have_prereq !REBASE_P || test_run_rebase success -p test_run_rebase () { result=$1 @@ -227,10 +198,10 @@ test_run_rebase () { test_linear_range 'd k l' c.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_have_prereq !REBASE_P || test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase failure -p test_run_rebase () { result=$1 @@ -242,10 +213,10 @@ test_run_rebase () { test_linear_range 'd k l' j.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i -test_have_prereq !REBASE_P || test_run_rebase success -p +test_have_prereq !REBASE_P || test_run_rebase failure -p test_run_rebase success --rebase-merges # m @@ -282,7 +253,7 @@ test_run_rebase () { test_linear_range 'x y' c.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p @@ -297,7 +268,7 @@ test_run_rebase () { test_linear_range 'x y' c.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase failure -p @@ -312,7 +283,7 @@ test_run_rebase () { test_linear_range 'x y' m.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p @@ -328,7 +299,7 @@ test_run_rebase () { " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase failure -p @@ -343,7 +314,7 @@ test_run_rebase () { test_linear_range 'x y' m.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase failure -p @@ -368,7 +339,7 @@ test_run_rebase () { test_expect_$result "rebase $* -f --root on linear history causes re-write" " reset_rebase && git rebase $* -f --root c && - test_cmp_rev ! a HEAD~2 && + ! test_cmp_rev a HEAD~2 && test_linear_range 'a b c' HEAD " } diff --git a/third_party/git/t/t3422-rebase-incompatible-options.sh b/third_party/git/t/t3422-rebase-incompatible-options.sh index 50e7960702da..a5868ea152f9 100755 --- a/third_party/git/t/t3422-rebase-incompatible-options.sh +++ b/third_party/git/t/t3422-rebase-incompatible-options.sh @@ -76,4 +76,14 @@ test_expect_success REBASE_P \ test_must_fail git rebase --preserve-merges --rebase-merges A ' +test_expect_success '--rebase-merges incompatible with --strategy' ' + git checkout B^0 && + test_must_fail git rebase --rebase-merges -s resolve A +' + +test_expect_success '--rebase-merges incompatible with --strategy-option' ' + git checkout B^0 && + test_must_fail git rebase --rebase-merges -Xignore-space-change A +' + test_done diff --git a/third_party/git/t/t3424-rebase-empty.sh b/third_party/git/t/t3424-rebase-empty.sh deleted file mode 100755 index e1e30517ea64..000000000000 --- a/third_party/git/t/t3424-rebase-empty.sh +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/sh - -test_description='git rebase of commits that start or become empty' - -. ./test-lib.sh - -test_expect_success 'setup test repository' ' - test_write_lines 1 2 3 4 5 6 7 8 9 10 >numbers && - test_write_lines A B C D E F G H I J >letters && - git add numbers letters && - git commit -m A && - - git branch upstream && - git branch localmods && - - git checkout upstream && - test_write_lines A B C D E >letters && - git add letters && - git commit -m B && - - test_write_lines 1 2 3 4 five 6 7 8 9 ten >numbers && - git add numbers && - git commit -m C && - - git checkout localmods && - test_write_lines 1 2 3 4 five 6 7 8 9 10 >numbers && - git add numbers && - git commit -m C2 && - - git commit --allow-empty -m D && - - test_write_lines A B C D E >letters && - git add letters && - git commit -m "Five letters ought to be enough for anybody" -' - -test_expect_failure 'rebase (apply-backend)' ' - test_when_finished "git rebase --abort" && - git checkout -B testing localmods && - # rebase (--apply) should not drop commits that start empty - git rebase --apply upstream && - - test_write_lines D C B A >expect && - git log --format=%s >actual && - test_cmp expect actual -' - -test_expect_success 'rebase --merge --empty=drop' ' - git checkout -B testing localmods && - git rebase --merge --empty=drop upstream && - - test_write_lines D C B A >expect && - git log --format=%s >actual && - test_cmp expect actual -' - -test_expect_success 'rebase --merge uses default of --empty=drop' ' - git checkout -B testing localmods && - git rebase --merge upstream && - - test_write_lines D C B A >expect && - git log --format=%s >actual && - test_cmp expect actual -' - -test_expect_success 'rebase --merge --empty=keep' ' - git checkout -B testing localmods && - git rebase --merge --empty=keep upstream && - - test_write_lines D C2 C B A >expect && - git log --format=%s >actual && - test_cmp expect actual -' - -test_expect_success 'rebase --merge --empty=ask' ' - git checkout -B testing localmods && - test_must_fail git rebase --merge --empty=ask upstream && - - git rebase --skip && - - test_write_lines D C B A >expect && - git log --format=%s >actual && - test_cmp expect actual -' - -test_expect_success 'rebase --interactive --empty=drop' ' - git checkout -B testing localmods && - git rebase --interactive --empty=drop upstream && - - test_write_lines D C B A >expect && - git log --format=%s >actual && - test_cmp expect actual -' - -test_expect_success 'rebase --interactive --empty=keep' ' - git checkout -B testing localmods && - git rebase --interactive --empty=keep upstream && - - test_write_lines D C2 C B A >expect && - git log --format=%s >actual && - test_cmp expect actual -' - -test_expect_success 'rebase --interactive --empty=ask' ' - git checkout -B testing localmods && - test_must_fail git rebase --interactive --empty=ask upstream && - - git rebase --skip && - - test_write_lines D C B A >expect && - git log --format=%s >actual && - test_cmp expect actual -' - -test_expect_success 'rebase --interactive uses default of --empty=ask' ' - git checkout -B testing localmods && - test_must_fail git rebase --interactive upstream && - - git rebase --skip && - - test_write_lines D C B A >expect && - git log --format=%s >actual && - test_cmp expect actual -' - -test_expect_success 'rebase --merge does not leave state laying around' ' - git checkout -B testing localmods~2 && - git rebase --merge upstream && - - test_path_is_missing .git/CHERRY_PICK_HEAD && - test_path_is_missing .git/MERGE_MSG -' - -test_done diff --git a/third_party/git/t/t3425-rebase-topology-merges.sh b/third_party/git/t/t3425-rebase-topology-merges.sh index e42faa44e74f..fd8efe84fe8f 100755 --- a/third_party/git/t/t3425-rebase-topology-merges.sh +++ b/third_party/git/t/t3425-rebase-topology-merges.sh @@ -54,7 +54,7 @@ test_run_rebase () { test_linear_range 'n o' e.. " } -test_run_rebase success --apply +test_run_rebase success '' test_run_rebase success -m test_run_rebase success -i @@ -70,7 +70,7 @@ test_run_rebase () { test_linear_range "\'"$expected"\'" d.. " } -test_run_rebase success 'n o e' --apply +test_run_rebase success 'n o e' '' test_run_rebase success 'n o e' -m test_run_rebase success 'n o e' -i @@ -86,7 +86,7 @@ test_run_rebase () { test_linear_range "\'"$expected"\'" c.. " } -test_run_rebase success 'd n o e' --apply +test_run_rebase success 'd n o e' '' test_run_rebase success 'd n o e' -m test_run_rebase success 'd n o e' -i @@ -102,7 +102,7 @@ test_run_rebase () { test_linear_range "\'"$expected"\'" c.. " } -test_run_rebase success 'd n o e' --apply +test_run_rebase success 'd n o e' '' test_run_rebase success 'd n o e' -m test_run_rebase success 'd n o e' -i diff --git a/third_party/git/t/t3427-rebase-subtree.sh b/third_party/git/t/t3427-rebase-subtree.sh index 79e43a370bac..d8640522a086 100755 --- a/third_party/git/t/t3427-rebase-subtree.sh +++ b/third_party/git/t/t3427-rebase-subtree.sh @@ -11,99 +11,113 @@ commit_message() { git log --pretty=format:%s -1 "$1" } -# There are a few bugs in the rebase with regards to the subtree strategy, and -# this test script tries to document them. First, the following commit history -# is generated (the onelines are shown, time flows from left to right): -# -# master1 - master2 - master3 -# \ -# README ---------------------- Add subproject master - master4 - files_subtree/master5 -# -# Where the merge moves the files master[123].t into the subdirectory -# files_subtree/ and master4 as well as files_subtree/master5 add files to that -# directory directly. -# -# Then, in subsequent test cases, `git filter-branch` is used to distill just -# the commits that touch files_subtree/. To give it a final pre-rebase touch, -# an empty commit is added on top. The pre-rebase commit history looks like -# this: -# -# Add subproject master - master4 - files_subtree/master5 - Empty commit -# -# where the root commit adds three files: master1.t, master2.t and master3.t. -# -# This commit history is then rebased onto `master3` with the -# `-Xsubtree=files_subtree` option in three different ways: -# -# 1. using `--preserve-merges` -# 2. using `--preserve-merges` and --keep-empty -# 3. without specifying a rebase backend - test_expect_success 'setup' ' test_commit README && - - git init files && - test_commit -C files master1 && - test_commit -C files master2 && - test_commit -C files master3 && - - : perform subtree merge into files_subtree/ && - git fetch files refs/heads/master:refs/heads/files-master && - git merge -s ours --no-commit --allow-unrelated-histories \ - files-master && - git read-tree --prefix=files_subtree -u files-master && - git commit -m "Add subproject master" && - - : add two extra commits to rebase && - test_commit -C files_subtree master4 && - test_commit files_subtree/master5 && - - git checkout -b to-rebase && - git fast-export --no-data HEAD -- files_subtree/ | - sed -e "s%\([0-9a-f]\{40\} \)files_subtree/%\1%" | - git fast-import --force --quiet && - git reset --hard && - git commit -m "Empty commit" --allow-empty + mkdir files && + ( + cd files && + git init && + test_commit master1 && + test_commit master2 && + test_commit master3 + ) && + git fetch files master && + git branch files-master FETCH_HEAD && + git read-tree --prefix=files_subtree files-master && + git checkout -- files_subtree && + tree=$(git write-tree) && + head=$(git rev-parse HEAD) && + rev=$(git rev-parse --verify files-master^0) && + commit=$(git commit-tree -p $head -p $rev -m "Add subproject master" $tree) && + git update-ref HEAD $commit && + ( + cd files_subtree && + test_commit master4 + ) && + test_commit files_subtree/master5 ' # FAILURE: Does not preserve master4. -test_expect_failure REBASE_P 'Rebase -Xsubtree --preserve-merges --onto commit' ' +test_expect_failure REBASE_P \ + 'Rebase -Xsubtree --preserve-merges --onto commit 4' ' reset_rebase && - git checkout -b rebase-preserve-merges to-rebase && + git checkout -b rebase-preserve-merges-4 master && + git filter-branch --prune-empty -f --subdirectory-filter files_subtree && + git commit -m "Empty commit" --allow-empty && + git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master && + verbose test "$(commit_message HEAD~)" = "files_subtree/master4" +' + +# FAILURE: Does not preserve master5. +test_expect_failure REBASE_P \ + 'Rebase -Xsubtree --preserve-merges --onto commit 5' ' + reset_rebase && + git checkout -b rebase-preserve-merges-5 master && + git filter-branch --prune-empty -f --subdirectory-filter files_subtree && + git commit -m "Empty commit" --allow-empty && git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master && - verbose test "$(commit_message HEAD~)" = "master4" && verbose test "$(commit_message HEAD)" = "files_subtree/master5" ' # FAILURE: Does not preserve master4. -test_expect_failure REBASE_P 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit' ' +test_expect_failure REBASE_P \ + 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 4' ' reset_rebase && - git checkout -b rebase-keep-empty to-rebase && + git checkout -b rebase-keep-empty-4 master && + git filter-branch --prune-empty -f --subdirectory-filter files_subtree && + git commit -m "Empty commit" --allow-empty && git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && - verbose test "$(commit_message HEAD~2)" = "master4" && - verbose test "$(commit_message HEAD~)" = "files_subtree/master5" && - verbose test "$(commit_message HEAD)" = "Empty commit" + verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" ' -test_expect_success 'Rebase -Xsubtree --empty=ask --onto commit' ' +# FAILURE: Does not preserve master5. +test_expect_failure REBASE_P \ + 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 5' ' reset_rebase && - git checkout -b rebase-onto to-rebase && - test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --onto files-master master && - : first pick results in no changes && - git rebase --skip && - verbose test "$(commit_message HEAD~2)" = "master4" && - verbose test "$(commit_message HEAD~)" = "files_subtree/master5" && + git checkout -b rebase-keep-empty-5 master && + git filter-branch --prune-empty -f --subdirectory-filter files_subtree && + git commit -m "Empty commit" --allow-empty && + git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && + verbose test "$(commit_message HEAD~)" = "files_subtree/master5" +' + +# FAILURE: Does not preserve Empty. +test_expect_failure REBASE_P \ + 'Rebase -Xsubtree --keep-empty --preserve-merges --onto empty commit' ' + reset_rebase && + git checkout -b rebase-keep-empty-empty master && + git filter-branch --prune-empty -f --subdirectory-filter files_subtree && + git commit -m "Empty commit" --allow-empty && + git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && verbose test "$(commit_message HEAD)" = "Empty commit" ' -test_expect_success 'Rebase -Xsubtree --empty=ask --rebase-merges --onto commit' ' +# FAILURE: fatal: Could not parse object +test_expect_failure 'Rebase -Xsubtree --onto commit 4' ' + reset_rebase && + git checkout -b rebase-onto-4 master && + git filter-branch --prune-empty -f --subdirectory-filter files_subtree && + git commit -m "Empty commit" --allow-empty && + git rebase -Xsubtree=files_subtree --onto files-master master && + verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" +' + +# FAILURE: fatal: Could not parse object +test_expect_failure 'Rebase -Xsubtree --onto commit 5' ' + reset_rebase && + git checkout -b rebase-onto-5 master && + git filter-branch --prune-empty -f --subdirectory-filter files_subtree && + git commit -m "Empty commit" --allow-empty && + git rebase -Xsubtree=files_subtree --onto files-master master && + verbose test "$(commit_message HEAD~)" = "files_subtree/master5" +' +# FAILURE: fatal: Could not parse object +test_expect_failure 'Rebase -Xsubtree --onto empty commit' ' reset_rebase && - git checkout -b rebase-merges-onto to-rebase && - test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --rebase-merges --onto files-master --root && - : first pick results in no changes && - git rebase --skip && - verbose test "$(commit_message HEAD~2)" = "master4" && - verbose test "$(commit_message HEAD~)" = "files_subtree/master5" && + git checkout -b rebase-onto-empty master && + git filter-branch --prune-empty -f --subdirectory-filter files_subtree && + git commit -m "Empty commit" --allow-empty && + git rebase -Xsubtree=files_subtree --onto files-master master && verbose test "$(commit_message HEAD)" = "Empty commit" ' diff --git a/third_party/git/t/t3429-rebase-edit-todo.sh b/third_party/git/t/t3429-rebase-edit-todo.sh index 7024d49ae7b9..76f6d306eaf3 100755 --- a/third_party/git/t/t3429-rebase-edit-todo.sh +++ b/third_party/git/t/t3429-rebase-edit-todo.sh @@ -3,21 +3,15 @@ test_description='rebase should reread the todo file if an exec modifies it' . ./test-lib.sh -. "$TEST_DIRECTORY"/lib-rebase.sh - -test_expect_success 'setup' ' - test_commit first file && - test_commit second file && - test_commit third file -' test_expect_success 'rebase exec modifies rebase-todo' ' + test_commit initial && todo=.git/rebase-merge/git-rebase-todo && git rebase HEAD -x "echo exec touch F >>$todo" && test -e F ' -test_expect_success 'loose object cache vs re-reading todo list' ' +test_expect_success SHA1 'loose object cache vs re-reading todo list' ' GIT_REBASE_TODO=.git/rebase-merge/git-rebase-todo && export GIT_REBASE_TODO && write_script append-todo.sh <<-\EOS && @@ -39,47 +33,4 @@ test_expect_success 'loose object cache vs re-reading todo list' ' git rebase HEAD -x "./append-todo.sh 5 6" ' -test_expect_success 'todo is re-read after reword and squash' ' - write_script reword-editor.sh <<-\EOS && - GIT_SEQUENCE_EDITOR="echo \"exec echo $(cat file) >>actual\" >>" \ - git rebase --edit-todo - EOS - - test_write_lines first third >expected && - set_fake_editor && - GIT_SEQUENCE_EDITOR="$EDITOR" FAKE_LINES="reword 1 squash 2 fixup 3" \ - GIT_EDITOR=./reword-editor.sh git rebase -i --root third && - test_cmp expected actual -' - -test_expect_success 're-reading todo doesnt interfere with revert --edit' ' - git reset --hard third && - - git revert --edit third second && - - cat >expect <<-\EOF && - Revert "second" - Revert "third" - third - second - first - EOF - git log --format="%s" >actual && - test_cmp expect actual -' - -test_expect_success 're-reading todo doesnt interfere with cherry-pick --edit' ' - git reset --hard first && - - git cherry-pick --edit second third && - - cat >expect <<-\EOF && - third - second - first - EOF - git log --format="%s" >actual && - test_cmp expect actual -' - test_done diff --git a/third_party/git/t/t3430-rebase-merges.sh b/third_party/git/t/t3430-rebase-merges.sh index a1bc3e20016b..7b6c4847ad6b 100755 --- a/third_party/git/t/t3430-rebase-merges.sh +++ b/third_party/git/t/t3430-rebase-merges.sh @@ -20,11 +20,12 @@ Initial setup: ' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh -. "$TEST_DIRECTORY"/lib-log-graph.sh test_cmp_graph () { cat >expect && - lib_test_cmp_graph --boundary --format=%s "$@" + git log --graph --boundary --format=%s "$@" >output && + sed "s/ *$//" output.trimmed && + test_cmp expect output.trimmed } test_expect_success 'setup' ' @@ -36,27 +37,20 @@ test_expect_success 'setup' ' test_commit A && git checkout -b first && test_commit B && - b=$(git rev-parse --short HEAD) && git checkout master && test_commit C && - c=$(git rev-parse --short HEAD) && test_commit D && - d=$(git rev-parse --short HEAD) && git merge --no-commit B && test_tick && git commit -m E && git tag -m E E && - e=$(git rev-parse --short HEAD) && git checkout -b second C && test_commit F && - f=$(git rev-parse --short HEAD) && test_commit G && - g=$(git rev-parse --short HEAD) && git checkout master && git merge --no-commit G && test_tick && git commit -m H && - h=$(git rev-parse --short HEAD) && git tag -m H H && git checkout A && test_commit conflicting-G G.t @@ -99,24 +93,24 @@ test_expect_success 'create completely different structure' ' ' test_expect_success 'generate correct todo list' ' - cat >expect <<-EOF && + cat >expect <<-\EOF && label onto reset onto - pick $b B + pick d9df450 B label E reset onto - pick $c C + pick 5dee784 C label branch-point - pick $f F - pick $g G + pick ca2c861 F + pick 088b00a G label H reset branch-point # C - pick $d D - merge -C $e E # E - merge -C $h H # H + pick 12bd07b D + merge -C 2051b56 E # E + merge -C 233d48a H # H EOF @@ -157,6 +151,7 @@ test_expect_success 'failed `merge -C` writes patch (may be rescheduled, too)' ' test_path_is_file .git/rebase-merge/patch ' +SQ="'" test_expect_success 'failed `merge ` does not crash' ' test_when_finished "test_might_fail git rebase --abort" && git checkout conflicting-G && @@ -345,7 +340,7 @@ test_expect_success 'A root commit can be a cousin, treat it that way' ' git merge --allow-unrelated-histories khnum && test_tick && git rebase -f -r HEAD^ && - test_cmp_rev ! HEAD^2 khnum && + ! test_cmp_rev HEAD^2 khnum && test_cmp_graph HEAD^.. <<-\EOF && * Merge branch '\''khnum'\'' into asherah |\ @@ -407,7 +402,7 @@ test_expect_success 'octopus merges' ' | | * three | * | two | |/ - * / one + * | one |/ o before-octopus EOF @@ -446,52 +441,4 @@ test_expect_success '--continue after resolving conflicts after a merge' ' test_path_is_missing .git/MERGE_HEAD ' -test_expect_success '--rebase-merges with strategies' ' - git checkout -b with-a-strategy F && - test_tick && - git merge -m "Merge conflicting-G" conflicting-G && - - : first, test with a merge strategy option && - git rebase -ir -Xtheirs G && - echo conflicting-G >expect && - test_cmp expect G.t && - - : now, try with a merge strategy other than recursive && - git reset --hard @{1} && - write_script git-merge-override <<-\EOF && - echo overridden$1 >>G.t - git add G.t - EOF - PATH="$PWD:$PATH" git rebase -ir -s override -Xxopt G && - test_write_lines G overridden--xopt >expect && - test_cmp expect G.t -' - -test_expect_success '--rebase-merges with commit that can generate bad characters for filename' ' - git checkout -b colon-in-label E && - git merge -m "colon: this should work" G && - git rebase --rebase-merges --force-rebase E -' - -test_expect_success '--rebase-merges with message matched with onto label' ' - git checkout -b onto-label E && - git merge -m onto G && - git rebase --rebase-merges --force-rebase E && - test_cmp_graph <<-\EOF - * onto - |\ - | * G - | * F - * | E - |\ \ - | * | B - * | | D - | |/ - |/| - * | C - |/ - * A - EOF -' - test_done diff --git a/third_party/git/t/t3431-rebase-fork-point.sh b/third_party/git/t/t3431-rebase-fork-point.sh deleted file mode 100755 index 78851b9a2ae8..000000000000 --- a/third_party/git/t/t3431-rebase-fork-point.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2019 Denton Liu -# - -test_description='git rebase --fork-point test' - -. ./test-lib.sh - -# A---B---D---E (master) -# \ -# C*---F---G (side) -# -# C was formerly part of master but master was rewound to remove C -# -test_expect_success setup ' - test_commit A && - test_commit B && - test_commit C && - git branch -t side && - git reset --hard HEAD^ && - test_commit D && - test_commit E && - git checkout side && - test_commit F && - test_commit G -' - -test_rebase () { - expected="$1" && - shift && - test_expect_success "git rebase $*" " - git checkout master && - git reset --hard E && - git checkout side && - git reset --hard G && - git rebase $* && - test_write_lines $expected >expect && - git log --pretty=%s >actual && - test_cmp expect actual - " -} - -test_rebase 'G F E D B A' -test_rebase 'G F D B A' --onto D -test_rebase 'G F B A' --keep-base -test_rebase 'G F C E D B A' --no-fork-point -test_rebase 'G F C D B A' --no-fork-point --onto D -test_rebase 'G F C B A' --no-fork-point --keep-base -test_rebase 'G F E D B A' --fork-point refs/heads/master -test_rebase 'G F D B A' --fork-point --onto D refs/heads/master -test_rebase 'G F B A' --fork-point --keep-base refs/heads/master -test_rebase 'G F C E D B A' refs/heads/master -test_rebase 'G F C D B A' --onto D refs/heads/master -test_rebase 'G F C B A' --keep-base refs/heads/master - -test_done diff --git a/third_party/git/t/t3432-rebase-fast-forward.sh b/third_party/git/t/t3432-rebase-fast-forward.sh deleted file mode 100755 index 6c9d4a137581..000000000000 --- a/third_party/git/t/t3432-rebase-fast-forward.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2019 Denton Liu -# - -test_description='ensure rebase fast-forwards commits when possible' - -. ./test-lib.sh - -test_expect_success setup ' - test_commit A && - test_commit B && - test_commit C && - test_commit D && - git checkout -t -b side -' - -test_rebase_same_head () { - status_n="$1" && - shift && - what_n="$1" && - shift && - cmp_n="$1" && - shift && - status_f="$1" && - shift && - what_f="$1" && - shift && - cmp_f="$1" && - shift && - test_rebase_same_head_ $status_n $what_n $cmp_n " --apply" "$*" && - test_rebase_same_head_ $status_f $what_f $cmp_f " --apply --no-ff" "$*" - test_rebase_same_head_ $status_n $what_n $cmp_n " --merge" "$*" && - test_rebase_same_head_ $status_f $what_f $cmp_f " --merge --no-ff" "$*" -} - -test_rebase_same_head_ () { - status="$1" && - shift && - what="$1" && - shift && - cmp="$1" && - shift && - flag="$1" - shift && - test_expect_$status "git rebase$flag $* with $changes is $what with $cmp HEAD" " - oldhead=\$(git rev-parse HEAD) && - test_when_finished 'git reset --hard \$oldhead' && - cp .git/logs/HEAD expect && - git rebase$flag $* >stdout && - if test $what = work - then - old=\$(wc -l DS/whatever && - git add DS && - git commit -m base && - - git branch side1 && - git branch side2 && - - git checkout side1 && - git rm -rf DS && - test_ln_s_add unrelated DS && - git commit -m side1 && - - git checkout side2 && - >unrelated && - git add unrelated && - git commit -m commit1 && - - echo >>unrelated && - git commit -am commit2 -' - -test_expect_success 'rebase changes with the apply backend' ' - test_when_finished "git rebase --abort || true" && - git checkout -b apply-backend side2 && - git rebase side1 -' - -test_expect_success 'rebase changes with the merge backend' ' - test_when_finished "git rebase --abort || true" && - git checkout -b merge-backend side2 && - git rebase -m side1 -' - -test_expect_success 'rebase changes with the merge backend with a delay' ' - test_when_finished "git rebase --abort || true" && - git checkout -b merge-delay-backend side2 && - git rebase -m --exec "sleep 1" side1 -' - -test_done diff --git a/third_party/git/t/t3434-rebase-i18n.sh b/third_party/git/t/t3434-rebase-i18n.sh deleted file mode 100755 index c7c835cde9b2..000000000000 --- a/third_party/git/t/t3434-rebase-i18n.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2019 Doan Tran Cong Danh -# - -test_description='rebase with changing encoding - -Initial setup: - -1 - 2 master - \ - 3 - 4 first - \ - 5 - 6 second -' - -. ./test-lib.sh - -compare_msg () { - iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect && - git cat-file commit HEAD >raw && - sed "1,/^$/d" raw >actual && - test_cmp expect actual -} - -test_expect_success setup ' - test_commit one && - git branch first && - test_commit two && - git switch first && - test_commit three && - git branch second && - test_commit four && - git switch second && - test_commit five && - test_commit six -' - -test_expect_success 'rebase --rebase-merges update encoding eucJP to UTF-8' ' - git switch -c merge-eucJP-UTF-8 first && - git config i18n.commitencoding eucJP && - git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second && - git config i18n.commitencoding UTF-8 && - git rebase --rebase-merges master && - compare_msg eucJP.txt eucJP UTF-8 -' - -test_expect_success 'rebase --rebase-merges update encoding eucJP to ISO-2022-JP' ' - git switch -c merge-eucJP-ISO-2022-JP first && - git config i18n.commitencoding eucJP && - git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second && - git config i18n.commitencoding ISO-2022-JP && - git rebase --rebase-merges master && - compare_msg eucJP.txt eucJP ISO-2022-JP -' - -test_rebase_continue_update_encode () { - old=$1 - new=$2 - msgfile=$3 - test_expect_success "rebase --continue update from $old to $new" ' - (git rebase --abort || : abort current git-rebase failure) && - git switch -c conflict-$old-$new one && - echo for-conflict >two.t && - git add two.t && - git config i18n.commitencoding $old && - git commit -F "$TEST_DIRECTORY/t3434/$msgfile" && - git config i18n.commitencoding $new && - test_must_fail git rebase -m master && - test -f .git/rebase-merge/message && - git stripspace <.git/rebase-merge/message >two.t && - git add two.t && - git rebase --continue && - compare_msg $msgfile $old $new && - : git-commit assume invalid utf-8 is latin1 && - test_cmp expect two.t - ' -} - -test_rebase_continue_update_encode ISO-8859-1 UTF-8 ISO8859-1.txt -test_rebase_continue_update_encode eucJP UTF-8 eucJP.txt -test_rebase_continue_update_encode eucJP ISO-2022-JP eucJP.txt - -test_done diff --git a/third_party/git/t/t3434/ISO8859-1.txt b/third_party/git/t/t3434/ISO8859-1.txt deleted file mode 100644 index 7cbef0ee6f43..000000000000 --- a/third_party/git/t/t3434/ISO8859-1.txt +++ /dev/null @@ -1,3 +0,0 @@ - - -bdfg diff --git a/third_party/git/t/t3434/eucJP.txt b/third_party/git/t/t3434/eucJP.txt deleted file mode 100644 index 546f2aac01b6..000000000000 --- a/third_party/git/t/t3434/eucJP.txt +++ /dev/null @@ -1,4 +0,0 @@ -ϤҤۤ - -ƤΤΤǡ -ͤۤפݤޤӤء diff --git a/third_party/git/t/t3501-revert-cherry-pick.sh b/third_party/git/t/t3501-revert-cherry-pick.sh index 7c1da21df149..d1c68af8c50e 100755 --- a/third_party/git/t/t3501-revert-cherry-pick.sh +++ b/third_party/git/t/t3501-revert-cherry-pick.sh @@ -106,7 +106,7 @@ test_expect_success 'cherry-pick on unborn branch' ' rm -rf * && git cherry-pick initial && git diff --quiet initial && - test_cmp_rev ! initial HEAD + ! test_cmp_rev initial HEAD ' test_expect_success 'cherry-pick "-" to pick from previous branch' ' @@ -150,7 +150,7 @@ test_expect_success 'cherry-pick works with dirty renamed file' ' test_tick && git commit -m renamed && echo modified >renamed && - git cherry-pick refs/heads/unrelated && + git cherry-pick refs/heads/unrelated >out && test $(git rev-parse :0:renamed) = $(git rev-parse HEAD~2:to-rename.t) && grep -q "^modified$" renamed ' diff --git a/third_party/git/t/t3504-cherry-pick-rerere.sh b/third_party/git/t/t3504-cherry-pick-rerere.sh index 80a0d0870653..a267b2d144df 100755 --- a/third_party/git/t/t3504-cherry-pick-rerere.sh +++ b/third_party/git/t/t3504-cherry-pick-rerere.sh @@ -94,10 +94,8 @@ test_expect_success 'cherry-pick --rerere-autoupdate more than once' ' test_expect_success 'cherry-pick conflict without rerere' ' test_config rerere.enabled false && - test_must_fail git cherry-pick foo-master && - grep ===== foo && - grep foo-dev foo && - grep foo-master foo + test_must_fail git cherry-pick master && + test_must_fail test_cmp expect foo ' test_done diff --git a/third_party/git/t/t3506-cherry-pick-ff.sh b/third_party/git/t/t3506-cherry-pick-ff.sh index 9d5adbc130b1..127dd0082ff8 100755 --- a/third_party/git/t/t3506-cherry-pick-ff.sh +++ b/third_party/git/t/t3506-cherry-pick-ff.sh @@ -16,11 +16,7 @@ test_expect_success setup ' git add file1 && test_tick && git commit -m "second" && - git tag second && - test_oid_cache <<-EOF - cp_ff sha1:1df192cd8bc58a2b275d842cede4d221ad9000d1 - cp_ff sha256:e70d6b7fc064bddb516b8d512c9057094b96ce6ff08e12080acc4fe7f1d60a1d - EOF + git tag second ' test_expect_success 'cherry-pick using --ff fast forwards' ' @@ -106,7 +102,7 @@ test_expect_success 'cherry pick a root commit with --ff' ' git add file2 && git commit --amend -m "file2" && git cherry-pick --ff first && - test "$(git rev-parse --verify HEAD)" = "$(test_oid cp_ff)" + test "$(git rev-parse --verify HEAD)" = "1df192cd8bc58a2b275d842cede4d221ad9000d1" ' test_expect_success 'cherry-pick --ff on unborn branch' ' diff --git a/third_party/git/t/t3507-cherry-pick-conflict.sh b/third_party/git/t/t3507-cherry-pick-conflict.sh index 9bd482ce3b89..9b9b4ca8d4f2 100755 --- a/third_party/git/t/t3507-cherry-pick-conflict.sh +++ b/third_party/git/t/t3507-cherry-pick-conflict.sh @@ -168,7 +168,7 @@ test_expect_success 'successful final commit clears cherry-pick state' ' echo resolved >foo && test_path_is_file .git/sequencer/todo && git commit -a && - test_path_is_missing .git/sequencer + test_must_fail test_path_exists .git/sequencer ' test_expect_success 'reset after final pick clears cherry-pick state' ' @@ -178,7 +178,7 @@ test_expect_success 'reset after final pick clears cherry-pick state' ' echo resolved >foo && test_path_is_file .git/sequencer/todo && git reset && - test_path_is_missing .git/sequencer + test_must_fail test_path_exists .git/sequencer ' test_expect_success 'failed cherry-pick produces dirty index' ' @@ -381,23 +381,23 @@ test_expect_success 'failed commit does not clear REVERT_HEAD' ' ' test_expect_success 'successful final commit clears revert state' ' - pristine_detach picked-signed && + pristine_detach picked-signed && - test_must_fail git revert picked-signed base && - echo resolved >foo && - test_path_is_file .git/sequencer/todo && - git commit -a && - test_path_is_missing .git/sequencer + test_must_fail git revert picked-signed base && + echo resolved >foo && + test_path_is_file .git/sequencer/todo && + git commit -a && + test_must_fail test_path_exists .git/sequencer ' test_expect_success 'reset after final pick clears revert state' ' - pristine_detach picked-signed && + pristine_detach picked-signed && - test_must_fail git revert picked-signed base && - echo resolved >foo && - test_path_is_file .git/sequencer/todo && - git reset && - test_path_is_missing .git/sequencer + test_must_fail git revert picked-signed base && + echo resolved >foo && + test_path_is_file .git/sequencer/todo && + git reset && + test_must_fail test_path_exists .git/sequencer ' test_expect_success 'revert conflict, diff3 -m style' ' diff --git a/third_party/git/t/t3508-cherry-pick-many-commits.sh b/third_party/git/t/t3508-cherry-pick-many-commits.sh index 23070a7b73ca..b457333e1865 100755 --- a/third_party/git/t/t3508-cherry-pick-many-commits.sh +++ b/third_party/git/t/t3508-cherry-pick-many-commits.sh @@ -5,7 +5,7 @@ test_description='test cherry-picking many commits' . ./test-lib.sh check_head_differs_from() { - test_cmp_rev ! HEAD "$1" + ! test_cmp_rev HEAD "$1" } check_head_equals() { diff --git a/third_party/git/t/t3600-rm.sh b/third_party/git/t/t3600-rm.sh index f2c0168941ad..66282a720ee8 100755 --- a/third_party/git/t/t3600-rm.sh +++ b/third_party/git/t/t3600-rm.sh @@ -113,10 +113,9 @@ test_expect_success '"rm" command printed' ' echo frotz >test-file && git add test-file && git commit -m "add file for rm test" && - git rm test-file >rm-output.raw && - grep "^rm " rm-output.raw >rm-output && - test_line_count = 1 rm-output && - rm -f test-file rm-output.raw rm-output && + git rm test-file >rm-output && + test $(grep "^rm " rm-output | wc -l) = 1 && + rm -f test-file rm-output && git commit -m "remove file from rm test" ' @@ -241,17 +240,14 @@ test_expect_success 'refresh index before checking if it is up-to-date' ' ' test_expect_success 'choking "git rm" should not let it die with cruft' ' - test_oid_init && git reset -q --hard && test_when_finished "rm -f .git/index.lock && git reset -q --hard" && i=0 && - hash=$(test_oid deadbeef) && while test $i -lt 12000 do - echo "100644 $hash 0 some-file-$i" + echo "100644 1234567890123456789012345678901234567890 0 some-file-$i" i=$(( $i + 1 )) done | git update-index --index-info && - # git command is intentionally placed upstream of pipe to induce SIGPIPE git rm -n "some-file-*" | : && test_path_is_missing .git/index.lock ' @@ -305,8 +301,7 @@ EOF test_expect_success 'rm removes empty submodules from work tree' ' mkdir submod && - hash=$(git rev-parse HEAD) && - git update-index --add --cacheinfo 160000 "$hash" submod && + git update-index --add --cacheinfo 160000 $(git rev-parse HEAD) submod && git config -f .gitmodules submodule.sub.url ./. && git config -f .gitmodules submodule.sub.path submod && git submodule init && @@ -425,13 +420,6 @@ test_expect_success 'rm will error out on a modified .gitmodules file unless sta git status -s -uno >actual && test_cmp expect actual ' -test_expect_success 'rm will not error out on .gitmodules file with zero stat data' ' - git reset --hard && - git submodule update && - git read-tree HEAD && - git rm submod && - test_path_is_missing submod -' test_expect_success 'rm issues a warning when section is not found in .gitmodules' ' git reset --hard && @@ -632,8 +620,7 @@ test_expect_success 'setup subsubmodule' ' git submodule update && ( cd submod && - hash=$(git rev-parse HEAD) && - git update-index --add --cacheinfo 160000 "$hash" subsubmod && + git update-index --add --cacheinfo 160000 $(git rev-parse HEAD) subsubmod && git config -f .gitmodules submodule.sub.url ../. && git config -f .gitmodules submodule.sub.path subsubmod && git submodule init && diff --git a/third_party/git/t/t3601-rm-pathspec-file.sh b/third_party/git/t/t3601-rm-pathspec-file.sh deleted file mode 100755 index 7de21f8bcff1..000000000000 --- a/third_party/git/t/t3601-rm-pathspec-file.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -test_description='rm --pathspec-from-file' - -. ./test-lib.sh - -test_tick - -test_expect_success setup ' - echo A >fileA.t && - echo B >fileB.t && - echo C >fileC.t && - echo D >fileD.t && - git add fileA.t fileB.t fileC.t fileD.t && - git commit -m "files" && - - git tag checkpoint -' - -restore_checkpoint () { - git reset --hard checkpoint -} - -verify_expect () { - git status --porcelain --untracked-files=no -- fileA.t fileB.t fileC.t fileD.t >actual && - test_cmp expect actual -} - -test_expect_success 'simplest' ' - restore_checkpoint && - - cat >expect <<-\EOF && - D fileA.t - EOF - - echo fileA.t | git rm --pathspec-from-file=- && - verify_expect -' - -test_expect_success '--pathspec-file-nul' ' - restore_checkpoint && - - cat >expect <<-\EOF && - D fileA.t - D fileB.t - EOF - - printf "fileA.t\0fileB.t\0" | git rm --pathspec-from-file=- --pathspec-file-nul && - verify_expect -' - -test_expect_success 'only touches what was listed' ' - restore_checkpoint && - - cat >expect <<-\EOF && - D fileB.t - D fileC.t - EOF - - printf "fileB.t\nfileC.t\n" | git rm --pathspec-from-file=- && - verify_expect -' - -test_expect_success 'error conditions' ' - restore_checkpoint && - echo fileA.t >list && - - test_must_fail git rm --pathspec-from-file=list -- fileA.t 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err && - - test_must_fail git rm --pathspec-file-nul 2>err && - test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err && - - >empty_list && - test_must_fail git rm --pathspec-from-file=empty_list 2>err && - test_i18ngrep -e "No pathspec was given. Which files should I remove?" err -' - -test_done diff --git a/third_party/git/t/t3700-add.sh b/third_party/git/t/t3700-add.sh index 88bc799807f7..c325167b9031 100755 --- a/third_party/git/t/t3700-add.sh +++ b/third_party/git/t/t3700-add.sh @@ -326,9 +326,7 @@ test_expect_success 'git add --dry-run of an existing file output' " cat >expect.err <<\EOF The following paths are ignored by one of your .gitignore files: ignored-file -hint: Use -f if you really want to add them. -hint: Turn this message off by running -hint: "git config advice.addIgnoredFile false" +Use -f if you really want to add them. EOF cat >expect.out <<\EOF add 'track-this' diff --git a/third_party/git/t/t3701-add-interactive.sh b/third_party/git/t/t3701-add-interactive.sh index 5bae6e50f1f3..69991a3168f3 100755 --- a/third_party/git/t/t3701-add-interactive.sh +++ b/third_party/git/t/t3701-add-interactive.sh @@ -23,17 +23,6 @@ diff_cmp () { test_cmp "$1.filtered" "$2.filtered" } -# This function uses a trick to manipulate the interactive add to use color: -# the `want_color()` function special-cases the situation where a pager was -# spawned and Git now wants to output colored text: to detect that situation, -# the environment variable `GIT_PAGER_IN_USE` is set. However, color is -# suppressed despite that environment variable if the `TERM` variable -# indicates a dumb terminal, so we set that variable, too. - -force_color () { - env GIT_PAGER_IN_USE=true TERM=vt100 "$@" -} - test_expect_success 'setup (initial)' ' echo content >file && git add file && @@ -68,15 +57,6 @@ test_expect_success 'revert works (initial)' ' ! grep . output ' -test_expect_success 'add untracked (multiple)' ' - test_when_finished "git reset && rm [1-9]" && - touch $(test_seq 9) && - test_write_lines a "2-5 8-" | git add -i -- [1-9] && - test_write_lines 2 3 4 5 8 9 >expected && - git ls-files [1-9] >output && - test_cmp expected output -' - test_expect_success 'setup (commit)' ' echo baseline >file && git add file && @@ -114,6 +94,7 @@ test_expect_success 'revert works (commit)' ' grep "unchanged *+3/-0 file" output ' + test_expect_success 'setup expected' ' cat >expected <<-\EOF EOF @@ -282,35 +263,6 @@ test_expect_success FILEMODE 'stage mode and hunk' ' # end of tests disabled when filemode is not usable -test_expect_success 'different prompts for mode change/deleted' ' - git reset --hard && - >file && - >deleted && - git add --chmod=+x file deleted && - echo changed >file && - rm deleted && - test_write_lines n n n | - git -c core.filemode=true add -p >actual && - sed -n "s/^\(([0-9/]*) Stage .*?\).*/\1/p" actual >actual.filtered && - cat >expect <<-\EOF && - (1/1) Stage deletion [y,n,q,a,d,?]? - (1/2) Stage mode change [y,n,q,a,d,j,J,g,/,?]? - (2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]? - EOF - test_cmp expect actual.filtered -' - -test_expect_success 'correct message when there is nothing to do' ' - git reset --hard && - git add -p 2>err && - test_i18ngrep "No changes" err && - printf "\\0123" >binary && - git add binary && - printf "\\0abc" >binary && - git add -p 2>err && - test_i18ngrep "Only binary files changed" err -' - test_expect_success 'setup again' ' git reset --hard && test_chmod +x file && @@ -362,7 +314,7 @@ test_expect_success C_LOCALE_OUTPUT 'add first line works' ' git commit -am "clear local changes" && git apply patch && printf "%s\n" s y y | git add -p file 2>error | - sed -n -e "s/^([1-2]\/[1-2]) Stage this hunk[^@]*\(@@ .*\)/\1/" \ + sed -n -e "s/^Stage this hunk[^@]*\(@@ .*\)/\1/" \ -e "/^[-+@ \\\\]"/p >output && test_must_be_empty error && git diff --cached >diff && @@ -422,36 +374,6 @@ test_expect_success 'split hunk setup' ' test_write_lines 10 15 20 21 22 23 24 30 40 50 60 >test ' -test_expect_success 'goto hunk' ' - test_when_finished "git reset" && - tr _ " " >expect <<-EOF && - (2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]? + 1: -1,2 +1,3 +15 - _ 2: -2,4 +3,8 +21 - go to which hunk? @@ -1,2 +1,3 @@ - _10 - +15 - _20 - (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]?_ - EOF - test_write_lines s y g 1 | git add -p >actual && - tail -n 7 actual.trimmed && - test_cmp expect actual.trimmed -' - -test_expect_success 'navigate to hunk via regex' ' - test_when_finished "git reset" && - tr _ " " >expect <<-EOF && - (2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]? @@ -1,2 +1,3 @@ - _10 - +15 - _20 - (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]?_ - EOF - test_write_lines s y /1,2 | git add -p >actual && - tail -n 5 actual.trimmed && - test_cmp expect actual.trimmed -' - test_expect_success 'split hunk "add -p (edit)"' ' # Split, say Edit and do nothing. Then: # @@ -481,40 +403,6 @@ test_expect_failure 'split hunk "add -p (no, yes, edit)"' ' ! grep "^+31" actual ' -test_expect_success 'split hunk with incomplete line at end' ' - git reset --hard && - printf "missing LF" >>test && - git add test && - test_write_lines before 10 20 30 40 50 60 70 >test && - git grep --cached missing && - test_write_lines s n y q | git add -p && - test_must_fail git grep --cached missing && - git grep before && - test_must_fail git grep --cached before -' - -test_expect_failure 'edit, adding lines to the first hunk' ' - test_write_lines 10 11 20 30 40 50 51 60 >test && - git reset && - tr _ " " >patch <<-EOF && - @@ -1,5 +1,6 @@ - _10 - +11 - +12 - _20 - +21 - +22 - _30 - EOF - # test sequence is s(plit), e(dit), n(o) - # q n q q is there to make sure we exit at the end. - printf "%s\n" s e n q n q q | - EDITOR=./fake_editor.sh git add -p 2>error && - test_must_be_empty error && - git diff --cached >actual && - grep "^+22" actual -' - test_expect_success 'patch mode ignores unmerged entries' ' git reset --hard && test_commit conflict && @@ -541,61 +429,35 @@ test_expect_success 'patch mode ignores unmerged entries' ' diff_cmp expected diff ' -test_expect_success 'diffs can be colorized' ' +test_expect_success TTY 'diffs can be colorized' ' git reset --hard && echo content >test && - printf y >y && - force_color git add -p >output 2>&1 output 2>&1 && # We do not want to depend on the exact coloring scheme # git uses for diffs, so just check that we saw some kind of color. grep "$(printf "\\033")" output ' -test_expect_success 'colorized diffs respect diff.wsErrorHighlight' ' - git reset --hard && - - echo "old " >test && - git add test && - echo "new " >test && - - printf y >y && - force_color git -c diff.wsErrorHighlight=all add -p >output.raw 2>&1 output && - grep "old<" output -' - -test_expect_success 'diffFilter filters diff' ' +test_expect_success TTY 'diffFilter filters diff' ' git reset --hard && echo content >test && test_config interactive.diffFilter "sed s/^/foo:/" && - printf y >y && - force_color git add -p >output 2>&1 output 2>&1 && # avoid depending on the exact coloring or content of the prompts, # and just make sure we saw our diff prefixed grep foo:.*content output ' -test_expect_success 'detect bogus diffFilter output' ' +test_expect_success TTY 'detect bogus diffFilter output' ' git reset --hard && echo content >test && - test_config interactive.diffFilter "sed 1d" && - printf y >y && - test_must_fail force_color git add -p file && - git add file && - echo changed >file && - test_must_fail git -c diff.algorithm=bogus add -p 2>err && - test_i18ngrep "error: option diff-algorithm accepts " err + test_config interactive.diffFilter "echo too-short" && + printf y | test_must_fail test_terminal git add -p ' test_expect_success 'patch-mode via -i prompts for files' ' @@ -785,29 +647,4 @@ test_expect_success 'checkout -p works with pathological context lines' ' test_write_lines a b a b a a b a b a >expect && test_cmp expect a ' - -test_expect_success 'show help from add--helper' ' - git reset --hard && - cat >expect <<-EOF && - - *** Commands *** - 1: status 2: update 3: revert 4: add untracked - 5: patch 6: diff 7: quit 8: help - What now> status - show paths with changes - update - add working tree state to the staged set of changes - revert - revert staged set of changes back to the HEAD version - patch - pick hunks and update selectively - diff - view diff between HEAD and index - add untracked - add contents of untracked files to the staged set of changes - *** Commands *** - 1: status 2: update 3: revert 4: add untracked - 5: patch 6: diff 7: quit 8: help - What now>$SP - Bye. - EOF - test_write_lines h | force_color git add -i >actual.colored && - test_decode_color actual && - test_i18ncmp expect actual -' - test_done diff --git a/third_party/git/t/t3704-add-pathspec-file.sh b/third_party/git/t/t3704-add-pathspec-file.sh deleted file mode 100755 index 9e35c1fbca68..000000000000 --- a/third_party/git/t/t3704-add-pathspec-file.sh +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/sh - -test_description='add --pathspec-from-file' - -. ./test-lib.sh - -test_tick - -test_expect_success setup ' - test_commit file0 && - echo A >fileA.t && - echo B >fileB.t && - echo C >fileC.t && - echo D >fileD.t -' - -restore_checkpoint () { - git reset -} - -verify_expect () { - git status --porcelain --untracked-files=no -- fileA.t fileB.t fileC.t fileD.t >actual && - test_cmp expect actual -} - -test_expect_success '--pathspec-from-file from stdin' ' - restore_checkpoint && - - echo fileA.t | git add --pathspec-from-file=- && - - cat >expect <<-\EOF && - A fileA.t - EOF - verify_expect -' - -test_expect_success '--pathspec-from-file from file' ' - restore_checkpoint && - - echo fileA.t >list && - git add --pathspec-from-file=list && - - cat >expect <<-\EOF && - A fileA.t - EOF - verify_expect -' - -test_expect_success 'NUL delimiters' ' - restore_checkpoint && - - printf "fileA.t\0fileB.t\0" | git add --pathspec-from-file=- --pathspec-file-nul && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'LF delimiters' ' - restore_checkpoint && - - printf "fileA.t\nfileB.t\n" | git add --pathspec-from-file=- && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'no trailing delimiter' ' - restore_checkpoint && - - printf "fileA.t\nfileB.t" | git add --pathspec-from-file=- && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'CRLF delimiters' ' - restore_checkpoint && - - printf "fileA.t\r\nfileB.t\r\n" | git add --pathspec-from-file=- && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'quotes' ' - restore_checkpoint && - - cat >list <<-\EOF && - "file\101.t" - EOF - - git add --pathspec-from-file=list && - - cat >expect <<-\EOF && - A fileA.t - EOF - verify_expect -' - -test_expect_success 'quotes not compatible with --pathspec-file-nul' ' - restore_checkpoint && - - cat >list <<-\EOF && - "file\101.t" - EOF - - test_must_fail git add --pathspec-from-file=list --pathspec-file-nul -' - -test_expect_success 'only touches what was listed' ' - restore_checkpoint && - - printf "fileB.t\nfileC.t\n" | git add --pathspec-from-file=- && - - cat >expect <<-\EOF && - A fileB.t - A fileC.t - EOF - verify_expect -' - -test_expect_success 'error conditions' ' - restore_checkpoint && - echo fileA.t >list && - >empty_list && - - test_must_fail git add --pathspec-from-file=list --interactive 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with --interactive/--patch" err && - - test_must_fail git add --pathspec-from-file=list --patch 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with --interactive/--patch" err && - - test_must_fail git add --pathspec-from-file=list --edit 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with --edit" err && - - test_must_fail git add --pathspec-from-file=list -- fileA.t 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err && - - test_must_fail git add --pathspec-file-nul 2>err && - test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err && - - # This case succeeds, but still prints to stderr - git add --pathspec-from-file=empty_list 2>err && - test_i18ngrep -e "Nothing specified, nothing added." err -' - -test_done diff --git a/third_party/git/t/t3800-mktag.sh b/third_party/git/t/t3800-mktag.sh index 64dcc5ec289e..8eb47942e2d7 100755 --- a/third_party/git/t/t3800-mktag.sh +++ b/third_party/git/t/t3800-mktag.sh @@ -23,7 +23,6 @@ check_verify_failure () { # first create a commit, so we have a valid object/type # for the tag. test_expect_success 'setup' ' - test_oid_init && echo Hello >A && git update-index --add A && git commit -m "Initial commit" && @@ -70,28 +69,28 @@ check_verify_failure '"object" line SHA1 check' '^error: char7: .*SHA1 hash$' # 4. type line label check cat >tag.sig < 0 +0000 EOF -check_verify_failure '"type" line label check' '^error: char.*: .*"\\ntype "$' +check_verify_failure '"type" line label check' '^error: char47: .*"\\ntype "$' ############################################################ # 5. type line eol check -echo "object $head" >tag.sig +echo "object 779e9b33986b1c2670fff52c5067603117b3e895" >tag.sig printf "type tagsssssssssssssssssssssssssssssss" >>tag.sig -check_verify_failure '"type" line eol check' '^error: char.*: .*"\\n"$' +check_verify_failure '"type" line eol check' '^error: char48: .*"\\n"$' ############################################################ # 6. tag line label check #1 cat >tag.sig < 0 +0000 @@ -99,37 +98,37 @@ tagger . <> 0 +0000 EOF check_verify_failure '"tag" line label check #1' \ - '^error: char.*: no "tag " found$' + '^error: char57: no "tag " found$' ############################################################ # 7. tag line label check #2 cat >tag.sig <tag.sig <tag.sig < 0 +0000 @@ -151,7 +150,7 @@ tagger . <> 0 +0000 EOF check_verify_failure 'verify tag-name check' \ - '^error: char.*: could not verify tag name$' + '^error: char67: could not verify tag name$' ############################################################ # 11. tagger line label check #1 @@ -165,7 +164,7 @@ This is filler EOF check_verify_failure '"tagger" line label check #1' \ - '^error: char.*: could not find "tagger "$' + '^error: char70: could not find "tagger "$' ############################################################ # 12. tagger line label check #2 @@ -180,7 +179,7 @@ This is filler EOF check_verify_failure '"tagger" line label check #2' \ - '^error: char.*: could not find "tagger "$' + '^error: char70: could not find "tagger "$' ############################################################ # 13. disallow missing tag author name @@ -195,7 +194,7 @@ This is filler EOF check_verify_failure 'disallow missing tag author name' \ - '^error: char.*: missing tagger name$' + '^error: char77: missing tagger name$' ############################################################ # 14. disallow missing tag author name @@ -210,7 +209,7 @@ tagger T A Gger < EOF check_verify_failure 'disallow malformed tagger' \ - '^error: char.*: malformed tagger field$' + '^error: char77: malformed tagger field$' ############################################################ # 15. allow empty tag email @@ -239,7 +238,7 @@ tagger T A Gger 0 +0000 EOF check_verify_failure 'disallow spaces in tag email' \ - '^error: char.*: malformed tagger field$' + '^error: char77: malformed tagger field$' ############################################################ # 17. disallow missing tag timestamp @@ -253,7 +252,7 @@ tagger T A Gger __ EOF check_verify_failure 'disallow missing tag timestamp' \ - '^error: char.*: missing tag timestamp$' + '^error: char107: missing tag timestamp$' ############################################################ # 18. detect invalid tag timestamp1 @@ -267,7 +266,7 @@ tagger T A Gger Tue Mar 25 15:47:44 2008 EOF check_verify_failure 'detect invalid tag timestamp1' \ - '^error: char.*: missing tag timestamp$' + '^error: char107: missing tag timestamp$' ############################################################ # 19. detect invalid tag timestamp2 @@ -281,7 +280,7 @@ tagger T A Gger 2008-03-31T12:20:15-0500 EOF check_verify_failure 'detect invalid tag timestamp2' \ - '^error: char.*: malformed tag timestamp$' + '^error: char111: malformed tag timestamp$' ############################################################ # 20. detect invalid tag timezone1 @@ -295,7 +294,7 @@ tagger T A Gger 1206478233 GMT EOF check_verify_failure 'detect invalid tag timezone1' \ - '^error: char.*: malformed tag timezone$' + '^error: char118: malformed tag timezone$' ############################################################ # 21. detect invalid tag timezone2 @@ -309,7 +308,7 @@ tagger T A Gger 1206478233 + 30 EOF check_verify_failure 'detect invalid tag timezone2' \ - '^error: char.*: malformed tag timezone$' + '^error: char118: malformed tag timezone$' ############################################################ # 22. detect invalid tag timezone3 @@ -323,7 +322,7 @@ tagger T A Gger 1206478233 -1430 EOF check_verify_failure 'detect invalid tag timezone3' \ - '^error: char.*: malformed tag timezone$' + '^error: char118: malformed tag timezone$' ############################################################ # 23. detect invalid header entry @@ -338,7 +337,7 @@ this line should not be here EOF check_verify_failure 'detect invalid header entry' \ - '^error: char.*: trailing garbage in tag header$' + '^error: char124: trailing garbage in tag header$' ############################################################ # 24. create valid tag diff --git a/third_party/git/t/t3900-i18n-commit.sh b/third_party/git/t/t3900-i18n-commit.sh index d277a9f4b721..b92ff9597728 100755 --- a/third_party/git/t/t3900-i18n-commit.sh +++ b/third_party/git/t/t3900-i18n-commit.sh @@ -204,41 +204,4 @@ test_commit_autosquash_flags eucJP fixup test_commit_autosquash_flags ISO-2022-JP squash -test_commit_autosquash_multi_encoding () { - flag=$1 - old=$2 - new=$3 - msg=$4 - test_expect_success "commit --$flag into $old from $new" ' - git checkout -b $flag-$old-$new C0 && - git config i18n.commitencoding $old && - echo $old >>F && - git commit -a -F "$TEST_DIRECTORY"/t3900/$msg && - test_tick && - echo intermediate stuff >>G && - git add G && - git commit -a -m "intermediate commit" && - test_tick && - git config i18n.commitencoding $new && - echo $new-$flag >>F && - git commit -a --$flag HEAD^ && - git rebase --autosquash -i HEAD^^^ && - git rev-list HEAD >actual && - test_line_count = 3 actual && - iconv -f $old -t UTF-8 "$TEST_DIRECTORY"/t3900/$msg >expect && - if test $flag = squash; then - subject="$(head -1 expect)" && - printf "\nsquash! %s\n" "$subject" >>expect - fi && - git cat-file commit HEAD^ >raw && - (sed "1,/^$/d" raw | iconv -f $new -t utf-8) >actual && - test_cmp expect actual - ' -} - -test_commit_autosquash_multi_encoding fixup UTF-8 ISO-8859-1 1-UTF-8.txt -test_commit_autosquash_multi_encoding squash ISO-8859-1 UTF-8 ISO8859-1.txt -test_commit_autosquash_multi_encoding squash eucJP ISO-2022-JP eucJP.txt -test_commit_autosquash_multi_encoding fixup ISO-2022-JP UTF-8 ISO-2022-JP.txt - test_done diff --git a/third_party/git/t/t3903-stash.sh b/third_party/git/t/t3903-stash.sh index 3ad23e2502be..b8e337893f3e 100755 --- a/third_party/git/t/t3903-stash.sh +++ b/third_party/git/t/t3903-stash.sh @@ -7,18 +7,6 @@ test_description='Test git stash' . ./test-lib.sh -diff_cmp () { - for i in "$1" "$2" - do - sed -e 's/^index 0000000\.\.[0-9a-f]*/index 0000000..1234567/' \ - -e 's/^index [0-9a-f]*\.\.[0-9a-f]*/index 1234567..89abcde/' \ - -e 's/^index [0-9a-f]*,[0-9a-f]*\.\.[0-9a-f]*/index 1234567,7654321..89abcde/' \ - "$i" >"$i.compare" || return 1 - done && - test_cmp "$1.compare" "$2.compare" && - rm -f "$1.compare" "$2.compare" -} - test_expect_success 'stash some dirty working directory' ' echo 1 >file && git add file && @@ -48,7 +36,7 @@ EOF test_expect_success 'parents of stash' ' test $(git rev-parse stash^) = $(git rev-parse HEAD) && git diff stash^2..stash >output && - diff_cmp expect output + test_cmp expect output ' test_expect_success 'applying bogus stash does nothing' ' @@ -222,13 +210,13 @@ test_expect_success 'stash branch' ' test refs/heads/stashbranch = $(git symbolic-ref HEAD) && test $(git rev-parse HEAD) = $(git rev-parse master^) && git diff --cached >output && - diff_cmp expect output && + test_cmp expect output && git diff >output && - diff_cmp expect1 output && + test_cmp expect1 output && git add file && git commit -m alternate\ second && git diff master..stashbranch >output && - diff_cmp output expect2 && + test_cmp output expect2 && test 0 = $(git stash list | wc -l) ' @@ -244,11 +232,8 @@ test_expect_success 'save -q is quiet' ' test_must_be_empty output.out ' -test_expect_success 'pop -q works and is quiet' ' +test_expect_success 'pop -q is quiet' ' git stash pop -q >output.out 2>&1 && - echo bar >expect && - git show :file >actual && - test_cmp expect actual && test_must_be_empty output.out ' @@ -257,8 +242,6 @@ test_expect_success 'pop -q --index works and is quiet' ' git add file && git stash save --quiet && git stash pop -q --index >output.out 2>&1 && - git diff-files file2 >file2.diff && - test_must_be_empty file2.diff && test foo = "$(git show :file)" && test_must_be_empty output.out ' @@ -285,11 +268,6 @@ test_expect_success 'stash --no-keep-index' ' test bar,bar2 = $(cat file),$(cat file2) ' -test_expect_success 'dont assume push with non-option args' ' - test_must_fail git stash -q drop 2>err && - test_i18ngrep -e "subcommand wasn'\''t specified; '\''push'\'' can'\''t be assumed due to unexpected token '\''drop'\''" err -' - test_expect_success 'stash --invalid-option' ' echo bar5 >file && echo bar6 >file2 && @@ -599,7 +577,7 @@ test_expect_success 'stash show -p - stashes on stack, stash-like argument' ' +bar EOF git stash show -p ${STASH_ID} >actual && - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'stash show - no stashes on stack, stash-like argument' ' @@ -631,7 +609,7 @@ test_expect_success 'stash show -p - no stashes on stack, stash-like argument' ' +foo EOF git stash show -p ${STASH_ID} >actual && - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'stash show --patience shows diff' ' @@ -649,7 +627,7 @@ test_expect_success 'stash show --patience shows diff' ' +foo EOF git stash show --patience ${STASH_ID} >actual && - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'drop: fail early if specified stash is not a stash ref' ' @@ -813,7 +791,7 @@ test_expect_success 'stash where working directory contains "HEAD" file' ' git diff-index --cached --quiet HEAD && test "$(git rev-parse stash^)" = "$(git rev-parse HEAD)" && git diff stash^..stash >output && - diff_cmp expect output + test_cmp expect output ' test_expect_success 'store called with invalid commit' ' @@ -869,7 +847,7 @@ test_expect_success 'stash list implies --first-parent -m' ' +working EOF git stash list --format=%gd -p >actual && - diff_cmp expect actual + test_cmp expect actual ' test_expect_success 'stash list --cc shows combined diff' ' @@ -886,7 +864,7 @@ test_expect_success 'stash list --cc shows combined diff' ' ++working EOF git stash list --format=%gd -p --cc >actual && - diff_cmp expect actual + test_cmp expect actual ' test_expect_success 'stash is not confused by partial renames' ' @@ -1263,31 +1241,4 @@ test_expect_success 'stash --keep-index with file deleted in index does not resu test_path_is_missing to-remove ' -test_expect_success 'stash apply should succeed with unmodified file' ' - echo base >file && - git add file && - git commit -m base && - - # now stash a modification - echo modified >file && - git stash && - - # make the file stat dirty - cp file other && - mv other file && - - git stash apply -' - -test_expect_success 'stash handles skip-worktree entries nicely' ' - test_commit A && - echo changed >A.t && - git add A.t && - git update-index --skip-worktree A.t && - rm A.t && - git stash && - - git rev-parse --verify refs/stash:A.t -' - test_done diff --git a/third_party/git/t/t3905-stash-include-untracked.sh b/third_party/git/t/t3905-stash-include-untracked.sh index f075c7f1f316..29ca76f2fbea 100755 --- a/third_party/git/t/t3905-stash-include-untracked.sh +++ b/third_party/git/t/t3905-stash-include-untracked.sh @@ -277,8 +277,8 @@ test_expect_success 'stash -u -- leaves ignored file alone' ' test_path_is_file ignored.d/bar ' -test_expect_success 'stash -u -- shows no changes when there are none' ' - git stash push -u -- non-existent >actual && +test_expect_success 'stash -u -- shows no changes when there are none' ' + git stash push -u -- non-existant >actual && echo "No local changes to save" >expect && test_i18ncmp expect actual ' diff --git a/third_party/git/t/t3906-stash-submodule.sh b/third_party/git/t/t3906-stash-submodule.sh index b93d1d74da7b..d7219d6f8f18 100755 --- a/third_party/git/t/t3906-stash-submodule.sh +++ b/third_party/git/t/t3906-stash-submodule.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='stash can handle submodules' +test_description='stash apply can handle submodules' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-submodule-update.sh @@ -21,44 +21,4 @@ KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT=1 KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1 test_submodule_switch "git_stash" -setup_basic () { - test_when_finished "rm -rf main sub" && - git init sub && - ( - cd sub && - test_commit sub_file - ) && - git init main && - ( - cd main && - git submodule add ../sub && - test_commit main_file - ) -} - -test_expect_success 'stash push with submodule.recurse=true preserves dirty submodule worktree' ' - setup_basic && - ( - cd main && - git config submodule.recurse true && - echo "x" >main_file.t && - echo "y" >sub/sub_file.t && - git stash push && - test_must_fail git -C sub diff --quiet - ) -' - -test_expect_success 'stash push and pop with submodule.recurse=true preserves dirty submodule worktree' ' - setup_basic && - ( - cd main && - git config submodule.recurse true && - echo "x" >main_file.t && - echo "y" >sub/sub_file.t && - git stash push && - git stash pop && - test_must_fail git -C sub diff --quiet - ) -' - test_done diff --git a/third_party/git/t/t3908-stash-in-worktree.sh b/third_party/git/t/t3908-stash-in-worktree.sh deleted file mode 100755 index 2b2b366ef94b..000000000000 --- a/third_party/git/t/t3908-stash-in-worktree.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2019 Johannes E Schindelin -# - -test_description='Test git stash in a worktree' - -. ./test-lib.sh - -test_expect_success 'setup' ' - test_commit initial && - git worktree add wt && - test_commit -C wt in-worktree -' - -test_expect_success 'apply in subdirectory' ' - mkdir wt/subdir && - ( - cd wt/subdir && - echo modified >../initial.t && - git stash && - git stash apply >out - ) && - grep "\.\.\/initial\.t" wt/subdir/out -' - -test_done diff --git a/third_party/git/t/t3909-stash-pathspec-file.sh b/third_party/git/t/t3909-stash-pathspec-file.sh deleted file mode 100755 index 55e050cfd4db..000000000000 --- a/third_party/git/t/t3909-stash-pathspec-file.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh - -test_description='stash --pathspec-from-file' - -. ./test-lib.sh - -test_tick - -test_expect_success setup ' - >fileA.t && - >fileB.t && - >fileC.t && - >fileD.t && - git add fileA.t fileB.t fileC.t fileD.t && - git commit -m "Files" && - - git tag checkpoint -' - -restore_checkpoint () { - git reset --hard checkpoint -} - -verify_expect () { - git stash show --name-status >actual && - test_cmp expect actual -} - -test_expect_success 'simplest' ' - restore_checkpoint && - - # More files are written to make sure that git didnt ignore - # --pathspec-from-file, stashing everything - echo A >fileA.t && - echo B >fileB.t && - echo C >fileC.t && - echo D >fileD.t && - - cat >expect <<-\EOF && - M fileA.t - EOF - - echo fileA.t | git stash push --pathspec-from-file=- && - verify_expect -' - -test_expect_success '--pathspec-file-nul' ' - restore_checkpoint && - - # More files are written to make sure that git didnt ignore - # --pathspec-from-file, stashing everything - echo A >fileA.t && - echo B >fileB.t && - echo C >fileC.t && - echo D >fileD.t && - - cat >expect <<-\EOF && - M fileA.t - M fileB.t - EOF - - printf "fileA.t\0fileB.t\0" | git stash push --pathspec-from-file=- --pathspec-file-nul && - verify_expect -' - -test_expect_success 'only touches what was listed' ' - restore_checkpoint && - - # More files are written to make sure that git didnt ignore - # --pathspec-from-file, stashing everything - echo A >fileA.t && - echo B >fileB.t && - echo C >fileC.t && - echo D >fileD.t && - - cat >expect <<-\EOF && - M fileB.t - M fileC.t - EOF - - printf "fileB.t\nfileC.t\n" | git stash push --pathspec-from-file=- && - verify_expect -' - -test_expect_success 'error conditions' ' - restore_checkpoint && - echo A >fileA.t && - echo fileA.t >list && - - test_must_fail git stash push --pathspec-from-file=list --patch 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with --patch" err && - - test_must_fail git stash push --pathspec-from-file=list -- fileA.t 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err && - - test_must_fail git stash push --pathspec-file-nul 2>err && - test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err -' - -test_done diff --git a/third_party/git/t/t4000-diff-format.sh b/third_party/git/t/t4000-diff-format.sh index e5116a76a1cc..8de36b7d1222 100755 --- a/third_party/git/t/t4000-diff-format.sh +++ b/third_party/git/t/t4000-diff-format.sh @@ -78,7 +78,7 @@ test_expect_success 'git diff-files --no-patch --patch shows the patch' ' test_expect_success 'git diff-files --no-patch --patch-with-raw shows the patch and raw data' ' git diff-files --no-patch --patch-with-raw >actual && - grep -q "^:100644 100755 .* $ZERO_OID M path0\$" actual && + grep -q "^:100644 100755 .* 0000000000000000000000000000000000000000 M path0\$" actual && tail -n +4 actual >actual-patch && compare_diff_patch expected actual-patch ' diff --git a/third_party/git/t/t4002-diff-basic.sh b/third_party/git/t/t4002-diff-basic.sh index cbcdd104647b..3a6c21e8251b 100755 --- a/third_party/git/t/t4002-diff-basic.sh +++ b/third_party/git/t/t4002-diff-basic.sh @@ -7,272 +7,123 @@ test_description='Test diff raw-output. ' . ./test-lib.sh - . "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh -test_oid_init - -test_oid_cache <<\EOF -aa_1 sha1:ccba72ad3888a3520b39efcf780b9ee64167535d -aa_1 sha256:9febfbf18197819b2735c45291f138525d2476d59470f98239647544586ba403 - -aa_2 sha1:6aa2b5335b16431a0ef71e5c0a28be69183cf6a2 -aa_2 sha256:6eaa3437de83f145a4aaa6ba355303075ade547b128ec6a2cd00a81ff7ce7a56 - -an_1 sha1:7e426fb079479fd67f6d81f984e4ec649a44bc25 -an_1 sha256:8f92a0bec99e399a38e3bd0e1bf19fbf121e0160efb29b857df79d439f1c4536 - -dd_1 sha1:bcc68ef997017466d5c9094bcf7692295f588c9a -dd_1 sha256:07e17428b00639b85485d2b01083d219e2f3e3ba8579e9ca44e9cc8dd554d952 - -df_1 sha1:6d50f65d3bdab91c63444294d38f08aeff328e42 -df_1 sha256:e367cecc27e9bf5451b1c65828cb21938d36a5f8e39c1b03ad6509cc36bb8e9d - -df_2 sha1:71420ab81e254145d26d6fc0cddee64c1acd4787 -df_2 sha256:0f0a86d10347ff6921d03a3c954679f3f1d14fa3d5cd82f57b32c09755f3a47d - -dfd1 sha1:68a6d8b91da11045cf4aa3a5ab9f2a781c701249 -dfd1 sha256:f3bd3265b02b6978ce86490d8ad026c573639c974b3de1d9faf30d8d5a77d3d5 - -dm_1 sha1:141c1f1642328e4bc46a7d801a71da392e66791e -dm_1 sha256:c89f8656e7b94e21ee5fbaf0e2149bbf783c51edbe2ce110349cac13059ee7ed - -dm_2 sha1:3c4d8de5fbad08572bab8e10eef8dbb264cf0231 -dm_2 sha256:83a572e37e0c94086294dae2cecc43d9131afd6f6c906e495c78972230b54988 - -dn_1 sha1:35abde1506ddf806572ff4d407bd06885d0f8ee9 -dn_1 sha256:775d5852582070e620be63327bfa515fab8f71c7ac3e4f0c3cd6267b4377ba28 - -ll_2 sha1:1d41122ebdd7a640f29d3c9cc4f9d70094374762 -ll_2 sha256:7917b4948a883cfed0a77d3d5a625dc8577d6ddcc3c6c3bbc56c4d4226a2246d - -md_1 sha1:03f24c8c4700babccfd28b654e7e8eac402ad6cd -md_1 sha256:fc9f30369b978595ad685ba11ca9a17de0af16d79cd4b629975f4f1590033902 - -md_2 sha1:103d9f89b50b9aad03054b579be5e7aa665f2d57 -md_2 sha256:fc78ec75275628762fe520479a6b2398dec295ce7aabcb1d15e5963c7b4e9317 - -mm_1 sha1:b258508afb7ceb449981bd9d63d2d3e971bf8d34 -mm_1 sha256:a4b7847d228e900e3000285e240c20fd96f9dd41ce1445305f6eada126d4a04a - -mm_2 sha1:b431b272d829ff3aa4d1a5085f4394ab4d3305b6 -mm_2 sha256:3f8b83ea36aacf689bcf1a1290a9a8ed341564d32682ea6f76fea9a979186782 - -mm_3 sha1:19989d4559aae417fedee240ccf2ba315ea4dc2b -mm_3 sha256:71b3bfc5747ac033fff9ea0ab39ee453a3af2969890e75d6ef547b87544e2681 - -mn_1 sha1:bd084b0c27c7b6cc34f11d6d0509a29be3caf970 -mn_1 sha256:47a67450583d7a329eb01a7c4ba644945af72c0ed2c7c95eb5a00d6e46d4d483 - -mn_2 sha1:a716d58de4a570e0038f5c307bd8db34daea021f -mn_2 sha256:f95104c1ebe27acb84bac25a7be98c71f6b8d3054b21f357a5be0c524ad97e08 - -nm_1 sha1:c8f25781e8f1792e3e40b74225e20553041b5226 -nm_1 sha256:09baddc7afaa62e62e152c23c9c3ab94bf15a3894031e227e9be7fe68e1f4e49 - -nm_2 sha1:cdb9a8c3da571502ac30225e9c17beccb8387983 -nm_2 sha256:58b5227956ac2d2a08d0efa513c0ae37430948b16791ea3869a1308dbf05536d - -na_1 sha1:15885881ea69115351c09b38371f0348a3fb8c67 -na_1 sha256:18e4fdd1670cd7968ee23d35bfd29e5418d56fb190c840094c1c57ceee0aad8f - -nd_1 sha1:a4e179e4291e5536a5e1c82e091052772d2c5a93 -nd_1 sha256:07dac9b01d00956ea0c65bd993d7de4864aeef2ed3cbb1255d9f1d949fcd6df6 - -ss_1 sha1:40c959f984c8b89a2b02520d17f00d717f024397 -ss_1 sha256:50fc1b5df74d9910db2f9270993484235f15b69b75b01bcfb53e059289d14af9 - -ss_2 sha1:2ac547ae9614a00d1b28275de608131f7a0e259f -ss_2 sha256:a90f02e6044f1497d13db587d22ab12f90150a7d1e084afcf96065fab35ae2bc - -tt_1 sha1:4ac13458899ab908ef3b1128fa378daefc88d356 -tt_1 sha256:c53113c7dd5060e86b5b251428bd058f6726f66273c6a24bff1c61a04f498dd3 - -tt_2 sha1:4c86f9a85fbc5e6804ee2e17a797538fbe785bca -tt_2 sha256:0775f2a296129a7cf2862b46bc0e88c14d593f2773a3e3fb1c5193db6f5a7e77 - -tt_3 sha1:c4e4a12231b9fa79a0053cb6077fcb21bb5b135a -tt_3 sha256:47860f93cdd211f96443e0560f21c57ab6c2f4b0ac27ff03651a352e53fe8484 - -z__1 sha1:7d670fdcdb9929f6c7dac196ff78689cd1c566a1 -z__1 sha256:44d0f37aff5e51cfcfdd1134c93a6419bcca7b9964f792ffcd5f9b4fcba1ee63 - -z__2 sha1:5e5f22072bb39f6e12cf663a57cb634c76eefb49 -z__2 sha256:d29de162113190fed104eb5f010820cef4e315f89b9326e8497f7219fb737894 - -z__3 sha1:1ba523955d5160681af65cb776411f574c1e8155 -z__3 sha256:07422d772b07794ab4369a5648e617719f89c2d2212cbeab05d97214b6471636 - -zaa1 sha1:8acb8e9750e3f644bf323fcf3d338849db106c77 -zaa1 sha256:e79b029282c8abec2d9f3f7faceaf2a1405e02d1f368e66450ae66cf5b68d1f4 - -zaa2 sha1:6c0b99286d0bce551ac4a7b3dff8b706edff3715 -zaa2 sha256:c82bd78c3e69ea1796e6b1a7a3ba45bb106c50e819296475b862123d3f5cc5a0 - -zan1 sha1:087494262084cefee7ed484d20c8dc0580791272 -zan1 sha256:4b159eb3804d05599023dd074f771d06d02870f4ab24a7165add8ac3d703b8d3 - -zdd1 sha1:879007efae624d2b1307214b24a956f0a8d686a8 -zdd1 sha256:eecfdd4d8092dd0363fb6d4548b54c6afc8982c3ed9b34e393f1d6a921d8eaa3 - -zdm1 sha1:9b541b2275c06e3a7b13f28badf5294e2ae63df4 -zdm1 sha256:ab136e88e19a843c4bf7713d2090d5a2186ba16a6a80dacc12eeddd256a8e556 - -zdm2 sha1:d77371d15817fcaa57eeec27f770c505ba974ec1 -zdm2 sha256:1c1a5f57363f46a15d95ce8527b3c2c158d88d16853b4acbf81bd20fd2c89a46 - -zdn1 sha1:beb5d38c55283d280685ea21a0e50cfcc0ca064a -zdn1 sha256:0f0eca66183617b0aa5ad74b256540329f841470922ca6760263c996d825eb18 - -zmd1 sha1:d41fda41b7ec4de46b43cb7ea42a45001ae393d5 -zmd1 sha256:1ed32d481852eddf31a0ce12652a0ad14bf5b7a842667b5dbb0b50f35bf1c80a - -zmd2 sha1:a79ac3be9377639e1c7d1edf1ae1b3a5f0ccd8a9 -zmd2 sha256:b238da211b404f8917df2d9c6f7030535e904b2186131007a3c292ec6902f933 - -zmm1 sha1:4ca22bae2527d3d9e1676498a0fba3b355bd1278 -zmm1 sha256:072b1d85b5f34fabc99dfa46008c5418df68302d3e317430006f49b32d244226 - -zmm2 sha1:61422ba9c2c873416061a88cd40a59a35b576474 -zmm2 sha256:81dd5d2b3c5cda16fef552256aed4e2ea0802a8450a08f308a92142112ff6dda - -zmm3 sha1:697aad7715a1e7306ca76290a3dd4208fbaeddfa -zmm3 sha256:8b10fab49e9be3414aa5e9a93d0e46f9569053440138a7c19a5eb5536d8e95bf - -zmn1 sha1:b16d7b25b869f2beb124efa53467d8a1550ad694 -zmn1 sha256:609e4f75d1295e844c826feeba213acb0b6cfc609adfe8ff705b19e3829ae3e9 - -zmn2 sha1:a5c544c21cfcb07eb80a4d89a5b7d1570002edfd -zmn2 sha256:d6d03edf2dc1a3b267a8205de5f41a2ff4b03def8c7ae02052b543fb09d589fc - -zna1 sha1:d12979c22fff69c59ca9409e7a8fe3ee25eaee80 -zna1 sha256:b37b80e789e8ea32aa323f004628f02013f632124b0282c7fe00a127d3c64c3c - -znd1 sha1:a18393c636b98e9bd7296b8b437ea4992b72440c -znd1 sha256:af92a22eee8c38410a0c9d2b5135a10aeb052cbc7cf675541ed9a67bfcaf7cf9 - -znm1 sha1:3fdbe17fd013303a2e981e1ca1c6cd6e72789087 -znm1 sha256:f75aeaa0c11e76918e381c105f0752932c6150e941fec565d24fa31098a13dc1 - -znm2 sha1:7e09d6a3a14bd630913e8c75693cea32157b606d -znm2 sha256:938d73cfbaa1c902a84fb5b3afd9736aa0590367fb9bd59c6c4d072ce70fcd6d -EOF - -cat >.test-plain-OA <.test-plain-OA <<\EOF +:000000 100644 0000000000000000000000000000000000000000 ccba72ad3888a3520b39efcf780b9ee64167535d A AA +:000000 100644 0000000000000000000000000000000000000000 7e426fb079479fd67f6d81f984e4ec649a44bc25 A AN +:100644 000000 bcc68ef997017466d5c9094bcf7692295f588c9a 0000000000000000000000000000000000000000 D DD +:000000 040000 0000000000000000000000000000000000000000 6d50f65d3bdab91c63444294d38f08aeff328e42 A DF +:100644 000000 141c1f1642328e4bc46a7d801a71da392e66791e 0000000000000000000000000000000000000000 D DM +:100644 000000 35abde1506ddf806572ff4d407bd06885d0f8ee9 0000000000000000000000000000000000000000 D DN +:000000 100644 0000000000000000000000000000000000000000 1d41122ebdd7a640f29d3c9cc4f9d70094374762 A LL +:100644 100644 03f24c8c4700babccfd28b654e7e8eac402ad6cd 103d9f89b50b9aad03054b579be5e7aa665f2d57 M MD +:100644 100644 b258508afb7ceb449981bd9d63d2d3e971bf8d34 b431b272d829ff3aa4d1a5085f4394ab4d3305b6 M MM +:100644 100644 bd084b0c27c7b6cc34f11d6d0509a29be3caf970 a716d58de4a570e0038f5c307bd8db34daea021f M MN +:100644 100644 40c959f984c8b89a2b02520d17f00d717f024397 2ac547ae9614a00d1b28275de608131f7a0e259f M SS +:100644 100644 4ac13458899ab908ef3b1128fa378daefc88d356 4c86f9a85fbc5e6804ee2e17a797538fbe785bca M TT +:040000 040000 7d670fdcdb9929f6c7dac196ff78689cd1c566a1 5e5f22072bb39f6e12cf663a57cb634c76eefb49 M Z EOF -cat >.test-recursive-OA <.test-recursive-OA <<\EOF +:000000 100644 0000000000000000000000000000000000000000 ccba72ad3888a3520b39efcf780b9ee64167535d A AA +:000000 100644 0000000000000000000000000000000000000000 7e426fb079479fd67f6d81f984e4ec649a44bc25 A AN +:100644 000000 bcc68ef997017466d5c9094bcf7692295f588c9a 0000000000000000000000000000000000000000 D DD +:000000 100644 0000000000000000000000000000000000000000 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 A DF/DF +:100644 000000 141c1f1642328e4bc46a7d801a71da392e66791e 0000000000000000000000000000000000000000 D DM +:100644 000000 35abde1506ddf806572ff4d407bd06885d0f8ee9 0000000000000000000000000000000000000000 D DN +:000000 100644 0000000000000000000000000000000000000000 1d41122ebdd7a640f29d3c9cc4f9d70094374762 A LL +:100644 100644 03f24c8c4700babccfd28b654e7e8eac402ad6cd 103d9f89b50b9aad03054b579be5e7aa665f2d57 M MD +:100644 100644 b258508afb7ceb449981bd9d63d2d3e971bf8d34 b431b272d829ff3aa4d1a5085f4394ab4d3305b6 M MM +:100644 100644 bd084b0c27c7b6cc34f11d6d0509a29be3caf970 a716d58de4a570e0038f5c307bd8db34daea021f M MN +:100644 100644 40c959f984c8b89a2b02520d17f00d717f024397 2ac547ae9614a00d1b28275de608131f7a0e259f M SS +:100644 100644 4ac13458899ab908ef3b1128fa378daefc88d356 4c86f9a85fbc5e6804ee2e17a797538fbe785bca M TT +:000000 100644 0000000000000000000000000000000000000000 8acb8e9750e3f644bf323fcf3d338849db106c77 A Z/AA +:000000 100644 0000000000000000000000000000000000000000 087494262084cefee7ed484d20c8dc0580791272 A Z/AN +:100644 000000 879007efae624d2b1307214b24a956f0a8d686a8 0000000000000000000000000000000000000000 D Z/DD +:100644 000000 9b541b2275c06e3a7b13f28badf5294e2ae63df4 0000000000000000000000000000000000000000 D Z/DM +:100644 000000 beb5d38c55283d280685ea21a0e50cfcc0ca064a 0000000000000000000000000000000000000000 D Z/DN +:100644 100644 d41fda41b7ec4de46b43cb7ea42a45001ae393d5 a79ac3be9377639e1c7d1edf1ae1b3a5f0ccd8a9 M Z/MD +:100644 100644 4ca22bae2527d3d9e1676498a0fba3b355bd1278 61422ba9c2c873416061a88cd40a59a35b576474 M Z/MM +:100644 100644 b16d7b25b869f2beb124efa53467d8a1550ad694 a5c544c21cfcb07eb80a4d89a5b7d1570002edfd M Z/MN EOF -cat >.test-plain-OB <.test-plain-OB <<\EOF +:000000 100644 0000000000000000000000000000000000000000 6aa2b5335b16431a0ef71e5c0a28be69183cf6a2 A AA +:100644 000000 bcc68ef997017466d5c9094bcf7692295f588c9a 0000000000000000000000000000000000000000 D DD +:000000 100644 0000000000000000000000000000000000000000 71420ab81e254145d26d6fc0cddee64c1acd4787 A DF +:100644 100644 141c1f1642328e4bc46a7d801a71da392e66791e 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 M DM +:000000 100644 0000000000000000000000000000000000000000 1d41122ebdd7a640f29d3c9cc4f9d70094374762 A LL +:100644 000000 03f24c8c4700babccfd28b654e7e8eac402ad6cd 0000000000000000000000000000000000000000 D MD +:100644 100644 b258508afb7ceb449981bd9d63d2d3e971bf8d34 19989d4559aae417fedee240ccf2ba315ea4dc2b M MM +:000000 100644 0000000000000000000000000000000000000000 15885881ea69115351c09b38371f0348a3fb8c67 A NA +:100644 000000 a4e179e4291e5536a5e1c82e091052772d2c5a93 0000000000000000000000000000000000000000 D ND +:100644 100644 c8f25781e8f1792e3e40b74225e20553041b5226 cdb9a8c3da571502ac30225e9c17beccb8387983 M NM +:100644 100644 40c959f984c8b89a2b02520d17f00d717f024397 2ac547ae9614a00d1b28275de608131f7a0e259f M SS +:100644 100644 4ac13458899ab908ef3b1128fa378daefc88d356 c4e4a12231b9fa79a0053cb6077fcb21bb5b135a M TT +:040000 040000 7d670fdcdb9929f6c7dac196ff78689cd1c566a1 1ba523955d5160681af65cb776411f574c1e8155 M Z EOF -cat >.test-recursive-OB <.test-recursive-OB <<\EOF +:000000 100644 0000000000000000000000000000000000000000 6aa2b5335b16431a0ef71e5c0a28be69183cf6a2 A AA +:100644 000000 bcc68ef997017466d5c9094bcf7692295f588c9a 0000000000000000000000000000000000000000 D DD +:000000 100644 0000000000000000000000000000000000000000 71420ab81e254145d26d6fc0cddee64c1acd4787 A DF +:100644 100644 141c1f1642328e4bc46a7d801a71da392e66791e 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 M DM +:000000 100644 0000000000000000000000000000000000000000 1d41122ebdd7a640f29d3c9cc4f9d70094374762 A LL +:100644 000000 03f24c8c4700babccfd28b654e7e8eac402ad6cd 0000000000000000000000000000000000000000 D MD +:100644 100644 b258508afb7ceb449981bd9d63d2d3e971bf8d34 19989d4559aae417fedee240ccf2ba315ea4dc2b M MM +:000000 100644 0000000000000000000000000000000000000000 15885881ea69115351c09b38371f0348a3fb8c67 A NA +:100644 000000 a4e179e4291e5536a5e1c82e091052772d2c5a93 0000000000000000000000000000000000000000 D ND +:100644 100644 c8f25781e8f1792e3e40b74225e20553041b5226 cdb9a8c3da571502ac30225e9c17beccb8387983 M NM +:100644 100644 40c959f984c8b89a2b02520d17f00d717f024397 2ac547ae9614a00d1b28275de608131f7a0e259f M SS +:100644 100644 4ac13458899ab908ef3b1128fa378daefc88d356 c4e4a12231b9fa79a0053cb6077fcb21bb5b135a M TT +:000000 100644 0000000000000000000000000000000000000000 6c0b99286d0bce551ac4a7b3dff8b706edff3715 A Z/AA +:100644 000000 879007efae624d2b1307214b24a956f0a8d686a8 0000000000000000000000000000000000000000 D Z/DD +:100644 100644 9b541b2275c06e3a7b13f28badf5294e2ae63df4 d77371d15817fcaa57eeec27f770c505ba974ec1 M Z/DM +:100644 000000 d41fda41b7ec4de46b43cb7ea42a45001ae393d5 0000000000000000000000000000000000000000 D Z/MD +:100644 100644 4ca22bae2527d3d9e1676498a0fba3b355bd1278 697aad7715a1e7306ca76290a3dd4208fbaeddfa M Z/MM +:000000 100644 0000000000000000000000000000000000000000 d12979c22fff69c59ca9409e7a8fe3ee25eaee80 A Z/NA +:100644 000000 a18393c636b98e9bd7296b8b437ea4992b72440c 0000000000000000000000000000000000000000 D Z/ND +:100644 100644 3fdbe17fd013303a2e981e1ca1c6cd6e72789087 7e09d6a3a14bd630913e8c75693cea32157b606d M Z/NM EOF -cat >.test-plain-AB <.test-plain-AB <<\EOF +:100644 100644 ccba72ad3888a3520b39efcf780b9ee64167535d 6aa2b5335b16431a0ef71e5c0a28be69183cf6a2 M AA +:100644 000000 7e426fb079479fd67f6d81f984e4ec649a44bc25 0000000000000000000000000000000000000000 D AN +:000000 100644 0000000000000000000000000000000000000000 71420ab81e254145d26d6fc0cddee64c1acd4787 A DF +:040000 000000 6d50f65d3bdab91c63444294d38f08aeff328e42 0000000000000000000000000000000000000000 D DF +:000000 100644 0000000000000000000000000000000000000000 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 A DM +:000000 100644 0000000000000000000000000000000000000000 35abde1506ddf806572ff4d407bd06885d0f8ee9 A DN +:100644 000000 103d9f89b50b9aad03054b579be5e7aa665f2d57 0000000000000000000000000000000000000000 D MD +:100644 100644 b431b272d829ff3aa4d1a5085f4394ab4d3305b6 19989d4559aae417fedee240ccf2ba315ea4dc2b M MM +:100644 100644 a716d58de4a570e0038f5c307bd8db34daea021f bd084b0c27c7b6cc34f11d6d0509a29be3caf970 M MN +:000000 100644 0000000000000000000000000000000000000000 15885881ea69115351c09b38371f0348a3fb8c67 A NA +:100644 000000 a4e179e4291e5536a5e1c82e091052772d2c5a93 0000000000000000000000000000000000000000 D ND +:100644 100644 c8f25781e8f1792e3e40b74225e20553041b5226 cdb9a8c3da571502ac30225e9c17beccb8387983 M NM +:100644 100644 4c86f9a85fbc5e6804ee2e17a797538fbe785bca c4e4a12231b9fa79a0053cb6077fcb21bb5b135a M TT +:040000 040000 5e5f22072bb39f6e12cf663a57cb634c76eefb49 1ba523955d5160681af65cb776411f574c1e8155 M Z EOF -cat >.test-recursive-AB <.test-recursive-AB <<\EOF +:100644 100644 ccba72ad3888a3520b39efcf780b9ee64167535d 6aa2b5335b16431a0ef71e5c0a28be69183cf6a2 M AA +:100644 000000 7e426fb079479fd67f6d81f984e4ec649a44bc25 0000000000000000000000000000000000000000 D AN +:000000 100644 0000000000000000000000000000000000000000 71420ab81e254145d26d6fc0cddee64c1acd4787 A DF +:100644 000000 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 0000000000000000000000000000000000000000 D DF/DF +:000000 100644 0000000000000000000000000000000000000000 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 A DM +:000000 100644 0000000000000000000000000000000000000000 35abde1506ddf806572ff4d407bd06885d0f8ee9 A DN +:100644 000000 103d9f89b50b9aad03054b579be5e7aa665f2d57 0000000000000000000000000000000000000000 D MD +:100644 100644 b431b272d829ff3aa4d1a5085f4394ab4d3305b6 19989d4559aae417fedee240ccf2ba315ea4dc2b M MM +:100644 100644 a716d58de4a570e0038f5c307bd8db34daea021f bd084b0c27c7b6cc34f11d6d0509a29be3caf970 M MN +:000000 100644 0000000000000000000000000000000000000000 15885881ea69115351c09b38371f0348a3fb8c67 A NA +:100644 000000 a4e179e4291e5536a5e1c82e091052772d2c5a93 0000000000000000000000000000000000000000 D ND +:100644 100644 c8f25781e8f1792e3e40b74225e20553041b5226 cdb9a8c3da571502ac30225e9c17beccb8387983 M NM +:100644 100644 4c86f9a85fbc5e6804ee2e17a797538fbe785bca c4e4a12231b9fa79a0053cb6077fcb21bb5b135a M TT +:100644 100644 8acb8e9750e3f644bf323fcf3d338849db106c77 6c0b99286d0bce551ac4a7b3dff8b706edff3715 M Z/AA +:100644 000000 087494262084cefee7ed484d20c8dc0580791272 0000000000000000000000000000000000000000 D Z/AN +:000000 100644 0000000000000000000000000000000000000000 d77371d15817fcaa57eeec27f770c505ba974ec1 A Z/DM +:000000 100644 0000000000000000000000000000000000000000 beb5d38c55283d280685ea21a0e50cfcc0ca064a A Z/DN +:100644 000000 a79ac3be9377639e1c7d1edf1ae1b3a5f0ccd8a9 0000000000000000000000000000000000000000 D Z/MD +:100644 100644 61422ba9c2c873416061a88cd40a59a35b576474 697aad7715a1e7306ca76290a3dd4208fbaeddfa M Z/MM +:100644 100644 a5c544c21cfcb07eb80a4d89a5b7d1570002edfd b16d7b25b869f2beb124efa53467d8a1550ad694 M Z/MN +:000000 100644 0000000000000000000000000000000000000000 d12979c22fff69c59ca9409e7a8fe3ee25eaee80 A Z/NA +:100644 000000 a18393c636b98e9bd7296b8b437ea4992b72440c 0000000000000000000000000000000000000000 D Z/ND +:100644 100644 3fdbe17fd013303a2e981e1ca1c6cd6e72789087 7e09d6a3a14bd630913e8c75693cea32157b606d M Z/NM EOF cmp_diff_files_output () { diff --git a/third_party/git/t/t4009-diff-rename-4.sh b/third_party/git/t/t4009-diff-rename-4.sh index b63bdf031f51..3641fd84d686 100755 --- a/third_party/git/t/t4009-diff-rename-4.sh +++ b/third_party/git/t/t4009-diff-rename-4.sh @@ -14,7 +14,6 @@ test_expect_success \ 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING && echo frotz >rezrov && git update-index --add COPYING rezrov && - orig=$(git hash-object COPYING) && tree=$(git write-tree) && echo $tree' @@ -23,8 +22,6 @@ test_expect_success \ 'sed -e 's/HOWEVER/However/' COPYING.1 && sed -e 's/GPL/G.P.L/g' COPYING.2 && rm -f COPYING && - c1=$(git hash-object COPYING.1) && - c2=$(git hash-object COPYING.2) && git update-index --add --remove COPYING COPYING.?' # tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2, @@ -34,11 +31,11 @@ test_expect_success \ git diff-index -z -C $tree >current -cat >expected <expected <<\EOF +:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 COPYING COPYING.1 -:100644 100644 $orig $c2 R1234 +:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 R1234 COPYING COPYING.2 EOF @@ -60,10 +57,10 @@ test_expect_success \ # about rezrov. git diff-index -z -C $tree >current -cat >expected <expected <<\EOF +:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 M COPYING -:100644 100644 $orig $c1 C1234 +:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 COPYING COPYING.1 EOF @@ -85,8 +82,8 @@ test_expect_success \ git update-index --add --remove COPYING COPYING.1' git diff-index -z -C --find-copies-harder $tree >current -cat >expected <expected <<\EOF +:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 COPYING COPYING.1 EOF diff --git a/third_party/git/t/t4010-diff-pathspec.sh b/third_party/git/t/t4010-diff-pathspec.sh index e5ca359edfa6..281f8fad0c71 100755 --- a/third_party/git/t/t4010-diff-pathspec.sh +++ b/third_party/git/t/t4010-diff-pathspec.sh @@ -17,15 +17,11 @@ test_expect_success \ 'echo frotz >file0 && mkdir path1 && echo rezrov >path1/file1 && - before0=$(git hash-object file0) && - before1=$(git hash-object path1/file1) && git update-index --add file0 path1/file1 && tree=$(git write-tree) && echo "$tree" && echo nitfol >file0 && echo yomin >path1/file1 && - after0=$(git hash-object file0) && - after1=$(git hash-object path1/file1) && git update-index file0 path1/file1' cat >expected <<\EOF @@ -35,32 +31,32 @@ test_expect_success \ 'git diff-index --cached $tree -- path >current && compare_diff_raw current expected' -cat >expected <expected <<\EOF +:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1 EOF test_expect_success \ 'limit to path1 should show path1/file1' \ 'git diff-index --cached $tree -- path1 >current && compare_diff_raw current expected' -cat >expected <expected <<\EOF +:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1 EOF test_expect_success \ 'limit to path1/ should show path1/file1' \ 'git diff-index --cached $tree -- path1/ >current && compare_diff_raw current expected' -cat >expected <expected <<\EOF +:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1 EOF test_expect_success \ '"*file1" should show path1/file1' \ 'git diff-index --cached $tree -- "*file1" >current && compare_diff_raw current expected' -cat >expected <expected <<\EOF +:100644 100644 8e4020bb5a8d8c873b25de15933e75cc0fc275df dca6b92303befc93086aa025d90a5facd7eb2812 M file0 EOF test_expect_success \ 'limit to file0 should show file0' \ diff --git a/third_party/git/t/t4011-diff-symlink.sh b/third_party/git/t/t4011-diff-symlink.sh index 717034bb50b5..5ae19b987d65 100755 --- a/third_party/git/t/t4011-diff-symlink.sh +++ b/third_party/git/t/t4011-diff-symlink.sh @@ -9,24 +9,11 @@ test_description='Test diff of symlinks. . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh -# Print the short OID of a symlink with the given name. -symlink_oid () { - local oid=$(printf "%s" "$1" | git hash-object --stdin) && - git rev-parse --short "$oid" -} - -# Print the short OID of the given file. -short_oid () { - local oid=$(git hash-object "$1") && - git rev-parse --short "$oid" -} - test_expect_success 'diff new symlink and file' ' - symlink=$(symlink_oid xyzzy) && - cat >expected <<-EOF && + cat >expected <<-\EOF && diff --git a/frotz b/frotz new file mode 120000 - index 0000000..$symlink + index 0000000..7c465af --- /dev/null +++ b/frotz @@ -0,0 +1 @@ @@ -34,7 +21,7 @@ test_expect_success 'diff new symlink and file' ' \ No newline at end of file diff --git a/nitfol b/nitfol new file mode 100644 - index 0000000..$symlink + index 0000000..7c465af --- /dev/null +++ b/nitfol @@ -0,0 +1 @@ @@ -59,10 +46,10 @@ test_expect_success 'diff unchanged symlink and file' ' ' test_expect_success 'diff removed symlink and file' ' - cat >expected <<-EOF && + cat >expected <<-\EOF && diff --git a/frotz b/frotz deleted file mode 120000 - index $symlink..0000000 + index 7c465af..0000000 --- a/frotz +++ /dev/null @@ -1 +0,0 @@ @@ -70,7 +57,7 @@ test_expect_success 'diff removed symlink and file' ' \ No newline at end of file diff --git a/nitfol b/nitfol deleted file mode 100644 - index $symlink..0000000 + index 7c465af..0000000 --- a/nitfol +++ /dev/null @@ -1 +0,0 @@ @@ -103,10 +90,9 @@ test_expect_success 'diff identical, but newly created symlink and file' ' ' test_expect_success 'diff different symlink and file' ' - new=$(symlink_oid yxyyz) && - cat >expected <<-EOF && + cat >expected <<-\EOF && diff --git a/frotz b/frotz - index $symlink..$new 120000 + index 7c465af..df1db54 120000 --- a/frotz +++ b/frotz @@ -1 +1 @@ @@ -115,7 +101,7 @@ test_expect_success 'diff different symlink and file' ' +yxyyz \ No newline at end of file diff --git a/nitfol b/nitfol - index $symlink..$new 100644 + index 7c465af..df1db54 100644 --- a/nitfol +++ b/nitfol @@ -1 +1 @@ @@ -151,16 +137,14 @@ test_expect_success SYMLINKS 'setup symlinks with attributes' ' ' test_expect_success SYMLINKS 'symlinks do not respect userdiff config by path' ' - file=$(short_oid file.bin) && - link=$(symlink_oid file.bin) && - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/file.bin b/file.bin new file mode 100644 - index 0000000..$file + index 0000000..d95f3ad Binary files /dev/null and b/file.bin differ diff --git a/link.bin b/link.bin new file mode 120000 - index 0000000..$link + index 0000000..dce41ec --- /dev/null +++ b/link.bin @@ -0,0 +1 @@ diff --git a/third_party/git/t/t4013-diff-various.sh b/third_party/git/t/t4013-diff-various.sh index dde3f11fec36..a9054d2db116 100755 --- a/third_party/git/t/t4013-diff-various.sh +++ b/third_party/git/t/t4013-diff-various.sh @@ -7,6 +7,9 @@ test_description='Various diff formatting options' . ./test-lib.sh +LF=' +' + test_expect_success setup ' GIT_AUTHOR_DATE="2006-06-26 00:00:00 +0000" && @@ -120,30 +123,6 @@ test_expect_success setup ' +*++ [initial] Initial EOF -process_diffs () { - _x04="[0-9a-f][0-9a-f][0-9a-f][0-9a-f]" && - _x07="$_x05[0-9a-f][0-9a-f]" && - sed -e "s/$OID_REGEX/$ZERO_OID/g" \ - -e "s/From $_x40 /From $ZERO_OID /" \ - -e "s/from $_x40)/from $ZERO_OID)/" \ - -e "s/commit $_x40\$/commit $ZERO_OID/" \ - -e "s/commit $_x40 (/commit $ZERO_OID (/" \ - -e "s/$_x40 $_x40 $_x40/$ZERO_OID $ZERO_OID $ZERO_OID/" \ - -e "s/$_x40 $_x40 /$ZERO_OID $ZERO_OID /" \ - -e "s/^$_x40 $_x40$/$ZERO_OID $ZERO_OID/" \ - -e "s/^$_x40 /$ZERO_OID /" \ - -e "s/^$_x40$/$ZERO_OID/" \ - -e "s/$_x07\.\.$_x07/fffffff..fffffff/g" \ - -e "s/$_x07,$_x07\.\.$_x07/fffffff,fffffff..fffffff/g" \ - -e "s/$_x07 $_x07 $_x07/fffffff fffffff fffffff/g" \ - -e "s/$_x07 $_x07 /fffffff fffffff /g" \ - -e "s/Merge: $_x07 $_x07/Merge: fffffff fffffff/g" \ - -e "s/$_x07\.\.\./fffffff.../g" \ - -e "s/ $_x04\.\.\./ ffff.../g" \ - -e "s/ $_x04/ ffff/g" \ - "$1" -} - V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g') while read magic cmd do @@ -182,15 +161,13 @@ do } >"$actual" && if test -f "$expect" then - process_diffs "$actual" >actual && - process_diffs "$expect" >expect && case $cmd in *format-patch* | *-stat*) - test_i18ncmp expect actual;; + test_i18ncmp "$expect" "$actual";; *) - test_cmp expect actual;; + test_cmp "$expect" "$actual";; esac && - rm -f "$actual" actual expect + rm -f "$actual" else # this is to help developing new tests. cp "$actual" "$expect" @@ -409,22 +386,16 @@ test_expect_success 'log -S requires an argument' ' test_expect_success 'diff --cached on unborn branch' ' echo ref: refs/heads/unborn >.git/HEAD && git diff --cached >result && - process_diffs result >actual && - process_diffs "$TEST_DIRECTORY/t4013/diff.diff_--cached" >expected && - test_cmp expected actual + test_cmp "$TEST_DIRECTORY/t4013/diff.diff_--cached" result ' test_expect_success 'diff --cached -- file on unborn branch' ' git diff --cached -- file0 >result && - process_diffs result >actual && - process_diffs "$TEST_DIRECTORY/t4013/diff.diff_--cached_--_file0" >expected && - test_cmp expected actual + test_cmp "$TEST_DIRECTORY/t4013/diff.diff_--cached_--_file0" result ' test_expect_success 'diff --line-prefix with spaces' ' git diff --line-prefix="| | | " --cached -- file0 >result && - process_diffs result >actual && - process_diffs "$TEST_DIRECTORY/t4013/diff.diff_--line-prefix_--cached_--_file0" >expected && - test_cmp expected actual + test_cmp "$TEST_DIRECTORY/t4013/diff.diff_--line-prefix_--cached_--_file0" result ' test_expect_success 'diff-tree --stdin with log formatting' ' diff --git a/third_party/git/t/t4014-format-patch.sh b/third_party/git/t/t4014-format-patch.sh index b653dd7d4452..ca7debf1d4c0 100755 --- a/third_party/git/t/t4014-format-patch.sh +++ b/third_party/git/t/t4014-format-patch.sh @@ -9,6 +9,7 @@ test_description='various format-patch tests' . "$TEST_DIRECTORY"/lib-terminal.sh test_expect_success setup ' + for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file && cat file >elif && git add file elif && @@ -33,8 +34,7 @@ test_expect_success setup ' git commit -m "Side changes #3 with \\n backslash-n in it." && git checkout master && - git diff-tree -p C2 >patch && - git apply --index patch0 && - grep "^From " patch0 >from0 && - test_line_count = 3 from0 + cnt=$(grep "^From " patch0 | wc -l) && + test $cnt = 3 + ' -test_expect_success 'format-patch --ignore-if-in-upstream' ' +test_expect_success "format-patch --ignore-if-in-upstream" ' + git format-patch --stdout \ --ignore-if-in-upstream master..side >patch1 && - grep "^From " patch1 >from1 && - test_line_count = 2 from1 + cnt=$(grep "^From " patch1 | wc -l) && + test $cnt = 2 + ' -test_expect_success 'format-patch --ignore-if-in-upstream handles tags' ' +test_expect_success "format-patch --ignore-if-in-upstream handles tags" ' git tag -a v1 -m tag side && git tag -a v2 -m tag master && git format-patch --stdout --ignore-if-in-upstream v2..v1 >patch1 && - grep "^From " patch1 >from1 && - test_line_count = 2 from1 + cnt=$(grep "^From " patch1 | wc -l) && + test $cnt = 2 ' test_expect_success "format-patch doesn't consider merge commits" ' + git checkout -b slave master && echo "Another line" >>file && test_tick && @@ -91,138 +96,148 @@ test_expect_success "format-patch doesn't consider merge commits" ' git checkout -b merger master && test_tick && git merge --no-ff slave && - git format-patch -3 --stdout >patch && - grep "^From " patch >from && - test_line_count = 3 from + cnt=$(git format-patch -3 --stdout | grep "^From " | wc -l) && + test $cnt = 3 ' -test_expect_success 'format-patch result applies' ' +test_expect_success "format-patch result applies" ' + git checkout -b rebuild-0 master && git am -3 patch0 && - git rev-list master.. >list && - test_line_count = 2 list + cnt=$(git rev-list master.. | wc -l) && + test $cnt = 2 ' -test_expect_success 'format-patch --ignore-if-in-upstream result applies' ' +test_expect_success "format-patch --ignore-if-in-upstream result applies" ' + git checkout -b rebuild-1 master && git am -3 patch1 && - git rev-list master.. >list && - test_line_count = 2 list + cnt=$(git rev-list master.. | wc -l) && + test $cnt = 2 ' test_expect_success 'commit did not screw up the log message' ' - git cat-file commit side >actual && - grep "^Side .* with .* backslash-n" actual + + git cat-file commit side | grep "^Side .* with .* backslash-n" + ' test_expect_success 'format-patch did not screw up the log message' ' + grep "^Subject: .*Side changes #3 with .* backslash-n" patch0 && grep "^Subject: .*Side changes #3 with .* backslash-n" patch1 + ' test_expect_success 'replay did not screw up the log message' ' - git cat-file commit rebuild-1 >actual && - grep "^Side .* with .* backslash-n" actual + + git cat-file commit rebuild-1 | grep "^Side .* with .* backslash-n" + ' test_expect_success 'extra headers' ' + git config format.headers "To: R E Cipient " && git config --add format.headers "Cc: S E Cipient " && - git format-patch --stdout master..side >patch2 && - sed -e "/^\$/q" patch2 >hdrs2 && + git format-patch --stdout master..side > patch2 && + sed -e "/^\$/q" patch2 > hdrs2 && grep "^To: R E Cipient \$" hdrs2 && grep "^Cc: S E Cipient \$" hdrs2 + ' test_expect_success 'extra headers without newlines' ' + git config --replace-all format.headers "To: R E Cipient " && git config --add format.headers "Cc: S E Cipient " && git format-patch --stdout master..side >patch3 && - sed -e "/^\$/q" patch3 >hdrs3 && + sed -e "/^\$/q" patch3 > hdrs3 && grep "^To: R E Cipient \$" hdrs3 && grep "^Cc: S E Cipient \$" hdrs3 + ' test_expect_success 'extra headers with multiple To:s' ' + git config --replace-all format.headers "To: R E Cipient " && git config --add format.headers "To: S E Cipient " && - git format-patch --stdout master..side >patch4 && - sed -e "/^\$/q" patch4 >hdrs4 && + git format-patch --stdout master..side > patch4 && + sed -e "/^\$/q" patch4 > hdrs4 && grep "^To: R E Cipient ,\$" hdrs4 && grep "^ *S E Cipient \$" hdrs4 ' test_expect_success 'additional command line cc (ascii)' ' + git config --replace-all format.headers "Cc: R E Cipient " && - git format-patch --cc="S E Cipient " --stdout master..side >patch5 && - sed -e "/^\$/q" patch5 >hdrs5 && - grep "^Cc: R E Cipient ,\$" hdrs5 && - grep "^ *S E Cipient \$" hdrs5 + git format-patch --cc="S E Cipient " --stdout master..side | sed -e "/^\$/q" >patch5 && + grep "^Cc: R E Cipient ,\$" patch5 && + grep "^ *S E Cipient \$" patch5 ' test_expect_failure 'additional command line cc (rfc822)' ' + git config --replace-all format.headers "Cc: R E Cipient " && - git format-patch --cc="S. E. Cipient " --stdout master..side >patch5 && - sed -e "/^\$/q" patch5 >hdrs5 && - grep "^Cc: R E Cipient ,\$" hdrs5 && - grep "^ *\"S. E. Cipient\" \$" hdrs5 + git format-patch --cc="S. E. Cipient " --stdout master..side | sed -e "/^\$/q" >patch5 && + grep "^Cc: R E Cipient ,\$" patch5 && + grep "^ *\"S. E. Cipient\" \$" patch5 ' test_expect_success 'command line headers' ' + git config --unset-all format.headers && - git format-patch --add-header="Cc: R E Cipient " --stdout master..side >patch6 && - sed -e "/^\$/q" patch6 >hdrs6 && - grep "^Cc: R E Cipient \$" hdrs6 + git format-patch --add-header="Cc: R E Cipient " --stdout master..side | sed -e "/^\$/q" >patch6 && + grep "^Cc: R E Cipient \$" patch6 ' test_expect_success 'configuration headers and command line headers' ' + git config --replace-all format.headers "Cc: R E Cipient " && - git format-patch --add-header="Cc: S E Cipient " --stdout master..side >patch7 && - sed -e "/^\$/q" patch7 >hdrs7 && - grep "^Cc: R E Cipient ,\$" hdrs7 && - grep "^ *S E Cipient \$" hdrs7 + git format-patch --add-header="Cc: S E Cipient " --stdout master..side | sed -e "/^\$/q" >patch7 && + grep "^Cc: R E Cipient ,\$" patch7 && + grep "^ *S E Cipient \$" patch7 ' test_expect_success 'command line To: header (ascii)' ' + git config --unset-all format.headers && - git format-patch --to="R E Cipient " --stdout master..side >patch8 && - sed -e "/^\$/q" patch8 >hdrs8 && - grep "^To: R E Cipient \$" hdrs8 + git format-patch --to="R E Cipient " --stdout master..side | sed -e "/^\$/q" >patch8 && + grep "^To: R E Cipient \$" patch8 ' test_expect_failure 'command line To: header (rfc822)' ' - git format-patch --to="R. E. Cipient " --stdout master..side >patch8 && - sed -e "/^\$/q" patch8 >hdrs8 && - grep "^To: \"R. E. Cipient\" \$" hdrs8 + + git format-patch --to="R. E. Cipient " --stdout master..side | sed -e "/^\$/q" >patch8 && + grep "^To: \"R. E. Cipient\" \$" patch8 ' test_expect_failure 'command line To: header (rfc2047)' ' - git format-patch --to="R Ä Cipient " --stdout master..side >patch8 && - sed -e "/^\$/q" patch8 >hdrs8 && - grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= \$" hdrs8 + + git format-patch --to="R Ä Cipient " --stdout master..side | sed -e "/^\$/q" >patch8 && + grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= \$" patch8 ' test_expect_success 'configuration To: header (ascii)' ' + git config format.to "R E Cipient " && - git format-patch --stdout master..side >patch9 && - sed -e "/^\$/q" patch9 >hdrs9 && - grep "^To: R E Cipient \$" hdrs9 + git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 && + grep "^To: R E Cipient \$" patch9 ' test_expect_failure 'configuration To: header (rfc822)' ' + git config format.to "R. E. Cipient " && - git format-patch --stdout master..side >patch9 && - sed -e "/^\$/q" patch9 >hdrs9 && - grep "^To: \"R. E. Cipient\" \$" hdrs9 + git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 && + grep "^To: \"R. E. Cipient\" \$" patch9 ' test_expect_failure 'configuration To: header (rfc2047)' ' + git config format.to "R Ä Cipient " && - git format-patch --stdout master..side >patch9 && - sed -e "/^\$/q" patch9 >hdrs9 && - grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= \$" hdrs9 + git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 && + grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= \$" patch9 ' # check_patch : Verify that looks like a half-sane @@ -234,79 +249,89 @@ check_patch () { } test_expect_success 'format.from=false' ' - git -c format.from=false format-patch --stdout master..side >patch && - sed -e "/^\$/q" patch >hdrs && + + git -c format.from=false format-patch --stdout master..side | + sed -e "/^\$/q" >patch && check_patch patch && - ! grep "^From: C O Mitter \$" hdrs + ! grep "^From: C O Mitter \$" patch ' test_expect_success 'format.from=true' ' - git -c format.from=true format-patch --stdout master..side >patch && - sed -e "/^\$/q" patch >hdrs && - check_patch hdrs && - grep "^From: C O Mitter \$" hdrs + + git -c format.from=true format-patch --stdout master..side | + sed -e "/^\$/q" >patch && + check_patch patch && + grep "^From: C O Mitter \$" patch ' test_expect_success 'format.from with address' ' - git -c format.from="F R Om " format-patch --stdout master..side >patch && - sed -e "/^\$/q" patch >hdrs && - check_patch hdrs && - grep "^From: F R Om \$" hdrs + + git -c format.from="F R Om " format-patch --stdout master..side | + sed -e "/^\$/q" >patch && + check_patch patch && + grep "^From: F R Om \$" patch ' test_expect_success '--no-from overrides format.from' ' - git -c format.from="F R Om " format-patch --no-from --stdout master..side >patch && - sed -e "/^\$/q" patch >hdrs && - check_patch hdrs && - ! grep "^From: F R Om \$" hdrs + + git -c format.from="F R Om " format-patch --no-from --stdout master..side | + sed -e "/^\$/q" >patch && + check_patch patch && + ! grep "^From: F R Om \$" patch ' test_expect_success '--from overrides format.from' ' - git -c format.from="F R Om " format-patch --from --stdout master..side >patch && - sed -e "/^\$/q" patch >hdrs && - check_patch hdrs && - ! grep "^From: F R Om \$" hdrs + + git -c format.from="F R Om " format-patch --from --stdout master..side | + sed -e "/^\$/q" >patch && + check_patch patch && + ! grep "^From: F R Om \$" patch ' test_expect_success '--no-to overrides config.to' ' + git config --replace-all format.to \ "R E Cipient " && - git format-patch --no-to --stdout master..side >patch10 && - sed -e "/^\$/q" patch10 >hdrs10 && - check_patch hdrs10 && - ! grep "^To: R E Cipient \$" hdrs10 + git format-patch --no-to --stdout master..side | + sed -e "/^\$/q" >patch10 && + check_patch patch10 && + ! grep "^To: R E Cipient \$" patch10 ' test_expect_success '--no-to and --to replaces config.to' ' + git config --replace-all format.to \ "Someone " && git format-patch --no-to --to="Someone Else " \ - --stdout master..side >patch11 && - sed -e "/^\$/q" patch11 >hdrs11 && - check_patch hdrs11 && - ! grep "^To: Someone \$" hdrs11 && - grep "^To: Someone Else \$" hdrs11 + --stdout master..side | + sed -e "/^\$/q" >patch11 && + check_patch patch11 && + ! grep "^To: Someone \$" patch11 && + grep "^To: Someone Else \$" patch11 ' test_expect_success '--no-cc overrides config.cc' ' + git config --replace-all format.cc \ "C E Cipient " && - git format-patch --no-cc --stdout master..side >patch12 && - sed -e "/^\$/q" patch12 >hdrs12 && - check_patch hdrs12 && - ! grep "^Cc: C E Cipient \$" hdrs12 + git format-patch --no-cc --stdout master..side | + sed -e "/^\$/q" >patch12 && + check_patch patch12 && + ! grep "^Cc: C E Cipient \$" patch12 ' test_expect_success '--no-add-header overrides config.headers' ' + git config --replace-all format.headers \ "Header1: B E Cipient " && - git format-patch --no-add-header --stdout master..side >patch13 && - sed -e "/^\$/q" patch13 >hdrs13 && - check_patch hdrs13 && - ! grep "^Header1: B E Cipient \$" hdrs13 + git format-patch --no-add-header --stdout master..side | + sed -e "/^\$/q" >patch13 && + check_patch patch13 && + ! grep "^Header1: B E Cipient \$" patch13 ' test_expect_success 'multiple files' ' + rm -rf patches/ && git checkout side && git format-patch -o patches/ master && @@ -332,7 +357,7 @@ test_expect_success 'reroll count (-v)' ' check_threading () { expect="$1" && shift && - git format-patch --stdout "$@" >patch && + (git format-patch --stdout "$@"; echo $? > status.out) | # Prints everything between the Message-ID and In-Reply-To, # and replaces all Message-ID-lookalikes by a sequence number perl -ne ' @@ -347,11 +372,12 @@ check_threading () { print; } print "---\n" if /^From /i; - ' actual && + ' > actual && + test 0 = "$(cat status.out)" && test_cmp "$expect" actual } -cat >>expect.no-threading <> expect.no-threading <expect.thread < expect.thread < --- @@ -379,7 +405,7 @@ test_expect_success 'thread' ' check_threading expect.thread --thread master ' -cat >expect.in-reply-to < expect.in-reply-to < In-Reply-To: <1> @@ -399,7 +425,7 @@ test_expect_success 'thread in-reply-to' ' --thread master ' -cat >expect.cover-letter < expect.cover-letter < --- @@ -420,7 +446,7 @@ test_expect_success 'thread cover-letter' ' check_threading expect.cover-letter --cover-letter --thread master ' -cat >expect.cl-irt < expect.cl-irt < In-Reply-To: <1> @@ -452,7 +478,7 @@ test_expect_success 'thread explicit shallow' ' --in-reply-to="" --thread=shallow master ' -cat >expect.deep < expect.deep < --- @@ -470,7 +496,7 @@ test_expect_success 'thread deep' ' check_threading expect.deep --thread=deep master ' -cat >expect.deep-irt < expect.deep-irt < In-Reply-To: <1> @@ -493,7 +519,7 @@ test_expect_success 'thread deep in-reply-to' ' --in-reply-to="" master ' -cat >expect.deep-cl < expect.deep-cl < --- @@ -517,7 +543,7 @@ test_expect_success 'thread deep cover-letter' ' check_threading expect.deep-cl --cover-letter --thread=deep master ' -cat >expect.deep-cl-irt < expect.deep-cl-irt < In-Reply-To: <1> @@ -568,6 +594,7 @@ test_expect_success 'thread config + --no-thread' ' ' test_expect_success 'excessive subject' ' + rm -rf patches/ && git checkout side && before=$(git hash-object file) && @@ -595,9 +622,10 @@ test_expect_success 'cover-letter inherits diff options' ' ! grep "file => foo .* 0 *\$" 0000-cover-letter.patch && git format-patch --cover-letter -1 -M && grep "file => foo .* 0 *\$" 0000-cover-letter.patch + ' -cat >expect < expect << EOF This is an excessively long subject line for a message due to the habit some projects have of not having a short, one-line subject at the start of the commit message, but rather sticking a whole @@ -608,12 +636,14 @@ cat >expect <output && + sed -e "1,/A U Thor/d" -e "/^\$/q" < 0000-cover-letter.patch > output && test_cmp expect output + ' -cat >expect < expect << EOF index $before..$after 100644 --- a/file +++ b/file @@ -626,14 +656,16 @@ index $before..$after 100644 EOF test_expect_success 'format-patch respects -U' ' + git format-patch -U4 -2 && sed -e "1,/^diff/d" -e "/^+5/q" \ <0001-This-is-an-excessively-long-subject-line-for-a-messa.patch \ >output && test_cmp expect output + ' -cat >expect < expect << EOF diff --git a/file b/file index $before..$after 100644 @@ -647,9 +679,11 @@ index $before..$after 100644 EOF test_expect_success 'format-patch -p suppresses stat' ' + git format-patch -p -2 && - sed -e "1,/^\$/d" -e "/^+5/q" 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch >output && + sed -e "1,/^\$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output && test_cmp expect output + ' test_expect_success 'format-patch from a subdirectory (1)' ' @@ -702,7 +736,7 @@ test_expect_success 'format-patch from a subdirectory (3)' ' ' test_expect_success 'format-patch --in-reply-to' ' - git format-patch -1 --stdout --in-reply-to "baz@foo.bar" >patch8 && + git format-patch -1 --stdout --in-reply-to "baz@foo.bar" > patch8 && grep "^In-Reply-To: " patch8 && grep "^References: " patch8 ' @@ -793,56 +827,21 @@ test_expect_success 'format-patch with multiple notes refs' ' ! grep "this is note 2" out ' -test_expect_success 'format-patch with multiple notes refs in config' ' - test_when_finished "test_unconfig format.notes" && - - git notes --ref note1 add -m "this is note 1" HEAD && - test_when_finished git notes --ref note1 remove HEAD && - git notes --ref note2 add -m "this is note 2" HEAD && - test_when_finished git notes --ref note2 remove HEAD && - - git config format.notes note1 && - git format-patch -1 --stdout >out && - grep "this is note 1" out && - ! grep "this is note 2" out && - git config format.notes note2 && - git format-patch -1 --stdout >out && - ! grep "this is note 1" out && - grep "this is note 2" out && - git config --add format.notes note1 && - git format-patch -1 --stdout >out && - grep "this is note 1" out && - grep "this is note 2" out && - - git config --replace-all format.notes note1 && - git config --add format.notes false && - git format-patch -1 --stdout >out && - ! grep "this is note 1" out && - ! grep "this is note 2" out && - git config --add format.notes note2 && - git format-patch -1 --stdout >out && - ! grep "this is note 1" out && - grep "this is note 2" out -' - -echo "fatal: --name-only does not make sense" >expect.name-only -echo "fatal: --name-status does not make sense" >expect.name-status -echo "fatal: --check does not make sense" >expect.check +echo "fatal: --name-only does not make sense" > expect.name-only +echo "fatal: --name-status does not make sense" > expect.name-status +echo "fatal: --check does not make sense" > expect.check test_expect_success 'options no longer allowed for format-patch' ' - test_must_fail git format-patch --name-only 2>output && + test_must_fail git format-patch --name-only 2> output && test_i18ncmp expect.name-only output && - test_must_fail git format-patch --name-status 2>output && + test_must_fail git format-patch --name-status 2> output && test_i18ncmp expect.name-status output && - test_must_fail git format-patch --check 2>output && - test_i18ncmp expect.check output -' + test_must_fail git format-patch --check 2> output && + test_i18ncmp expect.check output' test_expect_success 'format-patch --numstat should produce a patch' ' - git format-patch --numstat --stdout master..side >output && - grep "^diff --git a/" output >diff && - test_line_count = 5 diff -' + git format-patch --numstat --stdout master..side > output && + test 5 = $(grep "^diff --git a/" output | wc -l)' test_expect_success 'format-patch -- ' ' git format-patch master..side -- file 2>error && @@ -853,25 +852,20 @@ test_expect_success 'format-patch --ignore-if-in-upstream HEAD' ' git format-patch --ignore-if-in-upstream HEAD ' -test_expect_success 'get git version' ' - git_version=$(git --version) && - git_version=${git_version##* } -' +git_version="$(git --version | sed "s/.* //")" signature() { printf "%s\n%s\n\n" "-- " "${1:-$git_version}" } test_expect_success 'format-patch default signature' ' - git format-patch --stdout -1 >patch && - tail -n 3 patch >output && + git format-patch --stdout -1 | tail -n 3 >output && signature >expect && test_cmp expect output ' test_expect_success 'format-patch --signature' ' - git format-patch --stdout --signature="my sig" -1 >patch && - tail -n 3 patch >output && + git format-patch --stdout --signature="my sig" -1 | tail -n 3 >output && signature "my sig" >expect && test_cmp expect output ' @@ -903,8 +897,8 @@ test_expect_success 'format-patch --signature --cover-letter' ' git config --unset-all format.signature && git format-patch --stdout --signature="my sig" --cover-letter \ -1 >output && - grep "my sig" output >sig && - test_line_count = 2 sig + grep "my sig" output && + test 2 = $(grep "my sig" output | wc -l) ' test_expect_success 'format.signature="" suppresses signatures' ' @@ -941,7 +935,7 @@ test_expect_success 'prepare mail-signature input' ' test_expect_success '--signature-file=file works' ' git format-patch --stdout --signature-file=mail-signature -1 >output && check_patch output && - sed -e "1,/^-- \$/d" output >actual && + sed -e "1,/^-- \$/d" actual && { cat mail-signature && echo } >expect && @@ -952,7 +946,7 @@ test_expect_success 'format.signaturefile works' ' test_config format.signaturefile mail-signature && git format-patch --stdout -1 >output && check_patch output && - sed -e "1,/^-- \$/d" output >actual && + sed -e "1,/^-- \$/d" actual && { cat mail-signature && echo } >expect && @@ -974,7 +968,7 @@ test_expect_success '--signature-file overrides format.signaturefile' ' git format-patch --stdout \ --signature-file=other-mail-signature -1 >output && check_patch output && - sed -e "1,/^-- \$/d" output >actual && + sed -e "1,/^-- \$/d" actual && { cat other-mail-signature && echo } >expect && @@ -1043,7 +1037,7 @@ test_expect_success 'format-patch wraps extremely long subject (ascii)' ' git add file && git commit -m "$M512" && git format-patch --stdout -1 >patch && - sed -n "/^Subject/p; /^ /p; /^$/q" patch >subject && + sed -n "/^Subject/p; /^ /p; /^$/q" subject && test_cmp expect subject ' @@ -1082,7 +1076,7 @@ test_expect_success 'format-patch wraps extremely long subject (rfc2047)' ' git add file && git commit -m "$M512" && git format-patch --stdout -1 >patch && - sed -n "/^Subject/p; /^ /p; /^$/q" patch >subject && + sed -n "/^Subject/p; /^ /p; /^$/q" subject && test_cmp expect subject ' @@ -1091,7 +1085,7 @@ check_author() { git add file && GIT_AUTHOR_NAME=$1 git commit -m author-check && git format-patch --stdout -1 >patch && - sed -n "/^From: /p; /^ /p; /^$/q" patch >actual && + sed -n "/^From: /p; /^ /p; /^$/q" actual && test_cmp expect actual } @@ -1211,7 +1205,7 @@ test_expect_success '--from=ident replaces author' ' From: A U Thor EOF - sed -ne "/^From:/p; /^$/p; /^---$/q" patch >patch.head && + sed -ne "/^From:/p; /^$/p; /^---$/q" patch.head && test_cmp expect patch.head ' @@ -1223,7 +1217,7 @@ test_expect_success '--from uses committer ident' ' From: A U Thor EOF - sed -ne "/^From:/p; /^$/p; /^---$/q" patch >patch.head && + sed -ne "/^From:/p; /^$/p; /^---$/q" patch.head && test_cmp expect patch.head ' @@ -1233,7 +1227,7 @@ test_expect_success '--from omits redundant in-body header' ' From: A U Thor EOF - sed -ne "/^From:/p; /^$/p; /^---$/q" patch >patch.head && + sed -ne "/^From:/p; /^$/p; /^---$/q" patch.head && test_cmp expect patch.head ' @@ -1248,7 +1242,7 @@ test_expect_success 'in-body headers trigger content encoding' ' From: éxötìc EOF - sed -ne "/^From:/p; /^$/p; /^Content-Type/p; /^---$/q" patch >patch.head && + sed -ne "/^From:/p; /^$/p; /^Content-Type/p; /^---$/q" patch.head && test_cmp expect patch.head ' @@ -1262,283 +1256,283 @@ append_signoff() test_expect_success 'signoff: commit with no body' ' append_signoff actual && - cat <<-\EOF | sed "s/EOL$//" >expect && - 4:Subject: [PATCH] EOL - 8: - 9:Signed-off-by: C O Mitter - EOF - test_cmp expect actual + cat <<\EOF | sed "s/EOL$//" >expected && +4:Subject: [PATCH] EOL +8: +9:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: commit with only subject' ' echo subject | append_signoff >actual && - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 9:Signed-off-by: C O Mitter - EOF - test_cmp expect actual + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +9:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: commit with only subject that does not end with NL' ' printf subject | append_signoff >actual && - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 9:Signed-off-by: C O Mitter - EOF - test_cmp expect actual + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +9:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: no existing signoffs' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - body - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 10: - 11:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +body +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +10: +11:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: no existing signoffs and no trailing NL' ' printf "subject\n\nbody" | append_signoff >actual && - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 10: - 11:Signed-off-by: C O Mitter - EOF - test_cmp expect actual + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +10: +11:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: some random signoff' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - body +body - Signed-off-by: my@house - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 10: - 11:Signed-off-by: my@house - 12:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +Signed-off-by: my@house +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +10: +11:Signed-off-by: my@house +12:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: misc conforming footer elements' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - body +body - Signed-off-by: my@house - (cherry picked from commit da39a3ee5e6b4b0d3255bfef95601890afd80709) - Tested-by: Some One - Bug: 1234 - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 10: - 11:Signed-off-by: my@house - 15:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +Signed-off-by: my@house +(cherry picked from commit da39a3ee5e6b4b0d3255bfef95601890afd80709) +Tested-by: Some One +Bug: 1234 +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +10: +11:Signed-off-by: my@house +15:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: some random signoff-alike' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - body - Fooled-by-me: my@house - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 11: - 12:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +body +Fooled-by-me: my@house +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +11: +12:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: not really a signoff' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - I want to mention about Signed-off-by: here. - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 9:I want to mention about Signed-off-by: here. - 10: - 11:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +I want to mention about Signed-off-by: here. +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +9:I want to mention about Signed-off-by: here. +10: +11:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: not really a signoff (2)' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - My unfortunate - Signed-off-by: example happens to be wrapped here. - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 10:Signed-off-by: example happens to be wrapped here. - 11:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +My unfortunate +Signed-off-by: example happens to be wrapped here. +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +10:Signed-off-by: example happens to be wrapped here. +11:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: valid S-o-b paragraph in the middle' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - Signed-off-by: my@house - Signed-off-by: your@house +Signed-off-by: my@house +Signed-off-by: your@house - A lot of houses. - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 9:Signed-off-by: my@house - 10:Signed-off-by: your@house - 11: - 13: - 14:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +A lot of houses. +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +9:Signed-off-by: my@house +10:Signed-off-by: your@house +11: +13: +14:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: the same signoff at the end' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - body +body - Signed-off-by: C O Mitter - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 10: - 11:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +Signed-off-by: C O Mitter +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +10: +11:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: the same signoff at the end, no trailing NL' ' printf "subject\n\nSigned-off-by: C O Mitter " | append_signoff >actual && - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 9:Signed-off-by: C O Mitter - EOF - test_cmp expect actual + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +9:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: the same signoff NOT at the end' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - body +body - Signed-off-by: C O Mitter - Signed-off-by: my@house - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 10: - 11:Signed-off-by: C O Mitter - 12:Signed-off-by: my@house - EOF - test_cmp expect actual +Signed-off-by: C O Mitter +Signed-off-by: my@house +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +10: +11:Signed-off-by: C O Mitter +12:Signed-off-by: my@house +EOF + test_cmp expected actual ' test_expect_success 'signoff: tolerate garbage in conforming footer' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - body +body - Tested-by: my@house - Some Trash - Signed-off-by: C O Mitter - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 10: - 13:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +Tested-by: my@house +Some Trash +Signed-off-by: C O Mitter +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +10: +13:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: respect trailer config' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - Myfooter: x - Some Trash - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 11: - 12:Signed-off-by: C O Mitter - EOF - test_cmp expect actual && +Myfooter: x +Some Trash +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +11: +12:Signed-off-by: C O Mitter +EOF + test_cmp expected actual && test_config trailer.Myfooter.ifexists add && - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - Myfooter: x - Some Trash - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 11:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +Myfooter: x +Some Trash +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +11:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'signoff: footer begins with non-signoff without @ sign' ' - append_signoff <<-\EOF >actual && - subject + append_signoff <<\EOF >actual && +subject - body +body - Reviewed-id: Noone - Tested-by: my@house - Change-id: Ideadbeef - Signed-off-by: C O Mitter - Bug: 1234 - EOF - cat >expect <<-\EOF && - 4:Subject: [PATCH] subject - 8: - 10: - 14:Signed-off-by: C O Mitter - EOF - test_cmp expect actual +Reviewed-id: Noone +Tested-by: my@house +Change-id: Ideadbeef +Signed-off-by: C O Mitter +Bug: 1234 +EOF + cat >expected <<\EOF && +4:Subject: [PATCH] subject +8: +10: +14:Signed-off-by: C O Mitter +EOF + test_cmp expected actual ' test_expect_success 'format patch ignores color.ui' ' @@ -1549,218 +1543,46 @@ test_expect_success 'format patch ignores color.ui' ' test_cmp expect actual ' -test_expect_success 'cover letter with invalid --cover-from-description and config' ' - test_config branch.rebuild-1.description "config subject - -body" && - test_must_fail git format-patch --cover-letter --cover-from-description garbage master && - test_config format.coverFromDescription garbage && - test_must_fail git format-patch --cover-letter master -' - -test_expect_success 'cover letter with format.coverFromDescription = default' ' - test_config branch.rebuild-1.description "config subject - -body" && - test_config format.coverFromDescription default && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter master >actual && - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - grep "^config subject$" actual && - grep "^body$" actual -' - -test_expect_success 'cover letter with --cover-from-description default' ' - test_config branch.rebuild-1.description "config subject - -body" && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter --cover-from-description default master >actual && - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - grep "^config subject$" actual && - grep "^body$" actual -' - -test_expect_success 'cover letter with format.coverFromDescription = none' ' - test_config branch.rebuild-1.description "config subject - -body" && - test_config format.coverFromDescription none && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter master >actual && - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && - grep "^\*\*\* BLURB HERE \*\*\*$" actual && - ! grep "^config subject$" actual && - ! grep "^body$" actual -' - -test_expect_success 'cover letter with --cover-from-description none' ' - test_config branch.rebuild-1.description "config subject - -body" && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter --cover-from-description none master >actual && - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && - grep "^\*\*\* BLURB HERE \*\*\*$" actual && - ! grep "^config subject$" actual && - ! grep "^body$" actual -' - -test_expect_success 'cover letter with format.coverFromDescription = message' ' - test_config branch.rebuild-1.description "config subject - -body" && - test_config format.coverFromDescription message && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter master >actual && - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - grep "^config subject$" actual && - grep "^body$" actual -' - -test_expect_success 'cover letter with --cover-from-description message' ' - test_config branch.rebuild-1.description "config subject - -body" && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter --cover-from-description message master >actual && - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - grep "^config subject$" actual && - grep "^body$" actual -' - -test_expect_success 'cover letter with format.coverFromDescription = subject' ' - test_config branch.rebuild-1.description "config subject - -body" && - test_config format.coverFromDescription subject && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter master >actual && - grep "^Subject: \[PATCH 0/2\] config subject$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - ! grep "^config subject$" actual && - grep "^body$" actual -' - -test_expect_success 'cover letter with --cover-from-description subject' ' - test_config branch.rebuild-1.description "config subject - -body" && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter --cover-from-description subject master >actual && - grep "^Subject: \[PATCH 0/2\] config subject$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - ! grep "^config subject$" actual && - grep "^body$" actual -' - -test_expect_success 'cover letter with format.coverFromDescription = auto (short subject line)' ' - test_config branch.rebuild-1.description "config subject - -body" && - test_config format.coverFromDescription auto && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter master >actual && - grep "^Subject: \[PATCH 0/2\] config subject$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - ! grep "^config subject$" actual && - grep "^body$" actual -' - -test_expect_success 'cover letter with --cover-from-description auto (short subject line)' ' - test_config branch.rebuild-1.description "config subject - -body" && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter --cover-from-description auto master >actual && - grep "^Subject: \[PATCH 0/2\] config subject$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - ! grep "^config subject$" actual && - grep "^body$" actual -' - -test_expect_success 'cover letter with format.coverFromDescription = auto (long subject line)' ' - test_config branch.rebuild-1.description "this is a really long first line and it is over 100 characters long which is the threshold for long subjects - -body" && - test_config format.coverFromDescription auto && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter master >actual && - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - grep "^this is a really long first line and it is over 100 characters long which is the threshold for long subjects$" actual && - grep "^body$" actual -' - -test_expect_success 'cover letter with --cover-from-description auto (long subject line)' ' - test_config branch.rebuild-1.description "this is a really long first line and it is over 100 characters long which is the threshold for long subjects - -body" && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter --cover-from-description auto master >actual && - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - grep "^this is a really long first line and it is over 100 characters long which is the threshold for long subjects$" actual && - grep "^body$" actual -' - -test_expect_success 'cover letter with command-line --cover-from-description overrides config' ' - test_config branch.rebuild-1.description "config subject - -body" && - test_config format.coverFromDescription none && - git checkout rebuild-1 && - git format-patch --stdout --cover-letter --cover-from-description subject master >actual && - grep "^Subject: \[PATCH 0/2\] config subject$" actual && - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && - ! grep "^config subject$" actual && - grep "^body$" actual -' - test_expect_success 'cover letter using branch description (1)' ' git checkout rebuild-1 && test_config branch.rebuild-1.description hello && git format-patch --stdout --cover-letter master >actual && - grep hello actual + grep hello actual >/dev/null ' test_expect_success 'cover letter using branch description (2)' ' git checkout rebuild-1 && test_config branch.rebuild-1.description hello && git format-patch --stdout --cover-letter rebuild-1~2..rebuild-1 >actual && - grep hello actual + grep hello actual >/dev/null ' test_expect_success 'cover letter using branch description (3)' ' git checkout rebuild-1 && test_config branch.rebuild-1.description hello && git format-patch --stdout --cover-letter ^master rebuild-1 >actual && - grep hello actual + grep hello actual >/dev/null ' test_expect_success 'cover letter using branch description (4)' ' git checkout rebuild-1 && test_config branch.rebuild-1.description hello && git format-patch --stdout --cover-letter master.. >actual && - grep hello actual + grep hello actual >/dev/null ' test_expect_success 'cover letter using branch description (5)' ' git checkout rebuild-1 && test_config branch.rebuild-1.description hello && git format-patch --stdout --cover-letter -2 HEAD >actual && - grep hello actual + grep hello actual >/dev/null ' test_expect_success 'cover letter using branch description (6)' ' git checkout rebuild-1 && test_config branch.rebuild-1.description hello && git format-patch --stdout --cover-letter -2 >actual && - grep hello actual + grep hello actual >/dev/null ' test_expect_success 'cover letter with nothing' ' @@ -1810,39 +1632,11 @@ test_expect_success 'From line has expected format' ' test_cmp from filtered ' -test_expect_success 'format-patch -o with no leading directories' ' - rm -fr patches && - git format-patch -o patches master..side && - count=$(git rev-list --count master..side) && - ls patches >list && - test_line_count = $count list -' - -test_expect_success 'format-patch -o with leading existing directories' ' - rm -rf existing-dir && - mkdir existing-dir && - git format-patch -o existing-dir/patches master..side && - count=$(git rev-list --count master..side) && - ls existing-dir/patches >list && - test_line_count = $count list -' - -test_expect_success 'format-patch -o with leading non-existing directories' ' - rm -rf non-existing-dir && - git format-patch -o non-existing-dir/patches master..side && - count=$(git rev-list --count master..side) && - test_path_is_dir non-existing-dir && - ls non-existing-dir/patches >list && - test_line_count = $count list -' - test_expect_success 'format-patch format.outputDirectory option' ' test_config format.outputDirectory patches && rm -fr patches && git format-patch master..side && - count=$(git rev-list --count master..side) && - ls patches >list && - test_line_count = $count list + test $(git rev-list master..side | wc -l) -eq $(ls patches | wc -l) ' test_expect_success 'format-patch -o overrides format.outputDirectory' ' @@ -1855,41 +1649,20 @@ test_expect_success 'format-patch -o overrides format.outputDirectory' ' test_expect_success 'format-patch --base' ' git checkout patchid && - - git format-patch --stdout --base=HEAD~3 -1 >patch && - tail -n 7 patch >actual1 && - - git format-patch --stdout --base=HEAD~3 HEAD~.. >patch && - tail -n 7 patch >actual2 && - - echo >expect && - git rev-parse HEAD~3 >commit-id-base && - echo "base-commit: $(cat commit-id-base)" >>expect && - - git show --patch HEAD~2 >patch && - git patch-id --stable patch.id.raw && - awk "{print \"prerequisite-patch-id:\", \$1}" >expect && - - git show --patch HEAD~1 >patch && - git patch-id --stable patch.id.raw && - awk "{print \"prerequisite-patch-id:\", \$1}" >expect && - - signature >>expect && - test_cmp expect actual1 && - test_cmp expect actual2 && - + git format-patch --stdout --base=HEAD~3 -1 | tail -n 7 >actual1 && + git format-patch --stdout --base=HEAD~3 HEAD~.. | tail -n 7 >actual2 && + echo >expected && + echo "base-commit: $(git rev-parse HEAD~3)" >>expected && + echo "prerequisite-patch-id: $(git show --patch HEAD~2 | git patch-id --stable | awk "{print \$1}")" >>expected && + echo "prerequisite-patch-id: $(git show --patch HEAD~1 | git patch-id --stable | awk "{print \$1}")" >>expected && + signature >> expected && + test_cmp expected actual1 && + test_cmp expected actual2 && echo >fail && - echo "base-commit: $(cat commit-id-base)" >>fail && - - git show --patch HEAD~2 >patch && - git patch-id --unstable patch.id.raw && - awk "{print \"prerequisite-patch-id:\", \$1}" >fail && - - git show --patch HEAD~1 >patch && - git patch-id --unstable patch.id.raw && - awk "{print \"prerequisite-patch-id:\", \$1}" >fail && - - signature >>fail && + echo "base-commit: $(git rev-parse HEAD~3)" >>fail && + echo "prerequisite-patch-id: $(git show --patch HEAD~2 | git patch-id --unstable | awk "{print \$1}")" >>fail && + echo "prerequisite-patch-id: $(git show --patch HEAD~1 | git patch-id --unstable | awk "{print \$1}")" >>fail && + signature >> fail && ! test_cmp fail actual1 && ! test_cmp fail actual2 ' @@ -1899,9 +1672,8 @@ test_expect_success 'format-patch --base errors out when base commit is in revis test_must_fail git format-patch --base=HEAD~1 -2 && git format-patch --stdout --base=HEAD~2 -2 >patch && grep "^base-commit:" patch >actual && - git rev-parse HEAD~2 >commit-id-base && - echo "base-commit: $(cat commit-id-base)" >expect && - test_cmp expect actual + echo "base-commit: $(git rev-parse HEAD~2)" >expected && + test_cmp expected actual ' test_expect_success 'format-patch --base errors out when base commit is not ancestor of revision list' ' @@ -1927,8 +1699,8 @@ test_expect_success 'format-patch --base errors out when base commit is not ance test_must_fail git format-patch --base=$(cat commit-id-Z) -3 && git format-patch --stdout --base=$(cat commit-id-base) -3 >patch && grep "^base-commit:" patch >actual && - echo "base-commit: $(cat commit-id-base)" >expect && - test_cmp expect actual + echo "base-commit: $(cat commit-id-base)" >expected && + test_cmp expected actual ' test_expect_success 'format-patch --base=auto' ' @@ -1939,9 +1711,8 @@ test_expect_success 'format-patch --base=auto' ' test_commit N2 && git format-patch --stdout --base=auto -2 >patch && grep "^base-commit:" patch >actual && - git rev-parse upstream >commit-id-base && - echo "base-commit: $(cat commit-id-base)" >expect && - test_cmp expect actual + echo "base-commit: $(git rev-parse upstream)" >expected && + test_cmp expected actual ' test_expect_success 'format-patch errors out when history involves criss-cross' ' @@ -1971,29 +1742,23 @@ test_expect_success 'format-patch errors out when history involves criss-cross' test_must_fail git format-patch --base=auto -1 ' -test_expect_success 'format-patch format.useAutoBase option' ' +test_expect_success 'format-patch format.useAutoBaseoption' ' + test_when_finished "git config --unset format.useAutoBase" && git checkout local && - test_config format.useAutoBase true && + git config format.useAutoBase true && git format-patch --stdout -1 >patch && grep "^base-commit:" patch >actual && - git rev-parse upstream >commit-id-base && - echo "base-commit: $(cat commit-id-base)" >expect && - test_cmp expect actual + echo "base-commit: $(git rev-parse upstream)" >expected && + test_cmp expected actual ' test_expect_success 'format-patch --base overrides format.useAutoBase' ' - test_config format.useAutoBase true && + test_when_finished "git config --unset format.useAutoBase" && + git config format.useAutoBase true && git format-patch --stdout --base=HEAD~1 -1 >patch && grep "^base-commit:" patch >actual && - git rev-parse HEAD~1 >commit-id-base && - echo "base-commit: $(cat commit-id-base)" >expect && - test_cmp expect actual -' - -test_expect_success 'format-patch --no-base overrides format.useAutoBase' ' - test_config format.useAutoBase true && - git format-patch --stdout --no-base -1 >patch && - ! grep "^base-commit:" patch + echo "base-commit: $(git rev-parse HEAD~1)" >expected && + test_cmp expected actual ' test_expect_success 'format-patch --base with --attach' ' @@ -2068,7 +1833,7 @@ test_expect_success 'interdiff: cover-letter' ' git format-patch --cover-letter --interdiff=boop~2 -1 boop && test_i18ngrep "^Interdiff:$" 0000-cover-letter.patch && test_i18ngrep ! "^Interdiff:$" 0001-fleep.patch && - sed "1,/^@@ /d; /^-- $/q" 0000-cover-letter.patch >actual && + sed "1,/^@@ /d; /^-- $/q" <0000-cover-letter.patch >actual && test_cmp expect actual ' @@ -2084,7 +1849,7 @@ test_expect_success 'interdiff: solo-patch' ' EOF git format-patch --interdiff=boop~2 -1 boop && test_i18ngrep "^Interdiff:$" 0001-fleep.patch && - sed "1,/^ @@ /d; /^$/q" 0001-fleep.patch >actual && + sed "1,/^ @@ /d; /^$/q" <0001-fleep.patch >actual && test_cmp expect actual ' diff --git a/third_party/git/t/t4015-diff-whitespace.sh b/third_party/git/t/t4015-diff-whitespace.sh index 88d3026894f8..6b087df3dcbd 100755 --- a/third_party/git/t/t4015-diff-whitespace.sh +++ b/third_party/git/t/t4015-diff-whitespace.sh @@ -16,8 +16,6 @@ test_expect_success "Ray Lehtiniemi's example" ' } while (0); EOF git update-index --add x && - old_hash_x=$(git hash-object x) && - before=$(git rev-parse --short "$old_hash_x") && cat <<-\EOF >x && do @@ -26,12 +24,10 @@ test_expect_success "Ray Lehtiniemi's example" ' } while (0); EOF - new_hash_x=$(git hash-object x) && - after=$(git rev-parse --short "$new_hash_x") && - cat <<-EOF >expect && + cat <<-\EOF >expect && diff --git a/x b/x - index $before..$after 100644 + index adf3937..6edc172 100644 --- a/x +++ b/x @@ -1,3 +1,5 @@ @@ -65,8 +61,6 @@ test_expect_success 'another test, without options' ' EOF git update-index x && - old_hash_x=$(git hash-object x) && - before=$(git rev-parse --short "$old_hash_x") && tr "_" " " <<-\EOF >x && _ whitespace at beginning @@ -76,12 +70,10 @@ test_expect_success 'another test, without options' ' unchanged line CR at end EOF - new_hash_x=$(git hash-object x) && - after=$(git rev-parse --short "$new_hash_x") && - tr "Q_" "\015 " <<-EOF >expect && + tr "Q_" "\015 " <<-\EOF >expect && diff --git a/x b/x - index $before..$after 100644 + index d99af23..22d9f73 100644 --- a/x +++ b/x @@ -1,6 +1,6 @@ @@ -116,9 +108,9 @@ test_expect_success 'another test, without options' ' git diff -w --ignore-cr-at-eol >out && test_must_be_empty out && - tr "Q_" "\015 " <<-EOF >expect && + tr "Q_" "\015 " <<-\EOF >expect && diff --git a/x b/x - index $before..$after 100644 + index d99af23..22d9f73 100644 --- a/x +++ b/x @@ -1,6 +1,6 @@ @@ -140,9 +132,9 @@ test_expect_success 'another test, without options' ' git diff -b --ignore-cr-at-eol >out && test_cmp expect out && - tr "Q_" "\015 " <<-EOF >expect && + tr "Q_" "\015 " <<-\EOF >expect && diff --git a/x b/x - index $before..$after 100644 + index d99af23..22d9f73 100644 --- a/x +++ b/x @@ -1,6 +1,6 @@ @@ -162,9 +154,9 @@ test_expect_success 'another test, without options' ' git diff --ignore-space-at-eol --ignore-cr-at-eol >out && test_cmp expect out && - tr "Q_" "\015 " <<-EOF >expect && + tr "Q_" "\015 " <<-\EOF >expect && diff --git a/x b/x - index_$before..$after 100644 + index_d99af23..22d9f73 100644 --- a/x +++ b/x @@ -1,6 +1,6 @@ @@ -530,15 +522,13 @@ test_expect_success 'ignore-blank-lines: mix changes and blank lines' ' test_expect_success 'check mixed spaces and tabs in indent' ' # This is indented with SP HT SP. echo " foo();" >x && - test_must_fail git diff --check >check && - grep "space before tab in indent" check + git diff --check | grep "space before tab in indent" ' test_expect_success 'check mixed tabs and spaces in indent' ' # This is indented with HT SP HT. echo " foo();" >x && - test_must_fail git diff --check >check && - grep "space before tab in indent" check + git diff --check | grep "space before tab in indent" ' test_expect_success 'check with no whitespace errors' ' @@ -759,23 +749,20 @@ test_expect_success 'check tab-in-indent excluded from wildcard whitespace attri test_expect_success 'line numbers in --check output are correct' ' echo "" >x && echo "foo(); " >>x && - test_must_fail git diff --check >check && - grep "x:2:" check + git diff --check | grep "x:2:" ' test_expect_success 'checkdiff detects new trailing blank lines (1)' ' echo "foo();" >x && echo "" >>x && - test_must_fail git diff --check >check && - grep "new blank line" check + git diff --check | grep "new blank line" ' test_expect_success 'checkdiff detects new trailing blank lines (2)' ' - test_write_lines a b "" "" >x && + { echo a; echo b; echo; echo; } >x && git add x && - test_write_lines a "" "" "" "" >x && - test_must_fail git diff --check >check && - grep "new blank line" check + { echo a; echo; echo; echo; echo; } >x && + git diff --check | grep "new blank line" ' test_expect_success 'checkdiff allows new blank lines' ' @@ -799,27 +786,23 @@ test_expect_success 'whitespace-only changes not reported' ' test_must_be_empty actual ' +cat <expect +diff --git a/x b/z +similarity index NUM% +rename from x +rename to z +index 380c32a..a97b785 100644 +EOF test_expect_success 'whitespace-only changes reported across renames' ' git reset --hard && for i in 1 2 3 4 5 6 7 8 9; do echo "$i$i$i$i$i$i"; done >x && git add x && - hash_x=$(git hash-object x) && - before=$(git rev-parse --short "$hash_x") && git commit -m "base" && sed -e "5s/^/ /" x >z && git rm x && git add z && - hash_z=$(git hash-object z) && - after=$(git rev-parse --short "$hash_z") && - git diff -w -M --cached >actual.raw && - sed -e "/^similarity index /s/[0-9][0-9]*/NUM/" actual.raw >actual && - cat <<-EOF >expect && - diff --git a/x b/z - similarity index NUM% - rename from x - rename to z - index $before..$after 100644 - EOF + git diff -w -M --cached | + sed -e "/^similarity index /s/[0-9][0-9]*/NUM/" >actual && test_cmp expect actual ' @@ -851,8 +834,7 @@ test_expect_success 'combined diff with autocrlf conversion' ' git config core.autocrlf true && test_must_fail git merge master && - git diff >actual.raw && - sed -e "1,/^@@@/d" actual.raw >actual && + git diff | sed -e "1,/^@@@/d" >actual && ! grep "^-" actual ' @@ -876,18 +858,13 @@ test_expect_success 'diff that introduces a line with only tabs' ' git config core.whitespace blank-at-eol && git reset --hard && echo "test" >x && - old_hash_x=$(git hash-object x) && - before=$(git rev-parse --short "$old_hash_x") && git commit -m "initial" x && echo "{NTN}" | tr "NT" "\n\t" >>x && - new_hash_x=$(git hash-object x) && - after=$(git rev-parse --short "$new_hash_x") && - git diff --color >current.raw && - test_decode_color current && + git diff --color | test_decode_color >current && - cat >expected <<-EOF && + cat >expected <<-\EOF && diff --git a/x b/x - index $before..$after 100644 + index 9daeafb..2874b91 100644 --- a/x +++ b/x @@ -1 +1,4 @@ @@ -906,23 +883,19 @@ test_expect_success 'diff that introduces and removes ws breakages' ' echo "0. blank-at-eol " && echo "1. blank-at-eol " } >x && - old_hash_x=$(git hash-object x) && - before=$(git rev-parse --short "$old_hash_x") && git commit -a --allow-empty -m preimage && { echo "0. blank-at-eol " && echo "1. still-blank-at-eol " && echo "2. and a new line " } >x && - new_hash_x=$(git hash-object x) && - after=$(git rev-parse --short "$new_hash_x") && - git diff --color >current.raw && - test_decode_color current && + git diff --color | + test_decode_color >current && - cat >expected <<-EOF && + cat >expected <<-\EOF && diff --git a/x b/x - index $before..$after 100644 + index d0233a2..700886e 100644 --- a/x +++ b/x @@ -1,2 +1,3 @@ @@ -942,20 +915,16 @@ test_expect_success 'ws-error-highlight test setup' ' echo "0. blank-at-eol " && echo "1. blank-at-eol " } >x && - old_hash_x=$(git hash-object x) && - before=$(git rev-parse --short "$old_hash_x") && git commit -a --allow-empty -m preimage && { echo "0. blank-at-eol " && echo "1. still-blank-at-eol " && echo "2. and a new line " } >x && - new_hash_x=$(git hash-object x) && - after=$(git rev-parse --short "$new_hash_x") && - cat >expect.default-old <<-EOF && + cat >expect.default-old <<-\EOF && diff --git a/x b/x - index $before..$after 100644 + index d0233a2..700886e 100644 --- a/x +++ b/x @@ -1,2 +1,3 @@ @@ -965,9 +934,9 @@ test_expect_success 'ws-error-highlight test setup' ' +2. and a new line EOF - cat >expect.all <<-EOF && + cat >expect.all <<-\EOF && diff --git a/x b/x - index $before..$after 100644 + index d0233a2..700886e 100644 --- a/x +++ b/x @@ -1,2 +1,3 @@ @@ -977,9 +946,9 @@ test_expect_success 'ws-error-highlight test setup' ' +2. and a new line EOF - cat >expect.none <<-EOF + cat >expect.none <<-\EOF diff --git a/x b/x - index $before..$after 100644 + index d0233a2..700886e 100644 --- a/x +++ b/x @@ -1,2 +1,3 @@ @@ -993,32 +962,32 @@ test_expect_success 'ws-error-highlight test setup' ' test_expect_success 'test --ws-error-highlight option' ' - git diff --color --ws-error-highlight=default,old >current.raw && - test_decode_color current && + git diff --color --ws-error-highlight=default,old | + test_decode_color >current && test_cmp expect.default-old current && - git diff --color --ws-error-highlight=all >current.raw && - test_decode_color current && + git diff --color --ws-error-highlight=all | + test_decode_color >current && test_cmp expect.all current && - git diff --color --ws-error-highlight=none >current.raw && - test_decode_color current && + git diff --color --ws-error-highlight=none | + test_decode_color >current && test_cmp expect.none current ' test_expect_success 'test diff.wsErrorHighlight config' ' - git -c diff.wsErrorHighlight=default,old diff --color >current.raw && - test_decode_color current && + git -c diff.wsErrorHighlight=default,old diff --color | + test_decode_color >current && test_cmp expect.default-old current && - git -c diff.wsErrorHighlight=all diff --color >current.raw && - test_decode_color current && + git -c diff.wsErrorHighlight=all diff --color | + test_decode_color >current && test_cmp expect.all current && - git -c diff.wsErrorHighlight=none diff --color >current.raw && - test_decode_color current && + git -c diff.wsErrorHighlight=none diff --color | + test_decode_color >current && test_cmp expect.none current ' @@ -1026,18 +995,18 @@ test_expect_success 'test diff.wsErrorHighlight config' ' test_expect_success 'option overrides diff.wsErrorHighlight' ' git -c diff.wsErrorHighlight=none \ - diff --color --ws-error-highlight=default,old >current.raw && - test_decode_color current && + diff --color --ws-error-highlight=default,old | + test_decode_color >current && test_cmp expect.default-old current && git -c diff.wsErrorHighlight=default \ - diff --color --ws-error-highlight=all >current.raw && - test_decode_color current && + diff --color --ws-error-highlight=all | + test_decode_color >current && test_cmp expect.all current && git -c diff.wsErrorHighlight=all \ - diff --color --ws-error-highlight=none >current.raw && - test_decode_color current && + diff --color --ws-error-highlight=none | + test_decode_color >current && test_cmp expect.none current ' @@ -1053,16 +1022,14 @@ test_expect_success 'detect moved code, complete file' ' EOF git add test.c && git commit -m "add main function" && - file=$(git rev-parse --short HEAD:test.c) && git mv test.c main.c && test_config color.diff.oldMoved "normal red" && test_config color.diff.newMoved "normal green" && - git diff HEAD --color-moved=zebra --color --no-renames >actual.raw && - test_decode_color actual && - cat >expected <<-EOF && + git diff HEAD --color-moved=zebra --color --no-renames | test_decode_color >actual && + cat >expected <<-\EOF && diff --git a/main.c b/main.c new file mode 100644 - index 0000000..$file + index 0000000..a986c57 --- /dev/null +++ b/main.c @@ -0,0 +1,5 @@ @@ -1073,7 +1040,7 @@ test_expect_success 'detect moved code, complete file' ' +} diff --git a/test.c b/test.c deleted file mode 100644 - index $file..0000000 + index a986c57..0000000 --- a/test.c +++ /dev/null @@ -1,5 +0,0 @@ @@ -1127,8 +1094,6 @@ test_expect_success 'detect malicious moved code, inside file' ' EOF git add main.c test.c && git commit -m "add main and test file" && - before_main=$(git rev-parse --short HEAD:main.c) && - before_test=$(git rev-parse --short HEAD:test.c) && cat <<-\EOF >main.c && #include int stuff() @@ -1161,15 +1126,10 @@ test_expect_success 'detect malicious moved code, inside file' ' bar(); } EOF - hash_main=$(git hash-object main.c) && - after_main=$(git rev-parse --short "$hash_main") && - hash_test=$(git hash-object test.c) && - after_test=$(git rev-parse --short "$hash_test") && - git diff HEAD --no-renames --color-moved=zebra --color >actual.raw && - test_decode_color actual && - cat <<-EOF >expected && + git diff HEAD --no-renames --color-moved=zebra --color | test_decode_color >actual && + cat <<-\EOF >expected && diff --git a/main.c b/main.c - index $before_main..$after_main 100644 + index 27a619c..7cf9336 100644 --- a/main.c +++ b/main.c @@ -5,13 +5,6 @@ printf("Hello "); @@ -1187,7 +1147,7 @@ test_expect_success 'detect malicious moved code, inside file' ' { foo(); diff --git a/test.c b/test.c - index $before_test..$after_test 100644 + index 1dc1d85..2bedec9 100644 --- a/test.c +++ b/test.c @@ -4,6 +4,13 @@ int bar() @@ -1215,11 +1175,10 @@ test_expect_success 'plain moved code, inside file' ' test_config color.diff.oldMovedAlternative "blue" && test_config color.diff.newMovedAlternative "yellow" && # needs previous test as setup - git diff HEAD --no-renames --color-moved=plain --color >actual.raw && - test_decode_color actual && - cat <<-EOF >expected && + git diff HEAD --no-renames --color-moved=plain --color | test_decode_color >actual && + cat <<-\EOF >expected && diff --git a/main.c b/main.c - index $before_main..$after_main 100644 + index 27a619c..7cf9336 100644 --- a/main.c +++ b/main.c @@ -5,13 +5,6 @@ printf("Hello "); @@ -1237,7 +1196,7 @@ test_expect_success 'plain moved code, inside file' ' { foo(); diff --git a/test.c b/test.c - index $before_test..$after_test 100644 + index 1dc1d85..2bedec9 100644 --- a/test.c +++ b/test.c @@ -4,6 +4,13 @@ int bar() @@ -1795,8 +1754,7 @@ test_expect_success 'move detection with submodules' ' ! grep BRED decoded_actual && # nor did we mess with it another way - git diff --submodule=diff --color >expect.raw && - test_decode_color expect && + git diff --submodule=diff --color | test_decode_color >expect && test_cmp expect decoded_actual && rm -rf bananas && git submodule deinit bananas @@ -2050,6 +2008,11 @@ test_expect_success 'compare mixed whitespace delta across moved blocks' ' test_cmp expected actual ' +# Note that the "6" in the expected hunk header below is funny, since we only +# show 5 lines (the missing one was blank and thus ignored). This is how +# --ignore-blank-lines behaves even without --function-context, and this test +# is just checking the interaction of the two features. Don't take it as an +# endorsement of that output. test_expect_success 'combine --ignore-blank-lines with --function-context' ' test_write_lines 1 "" 2 3 4 5 >a && test_write_lines 1 2 3 4 >b && @@ -2059,7 +2022,6 @@ test_expect_success 'combine --ignore-blank-lines with --function-context' ' cat <<-\EOF >expect && @@ -1,6 +1,4 @@ 1 - - 2 3 4 @@ -2068,27 +2030,4 @@ test_expect_success 'combine --ignore-blank-lines with --function-context' ' test_cmp expect actual ' -test_expect_success 'combine --ignore-blank-lines with --function-context 2' ' - test_write_lines a b c "" function 1 2 3 4 5 "" 6 7 8 9 >a && - test_write_lines "" a b c "" function 1 2 3 4 5 6 7 8 >b && - test_must_fail git diff --no-index \ - --ignore-blank-lines --function-context a b >actual.raw && - sed -n "/@@/,\$p" actual && - cat <<-\EOF >expect && - @@ -5,11 +6,9 @@ c - function - 1 - 2 - 3 - 4 - 5 - - - 6 - 7 - 8 - -9 - EOF - test_cmp expect actual -' - test_done diff --git a/third_party/git/t/t4018-diff-funcname.sh b/third_party/git/t/t4018-diff-funcname.sh index 02255a08bf17..9261d6d3a000 100755 --- a/third_party/git/t/t4018-diff-funcname.sh +++ b/third_party/git/t/t4018-diff-funcname.sh @@ -31,8 +31,6 @@ diffpatterns=" cpp csharp css - dts - elixir fortran fountain golang @@ -106,6 +104,7 @@ do result=success fi test_expect_$result "hunk header: $i" " + test_when_finished 'cat actual' && # for debugging only git diff -U1 $i >actual && grep '@@ .* @@.*RIGHT' actual " diff --git a/third_party/git/t/t4018/dts-labels b/third_party/git/t/t4018/dts-labels deleted file mode 100644 index b21ef8737bb8..000000000000 --- a/third_party/git/t/t4018/dts-labels +++ /dev/null @@ -1,9 +0,0 @@ -/ { - label_1: node1@ff00 { - label2: RIGHT { - vendor,some-property; - - ChangeMe = <0x45-30>; - }; - }; -}; diff --git a/third_party/git/t/t4018/dts-node-unitless b/third_party/git/t/t4018/dts-node-unitless deleted file mode 100644 index c5287d91416e..000000000000 --- a/third_party/git/t/t4018/dts-node-unitless +++ /dev/null @@ -1,8 +0,0 @@ -/ { - label_1: node1 { - RIGHT { - prop-array = <1>, <4>; - ChangeMe = <0xffeedd00>; - }; - }; -}; diff --git a/third_party/git/t/t4018/dts-nodes b/third_party/git/t/t4018/dts-nodes deleted file mode 100644 index 5a4334bb1645..000000000000 --- a/third_party/git/t/t4018/dts-nodes +++ /dev/null @@ -1,8 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { - #size-cells = <1>; - ChangeMe = <0xffeedd00>; - }; - }; -}; diff --git a/third_party/git/t/t4018/dts-nodes-boolean-prop b/third_party/git/t/t4018/dts-nodes-boolean-prop deleted file mode 100644 index afc6b5b404e4..000000000000 --- a/third_party/git/t/t4018/dts-nodes-boolean-prop +++ /dev/null @@ -1,9 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { - boolean-prop1; - - ChangeMe; - }; - }; -}; diff --git a/third_party/git/t/t4018/dts-nodes-comment1 b/third_party/git/t/t4018/dts-nodes-comment1 deleted file mode 100644 index 559dfce9b308..000000000000 --- a/third_party/git/t/t4018/dts-nodes-comment1 +++ /dev/null @@ -1,8 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 /* &a comment */ { - #size-cells = <1>; - ChangeMe = <0xffeedd00>; - }; - }; -}; diff --git a/third_party/git/t/t4018/dts-nodes-comment2 b/third_party/git/t/t4018/dts-nodes-comment2 deleted file mode 100644 index 27e9718b31cf..000000000000 --- a/third_party/git/t/t4018/dts-nodes-comment2 +++ /dev/null @@ -1,8 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { /* a trailing comment */ - #size-cells = <1>; - ChangeMe = <0xffeedd00>; - }; - }; -}; diff --git a/third_party/git/t/t4018/dts-nodes-multiline-prop b/third_party/git/t/t4018/dts-nodes-multiline-prop deleted file mode 100644 index 072d58b69dc2..000000000000 --- a/third_party/git/t/t4018/dts-nodes-multiline-prop +++ /dev/null @@ -1,13 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { - multilineprop = <3>, - <4>, - <5>, - <6>, - <7>; - - ChangeMe = <0xffeedd00>; - }; - }; -}; diff --git a/third_party/git/t/t4018/dts-reference b/third_party/git/t/t4018/dts-reference deleted file mode 100644 index 8f0c87d8637f..000000000000 --- a/third_party/git/t/t4018/dts-reference +++ /dev/null @@ -1,9 +0,0 @@ -&label_1 { - TEST = <455>; -}; - -&RIGHT { - vendor,some-property; - - ChangeMe = <0x45-30>; -}; diff --git a/third_party/git/t/t4018/dts-root b/third_party/git/t/t4018/dts-root deleted file mode 100644 index 4353b8220c91..000000000000 --- a/third_party/git/t/t4018/dts-root +++ /dev/null @@ -1,5 +0,0 @@ -/ { RIGHT /* Technically just supposed to be a slash and brace */ - #size-cells = <1>; - - ChangeMe = <0xffeedd00>; -}; diff --git a/third_party/git/t/t4018/dts-root-comment b/third_party/git/t/t4018/dts-root-comment deleted file mode 100644 index 333a625c7007..000000000000 --- a/third_party/git/t/t4018/dts-root-comment +++ /dev/null @@ -1,8 +0,0 @@ -/ { RIGHT /* Technically just supposed to be a slash and brace */ - #size-cells = <1>; - - /* This comment should be ignored */ - - some-property = <40+2>; - ChangeMe = <0xffeedd00>; -}; diff --git a/third_party/git/t/t4018/elixir-do-not-pick-end b/third_party/git/t/t4018/elixir-do-not-pick-end deleted file mode 100644 index fae08ba7e8cb..000000000000 --- a/third_party/git/t/t4018/elixir-do-not-pick-end +++ /dev/null @@ -1,5 +0,0 @@ -defmodule RIGHT do -end -# -# -# ChangeMe; do not pick up 'end' line diff --git a/third_party/git/t/t4018/elixir-ex-unit-test b/third_party/git/t/t4018/elixir-ex-unit-test deleted file mode 100644 index 0560a2b69718..000000000000 --- a/third_party/git/t/t4018/elixir-ex-unit-test +++ /dev/null @@ -1,6 +0,0 @@ -defmodule Test do - test "RIGHT" do - assert true == true - assert ChangeMe - end -end diff --git a/third_party/git/t/t4018/elixir-function b/third_party/git/t/t4018/elixir-function deleted file mode 100644 index d452f495a7e0..000000000000 --- a/third_party/git/t/t4018/elixir-function +++ /dev/null @@ -1,5 +0,0 @@ -def function(RIGHT, arg) do - # comment - # comment - ChangeMe -end diff --git a/third_party/git/t/t4018/elixir-macro b/third_party/git/t/t4018/elixir-macro deleted file mode 100644 index 4f925e9ad463..000000000000 --- a/third_party/git/t/t4018/elixir-macro +++ /dev/null @@ -1,5 +0,0 @@ -defmacro foo(RIGHT) do - # Code - # Code - ChangeMe -end diff --git a/third_party/git/t/t4018/elixir-module b/third_party/git/t/t4018/elixir-module deleted file mode 100644 index 91a4e7aa2000..000000000000 --- a/third_party/git/t/t4018/elixir-module +++ /dev/null @@ -1,9 +0,0 @@ -defmodule RIGHT do - @moduledoc """ - Foo bar - """ - - def ChangeMe(a) where is_map(a) do - a - end -end diff --git a/third_party/git/t/t4018/elixir-module-func b/third_party/git/t/t4018/elixir-module-func deleted file mode 100644 index c9910d067513..000000000000 --- a/third_party/git/t/t4018/elixir-module-func +++ /dev/null @@ -1,8 +0,0 @@ -defmodule Foo do - def fun(RIGHT) do - # Code - # Code - # Code - ChangeMe - end -end diff --git a/third_party/git/t/t4018/elixir-nested-module b/third_party/git/t/t4018/elixir-nested-module deleted file mode 100644 index 771ebc5c42a9..000000000000 --- a/third_party/git/t/t4018/elixir-nested-module +++ /dev/null @@ -1,9 +0,0 @@ -defmodule MyApp.RIGHT do - @moduledoc """ - Foo bar - """ - - def ChangeMe(a) where is_map(a) do - a - end -end diff --git a/third_party/git/t/t4018/elixir-private-function b/third_party/git/t/t4018/elixir-private-function deleted file mode 100644 index 1aabe33b7a9a..000000000000 --- a/third_party/git/t/t4018/elixir-private-function +++ /dev/null @@ -1,5 +0,0 @@ -defp function(RIGHT, arg) do - # comment - # comment - ChangeMe -end diff --git a/third_party/git/t/t4018/elixir-protocol b/third_party/git/t/t4018/elixir-protocol deleted file mode 100644 index 7d9173691e32..000000000000 --- a/third_party/git/t/t4018/elixir-protocol +++ /dev/null @@ -1,6 +0,0 @@ -defprotocol RIGHT do - @doc """ - Calculates the size (and not the length!) of a data structure - """ - def size(data, ChangeMe) -end diff --git a/third_party/git/t/t4018/elixir-protocol-implementation b/third_party/git/t/t4018/elixir-protocol-implementation deleted file mode 100644 index f9234bbfc489..000000000000 --- a/third_party/git/t/t4018/elixir-protocol-implementation +++ /dev/null @@ -1,5 +0,0 @@ -defimpl RIGHT do - # Docs - # Docs - def foo(ChangeMe), do: :ok -end diff --git a/third_party/git/t/t4018/python-async-def b/third_party/git/t/t4018/python-async-def deleted file mode 100644 index 87640e03d213..000000000000 --- a/third_party/git/t/t4018/python-async-def +++ /dev/null @@ -1,4 +0,0 @@ -async def RIGHT(pi: int = 3.14): - while True: - break - return ChangeMe() diff --git a/third_party/git/t/t4018/python-class b/third_party/git/t/t4018/python-class deleted file mode 100644 index ba9e741430f2..000000000000 --- a/third_party/git/t/t4018/python-class +++ /dev/null @@ -1,4 +0,0 @@ -class RIGHT(int, str): - # comment - # another comment - # ChangeMe diff --git a/third_party/git/t/t4018/python-def b/third_party/git/t/t4018/python-def deleted file mode 100644 index e50b31b0ad5e..000000000000 --- a/third_party/git/t/t4018/python-def +++ /dev/null @@ -1,4 +0,0 @@ -def RIGHT(pi: int = 3.14): - while True: - break - return ChangeMe() diff --git a/third_party/git/t/t4018/python-indented-async-def b/third_party/git/t/t4018/python-indented-async-def deleted file mode 100644 index f5d03258af4d..000000000000 --- a/third_party/git/t/t4018/python-indented-async-def +++ /dev/null @@ -1,7 +0,0 @@ -class Foo: - async def RIGHT(self, x: int): - return [ - 1, - 2, - ChangeMe, - ] diff --git a/third_party/git/t/t4018/python-indented-class b/third_party/git/t/t4018/python-indented-class deleted file mode 100644 index 19b4f35c4ca1..000000000000 --- a/third_party/git/t/t4018/python-indented-class +++ /dev/null @@ -1,5 +0,0 @@ -if TYPE_CHECKING: - class RIGHT: - # comment - # another comment - # ChangeMe diff --git a/third_party/git/t/t4018/python-indented-def b/third_party/git/t/t4018/python-indented-def deleted file mode 100644 index 208fbadd2be6..000000000000 --- a/third_party/git/t/t4018/python-indented-def +++ /dev/null @@ -1,7 +0,0 @@ -class Foo: - def RIGHT(self, x: int): - return [ - 1, - 2, - ChangeMe, - ] diff --git a/third_party/git/t/t4026-color.sh b/third_party/git/t/t4026-color.sh index c0b642c1ab03..671e951ee549 100755 --- a/third_party/git/t/t4026-color.sh +++ b/third_party/git/t/t4026-color.sh @@ -30,14 +30,6 @@ test_expect_success 'attribute before color name' ' color "bold red" "[1;31m" ' -test_expect_success 'aixterm bright fg color' ' - color "brightred" "[91m" -' - -test_expect_success 'aixterm bright bg color' ' - color "green brightblue" "[32;104m" -' - test_expect_success 'color name before attribute' ' color "red bold" "[1;31m" ' @@ -82,10 +74,6 @@ test_expect_success '0-7 are aliases for basic ANSI color names' ' color "0 7" "[30;47m" ' -test_expect_success '8-15 are aliases for aixterm color names' ' - color "12 13" "[94;105m" -' - test_expect_success '256 colors' ' color "254 bold 255" "[1;38;5;254;48;5;255m" ' diff --git a/third_party/git/t/t4027-diff-submodule.sh b/third_party/git/t/t4027-diff-submodule.sh index e29deaf4a509..9aa8e2b39b45 100755 --- a/third_party/git/t/t4027-diff-submodule.sh +++ b/third_party/git/t/t4027-diff-submodule.sh @@ -6,7 +6,6 @@ test_description='difference in submodules' . "$TEST_DIRECTORY"/diff-lib.sh test_expect_success setup ' - test_oid_init && test_tick && test_create_repo sub && ( @@ -37,8 +36,7 @@ test_expect_success setup ' ' test_expect_success 'git diff --raw HEAD' ' - hexsz=$(test_oid hexsz) && - git diff --raw --abbrev=$hexsz HEAD >actual && + git diff --raw --abbrev=40 HEAD >actual && test_cmp expect actual ' @@ -247,21 +245,23 @@ test_expect_success 'git diff (empty submodule dir)' ' ' test_expect_success 'conflicted submodule setup' ' - c=$(test_oid ff_1) && + + # 39 efs + c=fffffffffffffffffffffffffffffffffffffff && ( echo "000000 $ZERO_OID 0 sub" && echo "160000 1$c 1 sub" && echo "160000 2$c 2 sub" && echo "160000 3$c 3 sub" ) | git update-index --index-info && - echo >expect.nosub "diff --cc sub + echo >expect.nosub '\''diff --cc sub index 2ffffff,3ffffff..0000000 --- a/sub +++ b/sub @@@ -1,1 -1,1 +1,1 @@@ -- Subproject commit 2$c - -Subproject commit 3$c -++Subproject commit $ZERO_OID" && +- Subproject commit 2fffffffffffffffffffffffffffffffffffffff + -Subproject commit 3fffffffffffffffffffffffffffffffffffffff +++Subproject commit 0000000000000000000000000000000000000000'\'' && hh=$(git rev-parse HEAD) && sed -e "s/$ZERO_OID/$hh/" expect.nosub >expect.withsub diff --git a/third_party/git/t/t4034-diff-words.sh b/third_party/git/t/t4034-diff-words.sh index fb145aa173ee..912df91226f2 100755 --- a/third_party/git/t/t4034-diff-words.sh +++ b/third_party/git/t/t4034-diff-words.sh @@ -19,11 +19,9 @@ cat >post.simple <<-\EOF aeff = aeff * ( aaa ) EOF -pre=$(git rev-parse --short $(git hash-object pre.simple)) -post=$(git rev-parse --short $(git hash-object post.simple)) -cat >expect.letter-runs-are-words <<-EOF +cat >expect.letter-runs-are-words <<-\EOF diff --git a/pre b/post - index $pre..$post 100644 + index 330b04f..5ed8eff 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -35,9 +33,9 @@ cat >expect.letter-runs-are-words <<-EOF aeff = aeff * ( aaa ) EOF -cat >expect.non-whitespace-is-word <<-EOF +cat >expect.non-whitespace-is-word <<-\EOF diff --git a/pre b/post - index $pre..$post 100644 + index 330b04f..5ed8eff 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -51,12 +49,9 @@ cat >expect.non-whitespace-is-word <<-EOF EOF word_diff () { - pre=$(git rev-parse --short $(git hash-object pre)) && - post=$(git rev-parse --short $(git hash-object post)) && test_must_fail git diff --no-index "$@" pre post >output && test_decode_color output.decrypted && - sed -e "2s/index [^ ]*/index $pre..$post/" expect >expected - test_cmp expected output.decrypted + test_cmp expect output.decrypted } test_language_driver () { @@ -82,9 +77,9 @@ test_expect_success 'set up pre and post with runs of whitespace' ' ' test_expect_success 'word diff with runs of whitespace' ' - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index 330b04f..5ed8eff 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -102,9 +97,9 @@ test_expect_success 'word diff with runs of whitespace' ' ' test_expect_success '--word-diff=porcelain' ' - sed 's/#.*$//' >expect <<-EOF && + sed 's/#.*$//' >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index 330b04f..5ed8eff 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -126,9 +121,9 @@ test_expect_success '--word-diff=porcelain' ' ' test_expect_success '--word-diff=plain' ' - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index 330b04f..5ed8eff 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -145,9 +140,9 @@ test_expect_success '--word-diff=plain' ' ' test_expect_success '--word-diff=plain --color' ' - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index 330b04f..5ed8eff 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -163,9 +158,9 @@ test_expect_success '--word-diff=plain --color' ' ' test_expect_success 'word diff without context' ' - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index 330b04f..5ed8eff 100644 --- a/pre +++ b/post @@ -1 +1 @@ @@ -212,9 +207,9 @@ test_expect_success 'command-line overrides config' ' ' test_expect_success 'command-line overrides config: --word-diff-regex' ' - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index 330b04f..5ed8eff 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -239,9 +234,9 @@ test_expect_success 'setup: remove diff driver regex' ' ' test_expect_success 'use configured regex' ' - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index 330b04f..5ed8eff 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -259,11 +254,9 @@ test_expect_success 'use configured regex' ' test_expect_success 'test parsing words for newline' ' echo "aaa (aaa)" >pre && echo "aaa (aaa) aaa" >post && - pre=$(git rev-parse --short $(git hash-object pre)) && - post=$(git rev-parse --short $(git hash-object post)) && - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index c29453b..be22f37 100644 --- a/pre +++ b/post @@ -1 +1 @@ @@ -275,11 +268,9 @@ test_expect_success 'test parsing words for newline' ' test_expect_success 'test when words are only removed at the end' ' echo "(:" >pre && echo "(" >post && - pre=$(git rev-parse --short $(git hash-object pre)) && - post=$(git rev-parse --short $(git hash-object post)) && - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index 289cb9d..2d06f37 100644 --- a/pre +++ b/post @@ -1 +1 @@ @@ -291,11 +282,9 @@ test_expect_success 'test when words are only removed at the end' ' test_expect_success '--word-diff=none' ' echo "(:" >pre && echo "(" >post && - pre=$(git rev-parse --short $(git hash-object pre)) && - post=$(git rev-parse --short $(git hash-object post)) && - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index 289cb9d..2d06f37 100644 --- a/pre +++ b/post @@ -1 +1 @@ @@ -314,7 +303,6 @@ test_language_driver bibtex test_language_driver cpp test_language_driver csharp test_language_driver css -test_language_driver dts test_language_driver fortran test_language_driver html test_language_driver java @@ -328,6 +316,16 @@ test_language_driver ruby test_language_driver tex test_expect_success 'word-diff with diff.sbe' ' + cat >expect <<-\EOF && + diff --git a/pre b/post + index a1a53b5..bc8fe6d 100644 + --- a/pre + +++ b/post + @@ -1,3 +1,3 @@ + a + + [-b-]{+c+} + EOF cat >pre <<-\EOF && a @@ -338,35 +336,21 @@ test_expect_success 'word-diff with diff.sbe' ' c EOF - pre=$(git rev-parse --short $(git hash-object pre)) && - post=$(git rev-parse --short $(git hash-object post)) && - cat >expect <<-EOF && - diff --git a/pre b/post - index $pre..$post 100644 - --- a/pre - +++ b/post - @@ -1,3 +1,3 @@ - a - - [-b-]{+c+} - EOF test_config diff.suppress-blank-empty true && word_diff --word-diff=plain ' test_expect_success 'word-diff with no newline at EOF' ' - printf "%s" "a a a a a" >pre && - printf "%s" "a a ab a a" >post && - pre=$(git rev-parse --short $(git hash-object pre)) && - post=$(git rev-parse --short $(git hash-object post)) && - cat >expect <<-EOF && + cat >expect <<-\EOF && diff --git a/pre b/post - index $pre..$post 100644 + index 7bf316e..3dd0303 100644 --- a/pre +++ b/post @@ -1 +1 @@ a a [-a-]{+ab+} a a EOF + printf "%s" "a a a a a" >pre && + printf "%s" "a a ab a a" >post && word_diff --word-diff=plain ' diff --git a/third_party/git/t/t4034/dts/expect b/third_party/git/t/t4034/dts/expect deleted file mode 100644 index 560fc9918476..000000000000 --- a/third_party/git/t/t4034/dts/expect +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/pre b/post -index b6a9051..7803aee 100644 ---- a/pre -+++ b/post -@@ -1,32 +1,32 @@ -/ { - this_handleHANDLE_2: nodenew-node@f00eeda { - compatible = "mydevvendor,compat"; - string-prop = startend: "hello world!world?" endstart: ; - #size-cells#address-cells = <0+00+40>; - reg = <0xf000xeeda>; - prop = <(1)>; - prop = <(-1e10)>; - prop = <(!31)>; - prop = <(~31)>; - prop = <(31*42)>; - prop = <(31&42)>; - prop = <(31*42)>; - prop = <(31/42)>; - prop = <(31%42)>; - prop = <(3+41+2)>; - prop = <(3-41-2)>; - prop = /bits/ 6432 <(31<<42)>; - prop = <(31>>42)>; - prop = <(31&42)>; - prop = <(31^42)>; - prop = <(31|42)>; - prop = <(31&&42)>; - prop = <(31||42)>; - prop = <(4?51?2:3)>; - list = <&this_handleHANDLE_2>, <0 0 0 01>; - }; - - &phandlephandle2 { - pre-phandleprop_handle = <&this_handleHANDLE_2>; - }; -}; diff --git a/third_party/git/t/t4034/dts/post b/third_party/git/t/t4034/dts/post deleted file mode 100644 index 7803aee28093..000000000000 --- a/third_party/git/t/t4034/dts/post +++ /dev/null @@ -1,32 +0,0 @@ -/ { - HANDLE_2: new-node@eeda { - compatible = "vendor,compat"; - string-prop = end: "hello world?" start: ; - #address-cells = <0+40>; - reg = <0xeeda>; - prop = <(1)>; - prop = <(-1e10)>; - prop = <(!1)>; - prop = <(~1)>; - prop = <(1*2)>; - prop = <(1&2)>; - prop = <(1*2)>; - prop = <(1/2)>; - prop = <(1%2)>; - prop = <(1+2)>; - prop = <(1-2)>; - prop = /bits/ 32 <(1<<2)>; - prop = <(1>>2)>; - prop = <(1&2)>; - prop = <(1^2)>; - prop = <(1|2)>; - prop = <(1&&2)>; - prop = <(1||2)>; - prop = <(1?2:3)>; - list = <&HANDLE_2>, <0 0 0 1>; - }; - - &phandle2 { - prop_handle = <&HANDLE_2>; - }; -}; diff --git a/third_party/git/t/t4034/dts/pre b/third_party/git/t/t4034/dts/pre deleted file mode 100644 index b6a905113c22..000000000000 --- a/third_party/git/t/t4034/dts/pre +++ /dev/null @@ -1,32 +0,0 @@ -/ { - this_handle: node@f00 { - compatible = "mydev"; - string-prop = start: "hello world!" end: ; - #size-cells = <0+0>; - reg = <0xf00>; - prop = <1>; - prop = <-1e10>; - prop = <(!3)>; - prop = <(~3)>; - prop = <(3*4)>; - prop = <(3&4)>; - prop = <(3*4)>; - prop = <(3/4)>; - prop = <(3%4)>; - prop = <(3+4)>; - prop = <(3-4)>; - prop = /bits/ 64 <(3<<4)>; - prop = <(3>>4)>; - prop = <(3&4)>; - prop = <(3^4)>; - prop = <(3|4)>; - prop = <(3&&4)>; - prop = <(3||4)>; - prop = <(4?5:3)>; - list = <&this_handle>, <0 0 0 0>; - }; - - &phandle { - pre-phandle = <&this_handle>; - }; -}; diff --git a/third_party/git/t/t4038-diff-combined.sh b/third_party/git/t/t4038-diff-combined.sh index 94680836ceb5..d4afe125548b 100755 --- a/third_party/git/t/t4038-diff-combined.sh +++ b/third_party/git/t/t4038-diff-combined.sh @@ -354,7 +354,7 @@ test_expect_failure 'combine diff coalesce three parents' ' ' # Test for a bug reported at -# https://lore.kernel.org/git/20130515143508.GO25742@login.drsnuggles.stderr.nl/ +# https://public-inbox.org/git/20130515143508.GO25742@login.drsnuggles.stderr.nl/ # where a delete lines were missing from combined diff output when they # occurred exactly before the context lines of a later change. test_expect_success 'combine diff missing delete bug' ' @@ -440,13 +440,11 @@ test_expect_success 'setup for --combined-all-paths' ' git branch side2c && git checkout side1c && test_seq 1 10 >filename-side1c && - side1cf=$(git hash-object filename-side1c) && git add filename-side1c && git commit -m with && git checkout side2c && test_seq 1 9 >filename-side2c && echo ten >>filename-side2c && - side2cf=$(git hash-object filename-side2c) && git add filename-side2c && git commit -m iam && git checkout -b mergery side1c && @@ -454,14 +452,13 @@ test_expect_success 'setup for --combined-all-paths' ' git rm filename-side1c && echo eleven >>filename-side2c && git mv filename-side2c filename-merged && - mergedf=$(git hash-object filename-merged) && git add filename-merged && git commit ' test_expect_success '--combined-all-paths and --raw' ' - cat <<-EOF >expect && - ::100644 100644 100644 $side1cf $side2cf $mergedf RR filename-side1c filename-side2c filename-merged + cat <<-\EOF >expect && + ::100644 100644 100644 f00c965d8307308469e537302baa73048488f162 088bd5d92c2a8e0203ca8e7e4c2a5c692f6ae3f7 333b9c62519f285e1854830ade0fe1ef1d40ee1b RR filename-side1c filename-side2c filename-merged EOF git diff-tree -c -M --raw --combined-all-paths HEAD >actual.tmp && sed 1d actual && @@ -485,13 +482,11 @@ test_expect_success FUNNYNAMES 'setup for --combined-all-paths with funny names' git checkout side1d && test_seq 1 10 >"$(printf "file\twith\ttabs")" && git add file* && - side1df=$(git hash-object *tabs) && git commit -m with && git checkout side2d && test_seq 1 9 >"$(printf "i\tam\ttabbed")" && echo ten >>"$(printf "i\tam\ttabbed")" && git add *tabbed && - side2df=$(git hash-object *tabbed) && git commit -m iam && git checkout -b funny-names-mergery side1d && git merge --no-commit side2d && @@ -499,14 +494,12 @@ test_expect_success FUNNYNAMES 'setup for --combined-all-paths with funny names' echo eleven >>"$(printf "i\tam\ttabbed")" && git mv "$(printf "i\tam\ttabbed")" "$(printf "fickle\tnaming")" && git add fickle* && - headf=$(git hash-object fickle*) && - git commit && - head=$(git rev-parse HEAD) + git commit ' test_expect_success FUNNYNAMES '--combined-all-paths and --raw and funny names' ' - cat <<-EOF >expect && - ::100644 100644 100644 $side1df $side2df $headf RR "file\twith\ttabs" "i\tam\ttabbed" "fickle\tnaming" + cat <<-\EOF >expect && + ::100644 100644 100644 f00c965d8307308469e537302baa73048488f162 088bd5d92c2a8e0203ca8e7e4c2a5c692f6ae3f7 333b9c62519f285e1854830ade0fe1ef1d40ee1b RR "file\twith\ttabs" "i\tam\ttabbed" "fickle\tnaming" EOF git diff-tree -c -M --raw --combined-all-paths HEAD >actual.tmp && sed 1d actual && @@ -514,9 +507,9 @@ test_expect_success FUNNYNAMES '--combined-all-paths and --raw and funny names' ' test_expect_success FUNNYNAMES '--combined-all-paths and --raw -and -z and funny names' ' - printf "$head\0::100644 100644 100644 $side1df $side2df $headf RR\0file\twith\ttabs\0i\tam\ttabbed\0fickle\tnaming\0" >expect && + printf "aaf8087c3cbd4db8e185a2d074cf27c53cfb75d7\0::100644 100644 100644 f00c965d8307308469e537302baa73048488f162 088bd5d92c2a8e0203ca8e7e4c2a5c692f6ae3f7 333b9c62519f285e1854830ade0fe1ef1d40ee1b RR\0file\twith\ttabs\0i\tam\ttabbed\0fickle\tnaming\0" >expect && git diff-tree -c -M --raw --combined-all-paths -z HEAD >actual && - test_cmp expect actual + test_cmp -a expect actual ' test_expect_success FUNNYNAMES '--combined-all-paths and --cc and funny names' ' diff --git a/third_party/git/t/t4039-diff-assume-unchanged.sh b/third_party/git/t/t4039-diff-assume-unchanged.sh index 0eb0314a8b35..53ac44b0f003 100755 --- a/third_party/git/t/t4039-diff-assume-unchanged.sh +++ b/third_party/git/t/t4039-diff-assume-unchanged.sh @@ -12,7 +12,6 @@ test_expect_success 'setup' ' git commit -m zero && echo one > one && echo two > two && - blob=$(git hash-object one) && git add one two && git commit -m onetwo && git update-index --assume-unchanged one && @@ -21,7 +20,7 @@ test_expect_success 'setup' ' ' test_expect_success 'diff-index does not examine assume-unchanged entries' ' - git diff-index HEAD^ -- one | grep -q $blob + git diff-index HEAD^ -- one | grep -q 5626abf0f72e58d7a153368ba57db4c673c0e171 ' test_expect_success 'diff-files does not examine assume-unchanged entries' ' diff --git a/third_party/git/t/t4041-diff-submodule-option.sh b/third_party/git/t/t4041-diff-submodule-option.sh index f85213658560..619bf970983e 100755 --- a/third_party/git/t/t4041-diff-submodule-option.sh +++ b/third_party/git/t/t4041-diff-submodule-option.sh @@ -284,7 +284,7 @@ test_expect_success 'submodule contains untracked content (all ignored)' ' test_must_be_empty actual ' -test_expect_success 'submodule contains untracked and modified content' ' +test_expect_success 'submodule contains untracked and modifed content' ' echo new > sm1/foo6 && git diff-index -p --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -294,7 +294,7 @@ test_expect_success 'submodule contains untracked and modified content' ' test_cmp expected actual ' -test_expect_success 'submodule contains untracked and modified content (untracked ignored)' ' +test_expect_success 'submodule contains untracked and modifed content (untracked ignored)' ' echo new > sm1/foo6 && git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -303,19 +303,19 @@ test_expect_success 'submodule contains untracked and modified content (untracke test_cmp expected actual ' -test_expect_success 'submodule contains untracked and modified content (dirty ignored)' ' +test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' ' echo new > sm1/foo6 && git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual && test_must_be_empty actual ' -test_expect_success 'submodule contains untracked and modified content (all ignored)' ' +test_expect_success 'submodule contains untracked and modifed content (all ignored)' ' echo new > sm1/foo6 && git diff-index -p --ignore-submodules --submodule=log HEAD >actual && test_must_be_empty actual ' -test_expect_success 'submodule contains modified content' ' +test_expect_success 'submodule contains modifed content' ' rm -f sm1/new-file && git diff-index -p --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -369,7 +369,7 @@ test_expect_success 'modified submodule contains untracked content (all ignored) test_must_be_empty actual ' -test_expect_success 'modified submodule contains untracked and modified content' ' +test_expect_success 'modified submodule contains untracked and modifed content' ' echo modification >> sm1/foo6 && git diff-index -p --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -381,7 +381,7 @@ test_expect_success 'modified submodule contains untracked and modified content' test_cmp expected actual ' -test_expect_success 'modified submodule contains untracked and modified content (untracked ignored)' ' +test_expect_success 'modified submodule contains untracked and modifed content (untracked ignored)' ' echo modification >> sm1/foo6 && git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -392,7 +392,7 @@ test_expect_success 'modified submodule contains untracked and modified content test_cmp expected actual ' -test_expect_success 'modified submodule contains untracked and modified content (dirty ignored)' ' +test_expect_success 'modified submodule contains untracked and modifed content (dirty ignored)' ' echo modification >> sm1/foo6 && git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -402,13 +402,13 @@ test_expect_success 'modified submodule contains untracked and modified content test_cmp expected actual ' -test_expect_success 'modified submodule contains untracked and modified content (all ignored)' ' +test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' ' echo modification >> sm1/foo6 && git diff-index -p --ignore-submodules --submodule=log HEAD >actual && test_must_be_empty actual ' -test_expect_success 'modified submodule contains modified content' ' +test_expect_success 'modified submodule contains modifed content' ' rm -f sm1/new-file && git diff-index -p --submodule=log HEAD >actual && cat >expected <<-EOF && diff --git a/third_party/git/t/t4044-diff-index-unique-abbrev.sh b/third_party/git/t/t4044-diff-index-unique-abbrev.sh index 4701796d10e1..647905e01fb9 100755 --- a/third_party/git/t/t4044-diff-index-unique-abbrev.sh +++ b/third_party/git/t/t4044-diff-index-unique-abbrev.sh @@ -3,48 +3,34 @@ test_description='test unique sha1 abbreviation on "index from..to" line' . ./test-lib.sh -test_expect_success 'setup' ' - test_oid_cache <<-EOF && - val1 sha1:4827 - val1 sha256:5664 - - val2 sha1:11742 - val2 sha256:10625 - - hash1 sha1:51d2738463ea4ca66f8691c91e33ce64b7d41bb1 - hash1 sha256:ae31dfff0af93b2c62b0098a039b38569c43b0a7e97b873000ca42d128f27350 - - hasht1 sha1:51d27384 - hasht1 sha256:ae31dfff - - hash2 sha1:51d2738efb4ad8a1e40bed839ab8e116f0a15e47 - hash2 sha256:ae31dffada88a46fd5f53c7ed5aa25a7a8951f1d5e88456c317c8d5484d263e5 - - hasht2 sha1:51d2738e - hasht2 sha256:ae31dffa - EOF - - cat >expect_initial <<-EOF && - 100644 blob $(test_oid hash1) foo - EOF +if ! test_have_prereq SHA1 +then + skip_all='not using SHA-1 for objects' + test_done +fi + +cat >expect_initial <expect_update <<-EOF && - 100644 blob $(test_oid hash2) foo - EOF +cat >expect_update < foo && +test_expect_success 'setup' ' + echo 4827 > foo && git add foo && git commit -m "initial" && git cat-file -p HEAD: > actual && test_cmp expect_initial actual && - echo "$(test_oid val2)" > foo && + echo 11742 > foo && git commit -a -m "update" && git cat-file -p HEAD: > actual && test_cmp expect_update actual ' cat >expect <expected <<-EOF - :000000 100644 $ZERO_OID $blob A $expect + :000000 100644 0000000000000000000000000000000000000000 $blob A $expect EOF test_expect_success "--raw $*" " git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual && diff --git a/third_party/git/t/t4048-diff-combined-binary.sh b/third_party/git/t/t4048-diff-combined-binary.sh index 7f9ad9fa3d1f..87a8949500bb 100755 --- a/third_party/git/t/t4048-diff-combined-binary.sh +++ b/third_party/git/t/t4048-diff-combined-binary.sh @@ -9,27 +9,24 @@ test_expect_success 'setup binary merge conflict' ' git commit -m one && echo twoQ2 | q_to_nul >binary && git commit -a -m two && - two=$(git rev-parse --short HEAD:binary) && git checkout -b branch-binary HEAD^ && echo threeQ3 | q_to_nul >binary && git commit -a -m three && - three=$(git rev-parse --short HEAD:binary) && test_must_fail git merge master && echo resolvedQhooray | q_to_nul >binary && - git commit -a -m resolved && - res=$(git rev-parse --short HEAD:binary) + git commit -a -m resolved ' -cat >expect <expect <<'EOF' resolved diff --git a/binary b/binary -index $three..$res 100644 +index 7ea6ded..9563691 100644 Binary files a/binary and b/binary differ resolved diff --git a/binary b/binary -index $two..$res 100644 +index 6197570..9563691 100644 Binary files a/binary and b/binary differ EOF test_expect_success 'diff -m indicates binary-ness' ' @@ -37,11 +34,11 @@ test_expect_success 'diff -m indicates binary-ness' ' test_cmp expect actual ' -cat >expect <expect <<'EOF' resolved diff --combined binary -index $three,$two..$res +index 7ea6ded,6197570..9563691 Binary files differ EOF test_expect_success 'diff -c indicates binary-ness' ' @@ -49,11 +46,11 @@ test_expect_success 'diff -c indicates binary-ness' ' test_cmp expect actual ' -cat >expect <expect <<'EOF' resolved diff --cc binary -index $three,$two..$res +index 7ea6ded,6197570..9563691 Binary files differ EOF test_expect_success 'diff --cc indicates binary-ness' ' @@ -65,26 +62,23 @@ test_expect_success 'setup non-binary with binary attribute' ' git checkout master && test_commit one text && test_commit two text && - two=$(git rev-parse --short HEAD:text) && git checkout -b branch-text HEAD^ && test_commit three text && - three=$(git rev-parse --short HEAD:text) && test_must_fail git merge master && test_commit resolved text && - res=$(git rev-parse --short HEAD:text) && echo text -diff >.gitattributes ' -cat >expect <expect <<'EOF' resolved diff --git a/text b/text -index $three..$res 100644 +index 2bdf67a..2ab19ae 100644 Binary files a/text and b/text differ resolved diff --git a/text b/text -index $two..$res 100644 +index f719efd..2ab19ae 100644 Binary files a/text and b/text differ EOF test_expect_success 'diff -m respects binary attribute' ' @@ -92,11 +86,11 @@ test_expect_success 'diff -m respects binary attribute' ' test_cmp expect actual ' -cat >expect <expect <<'EOF' resolved diff --combined text -index $three,$two..$res +index 2bdf67a,f719efd..2ab19ae Binary files differ EOF test_expect_success 'diff -c respects binary attribute' ' @@ -104,11 +98,11 @@ test_expect_success 'diff -c respects binary attribute' ' test_cmp expect actual ' -cat >expect <expect <<'EOF' resolved diff --cc text -index $three,$two..$res +index 2bdf67a,f719efd..2ab19ae Binary files differ EOF test_expect_success 'diff --cc respects binary attribute' ' @@ -121,11 +115,11 @@ test_expect_success 'setup textconv attribute' ' git config diff.upcase.textconv "tr a-z A-Z <" ' -cat >expect <expect <<'EOF' resolved diff --git a/text b/text -index $three..$res 100644 +index 2bdf67a..2ab19ae 100644 --- a/text +++ b/text @@ -1 +1 @@ @@ -134,7 +128,7 @@ index $three..$res 100644 resolved diff --git a/text b/text -index $two..$res 100644 +index f719efd..2ab19ae 100644 --- a/text +++ b/text @@ -1 +1 @@ @@ -146,11 +140,11 @@ test_expect_success 'diff -m respects textconv attribute' ' test_cmp expect actual ' -cat >expect <expect <<'EOF' resolved diff --combined text -index $three,$two..$res +index 2bdf67a,f719efd..2ab19ae --- a/text +++ b/text @@@ -1,1 -1,1 +1,1 @@@ @@ -163,11 +157,11 @@ test_expect_success 'diff -c respects textconv attribute' ' test_cmp expect actual ' -cat >expect <expect <<'EOF' resolved diff --cc text -index $three,$two..$res +index 2bdf67a,f719efd..2ab19ae --- a/text +++ b/text @@@ -1,1 -1,1 +1,1 @@@ @@ -180,9 +174,9 @@ test_expect_success 'diff --cc respects textconv attribute' ' test_cmp expect actual ' -cat >expect <expect <<'EOF' diff --combined text -index $three,$two..$res +index 2bdf67a,f719efd..2ab19ae --- a/text +++ b/text @@@ -1,1 -1,1 +1,1 @@@ @@ -196,9 +190,9 @@ test_expect_success 'diff-tree plumbing does not respect textconv' ' test_cmp expect actual ' -cat >expect <expect <<'EOF' diff --cc text -index $three,$two..0000000 +index 2bdf67a,f719efd..0000000 --- a/text +++ b/text @@@ -1,1 -1,1 +1,5 @@@ diff --git a/third_party/git/t/t4054-diff-bogus-tree.sh b/third_party/git/t/t4054-diff-bogus-tree.sh index 8c95f152b23b..fcae82fffa7f 100755 --- a/third_party/git/t/t4054-diff-bogus-tree.sh +++ b/third_party/git/t/t4054-diff-bogus-tree.sh @@ -4,9 +4,8 @@ test_description='test diff with a bogus tree containing the null sha1' . ./test-lib.sh test_expect_success 'create bogus tree' ' - name=$(echo $ZERO_OID | sed -e "s/00/Q/g") && bogus_tree=$( - printf "100644 fooQ$name" | + printf "100644 fooQQQQQQQQQQQQQQQQQQQQQ" | q_to_nul | git hash-object -w --stdin -t tree ) diff --git a/third_party/git/t/t4057-diff-combined-paths.sh b/third_party/git/t/t4057-diff-combined-paths.sh index 4f4b541658a1..dff36b77ec88 100755 --- a/third_party/git/t/t4057-diff-combined-paths.sh +++ b/third_party/git/t/t4057-diff-combined-paths.sh @@ -33,7 +33,7 @@ test_expect_success 'trivial merge - combine-diff empty' ' ' -test_expect_success 'only one truly conflicting path' ' +test_expect_success 'only one trully conflicting path' ' git checkout side && for i in $(test_seq 2 9) do diff --git a/third_party/git/t/t4060-diff-submodule-option-diff-format.sh b/third_party/git/t/t4060-diff-submodule-option-diff-format.sh index fc8229c7260b..9dcb69df5c36 100755 --- a/third_party/git/t/t4060-diff-submodule-option-diff-format.sh +++ b/third_party/git/t/t4060-diff-submodule-option-diff-format.sh @@ -42,17 +42,6 @@ commit_file () { git commit "$@" -m "Commit $*" >/dev/null } -diff_cmp () { - for i in "$1" "$2" - do - sed -e 's/^index 0000000\.\.[0-9a-f]*/index 0000000..1234567/' \ - -e 's/^index [0-9a-f]*\.\.[0-9a-f]*/index 1234567..89abcde/' \ - "$i" >"$i.compare" || return 1 - done && - test_cmp "$1.compare" "$2.compare" && - rm -f "$1.compare" "$2.compare" -} - test_expect_success 'setup repository' ' test_create_repo sm1 && add_file . foo && @@ -80,7 +69,7 @@ test_expect_success 'added submodule' ' @@ -0,0 +1 @@ +foo2 EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'added submodule, set diff.submodule' ' @@ -104,7 +93,7 @@ test_expect_success 'added submodule, set diff.submodule' ' @@ -0,0 +1 @@ +foo2 EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success '--submodule=short overrides diff.submodule' ' @@ -120,7 +109,7 @@ test_expect_success '--submodule=short overrides diff.submodule' ' @@ -0,0 +1 @@ +Subproject commit $fullhead1 EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'diff.submodule does not affect plumbing' ' @@ -135,7 +124,7 @@ test_expect_success 'diff.submodule does not affect plumbing' ' @@ -0,0 +1 @@ +Subproject commit $fullhead1 EOF - diff_cmp expected actual + test_cmp expected actual ' commit_file sm1 && @@ -153,7 +142,7 @@ test_expect_success 'modified submodule(forward)' ' @@ -0,0 +1 @@ +foo3 EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'modified submodule(forward)' ' @@ -168,7 +157,7 @@ test_expect_success 'modified submodule(forward)' ' @@ -0,0 +1 @@ +foo3 EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'modified submodule(forward) --submodule' ' @@ -177,7 +166,7 @@ test_expect_success 'modified submodule(forward) --submodule' ' Submodule sm1 $head1..$head2: > Add foo3 ($added foo3) EOF - diff_cmp expected actual + test_cmp expected actual ' fullhead2=$(cd sm1; git rev-parse --verify HEAD) @@ -192,7 +181,7 @@ test_expect_success 'modified submodule(forward) --submodule=short' ' -Subproject commit $fullhead1 +Subproject commit $fullhead2 EOF - diff_cmp expected actual + test_cmp expected actual ' commit_file sm1 && @@ -221,7 +210,7 @@ test_expect_success 'modified submodule(backward)' ' @@ -1 +0,0 @@ -foo3 EOF - diff_cmp expected actual + test_cmp expected actual ' head4=$(add_file sm1 foo4 foo5) @@ -258,7 +247,7 @@ test_expect_success 'modified submodule(backward and forward)' ' @@ -0,0 +1 @@ +foo5 EOF - diff_cmp expected actual + test_cmp expected actual ' commit_file sm1 && @@ -302,7 +291,7 @@ test_expect_success 'typechanged submodule(submodule->blob), --cached' ' @@ -0,0 +1 @@ +sm1 EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'typechanged submodule(submodule->blob)' ' @@ -338,7 +327,7 @@ test_expect_success 'typechanged submodule(submodule->blob)' ' @@ -0,0 +1 @@ +foo5 EOF - diff_cmp expected actual + test_cmp expected actual ' rm -rf sm1 && @@ -355,7 +344,7 @@ test_expect_success 'typechanged submodule(submodule->blob)' ' @@ -0,0 +1 @@ +sm1 EOF - diff_cmp expected actual + test_cmp expected actual ' rm -f sm1 && @@ -367,7 +356,7 @@ test_expect_success 'nonexistent commit' ' cat >expected <<-EOF && Submodule sm1 $head4...$head6 (commits not present) EOF - diff_cmp expected actual + test_cmp expected actual ' commit_file @@ -397,12 +386,11 @@ test_expect_success 'typechanged submodule(blob->submodule)' ' @@ -0,0 +1 @@ +foo7 EOF - diff_cmp expected actual + test_cmp expected actual ' commit_file sm1 && test_expect_success 'submodule is up to date' ' - head7=$(git -C sm1 rev-parse --short --verify HEAD) && git diff-index -p --submodule=diff HEAD >actual && test_must_be_empty actual ' @@ -413,7 +401,7 @@ test_expect_success 'submodule contains untracked content' ' cat >expected <<-EOF && Submodule sm1 contains untracked content EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'submodule contains untracked content (untracked ignored)' ' @@ -445,7 +433,7 @@ test_expect_success 'submodule contains untracked and modified content' ' -foo6 +new EOF - diff_cmp expected actual + test_cmp expected actual ' # NOT OK @@ -462,7 +450,7 @@ test_expect_success 'submodule contains untracked and modified content (untracke -foo6 +new EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'submodule contains untracked and modified content (dirty ignored)' ' @@ -490,7 +478,7 @@ test_expect_success 'submodule contains modified content' ' -foo6 +new EOF - diff_cmp expected actual + test_cmp expected actual ' (cd sm1; git commit -mchange foo6 >/dev/null) && @@ -498,7 +486,7 @@ head8=$(cd sm1; git rev-parse --short --verify HEAD) && test_expect_success 'submodule is modified' ' git diff-index -p --submodule=diff HEAD >actual && cat >expected <<-EOF && - Submodule sm1 $head7..$head8: + Submodule sm1 17243c9..$head8: diff --git a/sm1/foo6 b/sm1/foo6 index 462398b..3e75765 100644 --- a/sm1/foo6 @@ -507,7 +495,7 @@ test_expect_success 'submodule is modified' ' -foo6 +new EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'modified submodule contains untracked content' ' @@ -515,7 +503,7 @@ test_expect_success 'modified submodule contains untracked content' ' git diff-index -p --submodule=diff HEAD >actual && cat >expected <<-EOF && Submodule sm1 contains untracked content - Submodule sm1 $head7..$head8: + Submodule sm1 17243c9..$head8: diff --git a/sm1/foo6 b/sm1/foo6 index 462398b..3e75765 100644 --- a/sm1/foo6 @@ -524,13 +512,13 @@ test_expect_success 'modified submodule contains untracked content' ' -foo6 +new EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'modified submodule contains untracked content (untracked ignored)' ' git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual && cat >expected <<-EOF && - Submodule sm1 $head7..$head8: + Submodule sm1 17243c9..$head8: diff --git a/sm1/foo6 b/sm1/foo6 index 462398b..3e75765 100644 --- a/sm1/foo6 @@ -539,13 +527,13 @@ test_expect_success 'modified submodule contains untracked content (untracked ig -foo6 +new EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'modified submodule contains untracked content (dirty ignored)' ' git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual && cat >expected <<-EOF && - Submodule sm1 $head7..$head8: + Submodule sm1 17243c9..cfce562: diff --git a/sm1/foo6 b/sm1/foo6 index 462398b..3e75765 100644 --- a/sm1/foo6 @@ -554,7 +542,7 @@ test_expect_success 'modified submodule contains untracked content (dirty ignore -foo6 +new EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'modified submodule contains untracked content (all ignored)' ' @@ -568,7 +556,7 @@ test_expect_success 'modified submodule contains untracked and modified content' cat >expected <<-EOF && Submodule sm1 contains untracked content Submodule sm1 contains modified content - Submodule sm1 $head7..$head8: + Submodule sm1 17243c9..cfce562: diff --git a/sm1/foo6 b/sm1/foo6 index 462398b..dfda541 100644 --- a/sm1/foo6 @@ -578,7 +566,7 @@ test_expect_success 'modified submodule contains untracked and modified content' +new +modification EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'modified submodule contains untracked and modified content (untracked ignored)' ' @@ -586,7 +574,7 @@ test_expect_success 'modified submodule contains untracked and modified content git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual && cat >expected <<-EOF && Submodule sm1 contains modified content - Submodule sm1 $head7..$head8: + Submodule sm1 17243c9..cfce562: diff --git a/sm1/foo6 b/sm1/foo6 index 462398b..e20e2d9 100644 --- a/sm1/foo6 @@ -597,14 +585,14 @@ test_expect_success 'modified submodule contains untracked and modified content +modification +modification EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'modified submodule contains untracked and modified content (dirty ignored)' ' echo modification >> sm1/foo6 && git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual && cat >expected <<-EOF && - Submodule sm1 $head7..$head8: + Submodule sm1 17243c9..cfce562: diff --git a/sm1/foo6 b/sm1/foo6 index 462398b..3e75765 100644 --- a/sm1/foo6 @@ -613,7 +601,7 @@ test_expect_success 'modified submodule contains untracked and modified content -foo6 +new EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'modified submodule contains untracked and modified content (all ignored)' ' @@ -628,7 +616,7 @@ test_expect_success 'modified submodule contains modified content' ' git diff-index -p --submodule=diff HEAD >actual && cat >expected <<-EOF && Submodule sm1 contains modified content - Submodule sm1 $head7..$head8: + Submodule sm1 17243c9..cfce562: diff --git a/sm1/foo6 b/sm1/foo6 index 462398b..ac466ca 100644 --- a/sm1/foo6 @@ -641,29 +629,29 @@ test_expect_success 'modified submodule contains modified content' ' +modification +modification EOF - diff_cmp expected actual + test_cmp expected actual ' rm -rf sm1 test_expect_success 'deleted submodule' ' git diff-index -p --submodule=diff HEAD >actual && cat >expected <<-EOF && - Submodule sm1 $head7...0000000 (submodule deleted) + Submodule sm1 17243c9...0000000 (submodule deleted) EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'create second submodule' ' test_create_repo sm2 && - head9=$(add_file sm2 foo8 foo9) && + head7=$(add_file sm2 foo8 foo9) && git add sm2 ' test_expect_success 'multiple submodules' ' git diff-index -p --submodule=diff HEAD >actual && cat >expected <<-EOF && - Submodule sm1 $head7...0000000 (submodule deleted) - Submodule sm2 0000000...$head9 (new submodule) + Submodule sm1 17243c9...0000000 (submodule deleted) + Submodule sm2 0000000...a5a65c9 (new submodule) diff --git a/sm2/foo8 b/sm2/foo8 new file mode 100644 index 0000000..db9916b @@ -679,13 +667,13 @@ test_expect_success 'multiple submodules' ' @@ -0,0 +1 @@ +foo9 EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'path filter' ' git diff-index -p --submodule=diff HEAD sm2 >actual && cat >expected <<-EOF && - Submodule sm2 0000000...$head9 (new submodule) + Submodule sm2 0000000...a5a65c9 (new submodule) diff --git a/sm2/foo8 b/sm2/foo8 new file mode 100644 index 0000000..db9916b @@ -701,15 +689,15 @@ test_expect_success 'path filter' ' @@ -0,0 +1 @@ +foo9 EOF - diff_cmp expected actual + test_cmp expected actual ' commit_file sm2 test_expect_success 'given commit' ' git diff-index -p --submodule=diff HEAD^ >actual && cat >expected <<-EOF && - Submodule sm1 $head7...0000000 (submodule deleted) - Submodule sm2 0000000...$head9 (new submodule) + Submodule sm1 17243c9...0000000 (submodule deleted) + Submodule sm2 0000000...a5a65c9 (new submodule) diff --git a/sm2/foo8 b/sm2/foo8 new file mode 100644 index 0000000..db9916b @@ -725,7 +713,7 @@ test_expect_success 'given commit' ' @@ -0,0 +1 @@ +foo9 EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'setup .git file for sm2' ' @@ -738,8 +726,8 @@ test_expect_success 'setup .git file for sm2' ' test_expect_success 'diff --submodule=diff with .git file' ' git diff --submodule=diff HEAD^ >actual && cat >expected <<-EOF && - Submodule sm1 $head7...0000000 (submodule deleted) - Submodule sm2 0000000...$head9 (new submodule) + Submodule sm1 17243c9...0000000 (submodule deleted) + Submodule sm2 0000000...a5a65c9 (new submodule) diff --git a/sm2/foo8 b/sm2/foo8 new file mode 100644 index 0000000..db9916b @@ -755,27 +743,25 @@ test_expect_success 'diff --submodule=diff with .git file' ' @@ -0,0 +1 @@ +foo9 EOF - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'setup nested submodule' ' git submodule add -f ./sm2 && git commit -a -m "add sm2" && git -C sm2 submodule add ../sm2 nested && - git -C sm2 commit -a -m "nested sub" && - head10=$(git -C sm2 rev-parse --short --verify HEAD) + git -C sm2 commit -a -m "nested sub" ' test_expect_success 'move nested submodule HEAD' ' echo "nested content" >sm2/nested/file && git -C sm2/nested add file && - git -C sm2/nested commit --allow-empty -m "new HEAD" && - head11=$(git -C sm2/nested rev-parse --short --verify HEAD) + git -C sm2/nested commit --allow-empty -m "new HEAD" ' test_expect_success 'diff --submodule=diff with moved nested submodule HEAD' ' cat >expected <<-EOF && - Submodule nested $head9..$head11: + Submodule nested a5a65c9..b55928c: diff --git a/nested/file b/nested/file new file mode 100644 index 0000000..ca281f5 @@ -786,13 +772,13 @@ test_expect_success 'diff --submodule=diff with moved nested submodule HEAD' ' EOF git -C sm2 diff --submodule=diff >actual 2>err && test_must_be_empty err && - diff_cmp expected actual + test_cmp expected actual ' test_expect_success 'diff --submodule=diff recurses into nested submodules' ' cat >expected <<-EOF && Submodule sm2 contains modified content - Submodule sm2 $head9..$head10: + Submodule sm2 a5a65c9..280969a: diff --git a/sm2/.gitmodules b/sm2/.gitmodules new file mode 100644 index 0000000..3a816b8 @@ -802,7 +788,7 @@ test_expect_success 'diff --submodule=diff recurses into nested submodules' ' +[submodule "nested"] + path = nested + url = ../sm2 - Submodule nested 0000000...$head11 (new submodule) + Submodule nested 0000000...b55928c (new submodule) diff --git a/sm2/nested/file b/sm2/nested/file new file mode 100644 index 0000000..ca281f5 @@ -827,7 +813,7 @@ test_expect_success 'diff --submodule=diff recurses into nested submodules' ' EOF git diff --submodule=diff >actual 2>err && test_must_be_empty err && - diff_cmp expected actual + test_cmp expected actual ' test_done diff --git a/third_party/git/t/t4066-diff-emit-delay.sh b/third_party/git/t/t4066-diff-emit-delay.sh index 6331f63b127c..5df6b5e64e0e 100755 --- a/third_party/git/t/t4066-diff-emit-delay.sh +++ b/third_party/git/t/t4066-diff-emit-delay.sh @@ -18,7 +18,7 @@ test_expect_success 'set up history with a merge' ' ' test_expect_success 'log --cc -p --stat --color-moved' ' - cat >expect <<-EOF && + cat >expect <<-\EOF && commit D --- D.t | 1 + @@ -26,7 +26,7 @@ test_expect_success 'log --cc -p --stat --color-moved' ' diff --git a/D.t b/D.t new file mode 100644 - index 0000000..$(git rev-parse --short D:D.t) + index 0000000..1784810 --- /dev/null +++ b/D.t @@ -0,0 +1 @@ @@ -42,7 +42,7 @@ test_expect_success 'log --cc -p --stat --color-moved' ' diff --git a/C.t b/C.t new file mode 100644 - index 0000000..$(git rev-parse --short C:C.t) + index 0000000..3cc58df --- /dev/null +++ b/C.t @@ -0,0 +1 @@ @@ -54,7 +54,7 @@ test_expect_success 'log --cc -p --stat --color-moved' ' diff --git a/B.t b/B.t new file mode 100644 - index 0000000..$(git rev-parse --short B:B.t) + index 0000000..223b783 --- /dev/null +++ b/B.t @@ -0,0 +1 @@ @@ -66,7 +66,7 @@ test_expect_success 'log --cc -p --stat --color-moved' ' diff --git a/A.t b/A.t new file mode 100644 - index 0000000..$(git rev-parse --short A:A.t) + index 0000000..f70f10e --- /dev/null +++ b/A.t @@ -0,0 +1 @@ diff --git a/third_party/git/t/t4067-diff-partial-clone.sh b/third_party/git/t/t4067-diff-partial-clone.sh index 4831ad35e614..90c8fb290175 100755 --- a/third_party/git/t/t4067-diff-partial-clone.sh +++ b/third_party/git/t/t4067-diff-partial-clone.sh @@ -75,37 +75,6 @@ test_expect_success 'diff skips same-OID blobs' ' ! grep "want $(cat hash-b)" trace ' -test_expect_success 'when fetching missing objects, diff skips GITLINKs' ' - test_when_finished "rm -rf sub server client trace" && - - test_create_repo sub && - test_commit -C sub first && - - test_create_repo server && - echo a >server/a && - git -C server add a && - git -C server submodule add "file://$(pwd)/sub" && - git -C server commit -m x && - - test_commit -C server/sub second && - echo another-a >server/a && - git -C server add a sub && - git -C server commit -m x && - - test_config -C server uploadpack.allowfilter 1 && - test_config -C server uploadpack.allowanysha1inwant 1 && - git clone --bare --filter=blob:limit=0 "file://$(pwd)/server" client && - - echo a | git hash-object --stdin >hash-old-a && - echo another-a | git hash-object --stdin >hash-new-a && - - # Ensure that a and another-a are fetched, and check (by successful - # execution of the diff) that no invalid OIDs are sent. - GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff HEAD^ HEAD && - grep "want $(cat hash-old-a)" trace && - grep "want $(cat hash-new-a)" trace -' - test_expect_success 'diff with rename detection batches blobs' ' test_when_finished "rm -rf server client trace" && diff --git a/third_party/git/t/t4100/t-apply-1.patch b/third_party/git/t/t4100/t-apply-1.patch index 43394f828561..90ab54f0f586 100644 --- a/third_party/git/t/t4100/t-apply-1.patch +++ b/third_party/git/t/t4100/t-apply-1.patch @@ -75,8 +75,8 @@ diff --git a/Documentation/git.txt b/Documentation/git.txt +link:git-ssh-pull.html[git-ssh-pull]:: Pulls from a remote repository over ssh connection - Interrogators: -@@ -156,8 +156,8 @@ Interrogators: + Interogators: +@@ -156,8 +156,8 @@ Interogators: link:git-diff-helper.html[git-diff-helper]:: Generates patch format output for git-diff-* diff --git a/third_party/git/t/t4100/t-apply-3.patch b/third_party/git/t/t4100/t-apply-3.patch index cac172e7791d..90cdbaa5bb62 100644 --- a/third_party/git/t/t4100/t-apply-3.patch +++ b/third_party/git/t/t4100/t-apply-3.patch @@ -211,7 +211,7 @@ dissimilarity index 82% - - /* If this is an exact directory match, we may have - * directory files following this path. Match on them. -- * Otherwise, we're at a patch subcomponent, and we need +- * Otherwise, we're at a pach subcomponent, and we need - * to try to match again. - */ - if (mtype == 0) diff --git a/third_party/git/t/t4100/t-apply-5.patch b/third_party/git/t/t4100/t-apply-5.patch index 57ec79d8879a..5f6ddc105950 100644 --- a/third_party/git/t/t4100/t-apply-5.patch +++ b/third_party/git/t/t4100/t-apply-5.patch @@ -185,8 +185,8 @@ diff a/Documentation/git.txt b/Documentation/git.txt +link:git-ssh-pull.html[git-ssh-pull]:: Pulls from a remote repository over ssh connection - Interrogators: -@@ -156,8 +156,8 @@ Interrogators: + Interogators: +@@ -156,8 +156,8 @@ Interogators: link:git-diff-helper.html[git-diff-helper]:: Generates patch format output for git-diff-* diff --git a/third_party/git/t/t4100/t-apply-7.patch b/third_party/git/t/t4100/t-apply-7.patch index fa2430510864..07c6589e74fa 100644 --- a/third_party/git/t/t4100/t-apply-7.patch +++ b/third_party/git/t/t4100/t-apply-7.patch @@ -335,7 +335,7 @@ diff a/ls-tree.c b/ls-tree.c - /* If this is an exact directory match, we may have - * directory files following this path. Match on them. -- * Otherwise, we're at a patch subcomponent, and we need +- * Otherwise, we're at a pach subcomponent, and we need - * to try to match again. + if (e->directory) { + /* If this is a directory, we have the following cases: diff --git a/third_party/git/t/t4108-apply-threeway.sh b/third_party/git/t/t4108-apply-threeway.sh index d7349ced6be0..fa5d4efb89dc 100755 --- a/third_party/git/t/t4108-apply-threeway.sh +++ b/third_party/git/t/t4108-apply-threeway.sh @@ -4,17 +4,23 @@ test_description='git apply --3way' . ./test-lib.sh -print_sanitized_conflicted_diff () { - git diff HEAD >diff.raw && +create_file () { + for i + do + echo "$i" + done +} + +sanitize_conflicted_diff () { sed -e ' /^index /d - s/^\(+[<>|][<>|][<>|][<>|]*\) .*/\1/ - ' diff.raw + s/^\(+[<>][<>][<>][<>]*\) .*/\1/ + ' } test_expect_success setup ' test_tick && - test_write_lines 1 2 3 4 5 6 7 >one && + create_file >one 1 2 3 4 5 6 7 && cat one >two && git add one two && git commit -m initial && @@ -22,13 +28,13 @@ test_expect_success setup ' git branch side && test_tick && - test_write_lines 1 two 3 4 5 six 7 >one && - test_write_lines 1 two 3 4 5 6 7 >two && + create_file >one 1 two 3 4 5 six 7 && + create_file >two 1 two 3 4 5 6 7 && git commit -a -m master && git checkout side && - test_write_lines 1 2 3 4 five 6 7 >one && - test_write_lines 1 2 3 4 five 6 7 >two && + create_file >one 1 2 3 4 five 6 7 && + create_file >two 1 2 3 4 five 6 7 && git commit -a -m side && git checkout master @@ -46,7 +52,7 @@ test_expect_success 'apply without --3way' ' git diff-index --exit-code --cached HEAD ' -test_apply_with_3way () { +test_expect_success 'apply with --3way' ' # Merging side should be similar to applying this patch git diff ...side >P.diff && @@ -55,31 +61,22 @@ test_apply_with_3way () { git checkout master^0 && test_must_fail git merge --no-commit side && git ls-files -s >expect.ls && - print_sanitized_conflicted_diff >expect.diff && + git diff HEAD | sanitize_conflicted_diff >expect.diff && # should fail to apply git reset --hard && git checkout master^0 && test_must_fail git apply --index --3way P.diff && git ls-files -s >actual.ls && - print_sanitized_conflicted_diff >actual.diff && + git diff HEAD | sanitize_conflicted_diff >actual.diff && # The result should resemble the corresponding merge test_cmp expect.ls actual.ls && test_cmp expect.diff actual.diff -} - -test_expect_success 'apply with --3way' ' - test_apply_with_3way -' - -test_expect_success 'apply with --3way with merge.conflictStyle = diff3' ' - test_config merge.conflictStyle diff3 && - test_apply_with_3way ' test_expect_success 'apply with --3way with rerere enabled' ' - test_config rerere.enabled true && + git config rerere.enabled true && # Merging side should be similar to applying this patch git diff ...side >P.diff && @@ -90,7 +87,7 @@ test_expect_success 'apply with --3way with rerere enabled' ' test_must_fail git merge --no-commit side && # Manually resolve and record the resolution - test_write_lines 1 two 3 4 five six 7 >one && + create_file 1 two 3 4 five six 7 >one && git rerere && cat one >expect && @@ -107,14 +104,14 @@ test_expect_success 'apply -3 with add/add conflict setup' ' git reset --hard && git checkout -b adder && - test_write_lines 1 2 3 4 5 6 7 >three && - test_write_lines 1 2 3 4 5 6 7 >four && + create_file 1 2 3 4 5 6 7 >three && + create_file 1 2 3 4 5 6 7 >four && git add three four && git commit -m "add three and four" && git checkout -b another adder^ && - test_write_lines 1 2 3 4 5 6 7 >three && - test_write_lines 1 2 3 four 5 6 7 >four && + create_file 1 2 3 4 5 6 7 >three && + create_file 1 2 3 four 5 6 7 >four && git add three four && git commit -m "add three and four" && @@ -124,7 +121,7 @@ test_expect_success 'apply -3 with add/add conflict setup' ' git checkout adder^0 && test_must_fail git merge --no-commit another && git ls-files -s >expect.ls && - print_sanitized_conflicted_diff >expect.diff + git diff HEAD | sanitize_conflicted_diff >expect.diff ' test_expect_success 'apply -3 with add/add conflict' ' @@ -134,7 +131,7 @@ test_expect_success 'apply -3 with add/add conflict' ' test_must_fail git apply --index --3way P.diff && # ... and leave conflicts in the index and in the working tree git ls-files -s >actual.ls && - print_sanitized_conflicted_diff >actual.diff && + git diff HEAD | sanitize_conflicted_diff >actual.diff && # The result should resemble the corresponding merge test_cmp expect.ls actual.ls && diff --git a/third_party/git/t/t4117-apply-reject.sh b/third_party/git/t/t4117-apply-reject.sh index 0ee93fe845af..f7de6f077a6e 100755 --- a/third_party/git/t/t4117-apply-reject.sh +++ b/third_party/git/t/t4117-apply-reject.sh @@ -74,7 +74,7 @@ test_expect_success 'apply with --reject should fail but update the file' ' test_must_fail git apply --reject patch.1 && test_cmp expected file1 && - test_path_is_file file1.rej && + cat file1.rej && test_path_is_missing file2.rej ' @@ -87,7 +87,7 @@ test_expect_success 'apply with --reject should fail but update the file' ' test_path_is_missing file1 && test_cmp expected file2 && - test_path_is_file file2.rej && + cat file2.rej && test_path_is_missing file1.rej ' @@ -101,7 +101,7 @@ test_expect_success 'the same test with --verbose' ' test_path_is_missing file1 && test_cmp expected file2 && - test_path_is_file file2.rej && + cat file2.rej && test_path_is_missing file1.rej ' diff --git a/third_party/git/t/t4124-apply-ws-rule.sh b/third_party/git/t/t4124-apply-ws-rule.sh index 971a5a7512ac..ff51e9e78914 100755 --- a/third_party/git/t/t4124-apply-ws-rule.sh +++ b/third_party/git/t/t4124-apply-ws-rule.sh @@ -35,15 +35,9 @@ prepare_test_file () { } apply_patch () { - cmd_prefix= && - if test "x$1" = 'x!' - then - cmd_prefix=test_must_fail && - shift - fi && >target && sed -e "s|\([ab]\)/file|\1/target|" create-sm.patch < remove-sm.patch <after && printf "%64s\n" a b c >>after && printf "\t%s\n" 4 5 6 >>after && - test_expect_code 1 git diff --no-index before after >patch1.patch.raw && - sed -e "s/before/test-1/" -e "s/after/test-1/" patch1.patch.raw >patch1.patch && + git diff --no-index before after | + sed -e "s/before/test-1/" -e "s/after/test-1/" >patch1.patch && printf "%64s\n" 1 2 3 4 5 6 >test-1 && printf "%64s\n" 1 2 3 a b c 4 5 6 >expect-1 && @@ -33,8 +33,8 @@ test_expect_success setup ' x=$(( $x + 1 )) done && printf "\t%s\n" d e f >>after && - test_expect_code 1 git diff --no-index before after >patch2.patch.raw && - sed -e "s/before/test-2/" -e "s/after/test-2/" patch2.patch.raw >patch2.patch && + git diff --no-index before after | + sed -e "s/before/test-2/" -e "s/after/test-2/" >patch2.patch && printf "%64s\n" a b c d e f >test-2 && printf "%64s\n" a b c >expect-2 && x=1 && @@ -56,8 +56,8 @@ test_expect_success setup ' x=$(( $x + 1 )) done && printf "\t%s\n" d e f >>after && - test_expect_code 1 git diff --no-index before after >patch3.patch.raw && - sed -e "s/before/test-3/" -e "s/after/test-3/" patch3.patch.raw >patch3.patch && + git diff --no-index before after | + sed -e "s/before/test-3/" -e "s/after/test-3/" >patch3.patch && printf "%64s\n" a b c d e f >test-3 && printf "%64s\n" a b c >expect-3 && x=0 && @@ -84,8 +84,8 @@ test_expect_success setup ' printf "\t%02d\n" $x >>after x=$(( $x + 1 )) done && - test_expect_code 1 git diff --no-index before after >patch4.patch.raw && - sed -e "s/before/test-4/" -e "s/after/test-4/" patch4.patch.raw >patch4.patch && + git diff --no-index before after | + sed -e "s/before/test-4/" -e "s/after/test-4/" >patch4.patch && >test-4 && x=0 && while test $x -lt 50 diff --git a/third_party/git/t/t4150-am.sh b/third_party/git/t/t4150-am.sh index cb4527145726..3f7f750cc8d7 100755 --- a/third_party/git/t/t4150-am.sh +++ b/third_party/git/t/t4150-am.sh @@ -666,26 +666,6 @@ test_expect_success 'am --show-current-patch' ' test_cmp .git/rebase-apply/0001 actual.patch ' -test_expect_success 'am --show-current-patch=raw' ' - git am --show-current-patch=raw >actual.patch && - test_cmp .git/rebase-apply/0001 actual.patch -' - -test_expect_success 'am --show-current-patch=diff' ' - git am --show-current-patch=diff >actual.patch && - test_cmp .git/rebase-apply/patch actual.patch -' - -test_expect_success 'am accepts repeated --show-current-patch' ' - git am --show-current-patch --show-current-patch=raw >actual.patch && - test_cmp .git/rebase-apply/0001 actual.patch -' - -test_expect_success 'am detects incompatible --show-current-patch' ' - test_must_fail git am --show-current-patch=raw --show-current-patch=diff && - test_must_fail git am --show-current-patch --show-current-patch=diff -' - test_expect_success 'am --skip works' ' echo goodbye >expected && git am --skip && @@ -1081,56 +1061,4 @@ test_expect_success 'am --quit keeps HEAD where it is' ' test_cmp expected actual ' -test_expect_success 'am and .gitattibutes' ' - test_create_repo attributes && - ( - cd attributes && - test_commit init && - git config filter.test.clean "sed -e '\''s/smudged/clean/g'\''" && - git config filter.test.smudge "sed -e '\''s/clean/smudged/g'\''" && - - test_commit second && - git checkout -b test HEAD^ && - - echo "*.txt filter=test conflict-marker-size=10" >.gitattributes && - git add .gitattributes && - test_commit third && - - echo "This text is smudged." >a.txt && - git add a.txt && - test_commit fourth && - - git checkout -b removal HEAD^ && - git rm .gitattributes && - git add -u && - test_commit fifth && - git cherry-pick test && - - git checkout -b conflict third && - echo "This text is different." >a.txt && - git add a.txt && - test_commit sixth && - - git checkout test && - git format-patch --stdout master..HEAD >patches && - git reset --hard master && - git am patches && - grep "smudged" a.txt && - - git checkout removal && - git reset --hard && - git format-patch --stdout master..HEAD >patches && - git reset --hard master && - git am patches && - grep "clean" a.txt && - - git checkout conflict && - git reset --hard && - git format-patch --stdout master..HEAD >patches && - git reset --hard fourth && - test_must_fail git am -3 patches && - grep "<<<<<<<<<<" a.txt - ) -' - test_done diff --git a/third_party/git/t/t4200-rerere.sh b/third_party/git/t/t4200-rerere.sh index 831d424c4720..55b7750ade1c 100755 --- a/third_party/git/t/t4200-rerere.sh +++ b/third_party/git/t/t4200-rerere.sh @@ -25,7 +25,6 @@ test_description='git rerere . ./test-lib.sh test_expect_success 'setup' ' - test_oid_init && cat >a1 <<-\EOF && Some title ========== @@ -211,7 +210,7 @@ test_expect_success 'set up for garbage collection tests' ' echo Hello >$rr/preimage && echo World >$rr/postimage && - sha2=$(test_oid deadbeef) && + sha2=4000000000000000000000000000000000000000 && rr2=.git/rr-cache/$sha2 && mkdir $rr2 && echo Hello >$rr2/preimage && 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 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 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 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 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 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 <actual && + test_cmp expect actual ' cat > expect < expect <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 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 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.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.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 diff --git a/third_party/git/t/t4203-mailmap.sh b/third_party/git/t/t4203-mailmap.sh index 586c3a86b1d2..918ada69eb96 100755 --- a/third_party/git/t/t4203-mailmap.sh +++ b/third_party/git/t/t4203-mailmap.sh @@ -13,8 +13,8 @@ fuzz_blame () { } test_expect_success setup ' - cat >contacts <<- EOF && - $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> + cat >contacts <<-\EOF && + A U Thor nick1 EOF @@ -33,19 +33,19 @@ test_expect_success 'check-mailmap no arguments' ' ' test_expect_success 'check-mailmap arguments' ' - cat >expect <<- EOF && - $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> + cat >expect <<-\EOF && + A U Thor nick1 EOF git check-mailmap \ - "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>" \ + "A U Thor " \ "nick1 " >actual && test_cmp expect actual ' test_expect_success 'check-mailmap --stdin' ' - cat >expect <<- EOF && - $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> + cat >expect <<-\EOF && + A U Thor nick1 EOF git check-mailmap --stdin actual && @@ -66,8 +66,8 @@ test_expect_success 'check-mailmap bogus contact' ' test_must_fail git check-mailmap bogus ' -cat >expect << EOF -$GIT_AUTHOR_NAME (1): +cat >expect <<\EOF +A U Thor (1): initial nick1 (1): @@ -90,7 +90,7 @@ nick1 (1): EOF test_expect_success 'default .mailmap' ' - echo "Repo Guy <$GIT_AUTHOR_EMAIL>" > .mailmap && + echo "Repo Guy " > .mailmap && git shortlog HEAD >actual && test_cmp expect actual ' @@ -122,7 +122,7 @@ Internal Guy (1): EOF test_expect_success 'mailmap.file override' ' - echo "External Guy <$GIT_AUTHOR_EMAIL>" >> internal_mailmap/.mailmap && + echo "External Guy " >> internal_mailmap/.mailmap && git config mailmap.file internal_mailmap/.mailmap && git shortlog HEAD >actual && test_cmp expect actual @@ -178,8 +178,8 @@ test_expect_success 'name entry after email entry, case-insensitive' ' test_cmp expect actual ' -cat >expect << EOF -$GIT_AUTHOR_NAME (1): +cat >expect <<\EOF +A U Thor (1): initial nick1 (1): @@ -195,18 +195,18 @@ test_expect_success 'No mailmap files, but configured' ' test_expect_success 'setup mailmap blob tests' ' git checkout -b map && test_when_finished "git checkout master" && - cat >just-bugs <<- EOF && + cat >just-bugs <<-\EOF && Blob Guy EOF - cat >both <<- EOF && - Blob Guy <$GIT_AUTHOR_EMAIL> + cat >both <<-\EOF && + Blob Guy Blob Guy EOF - printf "Tricky Guy <$GIT_AUTHOR_EMAIL>" >no-newline && + printf "Tricky Guy " >no-newline && git add just-bugs both no-newline && git commit -m "my mailmaps" && - echo "Repo Guy <$GIT_AUTHOR_EMAIL>" >.mailmap && - echo "Internal Guy <$GIT_AUTHOR_EMAIL>" >internal.map + echo "Repo Guy " >.mailmap && + echo "Internal Guy " >internal.map ' test_expect_success 'mailmap.blob set' ' @@ -266,12 +266,12 @@ test_expect_success 'mailmap.blob defaults to off in non-bare repo' ' git init non-bare && ( cd non-bare && - test_commit one .mailmap "Fake Name <$GIT_AUTHOR_EMAIL>" && + test_commit one .mailmap "Fake Name " && echo " 1 Fake Name" >expect && git shortlog -ns HEAD >actual && test_cmp expect actual && rm .mailmap && - echo " 1 $GIT_AUTHOR_NAME" >expect && + echo " 1 A U Thor" >expect && git shortlog -ns HEAD >actual && test_cmp expect actual ) @@ -305,26 +305,26 @@ test_expect_success 'cleanup after mailmap.blob tests' ' ' test_expect_success 'single-character name' ' - echo " 1 A <$GIT_AUTHOR_EMAIL>" >expect && + echo " 1 A " >expect && echo " 1 nick1 " >>expect && - echo "A <$GIT_AUTHOR_EMAIL>" >.mailmap && + echo "A " >.mailmap && test_when_finished "rm .mailmap" && git shortlog -es HEAD >actual && test_cmp expect actual ' test_expect_success 'preserve canonical email case' ' - echo " 1 $GIT_AUTHOR_NAME " >expect && + echo " 1 A U Thor " >expect && echo " 1 nick1 " >>expect && - echo " <$GIT_AUTHOR_EMAIL>" >.mailmap && + echo " " >.mailmap && test_when_finished "rm .mailmap" && git shortlog -es HEAD >actual && test_cmp expect actual ' # Extended mailmap configurations should give us the following output for shortlog -cat >expect << EOF -$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> (1): +cat >expect <<\EOF +A U Thor (1): initial CTO (1): @@ -370,7 +370,7 @@ test_expect_success 'Shortlog output (complex mapping)' ' git commit --author "CTO " -m seventh && mkdir -p internal_mailmap && - echo "Committed <$GIT_COMMITTER_EMAIL>" > internal_mailmap/.mailmap && + echo "Committed " > internal_mailmap/.mailmap && echo " " >> internal_mailmap/.mailmap && echo "Some Dude nick1 " >> internal_mailmap/.mailmap && echo "Other Author nick2 " >> internal_mailmap/.mailmap && @@ -384,27 +384,27 @@ test_expect_success 'Shortlog output (complex mapping)' ' ' # git log with --pretty format which uses the name and email mailmap placemarkers -cat >expect << EOF +cat >expect <<\EOF Author CTO maps to CTO -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> +Committer C O Mitter maps to Committed Author claus maps to Santa Claus -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> +Committer C O Mitter maps to Committed Author santa maps to Santa Claus -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> +Committer C O Mitter maps to Committed Author nick2 maps to Other Author -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> +Committer C O Mitter maps to Committed Author nick2 maps to Other Author -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> +Committer C O Mitter maps to Committed Author nick1 maps to Some Dude -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> +Committer C O Mitter maps to Committed -Author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> maps to $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> +Author A U Thor maps to A U Thor +Committer C O Mitter maps to Committed EOF test_expect_success 'Log output (complex mapping)' ' @@ -412,42 +412,14 @@ test_expect_success 'Log output (complex mapping)' ' test_cmp expect actual ' -cat >expect << EOF -Author email cto@coompany.xx has local-part cto -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME - -Author email me@company.xx has local-part me -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME - -Author email me@company.xx has local-part me -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME - -Author email nick2@company.xx has local-part nick2 -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME - -Author email bugs@company.xx has local-part bugs -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME - -Author email bugs@company.xx has local-part bugs -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME - -Author email author@example.com has local-part author -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME -EOF - -test_expect_success 'Log output (local-part email address)' ' - git log --pretty=format:"Author email %ae has local-part %al%nCommitter email %ce has local-part %cl%n" >actual && - test_cmp expect actual -' - -cat >expect << EOF +cat >expect <<\EOF Author: CTO Author: Santa Claus Author: Santa Claus Author: Other Author Author: Other Author Author: Some Dude -Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> +Author: A U Thor EOF test_expect_success 'Log output with --use-mailmap' ' @@ -455,14 +427,14 @@ test_expect_success 'Log output with --use-mailmap' ' test_cmp expect actual ' -cat >expect << EOF +cat >expect <<\EOF Author: CTO Author: Santa Claus Author: Santa Claus Author: Other Author Author: Other Author Author: Some Dude -Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> +Author: A U Thor EOF test_expect_success 'Log output with log.mailmap' ' @@ -471,28 +443,28 @@ test_expect_success 'Log output with log.mailmap' ' ' test_expect_success 'log.mailmap=false disables mailmap' ' - cat >expect <<- EOF && + cat >expect <<-\EOF && Author: CTO Author: claus Author: santa Author: nick2 Author: nick2 Author: nick1 - Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> + Author: A U Thor EOF git -c log.mailmap=False log | grep Author > actual && test_cmp expect actual ' test_expect_success '--no-use-mailmap disables mailmap' ' - cat >expect <<- EOF && + cat >expect <<-\EOF && Author: CTO Author: claus Author: santa Author: nick2 Author: nick2 Author: nick1 - Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> + Author: A U Thor EOF git log --no-use-mailmap | grep Author > actual && test_cmp expect actual @@ -528,8 +500,8 @@ test_expect_success 'Only grep replaced author with --use-mailmap' ' ' # git blame -cat >expect <expect <<\EOF +^OBJI (A U Thor DATE 1) one OBJID (Some Dude DATE 2) two OBJID (Other Author DATE 3) three OBJID (Other Author DATE 4) four diff --git a/third_party/git/t/t4204-patch-id.sh b/third_party/git/t/t4204-patch-id.sh index 8ff8bd84c75e..0288c17ec60b 100755 --- a/third_party/git/t/t4204-patch-id.sh +++ b/third_party/git/t/t4204-patch-id.sh @@ -25,7 +25,7 @@ test_expect_success 'setup' ' test_expect_success 'patch-id output is well-formed' ' git log -p -1 | git patch-id >output && - grep "^$OID_REGEX $(git rev-parse HEAD)$" output + grep "^[a-f0-9]\{40\} $(git rev-parse HEAD)$" output ' #calculate patch id. Make sure output is not empty. diff --git a/third_party/git/t/t4205-log-pretty-formats.sh b/third_party/git/t/t4205-log-pretty-formats.sh index 204c149d5a49..f42a69faa2fd 100755 --- a/third_party/git/t/t4205-log-pretty-formats.sh +++ b/third_party/git/t/t4205-log-pretty-formats.sh @@ -134,36 +134,6 @@ test_expect_failure C_LOCALE_OUTPUT 'NUL termination with --stat' ' test_cmp expected actual ' -for p in short medium full fuller email raw -do - test_expect_success "NUL termination with --reflog --pretty=$p" ' - revs="$(git rev-list --reflog)" && - for r in $revs - do - git show -s "$r" --pretty="$p" && - printf "\0" || return 1 - done >expect && - { - git log -z --reflog --pretty="$p" && - printf "\0" - } >actual && - test_cmp expect actual - ' -done - -test_expect_success 'NUL termination with --reflog --pretty=oneline' ' - revs="$(git rev-list --reflog)" && - for r in $revs - do - git show -s --pretty=oneline "$r" >raw && - cat raw | lf_to_nul || exit 1 - done >expect && - # the trailing NUL is already produced so we do not need to - # output another one - git log -z --pretty=oneline --reflog >actual && - test_cmp expect actual -' - test_expect_success 'setup more commits' ' test_commit "message one" one one message-one && test_commit "message two" two two message-two && @@ -533,12 +503,6 @@ test_expect_success 'ISO and ISO-strict date formats display the same values' ' test_cmp expected actual ' -test_expect_success 'short date' ' - git log --format=%ad%n%cd --date=short >expected && - git log --format=%as%n%cs >actual && - test_cmp expected actual -' - # get new digests (with no abbreviations) test_expect_success 'set up log decoration tests' ' head1=$(git rev-parse --verify HEAD~0) && @@ -676,7 +640,7 @@ test_expect_success 'pretty format %(trailers:key=foo) multiple keys' ' test_cmp expect actual ' -test_expect_success '%(trailers:key=nonexistent) becomes empty' ' +test_expect_success '%(trailers:key=nonexistant) becomes empty' ' git log --no-walk --pretty="x%(trailers:key=Nacked-by)x" >actual && echo "xx" >expect && test_cmp expect actual @@ -824,47 +788,4 @@ test_expect_success '%S in git log --format works with other placeholders (part test_cmp expect actual ' -test_expect_success 'log --pretty=reference' ' - git log --pretty="tformat:%h (%s, %as)" >expect && - git log --pretty=reference >actual && - test_cmp expect actual -' - -test_expect_success 'log --pretty=reference with log.date is overridden by short date' ' - git log --pretty="tformat:%h (%s, %as)" >expect && - test_config log.date rfc && - git log --pretty=reference >actual && - test_cmp expect actual -' - -test_expect_success 'log --pretty=reference with explicit date overrides short date' ' - git log --date=rfc --pretty="tformat:%h (%s, %ad)" >expect && - git log --date=rfc --pretty=reference >actual && - test_cmp expect actual -' - -test_expect_success 'log --pretty=reference is never unabbreviated' ' - git log --pretty="tformat:%h (%s, %as)" >expect && - git log --no-abbrev-commit --pretty=reference >actual && - test_cmp expect actual -' - -test_expect_success 'log --pretty=reference is never decorated' ' - git log --pretty="tformat:%h (%s, %as)" >expect && - git log --decorate=short --pretty=reference >actual && - test_cmp expect actual -' - -test_expect_success 'log --pretty=reference does not output reflog info' ' - git log --walk-reflogs --pretty="tformat:%h (%s, %as)" >expect && - git log --walk-reflogs --pretty=reference >actual && - test_cmp expect actual -' - -test_expect_success 'log --pretty=reference is colored appropriately' ' - git log --color=always --pretty="tformat:%C(auto)%h (%s, %as)" >expect && - git log --color=always --pretty=reference >actual && - test_cmp expect actual -' - test_done diff --git a/third_party/git/t/t4210-log-i18n.sh b/third_party/git/t/t4210-log-i18n.sh index c3792081e627..7c519436ef3d 100755 --- a/third_party/git/t/t4210-log-i18n.sh +++ b/third_party/git/t/t4210-log-i18n.sh @@ -1,15 +1,12 @@ #!/bin/sh test_description='test log with i18n features' -. ./lib-gettext.sh +. ./test-lib.sh # two forms of é utf8_e=$(printf '\303\251') latin1_e=$(printf '\351') -# invalid UTF-8 -invalid_e=$(printf '\303\50)') # ")" at end to close opening "(" - test_expect_success 'create commits in different encodings' ' test_tick && cat >msg <<-EOF && @@ -51,43 +48,9 @@ test_expect_success !MINGW 'log --grep does not find non-reencoded values (utf8) test_must_be_empty actual ' -test_expect_success !MINGW 'log --grep does not find non-reencoded values (latin1)' ' +test_expect_success 'log --grep does not find non-reencoded values (latin1)' ' git log --encoding=ISO-8859-1 --format=%s --grep=$utf8_e >actual && test_must_be_empty actual ' -for engine in fixed basic extended perl -do - prereq= - if test $engine = "perl" - then - prereq="PCRE" - else - prereq="" - fi - force_regex= - if test $engine != "fixed" - then - force_regex=.* - fi - test_expect_success !MINGW,!REGEX_ILLSEQ,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not find non-reencoded values (latin1 + locale)" " - cat >expect <<-\EOF && - latin1 - utf8 - EOF - LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$latin1_e\" >actual && - test_cmp expect actual - " - - test_expect_success !MINGW,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not find non-reencoded values (latin1 + locale)" " - LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$utf8_e\" >actual && - test_must_be_empty actual - " - - test_expect_success !MINGW,!REGEX_ILLSEQ,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not die on invalid UTF-8 value (latin1 + locale + invalid needle)" " - LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$invalid_e\" >actual && - test_must_be_empty actual - " -done - test_done diff --git a/third_party/git/t/t4211-line-log.sh b/third_party/git/t/t4211-line-log.sh index cda58186c2d2..1db7bd0f59b4 100755 --- a/third_party/git/t/t4211-line-log.sh +++ b/third_party/git/t/t4211-line-log.sh @@ -4,7 +4,6 @@ test_description='test log -L' . ./test-lib.sh test_expect_success 'setup (import history)' ' - test_oid_init && git fast-import < "$TEST_DIRECTORY"/t4211/history.export && git reset --hard ' @@ -12,7 +11,7 @@ test_expect_success 'setup (import history)' ' canned_test_1 () { test_expect_$1 "$2" " git log $2 >actual && - test_cmp \"\$TEST_DIRECTORY\"/t4211/$(test_oid algo)/expect.$3 actual + test_cmp \"\$TEST_DIRECTORY\"/t4211/expect.$3 actual " } @@ -133,86 +132,4 @@ test_expect_success '--raw is forbidden' ' test_must_fail git log -L1,24:b.c --raw ' -test_expect_success 'setup for checking fancy rename following' ' - git checkout --orphan moves-start && - git reset --hard && - - printf "%s\n" 12 13 14 15 b c d e >file-1 && - printf "%s\n" 22 23 24 25 B C D E >file-2 && - git add file-1 file-2 && - test_tick && - git commit -m "Add file-1 and file-2" && - oid_add_f1_f2=$(git rev-parse --short HEAD) && - - git checkout -b moves-main && - printf "%s\n" 11 12 13 14 15 b c d e >file-1 && - git commit -a -m "Modify file-1 on main" && - oid_mod_f1_main=$(git rev-parse --short HEAD) && - - printf "%s\n" 21 22 23 24 25 B C D E >file-2 && - git commit -a -m "Modify file-2 on main #1" && - oid_mod_f2_main_1=$(git rev-parse --short HEAD) && - - git mv file-1 renamed-1 && - git commit -m "Rename file-1 to renamed-1 on main" && - - printf "%s\n" 11 12 13 14 15 b c d e f >renamed-1 && - git commit -a -m "Modify renamed-1 on main" && - oid_mod_r1_main=$(git rev-parse --short HEAD) && - - printf "%s\n" 21 22 23 24 25 B C D E F >file-2 && - git commit -a -m "Modify file-2 on main #2" && - oid_mod_f2_main_2=$(git rev-parse --short HEAD) && - - git checkout -b moves-side moves-start && - printf "%s\n" 12 13 14 15 16 b c d e >file-1 && - git commit -a -m "Modify file-1 on side #1" && - oid_mod_f1_side_1=$(git rev-parse --short HEAD) && - - printf "%s\n" 22 23 24 25 26 B C D E >file-2 && - git commit -a -m "Modify file-2 on side" && - oid_mod_f2_side=$(git rev-parse --short HEAD) && - - git mv file-2 renamed-2 && - git commit -m "Rename file-2 to renamed-2 on side" && - - printf "%s\n" 12 13 14 15 16 a b c d e >file-1 && - git commit -a -m "Modify file-1 on side #2" && - oid_mod_f1_side_2=$(git rev-parse --short HEAD) && - - printf "%s\n" 22 23 24 25 26 A B C D E >renamed-2 && - git commit -a -m "Modify renamed-2 on side" && - oid_mod_r2_side=$(git rev-parse --short HEAD) && - - git checkout moves-main && - git merge moves-side && - oid_merge=$(git rev-parse --short HEAD) -' - -test_expect_success 'fancy rename following #1' ' - cat >expect <<-EOF && - $oid_merge Merge branch '\''moves-side'\'' into moves-main - $oid_mod_f1_side_2 Modify file-1 on side #2 - $oid_mod_f1_side_1 Modify file-1 on side #1 - $oid_mod_r1_main Modify renamed-1 on main - $oid_mod_f1_main Modify file-1 on main - $oid_add_f1_f2 Add file-1 and file-2 - EOF - git log -L1:renamed-1 --oneline --no-patch >actual && - test_cmp expect actual -' - -test_expect_success 'fancy rename following #2' ' - cat >expect <<-EOF && - $oid_merge Merge branch '\''moves-side'\'' into moves-main - $oid_mod_r2_side Modify renamed-2 on side - $oid_mod_f2_side Modify file-2 on side - $oid_mod_f2_main_2 Modify file-2 on main #2 - $oid_mod_f2_main_1 Modify file-2 on main #1 - $oid_add_f1_f2 Add file-1 and file-2 - EOF - git log -L1:renamed-2 --oneline --no-patch >actual && - test_cmp expect actual -' - test_done diff --git a/third_party/git/t/t4211/expect.beginning-of-file b/third_party/git/t/t4211/expect.beginning-of-file new file mode 100644 index 000000000000..91b405489892 --- /dev/null +++ b/third_party/git/t/t4211/expect.beginning-of-file @@ -0,0 +1,43 @@ +commit 4a23ae5c98d59a58c6da036156959f2dc9f472ad +Author: Thomas Rast +Date: Thu Feb 28 10:47:40 2013 +0100 + + change at very beginning + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -1,3 +1,4 @@ ++#include + #include + + long f(long x) + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -1,3 +1,3 @@ + #include + +-int f(int x) ++long f(long x) + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +1,3 @@ ++#include ++ ++int f(int x) diff --git a/third_party/git/t/t4211/expect.end-of-file b/third_party/git/t/t4211/expect.end-of-file new file mode 100644 index 000000000000..bd25bb2f591f --- /dev/null +++ b/third_party/git/t/t4211/expect.end-of-file @@ -0,0 +1,62 @@ +commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 +Author: Thomas Rast +Date: Thu Feb 28 10:48:43 2013 +0100 + + change back to complete line + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -20,3 +20,5 @@ + printf("%ld\n", f(15)); + return 0; +-} +\ No newline at end of file ++} ++ ++/* incomplete lines are bad! */ + +commit 100b61a6f2f720f812620a9d10afb3a960ccb73c +Author: Thomas Rast +Date: Thu Feb 28 10:48:10 2013 +0100 + + change to an incomplete line at end + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -20,3 +20,3 @@ + printf("%ld\n", f(15)); + return 0; +-} ++} +\ No newline at end of file + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -19,3 +19,3 @@ +- printf("%d\n", f(15)); ++ printf("%ld\n", f(15)); + return 0; + } + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +18,3 @@ ++ printf("%d\n", f(15)); ++ return 0; ++} diff --git a/third_party/git/t/t4211/expect.move-support-f b/third_party/git/t/t4211/expect.move-support-f new file mode 100644 index 000000000000..c905e01bc25c --- /dev/null +++ b/third_party/git/t/t4211/expect.move-support-f @@ -0,0 +1,80 @@ +commit 6ce3c4ff690136099bb17e1a8766b75764726ea7 +Author: Thomas Rast +Date: Thu Feb 28 10:49:50 2013 +0100 + + another simple change + +diff --git a/b.c b/b.c +--- a/b.c ++++ b/b.c +@@ -4,9 +4,9 @@ + long f(long x) + { + int s = 0; + while (x) { +- x >>= 1; ++ x /= 2; + s++; + } + return s; + } + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,9 +3,9 @@ +-int f(int x) ++long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + +commit f04fb20f2c77850996cba739709acc6faecc58f7 +Author: Thomas Rast +Date: Thu Feb 28 10:44:55 2013 +0100 + + change f() + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,8 +3,9 @@ + int f(int x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } ++ return s; + } + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +3,8 @@ ++int f(int x) ++{ ++ int s = 0; ++ while (x) { ++ x >>= 1; ++ s++; ++ } ++} diff --git a/third_party/git/t/t4211/expect.multiple b/third_party/git/t/t4211/expect.multiple new file mode 100644 index 000000000000..76ad5b598cb8 --- /dev/null +++ b/third_party/git/t/t4211/expect.multiple @@ -0,0 +1,104 @@ +commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 +Author: Thomas Rast +Date: Thu Feb 28 10:48:43 2013 +0100 + + change back to complete line + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -18,5 +18,7 @@ + int main () + { + printf("%ld\n", f(15)); + return 0; +-} +\ No newline at end of file ++} ++ ++/* incomplete lines are bad! */ + +commit 100b61a6f2f720f812620a9d10afb3a960ccb73c +Author: Thomas Rast +Date: Thu Feb 28 10:48:10 2013 +0100 + + change to an incomplete line at end + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -18,5 +18,5 @@ + int main () + { + printf("%ld\n", f(15)); + return 0; +-} ++} +\ No newline at end of file + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,9 +3,9 @@ +-int f(int x) ++long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } +@@ -17,5 +17,5 @@ + int main () + { +- printf("%d\n", f(15)); ++ printf("%ld\n", f(15)); + return 0; + } + +commit f04fb20f2c77850996cba739709acc6faecc58f7 +Author: Thomas Rast +Date: Thu Feb 28 10:44:55 2013 +0100 + + change f() + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,8 +3,9 @@ + int f(int x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } ++ return s; + } + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +3,8 @@ ++int f(int x) ++{ ++ int s = 0; ++ while (x) { ++ x >>= 1; ++ s++; ++ } ++} diff --git a/third_party/git/t/t4211/expect.multiple-overlapping b/third_party/git/t/t4211/expect.multiple-overlapping new file mode 100644 index 000000000000..d930b6eec4c4 --- /dev/null +++ b/third_party/git/t/t4211/expect.multiple-overlapping @@ -0,0 +1,187 @@ +commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 +Author: Thomas Rast +Date: Thu Feb 28 10:48:43 2013 +0100 + + change back to complete line + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -4,19 +4,21 @@ + long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* + * This is only an example! + */ + + int main () + { + printf("%ld\n", f(15)); + return 0; +-} +\ No newline at end of file ++} ++ ++/* incomplete lines are bad! */ + +commit 100b61a6f2f720f812620a9d10afb3a960ccb73c +Author: Thomas Rast +Date: Thu Feb 28 10:48:10 2013 +0100 + + change to an incomplete line at end + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -4,19 +4,19 @@ + long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* + * This is only an example! + */ + + int main () + { + printf("%ld\n", f(15)); + return 0; +-} ++} +\ No newline at end of file + +commit 39b6eb2d5b706d3322184a169f666f25ed3fbd00 +Author: Thomas Rast +Date: Thu Feb 28 10:45:41 2013 +0100 + + touch comment + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,19 +3,19 @@ + long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* +- * A comment. ++ * This is only an example! + */ + + int main () + { + printf("%ld\n", f(15)); + return 0; + } + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,19 +3,19 @@ +-int f(int x) ++long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* + * A comment. + */ + + int main () + { +- printf("%d\n", f(15)); ++ printf("%ld\n", f(15)); + return 0; + } + +commit f04fb20f2c77850996cba739709acc6faecc58f7 +Author: Thomas Rast +Date: Thu Feb 28 10:44:55 2013 +0100 + + change f() + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,18 +3,19 @@ + int f(int x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } ++ return s; + } + + /* + * A comment. + */ + + int main () + { + printf("%d\n", f(15)); + return 0; + } + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +3,18 @@ ++int f(int x) ++{ ++ int s = 0; ++ while (x) { ++ x >>= 1; ++ s++; ++ } ++} ++ ++/* ++ * A comment. ++ */ ++ ++int main () ++{ ++ printf("%d\n", f(15)); ++ return 0; ++} diff --git a/third_party/git/t/t4211/expect.multiple-superset b/third_party/git/t/t4211/expect.multiple-superset new file mode 100644 index 000000000000..d930b6eec4c4 --- /dev/null +++ b/third_party/git/t/t4211/expect.multiple-superset @@ -0,0 +1,187 @@ +commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 +Author: Thomas Rast +Date: Thu Feb 28 10:48:43 2013 +0100 + + change back to complete line + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -4,19 +4,21 @@ + long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* + * This is only an example! + */ + + int main () + { + printf("%ld\n", f(15)); + return 0; +-} +\ No newline at end of file ++} ++ ++/* incomplete lines are bad! */ + +commit 100b61a6f2f720f812620a9d10afb3a960ccb73c +Author: Thomas Rast +Date: Thu Feb 28 10:48:10 2013 +0100 + + change to an incomplete line at end + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -4,19 +4,19 @@ + long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* + * This is only an example! + */ + + int main () + { + printf("%ld\n", f(15)); + return 0; +-} ++} +\ No newline at end of file + +commit 39b6eb2d5b706d3322184a169f666f25ed3fbd00 +Author: Thomas Rast +Date: Thu Feb 28 10:45:41 2013 +0100 + + touch comment + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,19 +3,19 @@ + long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* +- * A comment. ++ * This is only an example! + */ + + int main () + { + printf("%ld\n", f(15)); + return 0; + } + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,19 +3,19 @@ +-int f(int x) ++long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* + * A comment. + */ + + int main () + { +- printf("%d\n", f(15)); ++ printf("%ld\n", f(15)); + return 0; + } + +commit f04fb20f2c77850996cba739709acc6faecc58f7 +Author: Thomas Rast +Date: Thu Feb 28 10:44:55 2013 +0100 + + change f() + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,18 +3,19 @@ + int f(int x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } ++ return s; + } + + /* + * A comment. + */ + + int main () + { + printf("%d\n", f(15)); + return 0; + } + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +3,18 @@ ++int f(int x) ++{ ++ int s = 0; ++ while (x) { ++ x >>= 1; ++ s++; ++ } ++} ++ ++/* ++ * A comment. ++ */ ++ ++int main () ++{ ++ printf("%d\n", f(15)); ++ return 0; ++} diff --git a/third_party/git/t/t4211/expect.parallel-change-f-to-main b/third_party/git/t/t4211/expect.parallel-change-f-to-main new file mode 100644 index 000000000000..052def8074da --- /dev/null +++ b/third_party/git/t/t4211/expect.parallel-change-f-to-main @@ -0,0 +1,160 @@ +commit 0469c60bc4837d52d97b1f081dec5f98dea20fed +Merge: ba227c6 6ce3c4f +Author: Thomas Rast +Date: Fri Apr 12 16:16:24 2013 +0200 + + Merge across the rename + + +commit 6ce3c4ff690136099bb17e1a8766b75764726ea7 +Author: Thomas Rast +Date: Thu Feb 28 10:49:50 2013 +0100 + + another simple change + +diff --git a/b.c b/b.c +--- a/b.c ++++ b/b.c +@@ -4,14 +4,14 @@ + long f(long x) + { + int s = 0; + while (x) { +- x >>= 1; ++ x /= 2; + s++; + } + return s; + } + + /* + * This is only an example! + */ + + +commit ba227c6632349700fbb957dec2b50f5e2358be3f +Author: Thomas Rast +Date: Fri Apr 12 16:15:57 2013 +0200 + + change on another line of history while rename happens + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -4,14 +4,14 @@ + long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* +- * This is only an example! ++ * This is only a short example! + */ + + +commit 39b6eb2d5b706d3322184a169f666f25ed3fbd00 +Author: Thomas Rast +Date: Thu Feb 28 10:45:41 2013 +0100 + + touch comment + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,14 +3,14 @@ + long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* +- * A comment. ++ * This is only an example! + */ + + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,14 +3,14 @@ +-int f(int x) ++long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* + * A comment. + */ + + +commit f04fb20f2c77850996cba739709acc6faecc58f7 +Author: Thomas Rast +Date: Thu Feb 28 10:44:55 2013 +0100 + + change f() + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,13 +3,14 @@ + int f(int x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } ++ return s; + } + + /* + * A comment. + */ + + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +3,13 @@ ++int f(int x) ++{ ++ int s = 0; ++ while (x) { ++ x >>= 1; ++ s++; ++ } ++} ++ ++/* ++ * A comment. ++ */ ++ diff --git a/third_party/git/t/t4211/expect.simple-f b/third_party/git/t/t4211/expect.simple-f new file mode 100644 index 000000000000..a1f5bc49c879 --- /dev/null +++ b/third_party/git/t/t4211/expect.simple-f @@ -0,0 +1,59 @@ +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,9 +3,9 @@ +-int f(int x) ++long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + +commit f04fb20f2c77850996cba739709acc6faecc58f7 +Author: Thomas Rast +Date: Thu Feb 28 10:44:55 2013 +0100 + + change f() + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,8 +3,9 @@ + int f(int x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } ++ return s; + } + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +3,8 @@ ++int f(int x) ++{ ++ int s = 0; ++ while (x) { ++ x >>= 1; ++ s++; ++ } ++} diff --git a/third_party/git/t/t4211/expect.simple-f-to-main b/third_party/git/t/t4211/expect.simple-f-to-main new file mode 100644 index 000000000000..a475768710b5 --- /dev/null +++ b/third_party/git/t/t4211/expect.simple-f-to-main @@ -0,0 +1,100 @@ +commit 39b6eb2d5b706d3322184a169f666f25ed3fbd00 +Author: Thomas Rast +Date: Thu Feb 28 10:45:41 2013 +0100 + + touch comment + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,14 +3,14 @@ + long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* +- * A comment. ++ * This is only an example! + */ + + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,14 +3,14 @@ +-int f(int x) ++long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } + + /* + * A comment. + */ + + +commit f04fb20f2c77850996cba739709acc6faecc58f7 +Author: Thomas Rast +Date: Thu Feb 28 10:44:55 2013 +0100 + + change f() + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,13 +3,14 @@ + int f(int x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } ++ return s; + } + + /* + * A comment. + */ + + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +3,13 @@ ++int f(int x) ++{ ++ int s = 0; ++ while (x) { ++ x >>= 1; ++ s++; ++ } ++} ++ ++/* ++ * A comment. ++ */ ++ diff --git a/third_party/git/t/t4211/expect.simple-main b/third_party/git/t/t4211/expect.simple-main new file mode 100644 index 000000000000..39ce39bebed7 --- /dev/null +++ b/third_party/git/t/t4211/expect.simple-main @@ -0,0 +1,68 @@ +commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 +Author: Thomas Rast +Date: Thu Feb 28 10:48:43 2013 +0100 + + change back to complete line + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -18,5 +18,5 @@ + int main () + { + printf("%ld\n", f(15)); + return 0; +-} +\ No newline at end of file ++} + +commit 100b61a6f2f720f812620a9d10afb3a960ccb73c +Author: Thomas Rast +Date: Thu Feb 28 10:48:10 2013 +0100 + + change to an incomplete line at end + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -18,5 +18,5 @@ + int main () + { + printf("%ld\n", f(15)); + return 0; +-} ++} +\ No newline at end of file + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -17,5 +17,5 @@ + int main () + { +- printf("%d\n", f(15)); ++ printf("%ld\n", f(15)); + return 0; + } + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +16,5 @@ ++int main () ++{ ++ printf("%d\n", f(15)); ++ return 0; ++} diff --git a/third_party/git/t/t4211/expect.simple-main-to-end b/third_party/git/t/t4211/expect.simple-main-to-end new file mode 100644 index 000000000000..8480bd9cc45b --- /dev/null +++ b/third_party/git/t/t4211/expect.simple-main-to-end @@ -0,0 +1,70 @@ +commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 +Author: Thomas Rast +Date: Thu Feb 28 10:48:43 2013 +0100 + + change back to complete line + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -18,5 +18,7 @@ + int main () + { + printf("%ld\n", f(15)); + return 0; +-} +\ No newline at end of file ++} ++ ++/* incomplete lines are bad! */ + +commit 100b61a6f2f720f812620a9d10afb3a960ccb73c +Author: Thomas Rast +Date: Thu Feb 28 10:48:10 2013 +0100 + + change to an incomplete line at end + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -18,5 +18,5 @@ + int main () + { + printf("%ld\n", f(15)); + return 0; +-} ++} +\ No newline at end of file + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -17,5 +17,5 @@ + int main () + { +- printf("%d\n", f(15)); ++ printf("%ld\n", f(15)); + return 0; + } + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +16,5 @@ ++int main () ++{ ++ printf("%d\n", f(15)); ++ return 0; ++} diff --git a/third_party/git/t/t4211/expect.two-ranges b/third_party/git/t/t4211/expect.two-ranges new file mode 100644 index 000000000000..6109aa0dcee7 --- /dev/null +++ b/third_party/git/t/t4211/expect.two-ranges @@ -0,0 +1,102 @@ +commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 +Author: Thomas Rast +Date: Thu Feb 28 10:48:43 2013 +0100 + + change back to complete line + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -18,5 +18,5 @@ + int main () + { + printf("%ld\n", f(15)); + return 0; +-} +\ No newline at end of file ++} + +commit 100b61a6f2f720f812620a9d10afb3a960ccb73c +Author: Thomas Rast +Date: Thu Feb 28 10:48:10 2013 +0100 + + change to an incomplete line at end + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -18,5 +18,5 @@ + int main () + { + printf("%ld\n", f(15)); + return 0; +-} ++} +\ No newline at end of file + +commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 +Author: Thomas Rast +Date: Thu Feb 28 10:45:16 2013 +0100 + + touch both functions + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,9 +3,9 @@ +-int f(int x) ++long f(long x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } + return s; + } +@@ -17,5 +17,5 @@ + int main () + { +- printf("%d\n", f(15)); ++ printf("%ld\n", f(15)); + return 0; + } + +commit f04fb20f2c77850996cba739709acc6faecc58f7 +Author: Thomas Rast +Date: Thu Feb 28 10:44:55 2013 +0100 + + change f() + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -3,8 +3,9 @@ + int f(int x) + { + int s = 0; + while (x) { + x >>= 1; + s++; + } ++ return s; + } + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +3,8 @@ ++int f(int x) ++{ ++ int s = 0; ++ while (x) { ++ x >>= 1; ++ s++; ++ } ++} diff --git a/third_party/git/t/t4211/expect.vanishes-early b/third_party/git/t/t4211/expect.vanishes-early new file mode 100644 index 000000000000..1f7cd0694149 --- /dev/null +++ b/third_party/git/t/t4211/expect.vanishes-early @@ -0,0 +1,39 @@ +commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 +Author: Thomas Rast +Date: Thu Feb 28 10:48:43 2013 +0100 + + change back to complete line + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -22,1 +24,1 @@ +-} +\ No newline at end of file ++/* incomplete lines are bad! */ + +commit 100b61a6f2f720f812620a9d10afb3a960ccb73c +Author: Thomas Rast +Date: Thu Feb 28 10:48:10 2013 +0100 + + change to an incomplete line at end + +diff --git a/a.c b/a.c +--- a/a.c ++++ b/a.c +@@ -22,1 +22,1 @@ +-} ++} +\ No newline at end of file + +commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a +Author: Thomas Rast +Date: Thu Feb 28 10:44:48 2013 +0100 + + initial + +diff --git a/a.c b/a.c +--- /dev/null ++++ b/a.c +@@ -0,0 +20,1 @@ ++} diff --git a/third_party/git/t/t4211/sha1/expect.beginning-of-file b/third_party/git/t/t4211/sha1/expect.beginning-of-file deleted file mode 100644 index 91b405489892..000000000000 --- a/third_party/git/t/t4211/sha1/expect.beginning-of-file +++ /dev/null @@ -1,43 +0,0 @@ -commit 4a23ae5c98d59a58c6da036156959f2dc9f472ad -Author: Thomas Rast -Date: Thu Feb 28 10:47:40 2013 +0100 - - change at very beginning - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -1,3 +1,4 @@ -+#include - #include - - long f(long x) - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -1,3 +1,3 @@ - #include - --int f(int x) -+long f(long x) - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +1,3 @@ -+#include -+ -+int f(int x) diff --git a/third_party/git/t/t4211/sha1/expect.end-of-file b/third_party/git/t/t4211/sha1/expect.end-of-file deleted file mode 100644 index bd25bb2f591f..000000000000 --- a/third_party/git/t/t4211/sha1/expect.end-of-file +++ /dev/null @@ -1,62 +0,0 @@ -commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -20,3 +20,5 @@ - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} -+ -+/* incomplete lines are bad! */ - -commit 100b61a6f2f720f812620a9d10afb3a960ccb73c -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -20,3 +20,3 @@ - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -19,3 +19,3 @@ -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +18,3 @@ -+ printf("%d\n", f(15)); -+ return 0; -+} diff --git a/third_party/git/t/t4211/sha1/expect.move-support-f b/third_party/git/t/t4211/sha1/expect.move-support-f deleted file mode 100644 index c905e01bc25c..000000000000 --- a/third_party/git/t/t4211/sha1/expect.move-support-f +++ /dev/null @@ -1,80 +0,0 @@ -commit 6ce3c4ff690136099bb17e1a8766b75764726ea7 -Author: Thomas Rast -Date: Thu Feb 28 10:49:50 2013 +0100 - - another simple change - -diff --git a/b.c b/b.c ---- a/b.c -+++ b/b.c -@@ -4,9 +4,9 @@ - long f(long x) - { - int s = 0; - while (x) { -- x >>= 1; -+ x /= 2; - s++; - } - return s; - } - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,9 +3,9 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - -commit f04fb20f2c77850996cba739709acc6faecc58f7 -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,8 +3,9 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,8 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} diff --git a/third_party/git/t/t4211/sha1/expect.multiple b/third_party/git/t/t4211/sha1/expect.multiple deleted file mode 100644 index 76ad5b598cb8..000000000000 --- a/third_party/git/t/t4211/sha1/expect.multiple +++ /dev/null @@ -1,104 +0,0 @@ -commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,7 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} -+ -+/* incomplete lines are bad! */ - -commit 100b61a6f2f720f812620a9d10afb3a960ccb73c -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,9 +3,9 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } -@@ -17,5 +17,5 @@ - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit f04fb20f2c77850996cba739709acc6faecc58f7 -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,8 +3,9 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,8 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} diff --git a/third_party/git/t/t4211/sha1/expect.multiple-overlapping b/third_party/git/t/t4211/sha1/expect.multiple-overlapping deleted file mode 100644 index d930b6eec4c4..000000000000 --- a/third_party/git/t/t4211/sha1/expect.multiple-overlapping +++ /dev/null @@ -1,187 +0,0 @@ -commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -4,19 +4,21 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} -+ -+/* incomplete lines are bad! */ - -commit 100b61a6f2f720f812620a9d10afb3a960ccb73c -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -4,19 +4,19 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit 39b6eb2d5b706d3322184a169f666f25ed3fbd00 -Author: Thomas Rast -Date: Thu Feb 28 10:45:41 2013 +0100 - - touch comment - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,19 +3,19 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* -- * A comment. -+ * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; - } - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,19 +3,19 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * A comment. - */ - - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit f04fb20f2c77850996cba739709acc6faecc58f7 -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,18 +3,19 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - - /* - * A comment. - */ - - int main () - { - printf("%d\n", f(15)); - return 0; - } - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,18 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} -+ -+/* -+ * A comment. -+ */ -+ -+int main () -+{ -+ printf("%d\n", f(15)); -+ return 0; -+} diff --git a/third_party/git/t/t4211/sha1/expect.multiple-superset b/third_party/git/t/t4211/sha1/expect.multiple-superset deleted file mode 100644 index d930b6eec4c4..000000000000 --- a/third_party/git/t/t4211/sha1/expect.multiple-superset +++ /dev/null @@ -1,187 +0,0 @@ -commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -4,19 +4,21 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} -+ -+/* incomplete lines are bad! */ - -commit 100b61a6f2f720f812620a9d10afb3a960ccb73c -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -4,19 +4,19 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit 39b6eb2d5b706d3322184a169f666f25ed3fbd00 -Author: Thomas Rast -Date: Thu Feb 28 10:45:41 2013 +0100 - - touch comment - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,19 +3,19 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* -- * A comment. -+ * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; - } - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,19 +3,19 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * A comment. - */ - - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit f04fb20f2c77850996cba739709acc6faecc58f7 -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,18 +3,19 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - - /* - * A comment. - */ - - int main () - { - printf("%d\n", f(15)); - return 0; - } - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,18 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} -+ -+/* -+ * A comment. -+ */ -+ -+int main () -+{ -+ printf("%d\n", f(15)); -+ return 0; -+} diff --git a/third_party/git/t/t4211/sha1/expect.parallel-change-f-to-main b/third_party/git/t/t4211/sha1/expect.parallel-change-f-to-main deleted file mode 100644 index 052def8074da..000000000000 --- a/third_party/git/t/t4211/sha1/expect.parallel-change-f-to-main +++ /dev/null @@ -1,160 +0,0 @@ -commit 0469c60bc4837d52d97b1f081dec5f98dea20fed -Merge: ba227c6 6ce3c4f -Author: Thomas Rast -Date: Fri Apr 12 16:16:24 2013 +0200 - - Merge across the rename - - -commit 6ce3c4ff690136099bb17e1a8766b75764726ea7 -Author: Thomas Rast -Date: Thu Feb 28 10:49:50 2013 +0100 - - another simple change - -diff --git a/b.c b/b.c ---- a/b.c -+++ b/b.c -@@ -4,14 +4,14 @@ - long f(long x) - { - int s = 0; - while (x) { -- x >>= 1; -+ x /= 2; - s++; - } - return s; - } - - /* - * This is only an example! - */ - - -commit ba227c6632349700fbb957dec2b50f5e2358be3f -Author: Thomas Rast -Date: Fri Apr 12 16:15:57 2013 +0200 - - change on another line of history while rename happens - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -4,14 +4,14 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* -- * This is only an example! -+ * This is only a short example! - */ - - -commit 39b6eb2d5b706d3322184a169f666f25ed3fbd00 -Author: Thomas Rast -Date: Thu Feb 28 10:45:41 2013 +0100 - - touch comment - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,14 +3,14 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* -- * A comment. -+ * This is only an example! - */ - - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,14 +3,14 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * A comment. - */ - - -commit f04fb20f2c77850996cba739709acc6faecc58f7 -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,13 +3,14 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - - /* - * A comment. - */ - - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,13 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} -+ -+/* -+ * A comment. -+ */ -+ diff --git a/third_party/git/t/t4211/sha1/expect.simple-f b/third_party/git/t/t4211/sha1/expect.simple-f deleted file mode 100644 index a1f5bc49c879..000000000000 --- a/third_party/git/t/t4211/sha1/expect.simple-f +++ /dev/null @@ -1,59 +0,0 @@ -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,9 +3,9 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - -commit f04fb20f2c77850996cba739709acc6faecc58f7 -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,8 +3,9 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,8 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} diff --git a/third_party/git/t/t4211/sha1/expect.simple-f-to-main b/third_party/git/t/t4211/sha1/expect.simple-f-to-main deleted file mode 100644 index a475768710b5..000000000000 --- a/third_party/git/t/t4211/sha1/expect.simple-f-to-main +++ /dev/null @@ -1,100 +0,0 @@ -commit 39b6eb2d5b706d3322184a169f666f25ed3fbd00 -Author: Thomas Rast -Date: Thu Feb 28 10:45:41 2013 +0100 - - touch comment - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,14 +3,14 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* -- * A comment. -+ * This is only an example! - */ - - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,14 +3,14 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * A comment. - */ - - -commit f04fb20f2c77850996cba739709acc6faecc58f7 -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,13 +3,14 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - - /* - * A comment. - */ - - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,13 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} -+ -+/* -+ * A comment. -+ */ -+ diff --git a/third_party/git/t/t4211/sha1/expect.simple-main b/third_party/git/t/t4211/sha1/expect.simple-main deleted file mode 100644 index 39ce39bebed7..000000000000 --- a/third_party/git/t/t4211/sha1/expect.simple-main +++ /dev/null @@ -1,68 +0,0 @@ -commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} - -commit 100b61a6f2f720f812620a9d10afb3a960ccb73c -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -17,5 +17,5 @@ - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +16,5 @@ -+int main () -+{ -+ printf("%d\n", f(15)); -+ return 0; -+} diff --git a/third_party/git/t/t4211/sha1/expect.simple-main-to-end b/third_party/git/t/t4211/sha1/expect.simple-main-to-end deleted file mode 100644 index 8480bd9cc45b..000000000000 --- a/third_party/git/t/t4211/sha1/expect.simple-main-to-end +++ /dev/null @@ -1,70 +0,0 @@ -commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,7 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} -+ -+/* incomplete lines are bad! */ - -commit 100b61a6f2f720f812620a9d10afb3a960ccb73c -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -17,5 +17,5 @@ - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +16,5 @@ -+int main () -+{ -+ printf("%d\n", f(15)); -+ return 0; -+} diff --git a/third_party/git/t/t4211/sha1/expect.two-ranges b/third_party/git/t/t4211/sha1/expect.two-ranges deleted file mode 100644 index 6109aa0dcee7..000000000000 --- a/third_party/git/t/t4211/sha1/expect.two-ranges +++ /dev/null @@ -1,102 +0,0 @@ -commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} - -commit 100b61a6f2f720f812620a9d10afb3a960ccb73c -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2 -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,9 +3,9 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } -@@ -17,5 +17,5 @@ - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit f04fb20f2c77850996cba739709acc6faecc58f7 -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,8 +3,9 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,8 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} diff --git a/third_party/git/t/t4211/sha1/expect.vanishes-early b/third_party/git/t/t4211/sha1/expect.vanishes-early deleted file mode 100644 index 1f7cd0694149..000000000000 --- a/third_party/git/t/t4211/sha1/expect.vanishes-early +++ /dev/null @@ -1,39 +0,0 @@ -commit 4659538844daa2849b1a9e7d6fadb96fcd26fc83 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -22,1 +24,1 @@ --} -\ No newline at end of file -+/* incomplete lines are bad! */ - -commit 100b61a6f2f720f812620a9d10afb3a960ccb73c -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -22,1 +22,1 @@ --} -+} -\ No newline at end of file - -commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +20,1 @@ -+} diff --git a/third_party/git/t/t4211/sha256/expect.beginning-of-file b/third_party/git/t/t4211/sha256/expect.beginning-of-file deleted file mode 100644 index 5adfdfc1a120..000000000000 --- a/third_party/git/t/t4211/sha256/expect.beginning-of-file +++ /dev/null @@ -1,43 +0,0 @@ -commit 62a40b38fa4f00800004aee81ef287b7201317594ebcb990f38cbe493b01d200 -Author: Thomas Rast -Date: Thu Feb 28 10:47:40 2013 +0100 - - change at very beginning - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -1,3 +1,4 @@ -+#include - #include - - long f(long x) - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -1,3 +1,3 @@ - #include - --int f(int x) -+long f(long x) - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +1,3 @@ -+#include -+ -+int f(int x) diff --git a/third_party/git/t/t4211/sha256/expect.end-of-file b/third_party/git/t/t4211/sha256/expect.end-of-file deleted file mode 100644 index 03ab5c1784e2..000000000000 --- a/third_party/git/t/t4211/sha256/expect.end-of-file +++ /dev/null @@ -1,62 +0,0 @@ -commit 5526ed05c2476b56af8b7be499e8f78bd50f490740733a9ca7e1f55878fa90a9 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -20,3 +20,5 @@ - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} -+ -+/* incomplete lines are bad! */ - -commit 29f32ac3141c48b22803e5c4127b719917b67d0f8ca8c5248bebfa2a19f7da10 -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -20,3 +20,3 @@ - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -19,3 +19,3 @@ -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +18,3 @@ -+ printf("%d\n", f(15)); -+ return 0; -+} diff --git a/third_party/git/t/t4211/sha256/expect.move-support-f b/third_party/git/t/t4211/sha256/expect.move-support-f deleted file mode 100644 index 223b4ed2a0cf..000000000000 --- a/third_party/git/t/t4211/sha256/expect.move-support-f +++ /dev/null @@ -1,80 +0,0 @@ -commit 4f7a58195a92c400e28a2354328587f1ff14fb77f5cf894536f17ccbc72931b9 -Author: Thomas Rast -Date: Thu Feb 28 10:49:50 2013 +0100 - - another simple change - -diff --git a/b.c b/b.c ---- a/b.c -+++ b/b.c -@@ -4,9 +4,9 @@ - long f(long x) - { - int s = 0; - while (x) { -- x >>= 1; -+ x /= 2; - s++; - } - return s; - } - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,9 +3,9 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - -commit f6434acd34260a6c9f61e96d96bf9a323d330561df5b1ca2631104f82026dfed -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,8 +3,9 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,8 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} diff --git a/third_party/git/t/t4211/sha256/expect.multiple b/third_party/git/t/t4211/sha256/expect.multiple deleted file mode 100644 index ca00409b9a39..000000000000 --- a/third_party/git/t/t4211/sha256/expect.multiple +++ /dev/null @@ -1,104 +0,0 @@ -commit 5526ed05c2476b56af8b7be499e8f78bd50f490740733a9ca7e1f55878fa90a9 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,7 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} -+ -+/* incomplete lines are bad! */ - -commit 29f32ac3141c48b22803e5c4127b719917b67d0f8ca8c5248bebfa2a19f7da10 -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,9 +3,9 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } -@@ -17,5 +17,5 @@ - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit f6434acd34260a6c9f61e96d96bf9a323d330561df5b1ca2631104f82026dfed -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,8 +3,9 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,8 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} diff --git a/third_party/git/t/t4211/sha256/expect.multiple-overlapping b/third_party/git/t/t4211/sha256/expect.multiple-overlapping deleted file mode 100644 index 9015a45a256f..000000000000 --- a/third_party/git/t/t4211/sha256/expect.multiple-overlapping +++ /dev/null @@ -1,187 +0,0 @@ -commit 5526ed05c2476b56af8b7be499e8f78bd50f490740733a9ca7e1f55878fa90a9 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -4,19 +4,21 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} -+ -+/* incomplete lines are bad! */ - -commit 29f32ac3141c48b22803e5c4127b719917b67d0f8ca8c5248bebfa2a19f7da10 -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -4,19 +4,19 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit 5a1b3989063d55e71e7685efa3392f133385b4034bddde530dcb5090d8b8b8ca -Author: Thomas Rast -Date: Thu Feb 28 10:45:41 2013 +0100 - - touch comment - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,19 +3,19 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* -- * A comment. -+ * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; - } - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,19 +3,19 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * A comment. - */ - - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit f6434acd34260a6c9f61e96d96bf9a323d330561df5b1ca2631104f82026dfed -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,18 +3,19 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - - /* - * A comment. - */ - - int main () - { - printf("%d\n", f(15)); - return 0; - } - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,18 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} -+ -+/* -+ * A comment. -+ */ -+ -+int main () -+{ -+ printf("%d\n", f(15)); -+ return 0; -+} diff --git a/third_party/git/t/t4211/sha256/expect.multiple-superset b/third_party/git/t/t4211/sha256/expect.multiple-superset deleted file mode 100644 index 9015a45a256f..000000000000 --- a/third_party/git/t/t4211/sha256/expect.multiple-superset +++ /dev/null @@ -1,187 +0,0 @@ -commit 5526ed05c2476b56af8b7be499e8f78bd50f490740733a9ca7e1f55878fa90a9 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -4,19 +4,21 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} -+ -+/* incomplete lines are bad! */ - -commit 29f32ac3141c48b22803e5c4127b719917b67d0f8ca8c5248bebfa2a19f7da10 -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -4,19 +4,19 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit 5a1b3989063d55e71e7685efa3392f133385b4034bddde530dcb5090d8b8b8ca -Author: Thomas Rast -Date: Thu Feb 28 10:45:41 2013 +0100 - - touch comment - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,19 +3,19 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* -- * A comment. -+ * This is only an example! - */ - - int main () - { - printf("%ld\n", f(15)); - return 0; - } - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,19 +3,19 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * A comment. - */ - - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit f6434acd34260a6c9f61e96d96bf9a323d330561df5b1ca2631104f82026dfed -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,18 +3,19 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - - /* - * A comment. - */ - - int main () - { - printf("%d\n", f(15)); - return 0; - } - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,18 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} -+ -+/* -+ * A comment. -+ */ -+ -+int main () -+{ -+ printf("%d\n", f(15)); -+ return 0; -+} diff --git a/third_party/git/t/t4211/sha256/expect.parallel-change-f-to-main b/third_party/git/t/t4211/sha256/expect.parallel-change-f-to-main deleted file mode 100644 index e68f8928ea70..000000000000 --- a/third_party/git/t/t4211/sha256/expect.parallel-change-f-to-main +++ /dev/null @@ -1,160 +0,0 @@ -commit 98117c2059b76c36995748fb97b02542aef477fe26379e94c18fd70f7790bc67 -Merge: b511694 4f7a581 -Author: Thomas Rast -Date: Fri Apr 12 16:16:24 2013 +0200 - - Merge across the rename - - -commit 4f7a58195a92c400e28a2354328587f1ff14fb77f5cf894536f17ccbc72931b9 -Author: Thomas Rast -Date: Thu Feb 28 10:49:50 2013 +0100 - - another simple change - -diff --git a/b.c b/b.c ---- a/b.c -+++ b/b.c -@@ -4,14 +4,14 @@ - long f(long x) - { - int s = 0; - while (x) { -- x >>= 1; -+ x /= 2; - s++; - } - return s; - } - - /* - * This is only an example! - */ - - -commit b511694f5337663fbd697622993a5f8e1099eca84be4df313f2b3ee94a098b42 -Author: Thomas Rast -Date: Fri Apr 12 16:15:57 2013 +0200 - - change on another line of history while rename happens - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -4,14 +4,14 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* -- * This is only an example! -+ * This is only a short example! - */ - - -commit 5a1b3989063d55e71e7685efa3392f133385b4034bddde530dcb5090d8b8b8ca -Author: Thomas Rast -Date: Thu Feb 28 10:45:41 2013 +0100 - - touch comment - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,14 +3,14 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* -- * A comment. -+ * This is only an example! - */ - - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,14 +3,14 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * A comment. - */ - - -commit f6434acd34260a6c9f61e96d96bf9a323d330561df5b1ca2631104f82026dfed -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,13 +3,14 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - - /* - * A comment. - */ - - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,13 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} -+ -+/* -+ * A comment. -+ */ -+ diff --git a/third_party/git/t/t4211/sha256/expect.simple-f b/third_party/git/t/t4211/sha256/expect.simple-f deleted file mode 100644 index 65508d7c0bc6..000000000000 --- a/third_party/git/t/t4211/sha256/expect.simple-f +++ /dev/null @@ -1,59 +0,0 @@ -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,9 +3,9 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - -commit f6434acd34260a6c9f61e96d96bf9a323d330561df5b1ca2631104f82026dfed -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,8 +3,9 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,8 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} diff --git a/third_party/git/t/t4211/sha256/expect.simple-f-to-main b/third_party/git/t/t4211/sha256/expect.simple-f-to-main deleted file mode 100644 index 77b721c196b1..000000000000 --- a/third_party/git/t/t4211/sha256/expect.simple-f-to-main +++ /dev/null @@ -1,100 +0,0 @@ -commit 5a1b3989063d55e71e7685efa3392f133385b4034bddde530dcb5090d8b8b8ca -Author: Thomas Rast -Date: Thu Feb 28 10:45:41 2013 +0100 - - touch comment - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,14 +3,14 @@ - long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* -- * A comment. -+ * This is only an example! - */ - - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,14 +3,14 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } - - /* - * A comment. - */ - - -commit f6434acd34260a6c9f61e96d96bf9a323d330561df5b1ca2631104f82026dfed -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,13 +3,14 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - - /* - * A comment. - */ - - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,13 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} -+ -+/* -+ * A comment. -+ */ -+ diff --git a/third_party/git/t/t4211/sha256/expect.simple-main b/third_party/git/t/t4211/sha256/expect.simple-main deleted file mode 100644 index d20708c9f9a0..000000000000 --- a/third_party/git/t/t4211/sha256/expect.simple-main +++ /dev/null @@ -1,68 +0,0 @@ -commit 5526ed05c2476b56af8b7be499e8f78bd50f490740733a9ca7e1f55878fa90a9 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} - -commit 29f32ac3141c48b22803e5c4127b719917b67d0f8ca8c5248bebfa2a19f7da10 -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -17,5 +17,5 @@ - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +16,5 @@ -+int main () -+{ -+ printf("%d\n", f(15)); -+ return 0; -+} diff --git a/third_party/git/t/t4211/sha256/expect.simple-main-to-end b/third_party/git/t/t4211/sha256/expect.simple-main-to-end deleted file mode 100644 index 617cdf34819e..000000000000 --- a/third_party/git/t/t4211/sha256/expect.simple-main-to-end +++ /dev/null @@ -1,70 +0,0 @@ -commit 5526ed05c2476b56af8b7be499e8f78bd50f490740733a9ca7e1f55878fa90a9 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,7 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} -+ -+/* incomplete lines are bad! */ - -commit 29f32ac3141c48b22803e5c4127b719917b67d0f8ca8c5248bebfa2a19f7da10 -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -17,5 +17,5 @@ - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +16,5 @@ -+int main () -+{ -+ printf("%d\n", f(15)); -+ return 0; -+} diff --git a/third_party/git/t/t4211/sha256/expect.two-ranges b/third_party/git/t/t4211/sha256/expect.two-ranges deleted file mode 100644 index af57c8b99783..000000000000 --- a/third_party/git/t/t4211/sha256/expect.two-ranges +++ /dev/null @@ -1,102 +0,0 @@ -commit 5526ed05c2476b56af8b7be499e8f78bd50f490740733a9ca7e1f55878fa90a9 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -\ No newline at end of file -+} - -commit 29f32ac3141c48b22803e5c4127b719917b67d0f8ca8c5248bebfa2a19f7da10 -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -18,5 +18,5 @@ - int main () - { - printf("%ld\n", f(15)); - return 0; --} -+} -\ No newline at end of file - -commit ccf97b9878189c40a981da50b15713bb80a35755326320ec80900caf22ced46f -Author: Thomas Rast -Date: Thu Feb 28 10:45:16 2013 +0100 - - touch both functions - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,9 +3,9 @@ --int f(int x) -+long f(long x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } - return s; - } -@@ -17,5 +17,5 @@ - int main () - { -- printf("%d\n", f(15)); -+ printf("%ld\n", f(15)); - return 0; - } - -commit f6434acd34260a6c9f61e96d96bf9a323d330561df5b1ca2631104f82026dfed -Author: Thomas Rast -Date: Thu Feb 28 10:44:55 2013 +0100 - - change f() - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -3,8 +3,9 @@ - int f(int x) - { - int s = 0; - while (x) { - x >>= 1; - s++; - } -+ return s; - } - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +3,8 @@ -+int f(int x) -+{ -+ int s = 0; -+ while (x) { -+ x >>= 1; -+ s++; -+ } -+} diff --git a/third_party/git/t/t4211/sha256/expect.vanishes-early b/third_party/git/t/t4211/sha256/expect.vanishes-early deleted file mode 100644 index 11ec9bdecfcc..000000000000 --- a/third_party/git/t/t4211/sha256/expect.vanishes-early +++ /dev/null @@ -1,39 +0,0 @@ -commit 5526ed05c2476b56af8b7be499e8f78bd50f490740733a9ca7e1f55878fa90a9 -Author: Thomas Rast -Date: Thu Feb 28 10:48:43 2013 +0100 - - change back to complete line - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -22,1 +24,1 @@ --} -\ No newline at end of file -+/* incomplete lines are bad! */ - -commit 29f32ac3141c48b22803e5c4127b719917b67d0f8ca8c5248bebfa2a19f7da10 -Author: Thomas Rast -Date: Thu Feb 28 10:48:10 2013 +0100 - - change to an incomplete line at end - -diff --git a/a.c b/a.c ---- a/a.c -+++ b/a.c -@@ -22,1 +22,1 @@ --} -+} -\ No newline at end of file - -commit 1dd7e9b2b1699324b53b341e728653b913bc192a14dfea168c5b51f2b3d03592 -Author: Thomas Rast -Date: Thu Feb 28 10:44:48 2013 +0100 - - initial - -diff --git a/a.c b/a.c ---- /dev/null -+++ b/a.c -@@ -0,0 +20,1 @@ -+} diff --git a/third_party/git/t/t4213-log-tabexpand.sh b/third_party/git/t/t4213-log-tabexpand.sh index 53a4af324495..7f90f58c03e6 100755 --- a/third_party/git/t/t4213-log-tabexpand.sh +++ b/third_party/git/t/t4213-log-tabexpand.sh @@ -36,7 +36,7 @@ count_expand () esac # Prefix the output with the command line arguments, and - # replace SP with a dot both in the expected and actual output + # replace SP with a dot both in the expecte and actual output # so that test_cmp would show the difference together with the # breakage in a way easier to consume by the debugging user. { diff --git a/third_party/git/t/t4214-log-graph-octopus.sh b/third_party/git/t/t4214-log-graph-octopus.sh index a08032509840..dab96c89aa8a 100755 --- a/third_party/git/t/t4214-log-graph-octopus.sh +++ b/third_party/git/t/t4214-log-graph-octopus.sh @@ -3,86 +3,82 @@ test_description='git log --graph of skewed left octopus merge.' . ./test-lib.sh -. "$TEST_DIRECTORY"/lib-log-graph.sh - -test_cmp_graph () { - cat >expect && - lib_test_cmp_graph --color=never --date-order --format=%s "$@" -} - -test_cmp_colored_graph () { - lib_test_cmp_colored_graph --date-order --format=%s "$@" -} test_expect_success 'set up merge history' ' - test_commit initial && - for i in 1 2 3 4 ; do - git checkout master -b $i || return $? - # Make tag name different from branch name, to avoid - # ambiguity error when calling checkout. - test_commit $i $i $i tag$i || return $? - done && - git checkout 1 -b merge && - test_merge octopus-merge 1 2 3 4 && - test_commit after-merge && - git checkout 1 -b L && - test_commit left && - git checkout 4 -b crossover && - test_commit after-4 && - git checkout initial -b more-L && - test_commit after-initial -' - -test_expect_success 'log --graph with tricky octopus merge, no color' ' - test_cmp_graph left octopus-merge <<-\EOF + cat >expect.uncolored <<-\EOF && * left - | *-. octopus-merge - |/|\ \ + | *---. octopus-merge + | |\ \ \ + |/ / / / | | | * 4 | | * | 3 | | |/ - | * / 2 + | * | 2 | |/ - * / 1 + * | 1 |/ * initial EOF -' - -test_expect_success 'log --graph with tricky octopus merge with colors' ' - test_config log.graphColors red,green,yellow,blue,magenta,cyan && cat >expect.colors <<-\EOF && * left - | *-. octopus-merge - |/|\ \ + | *---. octopus-merge + | |\ \ \ + |/ / / / | | | * 4 | | * | 3 | | |/ - | * / 2 + | * | 2 | |/ - * / 1 + * | 1 |/ * initial EOF - test_cmp_colored_graph left octopus-merge + test_commit initial && + for i in 1 2 3 4 ; do + git checkout master -b $i || return $? + # Make tag name different from branch name, to avoid + # ambiguity error when calling checkout. + test_commit $i $i $i tag$i || return $? + done && + git checkout 1 -b merge && + test_tick && + git merge -m octopus-merge 1 2 3 4 && + git checkout 1 -b L && + test_commit left +' + +test_expect_success 'log --graph with tricky octopus merge with colors' ' + test_config log.graphColors red,green,yellow,blue,magenta,cyan && + git log --color=always --graph --date-order --pretty=tformat:%s --all >actual.colors.raw && + test_decode_color actual.colors && + test_cmp expect.colors actual.colors +' + +test_expect_success 'log --graph with tricky octopus merge, no color' ' + git log --color=never --graph --date-order --pretty=tformat:%s --all >actual.raw && + sed "s/ *\$//" actual.raw >actual && + test_cmp expect.uncolored actual ' # Repeat the previous two tests with "normal" octopus merge (i.e., # without the first parent skewing to the "left" branch column). test_expect_success 'log --graph with normal octopus merge, no color' ' - test_cmp_graph octopus-merge <<-\EOF + cat >expect.uncolored <<-\EOF && *---. octopus-merge |\ \ \ | | | * 4 | | * | 3 | | |/ - | * / 2 + | * | 2 | |/ - * / 1 + * | 1 |/ * initial EOF + git log --color=never --graph --date-order --pretty=tformat:%s merge >actual.raw && + sed "s/ *\$//" actual.raw >actual && + test_cmp expect.uncolored actual ' test_expect_success 'log --graph with normal octopus merge with colors' ' @@ -92,256 +88,15 @@ test_expect_success 'log --graph with normal octopus merge with colors' ' | | | * 4 | | * | 3 | | |/ - | * / 2 + | * | 2 | |/ - * / 1 + * | 1 |/ * initial EOF test_config log.graphColors red,green,yellow,blue,magenta,cyan && - test_cmp_colored_graph octopus-merge + git log --color=always --graph --date-order --pretty=tformat:%s merge >actual.colors.raw && + test_decode_color actual.colors && + test_cmp expect.colors actual.colors ' - -test_expect_success 'log --graph with normal octopus merge and child, no color' ' - test_cmp_graph after-merge <<-\EOF - * after-merge - *---. octopus-merge - |\ \ \ - | | | * 4 - | | * | 3 - | | |/ - | * / 2 - | |/ - * / 1 - |/ - * initial - EOF -' - -test_expect_success 'log --graph with normal octopus and child merge with colors' ' - cat >expect.colors <<-\EOF && - * after-merge - *---. octopus-merge - |\ \ \ - | | | * 4 - | | * | 3 - | | |/ - | * / 2 - | |/ - * / 1 - |/ - * initial - EOF - test_config log.graphColors red,green,yellow,blue,magenta,cyan && - test_cmp_colored_graph after-merge -' - -test_expect_success 'log --graph with tricky octopus merge and its child, no color' ' - test_cmp_graph left after-merge <<-\EOF - * left - | * after-merge - | *-. octopus-merge - |/|\ \ - | | | * 4 - | | * | 3 - | | |/ - | * / 2 - | |/ - * / 1 - |/ - * initial - EOF -' - -test_expect_success 'log --graph with tricky octopus merge and its child with colors' ' - test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && - * left - | * after-merge - | *-. octopus-merge - |/|\ \ - | | | * 4 - | | * | 3 - | | |/ - | * / 2 - | |/ - * / 1 - |/ - * initial - EOF - test_cmp_colored_graph left after-merge -' - -test_expect_success 'log --graph with crossover in octopus merge, no color' ' - test_cmp_graph after-4 octopus-merge <<-\EOF - * after-4 - | *---. octopus-merge - | |\ \ \ - | |_|_|/ - |/| | | - * | | | 4 - | | | * 3 - | |_|/ - |/| | - | | * 2 - | |/ - |/| - | * 1 - |/ - * initial - EOF -' - -test_expect_success 'log --graph with crossover in octopus merge with colors' ' - test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && - * after-4 - | *---. octopus-merge - | |\ \ \ - | |_|_|/ - |/| | | - * | | | 4 - | | | * 3 - | |_|/ - |/| | - | | * 2 - | |/ - |/| - | * 1 - |/ - * initial - EOF - test_cmp_colored_graph after-4 octopus-merge -' - -test_expect_success 'log --graph with crossover in octopus merge and its child, no color' ' - test_cmp_graph after-4 after-merge <<-\EOF - * after-4 - | * after-merge - | *---. octopus-merge - | |\ \ \ - | |_|_|/ - |/| | | - * | | | 4 - | | | * 3 - | |_|/ - |/| | - | | * 2 - | |/ - |/| - | * 1 - |/ - * initial - EOF -' - -test_expect_success 'log --graph with crossover in octopus merge and its child with colors' ' - test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && - * after-4 - | * after-merge - | *---. octopus-merge - | |\ \ \ - | |_|_|/ - |/| | | - * | | | 4 - | | | * 3 - | |_|/ - |/| | - | | * 2 - | |/ - |/| - | * 1 - |/ - * initial - EOF - test_cmp_colored_graph after-4 after-merge -' - -test_expect_success 'log --graph with unrelated commit and octopus tip, no color' ' - test_cmp_graph after-initial octopus-merge <<-\EOF - * after-initial - | *---. octopus-merge - | |\ \ \ - | | | | * 4 - | |_|_|/ - |/| | | - | | | * 3 - | |_|/ - |/| | - | | * 2 - | |/ - |/| - | * 1 - |/ - * initial - EOF -' - -test_expect_success 'log --graph with unrelated commit and octopus tip with colors' ' - test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && - * after-initial - | *---. octopus-merge - | |\ \ \ - | | | | * 4 - | |_|_|/ - |/| | | - | | | * 3 - | |_|/ - |/| | - | | * 2 - | |/ - |/| - | * 1 - |/ - * initial - EOF - test_cmp_colored_graph after-initial octopus-merge -' - -test_expect_success 'log --graph with unrelated commit and octopus child, no color' ' - test_cmp_graph after-initial after-merge <<-\EOF - * after-initial - | * after-merge - | *---. octopus-merge - | |\ \ \ - | | | | * 4 - | |_|_|/ - |/| | | - | | | * 3 - | |_|/ - |/| | - | | * 2 - | |/ - |/| - | * 1 - |/ - * initial - EOF -' - -test_expect_success 'log --graph with unrelated commit and octopus child with colors' ' - test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && - * after-initial - | * after-merge - | *---. octopus-merge - | |\ \ \ - | | | | * 4 - | |_|_|/ - |/| | | - | | | * 3 - | |_|/ - |/| | - | | * 2 - | |/ - |/| - | * 1 - |/ - * initial - EOF - test_cmp_colored_graph after-initial after-merge -' - test_done diff --git a/third_party/git/t/t4215-log-skewed-merges.sh b/third_party/git/t/t4215-log-skewed-merges.sh deleted file mode 100755 index 28d0779a8c59..000000000000 --- a/third_party/git/t/t4215-log-skewed-merges.sh +++ /dev/null @@ -1,373 +0,0 @@ -#!/bin/sh - -test_description='git log --graph of skewed merges' - -. ./test-lib.sh -. "$TEST_DIRECTORY"/lib-log-graph.sh - -check_graph () { - cat >expect && - lib_test_cmp_graph --format=%s "$@" -} - -test_expect_success 'log --graph with merge fusing with its left and right neighbors' ' - git checkout --orphan _p && - test_commit A && - test_commit B && - git checkout -b _q @^ && test_commit C && - git checkout -b _r @^ && test_commit D && - git checkout _p && git merge --no-ff _q _r -m E && - git checkout _r && test_commit F && - git checkout _p && git merge --no-ff _r -m G && - git checkout @^^ && git merge --no-ff _p -m H && - - check_graph <<-\EOF - * H - |\ - | * G - | |\ - | | * F - | * | E - |/|\| - | | * D - | * | C - | |/ - * / B - |/ - * A - EOF -' - -test_expect_success 'log --graph with left-skewed merge' ' - git checkout --orphan 0_p && test_commit 0_A && - git checkout -b 0_q 0_p && test_commit 0_B && - git checkout -b 0_r 0_p && - test_commit 0_C && - test_commit 0_D && - git checkout -b 0_s 0_p && test_commit 0_E && - git checkout -b 0_t 0_p && git merge --no-ff 0_r^ 0_s -m 0_F && - git checkout 0_p && git merge --no-ff 0_s -m 0_G && - git checkout @^ && git merge --no-ff 0_q 0_r 0_t 0_p -m 0_H && - - check_graph <<-\EOF - *-----. 0_H - |\ \ \ \ - | | | | * 0_G - | |_|_|/| - |/| | | | - | | | * | 0_F - | |_|/|\| - |/| | | | - | | | | * 0_E - | |_|_|/ - |/| | | - | | * | 0_D - | | |/ - | | * 0_C - | |/ - |/| - | * 0_B - |/ - * 0_A - EOF -' - -test_expect_success 'log --graph with nested left-skewed merge' ' - git checkout --orphan 1_p && - test_commit 1_A && - test_commit 1_B && - test_commit 1_C && - git checkout -b 1_q @^ && test_commit 1_D && - git checkout 1_p && git merge --no-ff 1_q -m 1_E && - git checkout -b 1_r @~3 && test_commit 1_F && - git checkout 1_p && git merge --no-ff 1_r -m 1_G && - git checkout @^^ && git merge --no-ff 1_p -m 1_H && - - check_graph <<-\EOF - * 1_H - |\ - | * 1_G - | |\ - | | * 1_F - | * | 1_E - |/| | - | * | 1_D - * | | 1_C - |/ / - * / 1_B - |/ - * 1_A - EOF -' - -test_expect_success 'log --graph with nested left-skewed merge following normal merge' ' - git checkout --orphan 2_p && - test_commit 2_A && - test_commit 2_B && - test_commit 2_C && - git checkout -b 2_q @^^ && - test_commit 2_D && - test_commit 2_E && - git checkout -b 2_r @^ && test_commit 2_F && - git checkout 2_q && - git merge --no-ff 2_r -m 2_G && - git merge --no-ff 2_p^ -m 2_H && - git checkout -b 2_s @^^ && git merge --no-ff 2_q -m 2_J && - git checkout 2_p && git merge --no-ff 2_s -m 2_K && - - check_graph <<-\EOF - * 2_K - |\ - | * 2_J - | |\ - | | * 2_H - | | |\ - | | * | 2_G - | |/| | - | | * | 2_F - | * | | 2_E - | |/ / - | * | 2_D - * | | 2_C - | |/ - |/| - * | 2_B - |/ - * 2_A - EOF -' - -test_expect_success 'log --graph with nested right-skewed merge following left-skewed merge' ' - git checkout --orphan 3_p && - test_commit 3_A && - git checkout -b 3_q && - test_commit 3_B && - test_commit 3_C && - git checkout -b 3_r @^ && - test_commit 3_D && - git checkout 3_q && git merge --no-ff 3_r -m 3_E && - git checkout 3_p && git merge --no-ff 3_q -m 3_F && - git checkout 3_r && test_commit 3_G && - git checkout 3_p && git merge --no-ff 3_r -m 3_H && - git checkout @^^ && git merge --no-ff 3_p -m 3_J && - - check_graph <<-\EOF - * 3_J - |\ - | * 3_H - | |\ - | | * 3_G - | * | 3_F - |/| | - | * | 3_E - | |\| - | | * 3_D - | * | 3_C - | |/ - | * 3_B - |/ - * 3_A - EOF -' - -test_expect_success 'log --graph with right-skewed merge following a left-skewed one' ' - git checkout --orphan 4_p && - test_commit 4_A && - test_commit 4_B && - test_commit 4_C && - git checkout -b 4_q @^^ && test_commit 4_D && - git checkout -b 4_r 4_p^ && git merge --no-ff 4_q -m 4_E && - git checkout -b 4_s 4_p^^ && - git merge --no-ff 4_r -m 4_F && - git merge --no-ff 4_p -m 4_G && - git checkout @^^ && git merge --no-ff 4_s -m 4_H && - - check_graph --date-order <<-\EOF - * 4_H - |\ - | * 4_G - | |\ - | * | 4_F - |/| | - | * | 4_E - | |\ \ - | | * | 4_D - | |/ / - |/| | - | | * 4_C - | |/ - | * 4_B - |/ - * 4_A - EOF -' - -test_expect_success 'log --graph with octopus merge with column joining its penultimate parent' ' - git checkout --orphan 5_p && - test_commit 5_A && - git branch 5_q && - git branch 5_r && - test_commit 5_B && - git checkout 5_q && test_commit 5_C && - git checkout 5_r && test_commit 5_D && - git checkout 5_p && - git merge --no-ff 5_q 5_r -m 5_E && - git checkout 5_q && test_commit 5_F && - git checkout -b 5_s 5_p^ && - git merge --no-ff 5_p 5_q -m 5_G && - git checkout 5_r && - git merge --no-ff 5_s -m 5_H && - - check_graph <<-\EOF - * 5_H - |\ - | *-. 5_G - | |\ \ - | | | * 5_F - | | * | 5_E - | |/|\ \ - | |_|/ / - |/| | / - | | |/ - * | | 5_D - | | * 5_C - | |/ - |/| - | * 5_B - |/ - * 5_A - EOF -' - -test_expect_success 'log --graph with multiple tips' ' - git checkout --orphan 6_1 && - test_commit 6_A && - git branch 6_2 && - git branch 6_4 && - test_commit 6_B && - git branch 6_3 && - test_commit 6_C && - git checkout 6_2 && test_commit 6_D && - git checkout 6_3 && test_commit 6_E && - git checkout -b 6_5 6_1 && - git merge --no-ff 6_2 -m 6_F && - git checkout 6_4 && test_commit 6_G && - git checkout 6_3 && - git merge --no-ff 6_4 -m 6_H && - git checkout 6_1 && - git merge --no-ff 6_2 -m 6_I && - - check_graph 6_1 6_3 6_5 <<-\EOF - * 6_I - |\ - | | * 6_H - | | |\ - | | | * 6_G - | | * | 6_E - | | | | * 6_F - | |_|_|/| - |/| | |/ - | | |/| - | |/| | - | * | | 6_D - | | |/ - | |/| - * | | 6_C - | |/ - |/| - * | 6_B - |/ - * 6_A - EOF -' - -test_expect_success 'log --graph with multiple tips and colors' ' - test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && - * 6_I - |\ - | | * 6_H - | | |\ - | | | * 6_G - | | | | * 6_F - | |_|_|/| - |/| | |/ - | | |/| - | |/| | - | | * | 6_E - | * | | 6_D - | | |/ - | |/| - * | | 6_C - | |/ - |/| - * | 6_B - |/ - * 6_A - EOF - lib_test_cmp_colored_graph --date-order --pretty=tformat:%s 6_1 6_3 6_5 -' - -test_expect_success 'log --graph with multiple tips' ' - git checkout --orphan 7_1 && - test_commit 7_A && - test_commit 7_B && - test_commit 7_C && - git checkout -b 7_2 7_1~2 && - test_commit 7_D && - test_commit 7_E && - git checkout -b 7_3 7_1~1 && - test_commit 7_F && - test_commit 7_G && - git checkout -b 7_4 7_2~1 && - test_commit 7_H && - git checkout -b 7_5 7_1~2 && - test_commit 7_I && - git checkout -b 7_6 7_3~1 && - test_commit 7_J && - git checkout -b M_1 7_1 && - git merge --no-ff 7_2 -m 7_M1 && - git checkout -b M_3 7_3 && - git merge --no-ff 7_4 -m 7_M2 && - git checkout -b M_5 7_5 && - git merge --no-ff 7_6 -m 7_M3 && - git checkout -b M_7 7_1 && - git merge --no-ff 7_2 7_3 -m 7_M4 && - - check_graph M_1 M_3 M_5 M_7 <<-\EOF - * 7_M1 - |\ - | | * 7_M2 - | | |\ - | | | * 7_H - | | | | * 7_M3 - | | | | |\ - | | | | | * 7_J - | | | | * | 7_I - | | | | | | * 7_M4 - | |_|_|_|_|/|\ - |/| | | | |/ / - | | |_|_|/| / - | |/| | | |/ - | | | |_|/| - | | |/| | | - | | * | | | 7_G - | | | |_|/ - | | |/| | - | | * | | 7_F - | * | | | 7_E - | | |/ / - | |/| | - | * | | 7_D - | | |/ - | |/| - * | | 7_C - | |/ - |/| - * | 7_B - |/ - * 7_A - EOF -' - -test_done diff --git a/third_party/git/t/t4256-am-format-flowed.sh b/third_party/git/t/t4256-am-format-flowed.sh index 2369c4e17ad8..6340310e9afb 100755 --- a/third_party/git/t/t4256-am-format-flowed.sh +++ b/third_party/git/t/t4256-am-format-flowed.sh @@ -11,7 +11,7 @@ test_expect_success 'setup' ' ' test_expect_success 'am with format=flowed' ' - git am <"$TEST_DIRECTORY/t4256/1/patch" 2>stderr && + git am <"$TEST_DIRECTORY/t4256/1/patch" >stdout 2>stderr && test_i18ngrep "warning: Patch sent with format=flowed" stderr && test_cmp "$TEST_DIRECTORY/t4256/1/mailinfo.c" mailinfo.c ' diff --git a/third_party/git/t/t4300-merge-tree.sh b/third_party/git/t/t4300-merge-tree.sh index e59601e5fe9b..d87cc7d9efde 100755 --- a/third_party/git/t/t4300-merge-tree.sh +++ b/third_party/git/t/t4300-merge-tree.sh @@ -11,16 +11,16 @@ test_expect_success setup ' ' test_expect_success 'file add A, !B' ' - git reset --hard initial && - test_commit "add-a-not-b" "ONE" "AAA" && - git merge-tree initial initial add-a-not-b >actual && - cat >expected <expected <<\EXPECTED && added in remote - their 100644 $(git rev-parse HEAD:ONE) ONE + their 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE @@ -0,0 +1 @@ +AAA EXPECTED + git reset --hard initial && + test_commit "add-a-not-b" "ONE" "AAA" && + git merge-tree initial initial add-a-not-b >actual && test_cmp expected actual ' @@ -41,15 +41,10 @@ test_expect_success 'file add A, B (same)' ' ' test_expect_success 'file add A, B (different)' ' - git reset --hard initial && - test_commit "add-a-b-diff-A" "ONE" "AAA" && - git reset --hard initial && - test_commit "add-a-b-diff-B" "ONE" "BBB" && - git merge-tree initial add-a-b-diff-A add-a-b-diff-B >actual && - cat >expected <expected <<\EXPECTED && added in both - our 100644 $(git rev-parse add-a-b-diff-A:ONE) ONE - their 100644 $(git rev-parse add-a-b-diff-B:ONE) ONE + our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE + their 100644 ba629238ca89489f2b350e196ca445e09d8bb834 ONE @@ -1 +1,5 @@ +<<<<<<< .our AAA @@ -58,6 +53,11 @@ added in both +>>>>>>> .their EXPECTED + git reset --hard initial && + test_commit "add-a-b-diff-A" "ONE" "AAA" && + git reset --hard initial && + test_commit "add-a-b-diff-B" "ONE" "BBB" && + git merge-tree initial add-a-b-diff-A add-a-b-diff-B >actual && test_cmp expected actual ' @@ -69,18 +69,18 @@ test_expect_success 'file change A, !B' ' ' test_expect_success 'file change !A, B' ' - git reset --hard initial && - test_commit "change-not-a-b" "initial-file" "BBB" && - git merge-tree initial initial change-not-a-b >actual && - cat >expected <expected <<\EXPECTED && merged - result 100644 $(git rev-parse change-a-not-b:initial-file) initial-file - our 100644 $(git rev-parse initial:initial-file ) initial-file + result 100644 ba629238ca89489f2b350e196ca445e09d8bb834 initial-file + our 100644 e79c5e8f964493290a409888d5413a737e8e5dd5 initial-file @@ -1 +1 @@ -initial +BBB EXPECTED + git reset --hard initial && + test_commit "change-not-a-b" "initial-file" "BBB" && + git merge-tree initial initial change-not-a-b >actual && test_cmp expected actual ' @@ -94,16 +94,11 @@ test_expect_success 'file change A, B (same)' ' ' test_expect_success 'file change A, B (different)' ' - git reset --hard initial && - test_commit "change-a-b-diff-A" "initial-file" "AAA" && - git reset --hard initial && - test_commit "change-a-b-diff-B" "initial-file" "BBB" && - git merge-tree initial change-a-b-diff-A change-a-b-diff-B >actual && - cat >expected <expected <<\EXPECTED && changed in both - base 100644 $(git rev-parse initial:initial-file ) initial-file - our 100644 $(git rev-parse change-a-b-diff-A:initial-file) initial-file - their 100644 $(git rev-parse change-a-b-diff-B:initial-file) initial-file + base 100644 e79c5e8f964493290a409888d5413a737e8e5dd5 initial-file + our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d initial-file + their 100644 ba629238ca89489f2b350e196ca445e09d8bb834 initial-file @@ -1 +1,5 @@ +<<<<<<< .our AAA @@ -112,10 +107,34 @@ changed in both +>>>>>>> .their EXPECTED + git reset --hard initial && + test_commit "change-a-b-diff-A" "initial-file" "AAA" && + git reset --hard initial && + test_commit "change-a-b-diff-B" "initial-file" "BBB" && + git merge-tree initial change-a-b-diff-A change-a-b-diff-B >actual && test_cmp expected actual ' test_expect_success 'file change A, B (mixed)' ' + cat >expected <<\EXPECTED && +changed in both + base 100644 f4f1f998c7776568c4ff38f516d77fef9399b5a7 ONE + our 100644 af14c2c3475337c73759d561ef70b59e5c731176 ONE + their 100644 372d761493f524d44d59bd24700c3bdf914c973c ONE +@@ -7,7 +7,11 @@ + AAA + AAA + AAA ++<<<<<<< .our + BBB ++======= ++CCC ++>>>>>>> .their + AAA + AAA + AAA +EXPECTED + git reset --hard initial && test_commit "change-a-b-mix-base" "ONE" " AAA @@ -140,26 +159,6 @@ AAA" && "$(sed -e "1{s/AAA/BBB/;}" -e "10{s/AAA/CCC/;}" actual && - - cat >expected <>>>>>> .their - AAA - AAA - AAA -EXPECTED - test_cmp expected actual ' @@ -174,20 +173,20 @@ test_expect_success 'file remove A, !B' ' ' test_expect_success 'file remove !A, B' ' + cat >expected <<\EXPECTED && +removed in remote + base 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE + our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE +@@ -1 +0,0 @@ +-AAA +EXPECTED + git reset --hard initial && test_commit "rm-not-a-b-base" "ONE" "AAA" && git rm ONE && git commit -m "rm-not-a-b" && git tag "rm-not-a-b" && git merge-tree rm-a-not-b-base rm-a-not-b-base rm-a-not-b >actual && - cat >expected <expected <<\EXPECTED && +removed in remote + base 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE + our 100644 ba629238ca89489f2b350e196ca445e09d8bb834 ONE +@@ -1 +0,0 @@ +-BBB +EXPECTED + git reset --hard initial && test_commit "change-a-rm-b-base" "ONE" "AAA" && test_commit "change-a-rm-b-A" "ONE" "BBB" && @@ -211,18 +218,16 @@ test_expect_success 'file change A, remove B' ' git tag "change-a-rm-b-B" && git merge-tree change-a-rm-b-base change-a-rm-b-A change-a-rm-b-B \ >actual && - cat >expected <expected <<\EXPECTED && +removed in local + base 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE + their 100644 ba629238ca89489f2b350e196ca445e09d8bb834 ONE +EXPECTED + git reset --hard initial && test_commit "rm-a-change-b-base" "ONE" "AAA" && @@ -233,11 +238,6 @@ test_expect_success 'file remove A, change B' ' test_commit "rm-a-change-b-B" "ONE" "BBB" && git merge-tree rm-a-change-b-base rm-a-change-b-A rm-a-change-b-B \ >actual && - cat >expected <actual && - cat >expect <<-EOF && + cat >expect <<-\EOF && added in both - our 100644 $(git rev-parse add-tree-a-b-A:sub/file) sub/file - their 100644 $(git rev-parse add-tree-a-b-B:sub/file) sub/file + our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file + their 100644 ba629238ca89489f2b350e196ca445e09d8bb834 sub/file @@ -1 +1,5 @@ +<<<<<<< .our AAA @@ -268,10 +261,24 @@ test_expect_success 'tree add A, B (different)' ' +BBB +>>>>>>> .their EOF + git reset --hard initial && + mkdir sub && + test_commit "add sub/file" "sub/file" "AAA" add-tree-a-b-A && + git reset --hard initial && + mkdir sub && + test_commit "add sub/file" "sub/file" "BBB" add-tree-a-b-B && + git merge-tree initial add-tree-a-b-A add-tree-a-b-B >actual && test_cmp expect actual ' test_expect_success 'tree unchanged A, removed B' ' + cat >expect <<-\EOF && + removed in remote + base 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file + our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file + @@ -1 +0,0 @@ + -AAA + EOF git reset --hard initial && mkdir sub && test_commit "add sub/file" "sub/file" "AAA" tree-remove-b-initial && @@ -280,13 +287,6 @@ test_expect_success 'tree unchanged A, removed B' ' git commit -m "remove sub/file" && git tag tree-remove-b-B && git merge-tree tree-remove-b-initial tree-remove-b-initial tree-remove-b-B >actual && - cat >expect <<-EOF && - removed in remote - base 100644 $(git rev-parse tree-remove-b-initial:sub/file) sub/file - our 100644 $(git rev-parse tree-remove-b-initial:sub/file) sub/file - @@ -1 +0,0 @@ - -AAA - EOF test_cmp expect actual ' @@ -296,14 +296,14 @@ test_expect_success 'turn file to tree' ' mkdir initial-file && test_commit "turn-file-to-tree" "initial-file/ONE" "CCC" && git merge-tree initial initial turn-file-to-tree >actual && - cat >expect <<-EOF && + cat >expect <<-\EOF && added in remote - their 100644 $(git rev-parse turn-file-to-tree:initial-file/ONE) initial-file/ONE + their 100644 43aa4fdec31eb92e1fdc2f0ce6ea9ddb7c32bcf7 initial-file/ONE @@ -0,0 +1 @@ +CCC removed in remote - base 100644 $(git rev-parse initial:initial-file) initial-file - our 100644 $(git rev-parse initial:initial-file) initial-file + base 100644 e79c5e8f964493290a409888d5413a737e8e5dd5 initial-file + our 100644 e79c5e8f964493290a409888d5413a737e8e5dd5 initial-file @@ -1 +0,0 @@ -initial EOF @@ -318,14 +318,14 @@ test_expect_success 'turn tree to file' ' rm -fr dir && test_commit "make-file" "dir" "CCC" && git merge-tree add-tree add-another-tree make-file >actual && - cat >expect <<-EOF && + cat >expect <<-\EOF && removed in remote - base 100644 $(git rev-parse add-tree:dir/path) dir/path - our 100644 $(git rev-parse add-tree:dir/path) dir/path + base 100644 43d5a8ed6ef6c00ff775008633f95787d088285d dir/path + our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d dir/path @@ -1 +0,0 @@ -AAA added in remote - their 100644 $(git rev-parse make-file:dir) dir + their 100644 43aa4fdec31eb92e1fdc2f0ce6ea9ddb7c32bcf7 dir @@ -0,0 +1 @@ +CCC EOF diff --git a/third_party/git/t/t5004-archive-corner-cases.sh b/third_party/git/t/t5004-archive-corner-cases.sh index 3e7b23cb32c5..271eb5a1fdfb 100755 --- a/third_party/git/t/t5004-archive-corner-cases.sh +++ b/third_party/git/t/t5004-archive-corner-cases.sh @@ -204,23 +204,4 @@ test_expect_success EXPENSIVE,LONG_IS_64BIT,UNZIP,UNZIP_ZIP64_SUPPORT,ZIPINFO \ grep $size big.lst ' -build_tree() { - perl -e ' - my $hash = $ARGV[0]; - foreach my $order (2..6) { - $first = 10 ** $order; - foreach my $i (-13..-9) { - my $name = "a" x ($first + $i); - print "100644 blob $hash\t$name\n" - } - } - ' "$1" -} - -test_expect_success 'tar archive with long paths' ' - blob=$(echo foo | git hash-object -w --stdin) && - tree=$(build_tree $blob | git mktree) && - git archive -o long_paths.tar $tree -' - test_done diff --git a/third_party/git/t/t5100-mailinfo.sh b/third_party/git/t/t5100-mailinfo.sh index 147e616533cf..9690dcad4fd5 100755 --- a/third_party/git/t/t5100-mailinfo.sh +++ b/third_party/git/t/t5100-mailinfo.sh @@ -213,19 +213,4 @@ test_expect_failure 'mailinfo -b separated double [PATCH]' ' test z"$subj" = z"Subject: [other] message" ' -test_expect_success 'mailinfo handles unusual header whitespace' ' - git mailinfo /dev/null /dev/null >actual <<-\EOF && - From:Real Name - Subject: extra spaces - EOF - - cat >expect <<-\EOF && - Author: Real Name - Email: user@example.com - Subject: extra spaces - - EOF - test_cmp expect actual -' - test_done diff --git a/third_party/git/t/t5150-request-pull.sh b/third_party/git/t/t5150-request-pull.sh index c1811ea0f412..852dcd913f1e 100755 --- a/third_party/git/t/t5150-request-pull.sh +++ b/third_party/git/t/t5150-request-pull.sh @@ -4,12 +4,6 @@ test_description='Test workflows involving pull request.' . ./test-lib.sh -if ! test_have_prereq PERL -then - skip_all='skipping request-pull tests, perl not available' - test_done -fi - test_expect_success 'setup' ' git init --bare upstream.git && @@ -150,6 +144,7 @@ test_expect_success 'pull request after push' ' git request-pull initial origin master:for-upstream >../request ) && sed -nf read-request.sed digest && + cat digest && { read task && read repository && @@ -178,6 +173,7 @@ test_expect_success 'request asks HEAD to be pulled' ' git request-pull initial "$downstream_url" >../request ) && sed -nf read-request.sed digest && + cat digest && { read task && read repository && diff --git a/third_party/git/t/t5302-pack-index.sh b/third_party/git/t/t5302-pack-index.sh index ad07f2f7fc26..91d51b35f917 100755 --- a/third_party/git/t/t5302-pack-index.sh +++ b/third_party/git/t/t5302-pack-index.sh @@ -6,10 +6,9 @@ test_description='pack index with 64-bit offsets and object CRC' . ./test-lib.sh -test_expect_success 'setup' ' - test_oid_init && - rawsz=$(test_oid rawsz) && - rm -rf .git && +test_expect_success \ + 'setup' \ + 'rm -rf .git && git init && git config pack.threads 1 && i=1 && @@ -33,8 +32,7 @@ test_expect_success 'setup' ' echo $tree && git ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/" } >obj-list && - git update-ref HEAD $commit -' + git update-ref HEAD $commit' test_expect_success \ 'pack-objects with index version 1' \ @@ -159,11 +157,10 @@ test_expect_success \ offs_101=$(index_obj_offset 1.idx $sha1_101) && nr_099=$(index_obj_nr 1.idx $sha1_099) && chmod +w ".git/objects/pack/pack-${pack1}.pack" && - recordsz=$((rawsz + 4)) && dd of=".git/objects/pack/pack-${pack1}.pack" seek=$(($offs_101 + 1)) \ if=".git/objects/pack/pack-${pack1}.idx" \ - skip=$((4 + 256 * 4 + $nr_099 * recordsz)) \ - bs=1 count=$rawsz conv=notrunc && + skip=$((4 + 256 * 4 + $nr_099 * 24)) \ + bs=1 count=20 conv=notrunc && git cat-file blob $sha1_101 > file_101_foo1' test_expect_success \ @@ -203,8 +200,8 @@ test_expect_success \ chmod +w ".git/objects/pack/pack-${pack1}.pack" && dd of=".git/objects/pack/pack-${pack1}.pack" seek=$(($offs_101 + 1)) \ if=".git/objects/pack/pack-${pack1}.idx" \ - skip=$((8 + 256 * 4 + $nr_099 * rawsz)) \ - bs=1 count=$rawsz conv=notrunc && + skip=$((8 + 256 * 4 + $nr_099 * 20)) \ + bs=1 count=20 conv=notrunc && git cat-file blob $sha1_101 > file_101_foo2' test_expect_success \ @@ -229,7 +226,7 @@ test_expect_success \ nr=$(index_obj_nr ".git/objects/pack/pack-${pack1}.idx" $obj) && chmod +w ".git/objects/pack/pack-${pack1}.idx" && printf xxxx | dd of=".git/objects/pack/pack-${pack1}.idx" conv=notrunc \ - bs=1 count=4 seek=$((8 + 256 * 4 + $(wc -l /dev/null || exit 1 done B)' ' @@ -56,13 +62,13 @@ test_expect_success 'index-pack detects REF_DELTA cycles' ' test_must_fail git index-pack --fix-thin --stdin recoverable.pack && pack_trailer recoverable.pack && - test_must_fail git index-pack --fix-thin --stdin expect && - git rev-list --use-bitmap-index --count --objects HEAD >actual && - test_cmp expect actual - ' - - test_expect_success "enumerate commits ($state)" ' - git rev-list --use-bitmap-index HEAD >actual && - git rev-list HEAD >expect && - test_bitmap_traversal --no-confirm-bitmaps expect actual - ' - test_expect_success "enumerate --objects ($state)" ' - git rev-list --objects --use-bitmap-index HEAD >actual && - git rev-list --objects HEAD >expect && - test_bitmap_traversal expect actual + git rev-list --objects --use-bitmap-index HEAD >tmp && + cut -d" " -f1 tmp2 && + sort actual && + git rev-list --objects HEAD >tmp && + cut -d" " -f1 tmp2 && + sort expect && + test_cmp expect actual ' test_expect_success "bitmap --objects handles non-commit objects ($state)" ' @@ -107,20 +99,6 @@ test_expect_success 'clone from bitmapped repository' ' test_cmp expect actual ' -test_expect_success 'partial clone from bitmapped repository' ' - test_config uploadpack.allowfilter true && - git clone --no-local --bare --filter=blob:none . partial-clone.git && - ( - cd partial-clone.git && - pack=$(echo objects/pack/*.pack) && - git verify-pack -v "$pack" >have && - awk "/blob/ { print \$1 }" blobs && - # we expect this single blob because of the direct ref - git rev-parse refs/tags/tagged-blob >expect && - test_cmp expect blobs - ) -' - test_expect_success 'setup further non-bitmapped commits' ' test_commit_bulk --id=further 10 ' diff --git a/third_party/git/t/t5313-pack-bounds-checks.sh b/third_party/git/t/t5313-pack-bounds-checks.sh index 2a4557efc2d6..f1708d415e55 100755 --- a/third_party/git/t/t5313-pack-bounds-checks.sh +++ b/third_party/git/t/t5313-pack-bounds-checks.sh @@ -38,27 +38,16 @@ munge () { # for the initial, and another ofs(4*nr) past that for the extended. # ofs_table () { - echo $((4 + 4 + 4*256 + $(test_oid rawsz)*$1 + 4*$1)) + echo $((4 + 4 + 4*256 + 20*$1 + 4*$1)) } extended_table () { echo $(($(ofs_table "$1") + 4*$1)) } -test_expect_success 'setup' ' - test_oid_init && - test_oid_cache <<-EOF - oid000 sha1:1485 - oid000 sha256:4222 - - oidfff sha1:74 - oidfff sha256:1350 - EOF -' - test_expect_success 'set up base packfile and variables' ' # the hash of this content starts with ff, which # makes some later computations much simpler - echo $(test_oid oidfff) >file && + echo 74 >file && git add file && git commit -m base && git repack -ad && @@ -151,10 +140,10 @@ test_expect_success 'bogus offset inside v2 extended table' ' # an extended table (if the first object were larger than 2^31). # # Note that the value is important here. We want $object as - # the second entry in sorted-hash order. The hash of this object starts + # the second entry in sorted-sha1 order. The sha1 of 1485 starts # with "000", which sorts before that of $object (which starts # with "fff"). - second=$(test_oid oid000 | git hash-object -w --stdin) && + second=$(echo 1485 | git hash-object -w --stdin) && do_pack "$object $second" --index-version=2 && # We have to make extra room for the table, so we cannot diff --git a/third_party/git/t/t5314-pack-cycle-detection.sh b/third_party/git/t/t5314-pack-cycle-detection.sh index 0aec8619e22d..e525466de098 100755 --- a/third_party/git/t/t5314-pack-cycle-detection.sh +++ b/third_party/git/t/t5314-pack-cycle-detection.sh @@ -53,7 +53,7 @@ immediately after the lookup for "dummy". -# Create a pack containing the tree $1 and blob $1:file, with +# Create a pack containing the the tree $1 and blob $1:file, with # the latter stored as a delta against $2:file. # # We convince pack-objects to make the delta in the direction of our choosing diff --git a/third_party/git/t/t5317-pack-objects-filter-objects.sh b/third_party/git/t/t5317-pack-objects-filter-objects.sh index dc0446574b3f..2d2f5d0229ce 100755 --- a/third_party/git/t/t5317-pack-objects-filter-objects.sh +++ b/third_party/git/t/t5317-pack-objects-filter-objects.sh @@ -45,7 +45,12 @@ test_expect_success 'verify blob:none packfile has no blobs' ' git -C r1 index-pack ../filter.pack && git -C r1 verify-pack -v ../filter.pack >verify_result && - ! grep blob verify_result + grep blob verify_result | + awk -f print_1.awk | + sort >observed && + + nr=$(wc -l r5/foo && git -C r5 add foo && git -C r5 commit -m "foo" && - git -C r5 rev-parse HEAD^{tree} >tree && - del=$(sed "s|..|&/|" tree) && + del=$(git -C r5 rev-parse HEAD^{tree} | sed "s|..|&/|") && rm r5/.git/objects/$del && test_must_fail git -C r5 pack-objects --revs --stdout 2>bad_tree <<-EOF && HEAD @@ -144,7 +148,12 @@ test_expect_success 'verify blob:limit=500 omits all blobs' ' git -C r2 index-pack ../filter.pack && git -C r2 verify-pack -v ../filter.pack >verify_result && - ! grep blob verify_result + grep blob verify_result | + awk -f print_1.awk | + sort >observed && + + nr=$(wc -l verify_result && - ! grep blob verify_result + grep blob verify_result | + awk -f print_1.awk | + sort >observed && + + nr=$(wc -l expected && - echo HEAD >objects && - git -C r2 rev-parse HEAD:large.10000 >>objects && - git -C r2 pack-objects --revs --stdout --filter=blob:limit=1k filter.pack && + git -C r2 pack-objects --revs --stdout --filter=blob:limit=1k >filter.pack <<-EOF && + HEAD + $(git -C r2 rev-parse HEAD:large.10000) + EOF git -C r2 index-pack ../filter.pack && git -C r2 verify-pack -v ../filter.pack >verify_result && @@ -362,8 +377,7 @@ test_expect_success 'verify sparse:oid=OID' ' awk -f print_2.awk ls_files_result | sort >expected && - git -C r4 ls-files -s pattern >staged && - oid=$(awk -f print_2.awk staged) && + oid=$(git -C r4 ls-files -s pattern | awk -f print_2.awk) && git -C r4 pack-objects --revs --stdout --filter=sparse:oid=$oid >filter.pack <<-EOF && HEAD EOF diff --git a/third_party/git/t/t5318-commit-graph.sh b/third_party/git/t/t5318-commit-graph.sh index 9bf920ae1716..22cb9d664304 100755 --- a/third_party/git/t/t5318-commit-graph.sh +++ b/third_party/git/t/t5318-commit-graph.sh @@ -19,14 +19,15 @@ test_expect_success 'verify graph with no graph file' ' test_expect_success 'write graph with no packs' ' cd "$TRASH_DIRECTORY/full" && - git commit-graph write --object-dir $objdir && - test_path_is_missing $objdir/info/commit-graph + git commit-graph write --object-dir . && + test_path_is_missing info/commit-graph ' -test_expect_success 'exit with correct error on bad input to --stdin-packs' ' +test_expect_success 'close with correct error on bad input' ' cd "$TRASH_DIRECTORY/full" && echo doesnotexist >in && - test_expect_code 1 git commit-graph write --stdin-packs stderr && + { git commit-graph write --stdin-packs stderr; ret=$?; } && + test "$ret" = 1 && test_i18ngrep "error adding pack" stderr ' @@ -40,15 +41,6 @@ test_expect_success 'create commits and repack' ' git repack ' -test_expect_success 'exit with correct error on bad input to --stdin-commits' ' - cd "$TRASH_DIRECTORY/full" && - echo HEAD | test_expect_code 1 git commit-graph write --stdin-commits 2>stderr && - test_i18ngrep "invalid commit object id" stderr && - # valid tree OID, but not a commit OID - git rev-parse HEAD^{tree} | test_expect_code 1 git commit-graph write --stdin-commits 2>stderr && - test_i18ngrep "invalid commit object id" stderr -' - graph_git_two_modes() { git -c core.commitGraph=true $1 >output git -c core.commitGraph=false $1 >expect @@ -85,7 +77,7 @@ graph_read_expect() { num_commits: $1 chunks: oid_fanout oid_lookup commit_metadata$OPTIONAL EOF - test-tool read-graph >output && + git commit-graph read >output && test_cmp expect output } @@ -124,42 +116,6 @@ test_expect_success 'Add more commits' ' git repack ' -test_expect_success 'commit-graph write progress off for redirected stderr' ' - cd "$TRASH_DIRECTORY/full" && - git commit-graph write 2>err && - test_line_count = 0 err -' - -test_expect_success 'commit-graph write force progress on for stderr' ' - cd "$TRASH_DIRECTORY/full" && - GIT_PROGRESS_DELAY=0 git commit-graph write --progress 2>err && - test_file_not_empty err -' - -test_expect_success 'commit-graph write with the --no-progress option' ' - cd "$TRASH_DIRECTORY/full" && - git commit-graph write --no-progress 2>err && - test_line_count = 0 err -' - -test_expect_success 'commit-graph verify progress off for redirected stderr' ' - cd "$TRASH_DIRECTORY/full" && - git commit-graph verify 2>err && - test_line_count = 0 err -' - -test_expect_success 'commit-graph verify force progress on for stderr' ' - cd "$TRASH_DIRECTORY/full" && - GIT_PROGRESS_DELAY=0 git commit-graph verify --progress 2>err && - test_file_not_empty err -' - -test_expect_success 'commit-graph verify with the --no-progress option' ' - cd "$TRASH_DIRECTORY/full" && - git commit-graph verify --no-progress 2>err && - test_line_count = 0 err -' - # Current graph structure: # # __M3___ @@ -481,7 +437,7 @@ test_expect_success 'detect bad version' ' ' test_expect_success 'detect bad hash version' ' - corrupt_graph_and_verify $GRAPH_BYTE_HASH "\03" \ + corrupt_graph_and_verify $GRAPH_BYTE_HASH "\02" \ "hash version" ' @@ -621,47 +577,4 @@ test_expect_success 'get_commit_tree_in_graph works for non-the_repository' ' test_cmp expect actual ' -test_expect_success 'corrupt commit-graph write (broken parent)' ' - rm -rf repo && - git init repo && - ( - cd repo && - empty="$(git mktree broken <<-EOF && - tree $empty - parent $ZERO_OID - author whatever 1234 -0000 - committer whatever 1234 -0000 - - broken commit - EOF - broken="$(git hash-object -w -t commit --literally broken)" && - git commit-tree -p "$broken" -m "good commit" "$empty" >good && - test_must_fail git commit-graph write --stdin-commits \ - test_err && - test_i18ngrep "unable to parse commit" test_err - ) -' - -test_expect_success 'corrupt commit-graph write (missing tree)' ' - rm -rf repo && - git init repo && - ( - cd repo && - tree="$(git mktree broken <<-EOF && - parent $ZERO_OID - author whatever 1234 -0000 - committer whatever 1234 -0000 - - broken commit - EOF - broken="$(git hash-object -w -t commit --literally broken)" && - git commit-tree -p "$broken" -m "good" "$tree" >good && - test_must_fail git commit-graph write --stdin-commits \ - test_err && - test_i18ngrep "unable to parse commit" test_err - ) -' - test_done diff --git a/third_party/git/t/t5319-multi-pack-index.sh b/third_party/git/t/t5319-multi-pack-index.sh index 43a7a66c9d1b..c72ca0439993 100755 --- a/third_party/git/t/t5319-multi-pack-index.sh +++ b/third_party/git/t/t5319-multi-pack-index.sh @@ -28,20 +28,6 @@ midx_read_expect () { test_cmp expect actual } -test_expect_success 'setup' ' - test_oid_init && - test_oid_cache <<-EOF - idxoff sha1:2999 - idxoff sha256:3739 - - packnameoff sha1:652 - packnameoff sha256:940 - - fanoutoff sha1:1 - fanoutoff sha256:3 - EOF -' - test_expect_success 'write midx with no packs' ' test_when_finished rm -f pack/multi-pack-index && git multi-pack-index --object-dir=. write && @@ -161,21 +147,6 @@ test_expect_success 'write midx with two packs' ' compare_results_with_midx "two packs" -test_expect_success 'write progress off for redirected stderr' ' - git multi-pack-index --object-dir=$objdir write 2>err && - test_line_count = 0 err -' - -test_expect_success 'write force progress on for stderr' ' - git multi-pack-index --object-dir=$objdir --progress write 2>err && - test_file_not_empty err -' - -test_expect_success 'write with the --no-progress option' ' - git multi-pack-index --object-dir=$objdir --no-progress write 2>err && - test_line_count = 0 err -' - test_expect_success 'add more packs' ' for j in $(test_seq 11 20) do @@ -198,21 +169,6 @@ test_expect_success 'verify multi-pack-index success' ' git multi-pack-index verify --object-dir=$objdir ' -test_expect_success 'verify progress off for redirected stderr' ' - git multi-pack-index verify --object-dir=$objdir 2>err && - test_line_count = 0 err -' - -test_expect_success 'verify force progress on for stderr' ' - git multi-pack-index verify --object-dir=$objdir --progress 2>err && - test_file_not_empty err -' - -test_expect_success 'verify with the --no-progress option' ' - git multi-pack-index verify --object-dir=$objdir --no-progress 2>err && - test_line_count = 0 err -' - # usage: corrupt_midx_and_verify corrupt_midx_and_verify() { POS=$1 && @@ -239,7 +195,7 @@ test_expect_success 'verify bad signature' ' "multi-pack-index signature" ' -HASH_LEN=$(test_oid rawsz) +HASH_LEN=20 NUM_OBJECTS=74 MIDX_BYTE_VERSION=4 MIDX_BYTE_OID_VERSION=5 @@ -252,9 +208,9 @@ MIDX_CHUNK_LOOKUP_WIDTH=12 MIDX_OFFSET_PACKNAMES=$(($MIDX_HEADER_SIZE + \ $MIDX_NUM_CHUNKS * $MIDX_CHUNK_LOOKUP_WIDTH)) MIDX_BYTE_PACKNAME_ORDER=$(($MIDX_OFFSET_PACKNAMES + 2)) -MIDX_OFFSET_OID_FANOUT=$(($MIDX_OFFSET_PACKNAMES + $(test_oid packnameoff))) +MIDX_OFFSET_OID_FANOUT=$(($MIDX_OFFSET_PACKNAMES + 652)) MIDX_OID_FANOUT_WIDTH=4 -MIDX_BYTE_OID_FANOUT_ORDER=$((MIDX_OFFSET_OID_FANOUT + 250 * $MIDX_OID_FANOUT_WIDTH + $(test_oid fanoutoff))) +MIDX_BYTE_OID_FANOUT_ORDER=$((MIDX_OFFSET_OID_FANOUT + 250 * $MIDX_OID_FANOUT_WIDTH + 1)) MIDX_OFFSET_OID_LOOKUP=$(($MIDX_OFFSET_OID_FANOUT + 256 * $MIDX_OID_FANOUT_WIDTH)) MIDX_BYTE_OID_LOOKUP=$(($MIDX_OFFSET_OID_LOOKUP + 16 * $HASH_LEN)) MIDX_OFFSET_OBJECT_OFFSETS=$(($MIDX_OFFSET_OID_LOOKUP + $NUM_OBJECTS * $HASH_LEN)) @@ -318,31 +274,16 @@ test_expect_success 'verify incorrect pack-int-id' ' ' test_expect_success 'verify incorrect offset' ' - corrupt_midx_and_verify $MIDX_BYTE_OFFSET "\377" $objdir \ + corrupt_midx_and_verify $MIDX_BYTE_OFFSET "\07" $objdir \ "incorrect object offset" ' test_expect_success 'git-fsck incorrect offset' ' - corrupt_midx_and_verify $MIDX_BYTE_OFFSET "\377" $objdir \ + corrupt_midx_and_verify $MIDX_BYTE_OFFSET "\07" $objdir \ "incorrect object offset" \ "git -c core.multipackindex=true fsck" ' -test_expect_success 'repack progress off for redirected stderr' ' - git multi-pack-index --object-dir=$objdir repack 2>err && - test_line_count = 0 err -' - -test_expect_success 'repack force progress on for stderr' ' - git multi-pack-index --object-dir=$objdir --progress repack 2>err && - test_file_not_empty err -' - -test_expect_success 'repack with the --no-progress option' ' - git multi-pack-index --object-dir=$objdir --no-progress repack 2>err && - test_line_count = 0 err -' - test_expect_success 'repack removes multi-pack-index' ' test_path_is_file $objdir/pack/multi-pack-index && GIT_TEST_MULTI_PACK_INDEX=0 git repack -adf && @@ -401,7 +342,7 @@ test_expect_success 'force some 64-bit offsets with pack-objects' ' pack64=$(git pack-objects --index-version=2,0x40 objects64/pack/test-64 err && - test_line_count = 0 err - ) -' - -test_expect_success 'expire force progress on for stderr' ' - ( - cd dup && - git multi-pack-index --progress expire 2>err && - test_file_not_empty err - ) -' - -test_expect_success 'expire with the --no-progress option' ' - ( - cd dup && - git multi-pack-index --no-progress expire 2>err && - test_line_count = 0 err - ) -' - test_expect_success 'expire removes unreferenced packs' ' ( cd dup && diff --git a/third_party/git/t/t5321-pack-large-objects.sh b/third_party/git/t/t5321-pack-large-objects.sh index 8a56d98a0e88..a75eab87d361 100755 --- a/third_party/git/t/t5321-pack-large-objects.sh +++ b/third_party/git/t/t5321-pack-large-objects.sh @@ -10,8 +10,8 @@ test_description='git pack-object with "large" deltas . "$TEST_DIRECTORY"/lib-pack.sh # Two similar-ish objects that we have computed deltas between. -A=$(test_oid packlib_7_0) -B=$(test_oid packlib_7_76) +A=01d7713666f4de822776c7622c10f1b07de280dc +B=e68fe8129b546b101aee9510c5328e7f21ca1d18 test_expect_success 'setup' ' clear_packs && diff --git a/third_party/git/t/t5324-split-commit-graph.sh b/third_party/git/t/t5324-split-commit-graph.sh index 53b2e6b4555d..99f4ef4c19df 100755 --- a/third_party/git/t/t5324-split-commit-graph.sh +++ b/third_party/git/t/t5324-split-commit-graph.sh @@ -8,17 +8,9 @@ GIT_TEST_COMMIT_GRAPH=0 test_expect_success 'setup repo' ' git init && git config core.commitGraph true && - git config gc.writeCommitGraph false && infodir=".git/objects/info" && graphdir="$infodir/commit-graphs" && - test_oid_init && - test_oid_cache <<-EOM - shallow sha1:1760 - shallow sha256:2064 - - base sha1:1376 - base sha256:1496 - EOM + test_oid_init ' graph_read_expect() { @@ -32,7 +24,7 @@ graph_read_expect() { num_commits: $1 chunks: oid_fanout oid_lookup commit_metadata EOF - test-tool read-graph >output && + git commit-graph read >output && test_cmp expect output } @@ -255,7 +247,7 @@ test_expect_success 'verify hashes along chain, even in shallow' ' cd verify && git commit-graph verify && base_file=$graphdir/graph-$(head -n 1 $graphdir/commit-graph-chain).graph && - corrupt_file "$base_file" $(test_oid shallow) "\01" && + corrupt_file "$base_file" 1760 "\01" && test_must_fail git commit-graph verify --shallow 2>test_err && grep -v "^+" test_err >err && test_i18ngrep "incorrect checksum" err @@ -282,7 +274,7 @@ test_expect_success 'warn on base graph chunk incorrect' ' cd base-chunk && git commit-graph verify && base_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph && - corrupt_file "$base_file" $(test_oid base) "\01" && + corrupt_file "$base_file" 1376 "\01" && git commit-graph verify --shallow 2>test_err && grep -v "^+" test_err >err && test_i18ngrep "commit-graph chain does not match" err @@ -327,7 +319,7 @@ test_expect_success 'add octopus merge' ' git merge commits/3 commits/4 && git branch merge/octopus && git commit-graph write --reachable --split && - git commit-graph verify --progress 2>err && + git commit-graph verify 2>err && test_line_count = 3 err && test_i18ngrep ! warning err && test_line_count = 3 $graphdir/commit-graph-chain @@ -342,7 +334,6 @@ test_expect_success 'split across alternate where alternate is not split' ' git clone --no-hardlinks . alt-split && ( cd alt-split && - rm -f .git/objects/info/commit-graph && echo "$(pwd)"/../.git/objects >.git/objects/info/alternates && test_commit 18 && git commit-graph write --reachable --split && diff --git a/third_party/git/t/t5400-send-pack.sh b/third_party/git/t/t5400-send-pack.sh index b84618c925fe..571d620aedba 100755 --- a/third_party/git/t/t5400-send-pack.sh +++ b/third_party/git/t/t5400-send-pack.sh @@ -288,7 +288,7 @@ test_expect_success 'receive-pack de-dupes .have lines' ' $shared .have EOF - GIT_TRACE_PACKET=$(pwd)/trace GIT_TEST_PROTOCOL_VERSION=0 \ + GIT_TRACE_PACKET=$(pwd)/trace GIT_TEST_PROTOCOL_VERSION= \ git push \ --receive-pack="unset GIT_TRACE_PACKET; git-receive-pack" \ fork HEAD:foo && diff --git a/third_party/git/t/t5407-post-rewrite-hook.sh b/third_party/git/t/t5407-post-rewrite-hook.sh index 80750a817e95..7344253bfbbc 100755 --- a/third_party/git/t/t5407-post-rewrite-hook.sh +++ b/third_party/git/t/t5407-post-rewrite-hook.sh @@ -53,10 +53,10 @@ test_expect_success 'git commit --amend --no-post-rewrite' ' test ! -f post-rewrite.data ' -test_expect_success 'git rebase --apply' ' +test_expect_success 'git rebase' ' git reset --hard D && clear_hook_input && - test_must_fail git rebase --apply --onto A B && + test_must_fail git rebase --onto A B && echo C > foo && git add foo && git rebase --continue && @@ -68,10 +68,10 @@ test_expect_success 'git rebase --apply' ' verify_hook_input ' -test_expect_success 'git rebase --apply --skip' ' +test_expect_success 'git rebase --skip' ' git reset --hard D && clear_hook_input && - test_must_fail git rebase --apply --onto A B && + test_must_fail git rebase --onto A B && test_must_fail git rebase --skip && echo D > foo && git add foo && @@ -84,10 +84,10 @@ test_expect_success 'git rebase --apply --skip' ' verify_hook_input ' -test_expect_success 'git rebase --apply --skip the last one' ' +test_expect_success 'git rebase --skip the last one' ' git reset --hard F && clear_hook_input && - test_must_fail git rebase --apply --onto D A && + test_must_fail git rebase --onto D A && git rebase --skip && echo rebase >expected.args && cat >expected.data <<-EOF && @@ -128,7 +128,7 @@ test_expect_success 'git rebase -m --skip' ' verify_hook_input ' -test_expect_success 'git rebase with implicit use of merge backend' ' +test_expect_success 'git rebase with implicit use of interactive backend' ' git reset --hard D && clear_hook_input && test_must_fail git rebase --keep-empty --onto A B && @@ -143,7 +143,7 @@ test_expect_success 'git rebase with implicit use of merge backend' ' verify_hook_input ' -test_expect_success 'git rebase --skip with implicit use of merge backend' ' +test_expect_success 'git rebase --skip with implicit use of interactive backend' ' git reset --hard D && clear_hook_input && test_must_fail git rebase --keep-empty --onto A B && diff --git a/third_party/git/t/t5409-colorize-remote-messages.sh b/third_party/git/t/t5409-colorize-remote-messages.sh index 5d8f401d8ece..2a8c44966185 100755 --- a/third_party/git/t/t5409-colorize-remote-messages.sh +++ b/third_party/git/t/t5409-colorize-remote-messages.sh @@ -56,13 +56,14 @@ test_expect_success 'short line' ' test_expect_success 'case-insensitive' ' git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/case-insensitive 2>output && + cat output && test_decode_color decoded && grep "error: error" decoded && grep "ERROR: also highlighted" decoded ' test_expect_success 'leading space' ' - git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/leading-space 2>output && + git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/leading-space 2>output && cat output && test_decode_color decoded && grep " error: leading space" decoded ' diff --git a/third_party/git/t/t5500-fetch-pack.sh b/third_party/git/t/t5500-fetch-pack.sh index baa1a99f45f8..1c71c0ec770c 100755 --- a/third_party/git/t/t5500-fetch-pack.sh +++ b/third_party/git/t/t5500-fetch-pack.sh @@ -440,12 +440,11 @@ test_expect_success 'setup tests for the --stdin parameter' ' ' test_expect_success 'setup fetch refs from cmdline v[12]' ' - cp -r client client0 && cp -r client client1 && cp -r client client2 ' -for version in '' 0 1 2 +for version in '' 1 2 do test_expect_success "protocol.version=$version fetch refs from cmdline" " ( @@ -639,7 +638,7 @@ test_expect_success 'fetch-pack cannot fetch a raw sha1 that is not advertised a git init client && # Some protocol versions (e.g. 2) support fetching # unadvertised objects, so restrict this test to v0. - test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 git -C client fetch-pack ../server \ + test_must_fail env GIT_TEST_PROTOCOL_VERSION= git -C client fetch-pack ../server \ $(git -C server rev-parse refs/heads/master^) 2>err && test_i18ngrep "Server does not allow request for unadvertised object" err ' @@ -709,22 +708,13 @@ do # file with scheme for p in file do - test_expect_success !MINGW "fetch-pack --diag-url $p://$h/$r" ' + test_expect_success "fetch-pack --diag-url $p://$h/$r" ' check_prot_path $p://$h/$r $p "/$r" ' - test_expect_success MINGW "fetch-pack --diag-url $p://$h/$r" ' - check_prot_path $p://$h/$r $p "//$h/$r" - ' - test_expect_success MINGW "fetch-pack --diag-url $p:///$r" ' - check_prot_path $p:///$r $p "/$r" - ' # No "/~" -> "~" conversion for file - test_expect_success !MINGW "fetch-pack --diag-url $p://$h/~$r" ' + test_expect_success "fetch-pack --diag-url $p://$h/~$r" ' check_prot_path $p://$h/~$r $p "/~$r" ' - test_expect_success MINGW "fetch-pack --diag-url $p://$h/~$r" ' - check_prot_path $p://$h/~$r $p "//$h/~$r" - ' done # file without scheme for h in nohost nohost:12 [::1] [::1]:23 [ [:aa @@ -793,44 +783,6 @@ test_expect_success 'clone shallow since selects no commits' ' ) ' -# A few subtle things about the request in this test: -# -# - the server must have commit-graphs present and enabled -# -# - the history is such that our want/have share a common ancestor ("base" -# here) -# -# - we send only a single have, which is fewer than a normal client would -# send. This ensures that we don't parse "base" up front with -# parse_object(), but rather traverse to it as a parent while deciding if we -# can stop the "have" negotiation, and call parse_commit(). The former -# sees the actual object data and so always loads the three oid, whereas the -# latter will try to load it lazily. -# -# - we must use protocol v2, because it handles the "have" negotiation before -# processing the shallow directives -# -test_expect_success 'shallow since with commit graph and already-seen commit' ' - test_create_repo shallow-since-graph && - ( - cd shallow-since-graph && - test_commit base && - test_commit master && - git checkout -b other HEAD^ && - test_commit other && - git commit-graph write --reachable && - git config core.commitGraph true && - - GIT_PROTOCOL=version=2 git upload-pack . <<-EOF >/dev/null - 0012command=fetch - 00010013deepen-since 1 - 0032want $(git rev-parse other) - 0032have $(git rev-parse master) - 0000 - EOF - ) -' - test_expect_success 'shallow clone exclude tag two' ' test_create_repo shallow-exclude && ( @@ -918,10 +870,7 @@ test_expect_success 'filtering by size' ' git -C client fetch-pack --filter=blob:limit=0 ../server HEAD && # Ensure that object is not inadvertently fetched - commit=$(git -C server rev-parse HEAD) && - blob=$(git hash-object server/one.t) && - git -C client rev-list --objects --missing=allow-any "$commit" >oids && - ! grep "$blob" oids + test_must_fail git -C client cat-file -e $(git hash-object server/one.t) ' test_expect_success 'filtering by size has no effect if support for it is not advertised' ' @@ -933,10 +882,7 @@ test_expect_success 'filtering by size has no effect if support for it is not ad git -C client fetch-pack --filter=blob:limit=0 ../server HEAD 2> err && # Ensure that object is fetched - commit=$(git -C server rev-parse HEAD) && - blob=$(git hash-object server/one.t) && - git -C client rev-list --objects --missing=allow-any "$commit" >oids && - grep "$blob" oids && + git -C client cat-file -e $(git hash-object server/one.t) && test_i18ngrep "filtering not recognized by server" err ' @@ -958,11 +904,9 @@ fetch_filter_blob_limit_zero () { git -C client fetch --filter=blob:limit=0 origin HEAD:somewhere && # Ensure that commit is fetched, but blob is not - commit=$(git -C "$SERVER" rev-parse two) && - blob=$(git hash-object server/two.t) && - git -C client rev-list --objects --missing=allow-any "$commit" >oids && - grep "$commit" oids && - ! grep "$blob" oids + test_config -C client extensions.partialclone "arbitrary string" && + git -C client cat-file -e $(git -C "$SERVER" rev-parse two) && + test_must_fail git -C client cat-file -e $(git hash-object "$SERVER/two.t") } test_expect_success 'fetch with --filter=blob:limit=0' ' @@ -976,7 +920,4 @@ test_expect_success 'fetch with --filter=blob:limit=0 and HTTP' ' fetch_filter_blob_limit_zero "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server" ' -# DO NOT add non-httpd-specific tests here, because the last part of this -# test script is only executed when httpd is available and enabled. - test_done diff --git a/third_party/git/t/t5504-fetch-receive-strict.sh b/third_party/git/t/t5504-fetch-receive-strict.sh index 645b4c78d356..fdfe179b1188 100755 --- a/third_party/git/t/t5504-fetch-receive-strict.sh +++ b/third_party/git/t/t5504-fetch-receive-strict.sh @@ -4,7 +4,6 @@ test_description='fetch/receive strict mode' . ./test-lib.sh test_expect_success 'setup and inject "corrupt or missing" object' ' - test_oid_init && echo hello >greetings && git add greetings && git commit -m greetings && @@ -145,11 +144,11 @@ test_expect_success 'fsck with no skipList input' ' test_expect_success 'setup sorted and unsorted skipLists' ' cat >SKIP.unsorted <<-EOF && - $(test_oid 004) - $(test_oid 002) + 0000000000000000000000000000000000000004 + 0000000000000000000000000000000000000002 $commit - $(test_oid 001) - $(test_oid 003) + 0000000000000000000000000000000000000001 + 0000000000000000000000000000000000000003 EOF sort SKIP.unsorted >SKIP.sorted ' @@ -173,14 +172,14 @@ test_expect_success 'fsck with invalid or bogus skipList input' ' test_expect_success 'fsck with other accepted skipList input (comments & empty lines)' ' cat >SKIP.with-comment <<-EOF && # Some bad commit - $(test_oid 001) + 0000000000000000000000000000000000000001 EOF test_must_fail git -c fsck.skipList=SKIP.with-comment fsck 2>err-with-comment && test_i18ngrep "missingEmail" err-with-comment && cat >SKIP.with-empty-line <<-EOF && - $(test_oid 001) + 0000000000000000000000000000000000000001 - $(test_oid 002) + 0000000000000000000000000000000000000002 EOF test_must_fail git -c fsck.skipList=SKIP.with-empty-line fsck 2>err-with-empty-line && test_i18ngrep "missingEmail" err-with-empty-line @@ -205,7 +204,7 @@ test_expect_success 'fsck with exhaustive accepted skipList input (various types echo " # Comment after whitespace" >>SKIP.exhaustive && echo "$commit # Our bad commit (with leading whitespace and trailing comment)" >>SKIP.exhaustive && echo "# Some bad commit (leading whitespace)" >>SKIP.exhaustive && - echo " $(test_oid 001)" >>SKIP.exhaustive && + echo " 0000000000000000000000000000000000000001" >>SKIP.exhaustive && git -c fsck.skipList=SKIP.exhaustive fsck 2>err && test_must_be_empty err ' diff --git a/third_party/git/t/t5505-remote.sh b/third_party/git/t/t5505-remote.sh index dda81b7d07a2..883b32efa024 100755 --- a/third_party/git/t/t5505-remote.sh +++ b/third_party/git/t/t5505-remote.sh @@ -734,53 +734,15 @@ test_expect_success 'reject adding remote with an invalid name' ' # the last two ones check if the config is updated. test_expect_success 'rename a remote' ' - test_config_global remote.pushDefault origin && git clone one four && ( cd four && - git config branch.master.pushRemote origin && git remote rename origin upstream && test -z "$(git for-each-ref refs/remotes/origin)" && test "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/master" && test "$(git rev-parse upstream/master)" = "$(git rev-parse master)" && test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*" && - test "$(git config branch.master.remote)" = "upstream" && - test "$(git config branch.master.pushRemote)" = "upstream" && - test "$(git config --global remote.pushDefault)" = "origin" - ) -' - -test_expect_success 'rename a remote renames repo remote.pushDefault' ' - git clone one four.1 && - ( - cd four.1 && - git config remote.pushDefault origin && - git remote rename origin upstream && - test "$(git config --local remote.pushDefault)" = "upstream" - ) -' - -test_expect_success 'rename a remote renames repo remote.pushDefault but ignores global' ' - test_config_global remote.pushDefault other && - git clone one four.2 && - ( - cd four.2 && - git config remote.pushDefault origin && - git remote rename origin upstream && - test "$(git config --global remote.pushDefault)" = "other" && - test "$(git config --local remote.pushDefault)" = "upstream" - ) -' - -test_expect_success 'rename a remote renames repo remote.pushDefault but keeps global' ' - test_config_global remote.pushDefault origin && - git clone one four.3 && - ( - cd four.3 && - git config remote.pushDefault origin && - git remote rename origin upstream && - test "$(git config --global remote.pushDefault)" = "origin" && - test "$(git config --local remote.pushDefault)" = "upstream" + test "$(git config branch.master.remote)" = "upstream" ) ' @@ -822,54 +784,6 @@ test_expect_success 'rename succeeds with existing remote..prune' ' git -C four.four remote rename origin upstream ' -test_expect_success 'remove a remote' ' - test_config_global remote.pushDefault origin && - git clone one four.five && - ( - cd four.five && - git config branch.master.pushRemote origin && - git remote remove origin && - test -z "$(git for-each-ref refs/remotes/origin)" && - test_must_fail git config branch.master.remote && - test_must_fail git config branch.master.pushRemote && - test "$(git config --global remote.pushDefault)" = "origin" - ) -' - -test_expect_success 'remove a remote removes repo remote.pushDefault' ' - git clone one four.five.1 && - ( - cd four.five.1 && - git config remote.pushDefault origin && - git remote remove origin && - test_must_fail git config --local remote.pushDefault - ) -' - -test_expect_success 'remove a remote removes repo remote.pushDefault but ignores global' ' - test_config_global remote.pushDefault other && - git clone one four.five.2 && - ( - cd four.five.2 && - git config remote.pushDefault origin && - git remote remove origin && - test "$(git config --global remote.pushDefault)" = "other" && - test_must_fail git config --local remote.pushDefault - ) -' - -test_expect_success 'remove a remote removes repo remote.pushDefault but keeps global' ' - test_config_global remote.pushDefault origin && - git clone one four.five.3 && - ( - cd four.five.3 && - git config remote.pushDefault origin && - git remote remove origin && - test "$(git config --global remote.pushDefault)" = "origin" && - test_must_fail git config --local remote.pushDefault - ) -' - cat >remotes_origin <verify.out && - test "$2" = $(grep "^$OID_REGEX " verify.out | wc -l) + test "$2" = $(grep '^[0-9a-f]\{40\} ' verify.out | wc -l) } convert_bundle_to_pack () { @@ -174,30 +174,6 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec' git rev-parse sometag ' -test_expect_success '--refmap="" ignores configured refspec' ' - cd "$TRASH_DIRECTORY" && - git clone "$D" remote-refs && - git -C remote-refs rev-parse remotes/origin/master >old && - git -C remote-refs update-ref refs/remotes/origin/master master~1 && - git -C remote-refs rev-parse remotes/origin/master >new && - git -C remote-refs fetch --refmap= origin "+refs/heads/*:refs/hidden/origin/*" && - git -C remote-refs rev-parse remotes/origin/master >actual && - test_cmp new actual && - git -C remote-refs fetch origin && - git -C remote-refs rev-parse remotes/origin/master >actual && - test_cmp old actual -' - -test_expect_success '--refmap="" and --prune' ' - git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch master && - git -C remote-refs update-ref refs/hidden/foo/otherbranch master && - git -C remote-refs fetch --prune --refmap="" origin +refs/heads/*:refs/hidden/* && - git -C remote-refs rev-parse remotes/origin/foo/otherbranch && - test_must_fail git -C remote-refs rev-parse refs/hidden/foo/otherbranch && - git -C remote-refs fetch --prune origin && - test_must_fail git -C remote-refs rev-parse remotes/origin/foo/otherbranch -' - test_expect_success 'fetch tags when there is no tags' ' cd "$D" && @@ -285,10 +261,9 @@ test_expect_success 'create bundle 1' ' ' test_expect_success 'header of bundle looks right' ' - head -n 4 "$D"/bundle1 && head -n 1 "$D"/bundle1 | grep "^#" && - head -n 2 "$D"/bundle1 | grep "^-$OID_REGEX " && - head -n 3 "$D"/bundle1 | grep "^$OID_REGEX " && + head -n 2 "$D"/bundle1 | grep "^-[0-9a-f]\{40\} " && + head -n 3 "$D"/bundle1 | grep "^[0-9a-f]\{40\} " && head -n 4 "$D"/bundle1 | grep "^$" ' @@ -314,7 +289,7 @@ test_expect_success 'bundle 1 has only 3 files ' ' test_expect_success 'unbundle 2' ' cd "$D/bundle" && git fetch ../bundle2 master:master && - test "tip" = "$(git log -1 --pretty=oneline master | cut -d" " -f2)" + test "tip" = "$(git log -1 --pretty=oneline master | cut -b42-)" ' test_expect_success 'bundle does not prerequisite objects' ' @@ -379,6 +354,7 @@ test_expect_success 'fetch from GIT URL with a non-applying branch..merge # the strange name is: a\!'b test_expect_success 'quoting of a strangely named repo' ' test_must_fail git fetch "a\\!'\''b" > result 2>&1 && + cat result && grep "fatal: '\''a\\\\!'\''b'\''" result ' @@ -594,35 +570,6 @@ test_expect_success 'LHS of refspec follows ref disambiguation rules' ' ) ' -test_expect_success 'fetch.writeCommitGraph' ' - git clone three write && - ( - cd three && - test_commit new - ) && - ( - cd write && - git -c fetch.writeCommitGraph fetch origin && - test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain - ) -' - -test_expect_success 'fetch.writeCommitGraph with submodules' ' - git clone dups super && - ( - cd super && - git submodule add "file://$TRASH_DIRECTORY/three" && - git commit -m "add submodule" - ) && - git clone "super" super-clone && - ( - cd super-clone && - rm -rf .git/objects/info && - git -c fetch.writeCommitGraph=true fetch origin && - test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain - ) -' - # configured prune tests set_config_tristate () { @@ -955,29 +902,6 @@ test_expect_success C_LOCALE_OUTPUT 'fetch compact output' ' test_cmp expect actual ' -test_expect_success '--no-show-forced-updates' ' - mkdir forced-updates && - ( - cd forced-updates && - git init && - test_commit 1 && - test_commit 2 - ) && - git clone forced-updates forced-update-clone && - git clone forced-updates no-forced-update-clone && - git -C forced-updates reset --hard HEAD~1 && - ( - cd forced-update-clone && - git fetch --show-forced-updates origin 2>output && - test_i18ngrep "(forced update)" output - ) && - ( - cd no-forced-update-clone && - git fetch --no-show-forced-updates origin 2>output && - test_i18ngrep ! "(forced update)" output - ) -' - setup_negotiation_tip () { SERVER="$1" URL="$2" @@ -1054,7 +978,27 @@ test_expect_success '--negotiation-tip limits "have" lines sent with HTTP protoc check_negotiation_tip ' -# DO NOT add non-httpd-specific tests here, because the last part of this -# test script is only executed when httpd is available and enabled. +test_expect_success '--no-show-forced-updates' ' + mkdir forced-updates && + ( + cd forced-updates && + git init && + test_commit 1 && + test_commit 2 + ) && + git clone forced-updates forced-update-clone && + git clone forced-updates no-forced-update-clone && + git -C forced-updates reset --hard HEAD~1 && + ( + cd forced-update-clone && + git fetch --show-forced-updates origin 2>output && + test_i18ngrep "(forced update)" output + ) && + ( + cd no-forced-update-clone && + git fetch --no-show-forced-updates origin 2>output && + ! test_i18ngrep "(forced update)" output + ) +' test_done diff --git a/third_party/git/t/t5512-ls-remote.sh b/third_party/git/t/t5512-ls-remote.sh index 04b35402c7aa..43e1d8d4d2a4 100755 --- a/third_party/git/t/t5512-ls-remote.sh +++ b/third_party/git/t/t5512-ls-remote.sh @@ -225,50 +225,49 @@ test_expect_success 'ls-remote --symref' ' EOF # Protocol v2 supports sending symrefs for refs other than HEAD, so use # protocol v0 here. - GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref >actual && + GIT_TEST_PROTOCOL_VERSION= git ls-remote --symref >actual && test_cmp expect actual ' test_expect_success 'ls-remote with filtered symref (refname)' ' - rev=$(git rev-parse HEAD) && - cat >expect <<-EOF && + cat >expect <<-\EOF && ref: refs/heads/master HEAD - $rev HEAD + 1bd44cb9d13204b0fe1958db0082f5028a16eb3a HEAD EOF # Protocol v2 supports sending symrefs for refs other than HEAD, so use # protocol v0 here. - GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref . HEAD >actual && + GIT_TEST_PROTOCOL_VERSION= git ls-remote --symref . HEAD >actual && test_cmp expect actual ' test_expect_failure 'ls-remote with filtered symref (--heads)' ' git symbolic-ref refs/heads/foo refs/tags/mark && - cat >expect <<-EOF && + cat >expect <<-\EOF && ref: refs/tags/mark refs/heads/foo - $rev refs/heads/foo - $rev refs/heads/master + 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/heads/foo + 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/heads/master EOF # Protocol v2 supports sending symrefs for refs other than HEAD, so use # protocol v0 here. - GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref --heads . >actual && + GIT_TEST_PROTOCOL_VERSION= git ls-remote --symref --heads . >actual && test_cmp expect actual ' test_expect_success 'ls-remote --symref omits filtered-out matches' ' - cat >expect <<-EOF && - $rev refs/heads/foo - $rev refs/heads/master + cat >expect <<-\EOF && + 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/heads/foo + 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/heads/master EOF # Protocol v2 supports sending symrefs for refs other than HEAD, so use # protocol v0 here. - GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref --heads . >actual && + GIT_TEST_PROTOCOL_VERSION= git ls-remote --symref --heads . >actual && test_cmp expect actual && - GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref . "refs/heads/*" >actual && + GIT_TEST_PROTOCOL_VERSION= git ls-remote --symref . "refs/heads/*" >actual && test_cmp expect actual ' test_lazy_prereq GIT_DAEMON ' - test_bool_env GIT_TEST_GIT_DAEMON true + git env--helper --type=bool --default=true --exit-code GIT_TEST_GIT_DAEMON ' # This test spawns a daemon, so run it only if the user would be OK with diff --git a/third_party/git/t/t5514-fetch-multiple.sh b/third_party/git/t/t5514-fetch-multiple.sh index de8e2f15319b..5426d4b5abb4 100755 --- a/third_party/git/t/t5514-fetch-multiple.sh +++ b/third_party/git/t/t5514-fetch-multiple.sh @@ -183,15 +183,4 @@ test_expect_success 'git fetch --all --tags' ' test_cmp expect test8/output ' -test_expect_success 'parallel' ' - git remote add one ./bogus1 && - git remote add two ./bogus2 && - - test_must_fail env GIT_TRACE="$PWD/trace" \ - git fetch --jobs=2 --multiple one two 2>err && - grep "preparing to run up to 2 tasks" trace && - test_i18ngrep "could not fetch .one.*128" err && - test_i18ngrep "could not fetch .two.*128" err -' - test_done diff --git a/third_party/git/t/t5515-fetch-merge-logic.sh b/third_party/git/t/t5515-fetch-merge-logic.sh index 9d6a46ff56c9..e55d8474efb6 100755 --- a/third_party/git/t/t5515-fetch-merge-logic.sh +++ b/third_party/git/t/t5515-fetch-merge-logic.sh @@ -8,60 +8,18 @@ test_description='Merge logic in fetch' # NEEDSWORK: If the overspecification of the expected result is reduced, we # might be able to run this test in all protocol versions. -GIT_TEST_PROTOCOL_VERSION=0 -export GIT_TEST_PROTOCOL_VERSION +GIT_TEST_PROTOCOL_VERSION= . ./test-lib.sh -build_script () { - script="$1" && - for i in one three_file master master2 one_tree three two two2 three2 - do - echo "s/$(test_oid --hash=sha1 "$i")/$(test_oid "$i")/g" >>"$script" - done -} - -convert_expected () { - file="$1" && - script="$2" && - sed -f "$script" "$file" >"$file.tmp" && - mv "$file.tmp" "$file" -} +LF=' +' test_expect_success setup ' GIT_AUTHOR_DATE="2006-06-26 00:00:00 +0000" && GIT_COMMITTER_DATE="2006-06-26 00:00:00 +0000" && export GIT_AUTHOR_DATE GIT_COMMITTER_DATE && - test_oid_cache <<-EOF && - one sha1:8e32a6d901327a23ef831511badce7bf3bf46689 - one sha256:8739546433ab1ac72ee93088dce611210effee072b2b586ceac6dde43ebec9ce - - three_file sha1:0e3b14047d3ee365f4f2a1b673db059c3972589c - three_file sha256:bc4447d50c07497a8bfe6eef817f2364ecca9d471452e43b52756cc1a908bd32 - - master sha1:6c9dec2b923228c9ff994c6cfe4ae16c12408dc5 - master sha256:8521c3072461fcfe8f32d67f95cc6e6b832a2db2fa29769ffc788bce85ebcd75 - - one_tree sha1:22feea448b023a2d864ef94b013735af34d238ba - one_tree sha256:6e4743f4ef2356b881dda5e91f5c7cdffe870faf350bf7b312f80a20935f5d83 - - three sha1:c61a82b60967180544e3c19f819ddbd0c9f89899 - three sha256:0cc6d1eda617ded715170786e31ba4e2d0185404ec5a3508dd0d73b324860c6a - - two sha1:525b7fb068d59950d185a8779dc957c77eed73ba - two sha256:3b21de3440cd38c2a9e9b464adb923f7054949ed4c918e1a0ac4c95cd52774db - - master2 sha1:754b754407bf032e9a2f9d5a9ad05ca79a6b228f - master2 sha256:6c7abaea8a6d8ef4d89877e68462758dc6774690fbbbb0e6d7dd57415c9abde0 - - two2 sha1:6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 - two2 sha256:87a2d3ee29c83a3dc7afd41c0606b11f67603120b910a7be7840accdc18344d4 - - three2 sha1:0567da4d5edd2ff4bb292a465ba9e64dcad9536b - three2 sha256:cceb3e8eca364fa9a0a39a1efbebecacc664af86cbbd8070571f5faeb5f0e8c3 - EOF - echo >file original && git add file && git commit -a -m One && @@ -131,8 +89,7 @@ test_expect_success setup ' git config branch.br-$remote-octopus.remote $remote && git config branch.br-$remote-octopus.merge refs/heads/one && git config --add branch.br-$remote-octopus.merge two - done && - build_script sed_script + done ' # Merge logic depends on branch properties and Pull: or .fetch lines @@ -183,10 +140,6 @@ do actual_r="$pfx-refs.$test" test_expect_success "$cmd" ' - cp "$expect_f" expect_f && - convert_expected expect_f sed_script && - cp "$expect_r" expect_r && - convert_expected expect_r sed_script && { echo "# $cmd" set x $cmd; shift @@ -202,18 +155,18 @@ do cat .git/FETCH_HEAD } >"$actual_f" && git show-ref >"$actual_r" && - if test -f "expect_f" + if test -f "$expect_f" then - test_cmp "expect_f" "$actual_f" && + test_cmp "$expect_f" "$actual_f" && rm -f "$actual_f" else # this is to help developing new tests. cp "$actual_f" "$expect_f" false fi && - if test -f "expect_r" + if test -f "$expect_r" then - test_cmp "expect_r" "$actual_r" && + test_cmp "$expect_r" "$actual_r" && rm -f "$actual_r" else # this is to help developing new tests. diff --git a/third_party/git/t/t5516-fetch-push.sh b/third_party/git/t/t5516-fetch-push.sh index 9ff041a093e7..c81ca360ac4a 100755 --- a/third_party/git/t/t5516-fetch-push.sh +++ b/third_party/git/t/t5516-fetch-push.sh @@ -1151,7 +1151,7 @@ test_expect_success 'fetch exact SHA1' ' # unadvertised objects, so restrict this test to v0. # fetching the hidden object should fail by default - test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err && test_i18ngrep "Server does not allow request for unadvertised object" err && test_must_fail git rev-parse --verify refs/heads/copy && @@ -1210,7 +1210,7 @@ do cd shallow && # Some protocol versions (e.g. 2) support fetching # unadvertised objects, so restrict this test to v0. - test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ git fetch --depth=1 ../testrepo/.git $SHA1 && git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true && git fetch --depth=1 ../testrepo/.git $SHA1 && @@ -1241,9 +1241,9 @@ do cd shallow && # Some protocol versions (e.g. 2) support fetching # unadvertised objects, so restrict this test to v0. - test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ git fetch ../testrepo/.git $SHA1_3 && - test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ git fetch ../testrepo/.git $SHA1_1 && git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true && git fetch ../testrepo/.git $SHA1_1 && @@ -1251,7 +1251,7 @@ do test_must_fail git cat-file commit $SHA1_2 && git fetch ../testrepo/.git $SHA1_2 && git cat-file commit $SHA1_2 && - test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ git fetch ../testrepo/.git $SHA1_3 2>err && test_i18ngrep "remote error:.*not our ref.*$SHA1_3\$" err ) @@ -1291,7 +1291,7 @@ test_expect_success 'peeled advertisements are not considered ref tips' ' git -C testrepo commit --allow-empty -m two && git -C testrepo tag -m foo mytag HEAD^ && oid=$(git -C testrepo rev-parse mytag^{commit}) && - test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ git fetch testrepo $oid 2>err && test_i18ngrep "Server does not allow request for unadvertised object" err ' @@ -1712,15 +1712,4 @@ test_expect_success 'updateInstead with push-to-checkout hook' ' ) ' -test_expect_success 'denyCurrentBranch and worktrees' ' - git worktree add new-wt && - git clone . cloned && - test_commit -C cloned first && - test_config receive.denyCurrentBranch refuse && - test_must_fail git -C cloned push origin HEAD:new-wt && - test_config receive.denyCurrentBranch updateInstead && - git -C cloned push origin HEAD:new-wt && - test_must_fail git -C cloned push --delete origin new-wt -' - test_done diff --git a/third_party/git/t/t5517-push-mirror.sh b/third_party/git/t/t5517-push-mirror.sh index e4edd56404fe..c05a661400c1 100755 --- a/third_party/git/t/t5517-push-mirror.sh +++ b/third_party/git/t/t5517-push-mirror.sh @@ -265,14 +265,4 @@ test_expect_success 'remote.foo.mirror=no has no effect' ' ' -test_expect_success 'push to mirrored repository with refspec fails' ' - mk_repo_pair && - ( - cd master && - echo one >foo && git add foo && git commit -m one && - git config --add remote.up.mirror true && - test_must_fail git push up master - ) -' - test_done diff --git a/third_party/git/t/t5520-pull.sh b/third_party/git/t/t5520-pull.sh index 2f86fca0428c..cf4cc32fd0eb 100755 --- a/third_party/git/t/t5520-pull.sh +++ b/third_party/git/t/t5520-pull.sh @@ -5,7 +5,7 @@ test_description='pulling into void' . ./test-lib.sh modify () { - sed -e "$1" "$2" >"$2.x" && + sed -e "$1" <"$2" >"$2.x" && mv "$2.x" "$2" } @@ -15,10 +15,8 @@ test_pull_autostash () { git add new_file && git pull "$@" . copy && test_cmp_rev HEAD^ copy && - echo dirty >expect && - test_cmp expect new_file && - echo "modified again" >expect && - test_cmp expect file + test "$(cat new_file)" = dirty && + test "$(cat file)" = "modified again" } test_pull_autostash_fail () { @@ -41,8 +39,8 @@ test_expect_success 'pulling into void' ' cd cloned && git pull .. ) && - test_path_is_file file && - test_path_is_file cloned/file && + test -f file && + test -f cloned/file && test_cmp file cloned/file ' @@ -52,8 +50,8 @@ test_expect_success 'pulling into void using master:master' ' cd cloned-uho && git pull .. master:master ) && - test_path_is_file file && - test_path_is_file cloned-uho/file && + test -f file && + test -f cloned-uho/file && test_cmp file cloned-uho/file ' @@ -101,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' ' ( cd cloned-octopus && test_must_fail git pull .. master master && - test_path_is_missing file + ! test -f file ) ' @@ -112,11 +110,9 @@ test_expect_success 'test . as a remote' ' echo updated >file && git commit -a -m updated && git checkout copy && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && git pull && - echo updated >expect && - test_cmp expect file && + test "$(cat file)" = updated && git reflog -1 >reflog.actual && sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy && echo "OBJID HEAD@{0}: pull: Fast-forward" >reflog.expected && @@ -129,11 +125,9 @@ test_expect_success 'the default remote . should not break explicit pull' ' git commit -a -m modified && git checkout copy && git reset --hard HEAD^ && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && git pull . second && - echo modified >expect && - test_cmp expect file && + test "$(cat file)" = modified && git reflog -1 >reflog.actual && sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy && echo "OBJID HEAD@{0}: pull . second: Fast-forward" >reflog.expected && @@ -143,11 +137,10 @@ test_expect_success 'the default remote . should not break explicit pull' ' test_expect_success 'fail if wildcard spec does not match any refs' ' git checkout -b test copy^ && test_when_finished "git checkout -f copy && git branch -D test" && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && test_must_fail git pull . "refs/nonexisting1/*:refs/nonexisting2/*" 2>err && test_i18ngrep "no candidates for merging" err && - test_cmp expect file + test "$(cat file)" = file ' test_expect_success 'fail if no branches specified with non-default remote' ' @@ -155,12 +148,11 @@ test_expect_success 'fail if no branches specified with non-default remote' ' test_when_finished "git remote remove test_remote" && git checkout -b test copy^ && test_when_finished "git checkout -f copy && git branch -D test" && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && test_config branch.test.remote origin && test_must_fail git pull test_remote 2>err && test_i18ngrep "specify a branch on the command line" err && - test_cmp expect file + test "$(cat file)" = file ' test_expect_success 'fail if not on a branch' ' @@ -168,11 +160,10 @@ test_expect_success 'fail if not on a branch' ' test_when_finished "git remote remove origin" && git checkout HEAD^ && test_when_finished "git checkout -f copy" && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && test_must_fail git pull 2>err && test_i18ngrep "not currently on a branch" err && - test_cmp expect file + test "$(cat file)" = file ' test_expect_success 'fail if no configuration for current branch' ' @@ -181,11 +172,10 @@ test_expect_success 'fail if no configuration for current branch' ' git checkout -b test copy^ && test_when_finished "git checkout -f copy && git branch -D test" && test_config branch.test.remote test_remote && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && test_must_fail git pull 2>err && test_i18ngrep "no tracking information" err && - test_cmp expect file + test "$(cat file)" = file ' test_expect_success 'pull --all: fail if no configuration for current branch' ' @@ -194,11 +184,10 @@ test_expect_success 'pull --all: fail if no configuration for current branch' ' git checkout -b test copy^ && test_when_finished "git checkout -f copy && git branch -D test" && test_config branch.test.remote test_remote && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && test_must_fail git pull --all 2>err && test_i18ngrep "There is no tracking information" err && - test_cmp expect file + test "$(cat file)" = file ' test_expect_success 'fail if upstream branch does not exist' ' @@ -206,31 +195,26 @@ test_expect_success 'fail if upstream branch does not exist' ' test_when_finished "git checkout -f copy && git branch -D test" && test_config branch.test.remote . && test_config branch.test.merge refs/heads/nonexisting && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && test_must_fail git pull 2>err && test_i18ngrep "no such ref was fetched" err && - test_cmp expect file + test "$(cat file)" = file ' test_expect_success 'fail if the index has unresolved entries' ' git checkout -b third second^ && test_when_finished "git checkout -f copy && git branch -D third" && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && test_commit modified2 file && - git ls-files -u >unmerged && - test_must_be_empty unmerged && + test -z "$(git ls-files -u)" && test_must_fail git pull . second && - git ls-files -u >unmerged && - test_file_not_empty unmerged && + test -n "$(git ls-files -u)" && cp file expected && test_must_fail git pull . second 2>err && test_i18ngrep "Pulling is not possible because you have unmerged files." err && test_cmp expected file && git add file && - git ls-files -u >unmerged && - test_must_be_empty unmerged && + test -z "$(git ls-files -u)" && test_must_fail git pull . second 2>err && test_i18ngrep "You have not concluded your merge" err && test_cmp expected file @@ -239,66 +223,47 @@ test_expect_success 'fail if the index has unresolved entries' ' test_expect_success 'fast-forwards working tree if branch head is updated' ' git checkout -b third second^ && test_when_finished "git checkout -f copy && git branch -D third" && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && git pull . second:third 2>err && test_i18ngrep "fetch updated the current branch head" err && - echo modified >expect && - test_cmp expect file && - test_cmp_rev third second + test "$(cat file)" = modified && + test "$(git rev-parse third)" = "$(git rev-parse second)" ' test_expect_success 'fast-forward fails with conflicting work tree' ' git checkout -b third second^ && test_when_finished "git checkout -f copy && git branch -D third" && - echo file >expect && - test_cmp expect file && + test "$(cat file)" = file && echo conflict >file && test_must_fail git pull . second:third 2>err && test_i18ngrep "Cannot fast-forward your working tree" err && - echo conflict >expect && - test_cmp expect file && - test_cmp_rev third second + test "$(cat file)" = conflict && + test "$(git rev-parse third)" = "$(git rev-parse second)" ' test_expect_success '--rebase' ' git branch to-rebase && - echo modified again >file && + echo modified again > file && git commit -m file file && git checkout to-rebase && - echo new >file2 && + echo new > file2 && git add file2 && git commit -m "new file" && git tag before-rebase && git pull --rebase . copy && - test_cmp_rev HEAD^ copy && - echo new >expect && - git show HEAD:file2 >actual && - test_cmp expect actual + test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && + test new = "$(git show HEAD:file2)" ' -test_expect_success '--rebase (merge) fast forward' ' +test_expect_success '--rebase fast forward' ' git reset --hard before-rebase && git checkout -b ff && echo another modification >file && git commit -m third file && git checkout to-rebase && - git -c rebase.backend=merge pull --rebase . ff && - test_cmp_rev HEAD ff && - - # The above only validates the result. Did we actually bypass rebase? - git reflog -1 >reflog.actual && - sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy && - echo "OBJID HEAD@{0}: pull --rebase . ff: Fast-forward" >reflog.expected && - test_cmp reflog.expected reflog.fuzzy -' - -test_expect_success '--rebase (am) fast forward' ' - git reset --hard before-rebase && - - git -c rebase.backend=apply pull --rebase . ff && - test_cmp_rev HEAD ff && + git pull --rebase . ff && + test "$(git rev-parse HEAD)" = "$(git rev-parse ff)" && # The above only validates the result. Did we actually bypass rebase? git reflog -1 >reflog.actual && @@ -322,7 +287,7 @@ test_expect_success '--rebase --autostash fast forward' ' git checkout behind && echo dirty >file && git pull --rebase --autostash . to-rebase-ff && - test_cmp_rev HEAD to-rebase-ff + test "$(git rev-parse HEAD)" = "$(git rev-parse to-rebase-ff)" ' test_expect_success '--rebase with conflicts shows advice' ' @@ -340,7 +305,7 @@ test_expect_success '--rebase with conflicts shows advice' ' test_tick && git commit -m "Create conflict" seq.txt && test_must_fail git pull --rebase . seq 2>err >out && - test_i18ngrep "Resolve all conflicts manually" err + test_i18ngrep "Resolve all conflicts manually" out ' test_expect_success 'failed --rebase shows advice' ' @@ -354,17 +319,15 @@ test_expect_success 'failed --rebase shows advice' ' git checkout -f -b fails-to-rebase HEAD^ && test_commit v2-without-cr file "2" file2-lf && test_must_fail git pull --rebase . diverging 2>err >out && - test_i18ngrep "Resolve all conflicts manually" err + test_i18ngrep "Resolve all conflicts manually" out ' test_expect_success '--rebase fails with multiple branches' ' git reset --hard before-rebase && test_must_fail git pull --rebase . copy master 2>err && - test_cmp_rev HEAD before-rebase && + test "$(git rev-parse HEAD)" = "$(git rev-parse before-rebase)" && test_i18ngrep "Cannot rebase onto multiple branches" err && - echo modified >expect && - git show HEAD:file >actual && - test_cmp expect actual + test modified = "$(git show HEAD:file)" ' test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' ' @@ -414,10 +377,8 @@ test_expect_success 'pull.rebase' ' git reset --hard before-rebase && test_config pull.rebase true && git pull . copy && - test_cmp_rev HEAD^ copy && - echo new >expect && - git show HEAD:file2 >actual && - test_cmp expect actual + test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && + test new = "$(git show HEAD:file2)" ' test_expect_success 'pull --autostash & pull.rebase=true' ' @@ -434,10 +395,8 @@ test_expect_success 'branch.to-rebase.rebase' ' git reset --hard before-rebase && test_config branch.to-rebase.rebase true && git pull . copy && - test_cmp_rev HEAD^ copy && - echo new >expect && - git show HEAD:file2 >actual && - test_cmp expect actual + test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && + test new = "$(git show HEAD:file2)" ' test_expect_success 'branch.to-rebase.rebase should override pull.rebase' ' @@ -445,29 +404,23 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' ' test_config pull.rebase true && test_config branch.to-rebase.rebase false && git pull . copy && - test_cmp_rev ! HEAD^ copy && - echo new >expect && - git show HEAD:file2 >actual && - test_cmp expect actual + test "$(git rev-parse HEAD^)" != "$(git rev-parse copy)" && + test new = "$(git show HEAD:file2)" ' -test_expect_success 'pull --rebase warns on --verify-signatures' ' +test_expect_success "pull --rebase warns on --verify-signatures" ' git reset --hard before-rebase && git pull --rebase --verify-signatures . copy 2>err && - test_cmp_rev HEAD^ copy && - echo new >expect && - git show HEAD:file2 >actual && - test_cmp expect actual && + test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && + test new = "$(git show HEAD:file2)" && test_i18ngrep "ignoring --verify-signatures for rebase" err ' -test_expect_success 'pull --rebase does not warn on --no-verify-signatures' ' +test_expect_success "pull --rebase does not warn on --no-verify-signatures" ' git reset --hard before-rebase && git pull --rebase --no-verify-signatures . copy 2>err && - test_cmp_rev HEAD^ copy && - echo new >expect && - git show HEAD:file2 >actual && - test_cmp expect actual && + test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && + test new = "$(git show HEAD:file2)" && test_i18ngrep ! "verify-signatures" err ' @@ -487,31 +440,25 @@ test_expect_success 'pull.rebase=false create a new merge commit' ' git reset --hard before-preserve-rebase && test_config pull.rebase false && git pull . copy && - test_cmp_rev HEAD^1 before-preserve-rebase && - test_cmp_rev HEAD^2 copy && - echo file3 >expect && - git show HEAD:file3.t >actual && - test_cmp expect actual + test "$(git rev-parse HEAD^1)" = "$(git rev-parse before-preserve-rebase)" && + test "$(git rev-parse HEAD^2)" = "$(git rev-parse copy)" && + test file3 = "$(git show HEAD:file3.t)" ' test_expect_success 'pull.rebase=true flattens keep-merge' ' git reset --hard before-preserve-rebase && test_config pull.rebase true && git pull . copy && - test_cmp_rev HEAD^^ copy && - echo file3 >expect && - git show HEAD:file3.t >actual && - test_cmp expect actual + test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && + test file3 = "$(git show HEAD:file3.t)" ' test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' ' git reset --hard before-preserve-rebase && test_config pull.rebase 1 && git pull . copy && - test_cmp_rev HEAD^^ copy && - echo file3 >expect && - git show HEAD:file3.t >actual && - test_cmp expect actual + test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && + test file3 = "$(git show HEAD:file3.t)" ' test_expect_success REBASE_P \ @@ -519,8 +466,8 @@ test_expect_success REBASE_P \ git reset --hard before-preserve-rebase && test_config pull.rebase preserve && git pull . copy && - test_cmp_rev HEAD^^ copy && - test_cmp_rev HEAD^2 keep-merge + test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && + test "$(git rev-parse HEAD^2)" = "$(git rev-parse keep-merge)" ' test_expect_success 'pull.rebase=interactive' ' @@ -531,8 +478,7 @@ test_expect_success 'pull.rebase=interactive' ' test_set_editor "$TRASH_DIRECTORY/fake-editor" && test_when_finished "test_might_fail git rebase --abort" && test_must_fail git pull --rebase=interactive . copy && - echo "I was here" >expect && - test_cmp expect fake.out + test "I was here" = "$(cat fake.out)" ' test_expect_success 'pull --rebase=i' ' @@ -543,35 +489,30 @@ test_expect_success 'pull --rebase=i' ' test_set_editor "$TRASH_DIRECTORY/fake-editor" && test_when_finished "test_might_fail git rebase --abort" && test_must_fail git pull --rebase=i . copy && - echo "I was here, too" >expect && - test_cmp expect fake.out + test "I was here, too" = "$(cat fake.out)" ' test_expect_success 'pull.rebase=invalid fails' ' git reset --hard before-preserve-rebase && test_config pull.rebase invalid && - test_must_fail git pull . copy + ! git pull . copy ' test_expect_success '--rebase=false create a new merge commit' ' git reset --hard before-preserve-rebase && test_config pull.rebase true && git pull --rebase=false . copy && - test_cmp_rev HEAD^1 before-preserve-rebase && - test_cmp_rev HEAD^2 copy && - echo file3 >expect && - git show HEAD:file3.t >actual && - test_cmp expect actual + test "$(git rev-parse HEAD^1)" = "$(git rev-parse before-preserve-rebase)" && + test "$(git rev-parse HEAD^2)" = "$(git rev-parse copy)" && + test file3 = "$(git show HEAD:file3.t)" ' test_expect_success '--rebase=true rebases and flattens keep-merge' ' git reset --hard before-preserve-rebase && test_config pull.rebase preserve && git pull --rebase=true . copy && - test_cmp_rev HEAD^^ copy && - echo file3 >expect && - git show HEAD:file3.t >actual && - test_cmp expect actual + test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && + test file3 = "$(git show HEAD:file3.t)" ' test_expect_success REBASE_P \ @@ -579,62 +520,58 @@ test_expect_success REBASE_P \ git reset --hard before-preserve-rebase && test_config pull.rebase true && git pull --rebase=preserve . copy && - test_cmp_rev HEAD^^ copy && - test_cmp_rev HEAD^2 keep-merge + test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && + test "$(git rev-parse HEAD^2)" = "$(git rev-parse keep-merge)" ' test_expect_success '--rebase=invalid fails' ' git reset --hard before-preserve-rebase && - test_must_fail git pull --rebase=invalid . copy + ! git pull --rebase=invalid . copy ' test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' ' git reset --hard before-preserve-rebase && test_config pull.rebase preserve && git pull --rebase . copy && - test_cmp_rev HEAD^^ copy && - echo file3 >expect && - git show HEAD:file3.t >actual && - test_cmp expect actual + test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && + test file3 = "$(git show HEAD:file3.t)" ' test_expect_success '--rebase with rebased upstream' ' + git remote add -f me . && git checkout copy && git tag copy-orig && git reset --hard HEAD^ && - echo conflicting modification >file && + echo conflicting modification > file && git commit -m conflict file && git checkout to-rebase && - echo file >file2 && + echo file > file2 && git commit -m to-rebase file2 && git tag to-rebase-orig && git pull --rebase me copy && - echo "conflicting modification" >expect && - test_cmp expect file && - echo file >expect && - test_cmp expect file2 + test "conflicting modification" = "$(cat file)" && + test file = "$(cat file2)" + ' test_expect_success '--rebase -f with rebased upstream' ' test_when_finished "test_might_fail git rebase --abort" && git reset --hard to-rebase-orig && git pull --rebase -f me copy && - echo "conflicting modification" >expect && - test_cmp expect file && - echo file >expect && - test_cmp expect file2 + test "conflicting modification" = "$(cat file)" && + test file = "$(cat file2)" ' test_expect_success '--rebase with rebased default upstream' ' + git update-ref refs/remotes/me/copy copy-orig && git checkout --track -b to-rebase2 me/copy && git reset --hard to-rebase-orig && git pull --rebase && - echo "conflicting modification" >expect && - test_cmp expect file && - echo file >expect && - test_cmp expect file2 + test "conflicting modification" = "$(cat file)" && + test file = "$(cat file2)" + ' test_expect_success 'rebased upstream + fetch + pull --rebase' ' @@ -645,14 +582,13 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' ' git reset --hard to-rebase-orig && git fetch && git pull --rebase && - echo "conflicting modification" >expect && - test_cmp expect file && - echo file >expect && - test_cmp expect file2 + test "conflicting modification" = "$(cat file)" && + test file = "$(cat file2)" ' test_expect_success 'pull --rebase dies early with dirty working directory' ' + git checkout to-rebase && git update-ref refs/remotes/me/copy copy^ && COPY="$(git rev-parse --verify me/copy)" && @@ -660,23 +596,23 @@ test_expect_success 'pull --rebase dies early with dirty working directory' ' test_config branch.to-rebase.remote me && test_config branch.to-rebase.merge refs/heads/copy && test_config branch.to-rebase.rebase true && - echo dirty >>file && + echo dirty >> file && git add file && test_must_fail git pull && - test_cmp_rev "$COPY" me/copy && + test "$COPY" = "$(git rev-parse --verify me/copy)" && git checkout HEAD -- file && git pull && - test_cmp_rev ! "$COPY" me/copy + test "$COPY" != "$(git rev-parse --verify me/copy)" + ' test_expect_success 'pull --rebase works on branch yet to be born' ' git rev-parse master >expect && mkdir empty_repo && - ( - cd empty_repo && - git init && - git pull --rebase .. master && - git rev-parse HEAD >../actual + (cd empty_repo && + git init && + git pull --rebase .. master && + git rev-parse HEAD >../actual ) && test_cmp expect actual ' @@ -688,14 +624,10 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' ' cd empty_repo2 && echo staged-file >staged-file && git add staged-file && - echo staged-file >expect && - git ls-files >actual && - test_cmp expect actual && + test "$(git ls-files)" = staged-file && test_must_fail git pull --rebase .. master 2>err && - git ls-files >actual && - test_cmp expect actual && - git show :staged-file >actual && - test_cmp expect actual && + test "$(git ls-files)" = staged-file && + test "$(git show :staged-file)" = staged-file && test_i18ngrep "unborn branch with changes added to the index" err ) ' @@ -706,8 +638,7 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' ' ( cd corrupt && test_commit one && - git rev-parse --verify HEAD >head && - obj=$(sed "s#^..#&/#" head) && + obj=$(git rev-parse --verify HEAD | sed "s#^..#&/#") && rm -f .git/objects/$obj && test_must_fail git pull --rebase ) @@ -715,79 +646,66 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' ' test_expect_success 'setup for detecting upstreamed changes' ' mkdir src && - ( - cd src && - git init && - printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff && - git add stuff && - git commit -m "Initial revision" + (cd src && + git init && + printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff && + git add stuff && + git commit -m "Initial revision" ) && git clone src dst && - ( - cd src && - modify s/5/43/ stuff && - git commit -a -m "5->43" && - modify s/6/42/ stuff && - git commit -a -m "Make it bigger" + (cd src && + modify s/5/43/ stuff && + git commit -a -m "5->43" && + modify s/6/42/ stuff && + git commit -a -m "Make it bigger" ) && - ( - cd dst && - modify s/5/43/ stuff && - git commit -a -m "Independent discovery of 5->43" + (cd dst && + modify s/5/43/ stuff && + git commit -a -m "Independent discovery of 5->43" ) ' test_expect_success 'git pull --rebase detects upstreamed changes' ' - ( - cd dst && - git pull --rebase && - git ls-files -u >untracked && - test_must_be_empty untracked + (cd dst && + git pull --rebase && + test -z "$(git ls-files -u)" ) ' test_expect_success 'setup for avoiding reapplying old patches' ' - ( - cd dst && - test_might_fail git rebase --abort && - git reset --hard origin/master + (cd dst && + test_might_fail git rebase --abort && + git reset --hard origin/master ) && git clone --bare src src-replace.git && rm -rf src && mv src-replace.git src && - ( - cd dst && - modify s/2/22/ stuff && - git commit -a -m "Change 2" && - modify s/3/33/ stuff && - git commit -a -m "Change 3" && - modify s/4/44/ stuff && - git commit -a -m "Change 4" && - git push && - - modify s/44/55/ stuff && - git commit --amend -a -m "Modified Change 4" + (cd dst && + modify s/2/22/ stuff && + git commit -a -m "Change 2" && + modify s/3/33/ stuff && + git commit -a -m "Change 3" && + modify s/4/44/ stuff && + git commit -a -m "Change 4" && + git push && + + modify s/44/55/ stuff && + git commit --amend -a -m "Modified Change 4" ) ' test_expect_success 'git pull --rebase does not reapply old patches' ' - ( - cd dst && - test_must_fail git pull --rebase && - cat .git/rebase-merge/done .git/rebase-merge/git-rebase-todo >work && - grep -v -e \# -e ^$ work >patches && - test_line_count = 1 patches && - rm -f work + (cd dst && + test_must_fail git pull --rebase && + test 1 = $(find .git/rebase-apply -name "000*" | wc -l) ) ' test_expect_success 'git pull --rebase against local branch' ' git checkout -b copy2 to-rebase-orig && git pull --rebase . to-rebase && - echo "conflicting modification" >expect && - test_cmp expect file && - echo file >expect && - test_cmp expect file2 + test "conflicting modification" = "$(cat file)" && + test file = "$(cat file2)" ' test_done diff --git a/third_party/git/t/t5528-push-default.sh b/third_party/git/t/t5528-push-default.sh index 4d1e0c363ea1..44309566f134 100755 --- a/third_party/git/t/t5528-push-default.sh +++ b/third_party/git/t/t5528-push-default.sh @@ -163,7 +163,7 @@ test_pushdefault_workflow success current master # update parent1's foo (which is our upstream) test_pushdefault_workflow success upstream foo -# upstream is foo which is not the name of the current branch +# upsream is foo which is not the name of the current branch test_pushdefault_workflow failure simple master # master and foo are updated diff --git a/third_party/git/t/t5530-upload-pack-error.sh b/third_party/git/t/t5530-upload-pack-error.sh index 4ce9a9f70411..a1d3031d40dc 100755 --- a/third_party/git/t/t5530-upload-pack-error.sh +++ b/third_party/git/t/t5530-upload-pack-error.sh @@ -14,7 +14,7 @@ corrupt_repo () { } test_expect_success 'setup and corrupt repository' ' - test_oid_init && + echo file >file && git add file && git rev-parse :file && @@ -31,10 +31,9 @@ test_expect_success 'fsck fails' ' ' test_expect_success 'upload-pack fails due to error in pack-objects packing' ' - head=$(git rev-parse HEAD) && - hexsz=$(test_oid hexsz) && - printf "%04xwant %s\n00000009done\n0000" \ - $(($hexsz + 10)) $head >input && + + printf "0032want %s\n00000009done\n0000" \ + $(git rev-parse HEAD) >input && test_must_fail git upload-pack . /dev/null 2>output.err && test_i18ngrep "unable to read" output.err && test_i18ngrep "pack-objects died" output.err @@ -52,17 +51,16 @@ test_expect_success 'fsck fails' ' ' test_expect_success 'upload-pack fails due to error in rev-list' ' - printf "%04xwant %s\n%04xshallow %s00000009done\n0000" \ - $(($hexsz + 10)) $(git rev-parse HEAD) \ - $(($hexsz + 12)) $(git rev-parse HEAD^) >input && + printf "0032want %s\n0034shallow %s00000009done\n0000" \ + $(git rev-parse HEAD) $(git rev-parse HEAD^) >input && test_must_fail git upload-pack . /dev/null 2>output.err && grep "bad tree object" output.err ' test_expect_success 'upload-pack fails due to bad want (no object)' ' - printf "%04xwant %s multi_ack_detailed\n00000009done\n0000" \ - $(($hexsz + 29)) $(test_oid deadbeef) >input && + printf "0045want %s multi_ack_detailed\n00000009done\n0000" \ + "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" >input && test_must_fail git upload-pack . output 2>output.err && grep "not our ref" output.err && grep "ERR" output && @@ -72,8 +70,8 @@ test_expect_success 'upload-pack fails due to bad want (no object)' ' test_expect_success 'upload-pack fails due to bad want (not tip)' ' oid=$(echo an object we have | git hash-object -w --stdin) && - printf "%04xwant %s multi_ack_detailed\n00000009done\n0000" \ - $(($hexsz + 29)) "$oid" >input && + printf "0045want %s multi_ack_detailed\n00000009done\n0000" \ + "$oid" >input && test_must_fail git upload-pack . output 2>output.err && grep "not our ref" output.err && grep "ERR" output && @@ -82,8 +80,8 @@ test_expect_success 'upload-pack fails due to bad want (not tip)' ' test_expect_success 'upload-pack fails due to error in pack-objects enumeration' ' - printf "%04xwant %s\n00000009done\n0000" \ - $((hexsz + 10)) $(git rev-parse HEAD) >input && + printf "0032want %s\n00000009done\n0000" \ + $(git rev-parse HEAD) >input && test_must_fail git upload-pack . /dev/null 2>output.err && grep "bad tree object" output.err && grep "pack-objects died" output.err diff --git a/third_party/git/t/t5535-fetch-push-symref.sh b/third_party/git/t/t5535-fetch-push-symref.sh index e8f6d233ffb8..8ed58d27f243 100755 --- a/third_party/git/t/t5535-fetch-push-symref.sh +++ b/third_party/git/t/t5535-fetch-push-symref.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='avoiding conflicting update through symref aliasing' +test_description='avoiding conflicting update thru symref aliasing' . ./test-lib.sh diff --git a/third_party/git/t/t5537-fetch-shallow.sh b/third_party/git/t/t5537-fetch-shallow.sh index 4f681dbbe11c..66f0b64d3927 100755 --- a/third_party/git/t/t5537-fetch-shallow.sh +++ b/third_party/git/t/t5537-fetch-shallow.sh @@ -15,11 +15,7 @@ test_expect_success 'setup' ' commit 2 && commit 3 && commit 4 && - git config --global transfer.fsckObjects true && - test_oid_cache <<-EOF - perl sha1:s/0034shallow %s/0036unshallow %s/ - perl sha256:s/004cshallow %s/004eunshallow %s/ - EOF + git config --global transfer.fsckObjects true ' test_expect_success 'setup shallow clone' ' @@ -237,29 +233,26 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f git -C "$REPO" config protocol.version 2 && git -C client config protocol.version 2 && - git -C client fetch --depth=2 "$HTTPD_URL/one_time_perl/repo" master:a_branch && + git -C client fetch --depth=2 "$HTTPD_URL/one_time_sed/repo" master:a_branch && # Craft a situation in which the server sends back an unshallow request # with an empty packfile. This is done by refetching with a shorter # depth (to ensure that the packfile is empty), and overwriting the # shallow line in the response with the unshallow line we want. - printf "$(test_oid perl)" \ + printf "s/0034shallow %s/0036unshallow %s/" \ "$(git -C "$REPO" rev-parse HEAD)" \ "$(git -C "$REPO" rev-parse HEAD^)" \ - >"$HTTPD_ROOT_PATH/one-time-perl" && + >"$HTTPD_ROOT_PATH/one-time-sed" && test_must_fail env GIT_TEST_SIDEBAND_ALL=0 git -C client \ - fetch --depth=1 "$HTTPD_URL/one_time_perl/repo" \ + fetch --depth=1 "$HTTPD_URL/one_time_sed/repo" \ master:a_branch && - # Ensure that the one-time-perl script was used. - ! test -e "$HTTPD_ROOT_PATH/one-time-perl" && + # Ensure that the one-time-sed script was used. + ! test -e "$HTTPD_ROOT_PATH/one-time-sed" && # Ensure that the resulting repo is consistent, despite our failure to # fetch. git -C client fsck ' -# DO NOT add non-httpd-specific tests here, because the last part of this -# test script is only executed when httpd is available and enabled. - test_done diff --git a/third_party/git/t/t5539-fetch-http-shallow.sh b/third_party/git/t/t5539-fetch-http-shallow.sh index c0d02dee893f..b4ad81f00635 100755 --- a/third_party/git/t/t5539-fetch-http-shallow.sh +++ b/third_party/git/t/t5539-fetch-http-shallow.sh @@ -69,7 +69,7 @@ test_expect_success 'no shallow lines after receiving ACK ready' ' test_commit new-too && # NEEDSWORK: If the overspecification of the expected result is reduced, we # might be able to run this test in all protocol versions. - GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" GIT_TEST_PROTOCOL_VERSION=0 \ + GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" GIT_TEST_PROTOCOL_VERSION= \ git fetch --depth=2 && grep "fetch-pack< ACK .* ready" ../trace && ! grep "fetch-pack> done" ../trace diff --git a/third_party/git/t/t5540-http-push-webdav.sh b/third_party/git/t/t5540-http-push-webdav.sh index d476c335098e..a094fd5e7133 100755 --- a/third_party/git/t/t5540-http-push-webdav.sh +++ b/third_party/git/t/t5540-http-push-webdav.sh @@ -134,13 +134,15 @@ test_expect_success 'MKCOL sends directory names with trailing slashes' ' x1="[0-9a-f]" x2="$x1$x1" -xtrunc=$(echo $OID_REGEX | sed -e "s/\[0-9a-f\]\[0-9a-f\]//") +x5="$x1$x1$x1$x1$x1" +x38="$x5$x5$x5$x5$x5$x5$x5$x1$x1$x1" +x40="$x38$x2" test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' ' sed \ -e "s/PUT /OP /" \ -e "s/MOVE /OP /" \ - -e "s|/objects/$x2/${xtrunc}_$OID_REGEX|WANTED_PATH_REQUEST|" \ + -e "s|/objects/$x2/${x38}_$x40|WANTED_PATH_REQUEST|" \ "$HTTPD_ROOT_PATH"/access.log | grep -e "\"OP .*WANTED_PATH_REQUEST HTTP/[.0-9]*\" 20[0-9] " diff --git a/third_party/git/t/t5541-http-push-smart.sh b/third_party/git/t/t5541-http-push-smart.sh index 23be8ce92d67..b86ddb60f2ea 100755 --- a/third_party/git/t/t5541-http-push-smart.sh +++ b/third_party/git/t/t5541-http-push-smart.sh @@ -49,7 +49,7 @@ test_expect_success 'no empty path components' ' # NEEDSWORK: If the overspecification of the expected result is reduced, we # might be able to run this test in all protocol versions. - if test "$GIT_TEST_PROTOCOL_VERSION" = 0 + if test -z "$GIT_TEST_PROTOCOL_VERSION" then check_access_log exp fi @@ -135,7 +135,7 @@ EOF test_expect_success 'used receive-pack service' ' # NEEDSWORK: If the overspecification of the expected result is reduced, we # might be able to run this test in all protocol versions. - if test "$GIT_TEST_PROTOCOL_VERSION" = 0 + if test -z "$GIT_TEST_PROTOCOL_VERSION" then check_access_log exp fi @@ -184,12 +184,11 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat test_config -C "$d" http.receivepack true && up="$HTTPD_URL"/smart/atomic-branches.git && - # Tell "$up" about three branches for now + # Tell "$up" about two branches for now test_commit atomic1 && test_commit atomic2 && git branch collateral && - git branch other && - git push "$up" master collateral other && + git push "$up" master collateral && # collateral is a valid push, but should be failed by atomic push git checkout collateral && @@ -227,41 +226,6 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat grep "^ ! .*rejected.* collateral -> collateral .*atomic push failed" output ' -test_expect_success 'push --atomic fails on server-side errors' ' - # Use previously set up repository - d=$HTTPD_DOCUMENT_ROOT_PATH/atomic-branches.git && - test_config -C "$d" http.receivepack true && - up="$HTTPD_URL"/smart/atomic-branches.git && - - # break ref updates for other on the remote site - mkdir "$d/refs/heads/other.lock" && - - # add the new commit to other - git branch -f other collateral && - - # --atomic should cause entire push to be rejected - test_must_fail git push --atomic "$up" atomic other 2>output && - - # the new branch should not have been created upstream - test_must_fail git -C "$d" show-ref --verify refs/heads/atomic && - - # upstream should still reflect atomic2, the last thing we pushed - # successfully - git rev-parse atomic2 >expected && - # ...to other. - git -C "$d" rev-parse refs/heads/other >actual && - test_cmp expected actual && - - # the new branch should not have been created upstream - test_must_fail git -C "$d" show-ref --verify refs/heads/atomic && - - # the failed refs should be indicated to the user - grep "^ ! .*rejected.* other -> other .*atomic transaction failed" output && - - # the collateral failure refs should be indicated to the user - grep "^ ! .*rejected.* atomic -> atomic .*atomic transaction failed" output -' - test_expect_success 'push --all can push to empty repo' ' d=$HTTPD_DOCUMENT_ROOT_PATH/empty-all.git && git init --bare "$d" && @@ -298,7 +262,7 @@ test_expect_success TTY 'push shows progress when stderr is a tty' ' cd "$ROOT_PATH"/test_repo_clone && test_commit noisy && test_terminal git push >output 2>&1 && - test_i18ngrep "^Writing objects" output + test_i18ngrep "Writing objects" output ' test_expect_success TTY 'push --quiet silences status and progress' ' @@ -313,7 +277,7 @@ test_expect_success TTY 'push --no-progress silences progress but not status' ' test_commit no-progress && test_terminal git push --no-progress >output 2>&1 && test_i18ngrep "^To http" output && - test_i18ngrep ! "^Writing objects" output + test_i18ngrep ! "Writing objects" output ' test_expect_success 'push --progress shows progress to non-tty' ' @@ -321,7 +285,7 @@ test_expect_success 'push --progress shows progress to non-tty' ' test_commit progress && git push --progress >output 2>&1 && test_i18ngrep "^To http" output && - test_i18ngrep "^Writing objects" output + test_i18ngrep "Writing objects" output ' test_expect_success 'http push gives sane defaults to reflog' ' diff --git a/third_party/git/t/t5545-push-options.sh b/third_party/git/t/t5545-push-options.sh index 38e6f7340e74..6d1d59c9b1af 100755 --- a/third_party/git/t/t5545-push-options.sh +++ b/third_party/git/t/t5545-push-options.sh @@ -115,7 +115,7 @@ test_expect_success 'push options and submodules' ' git -C parent submodule add ../upstream workbench && git -C parent/workbench remote add up ../../upstream && - git -C parent commit -m "add submodule" && + git -C parent commit -m "add submoule" && test_commit -C parent/workbench two && git -C parent add workbench && @@ -278,7 +278,4 @@ test_expect_success 'push options keep quoted characters intact (http)' ' test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options ' -# DO NOT add non-httpd-specific tests here, because the last part of this -# test script is only executed when httpd is available and enabled. - test_done diff --git a/third_party/git/t/t5550-http-fetch-dumb.sh b/third_party/git/t/t5550-http-fetch-dumb.sh index ea2688bde59c..b811d89cfd6d 100755 --- a/third_party/git/t/t5550-http-fetch-dumb.sh +++ b/third_party/git/t/t5550-http-fetch-dumb.sh @@ -321,17 +321,11 @@ test_expect_success 'git client does not send an empty Accept-Language' ' ' test_expect_success 'remote-http complains cleanly about malformed urls' ' - test_must_fail git remote-http http::/example.com/repo.git 2>stderr && - test_i18ngrep "url has no scheme" stderr -' - -# NEEDSWORK: Writing commands to git-remote-curl can race against the latter -# erroring out, producing SIGPIPE. Remove "ok=sigpipe" once transport-helper has -# learned to handle early remote helper failures more cleanly. -test_expect_success 'remote-http complains cleanly about empty scheme' ' - test_must_fail ok=sigpipe git ls-remote \ - http::${HTTPD_URL#http}/dumb/repo.git 2>stderr && - test_i18ngrep "url has no scheme" stderr + # do not actually issue "list" or other commands, as we do not + # want to rely on what curl would actually do with such a broken + # URL. This is just about making sure we do not segfault during + # initialization. + test_must_fail git remote-http http::/example.com/repo.git ' test_expect_success 'redirects can be forbidden/allowed' ' diff --git a/third_party/git/t/t5551-http-fetch-smart.sh b/third_party/git/t/t5551-http-fetch-smart.sh index 6788aefaceb8..e38e54386795 100755 --- a/third_party/git/t/t5551-http-fetch-smart.sh +++ b/third_party/git/t/t5551-http-fetch-smart.sh @@ -43,7 +43,7 @@ test_expect_success 'clone http repository' ' < Cache-Control: no-cache, max-age=0, must-revalidate < Content-Type: application/x-git-upload-pack-result EOF - GIT_TRACE_CURL=true GIT_TEST_PROTOCOL_VERSION=0 \ + GIT_TRACE_CURL=true GIT_TEST_PROTOCOL_VERSION= \ git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err && test_cmp file clone/file && tr '\''\015'\'' Q Accept-Encoding: .*/> Accept-Encoding: ENCODINGS/" \ actual >actual.smudged && @@ -113,7 +113,7 @@ test_expect_success 'used upload-pack service' ' # NEEDSWORK: If the overspecification of the expected result is reduced, we # might be able to run this test in all protocol versions. - if test "$GIT_TEST_PROTOCOL_VERSION" = 0 + if test -z "$GIT_TEST_PROTOCOL_VERSION" then check_access_log exp fi @@ -241,7 +241,7 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set # NEEDSWORK: If the overspecification of the expected result is reduced, we # might be able to run this test in all protocol versions. - if test "$GIT_TEST_PROTOCOL_VERSION" = 0 + if test -z "$GIT_TEST_PROTOCOL_VERSION" then tail -3 cookies.txt | sort >cookies_tail.txt && test_cmp expect_cookies.txt cookies_tail.txt @@ -336,7 +336,7 @@ test_expect_success 'test allowreachablesha1inwant with unreachable' ' git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" && # Some protocol versions (e.g. 2) support fetching # unadvertised objects, so restrict this test to v0. - test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" ' @@ -358,7 +358,7 @@ test_expect_success 'test allowanysha1inwant with unreachable' ' git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" && # Some protocol versions (e.g. 2) support fetching # unadvertised objects, so restrict this test to v0. - test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" && git -C "$server" config uploadpack.allowanysha1inwant 1 && diff --git a/third_party/git/t/t5552-skipping-fetch-negotiator.sh b/third_party/git/t/t5552-skipping-fetch-negotiator.sh index 156c70404083..8a14be51a132 100755 --- a/third_party/git/t/t5552-skipping-fetch-negotiator.sh +++ b/third_party/git/t/t5552-skipping-fetch-negotiator.sh @@ -60,6 +60,29 @@ test_expect_success 'commits with no parents are sent regardless of skip distanc have_not_sent c6 c4 c3 ' +test_expect_success 'unknown fetch.negotiationAlgorithm values error out' ' + rm -rf server client trace && + git init server && + test_commit -C server to_fetch && + + git init client && + test_commit -C client on_client && + git -C client checkout on_client && + + test_config -C client fetch.negotiationAlgorithm invalid && + test_must_fail git -C client fetch "$(pwd)/server" 2>err && + test_i18ngrep "unknown fetch negotiation algorithm" err && + + # Explicit "default" value + test_config -C client fetch.negotiationAlgorithm default && + git -C client -c fetch.negotiationAlgorithm=default fetch "$(pwd)/server" && + + # Implementation detail: If there is nothing to fetch, we will not error out + test_config -C client fetch.negotiationAlgorithm invalid && + git -C client fetch "$(pwd)/server" 2>err && + test_i18ngrep ! "unknown fetch negotiation algorithm" err +' + test_expect_success 'when two skips collide, favor the larger one' ' rm -rf server client trace && git init server && @@ -107,11 +130,7 @@ test_expect_success 'use ref advertisement to filter out commits' ' # The ref advertisement itself is filtered when protocol v2 is used, so # use v0. - ( - GIT_TEST_PROTOCOL_VERSION=0 && - export GIT_TEST_PROTOCOL_VERSION && - trace_fetch client origin to_fetch - ) && + GIT_TEST_PROTOCOL_VERSION= trace_fetch client origin to_fetch && have_sent c5 c4^ c2side && have_not_sent c4 c4^^ c4^^^ ' @@ -173,17 +192,7 @@ test_expect_success 'do not send "have" with ancestors of commits that server AC test_commit -C server commit-on-b1 && test_config -C client fetch.negotiationalgorithm skipping && - - # NEEDSWORK: The number of "have"s sent depends on whether the transport - # is stateful. If the overspecification of the result were reduced, this - # test could be used for both stateful and stateless transports. - ( - # Force protocol v0, in which local transport is stateful (in - # protocol v2 it is stateless). - GIT_TEST_PROTOCOL_VERSION=0 && - export GIT_TEST_PROTOCOL_VERSION && - trace_fetch client "$(pwd)/server" to_fetch - ) && + trace_fetch client "$(pwd)/server" to_fetch && grep " fetch" trace && # fetch-pack sends 2 requests each containing 16 "have" lines before diff --git a/third_party/git/t/t5553-set-upstream.sh b/third_party/git/t/t5553-set-upstream.sh deleted file mode 100755 index 81975ad8f9eb..000000000000 --- a/third_party/git/t/t5553-set-upstream.sh +++ /dev/null @@ -1,178 +0,0 @@ -#!/bin/sh - -test_description='"git fetch/pull --set-upstream" basic tests.' -. ./test-lib.sh - -check_config () { - printf "%s\n" "$2" "$3" >"expect.$1" && - { - git config "branch.$1.remote" && git config "branch.$1.merge" - } >"actual.$1" && - test_cmp "expect.$1" "actual.$1" -} - -check_config_missing () { - test_expect_code 1 git config "branch.$1.remote" && - test_expect_code 1 git config "branch.$1.merge" -} - -clear_config () { - for branch in "$@"; do - test_might_fail git config --unset-all "branch.$branch.remote" - test_might_fail git config --unset-all "branch.$branch.merge" - done -} - -ensure_fresh_upstream () { - rm -rf parent && git init --bare parent -} - -test_expect_success 'setup bare parent fetch' ' - ensure_fresh_upstream && - git remote add upstream parent -' - -test_expect_success 'setup commit on master and other fetch' ' - test_commit one && - git push upstream master && - git checkout -b other && - test_commit two && - git push upstream other -' - -# tests for fetch --set-upstream - -test_expect_success 'fetch --set-upstream does not set upstream w/o branch' ' - clear_config master other && - git checkout master && - git fetch --set-upstream upstream && - check_config_missing master && - check_config_missing other -' - -test_expect_success 'fetch --set-upstream upstream master sets branch master but not other' ' - clear_config master other && - git fetch --set-upstream upstream master && - check_config master upstream refs/heads/master && - check_config_missing other -' - -test_expect_success 'fetch --set-upstream upstream other sets branch other' ' - clear_config master other && - git fetch --set-upstream upstream other && - check_config master upstream refs/heads/other && - check_config_missing other -' - -test_expect_success 'fetch --set-upstream master:other does not set the branch other2' ' - clear_config other2 && - git fetch --set-upstream upstream master:other2 && - check_config_missing other2 -' - -test_expect_success 'fetch --set-upstream http://nosuchdomain.example.com fails with invalid url' ' - # master explicitly not cleared, we check that it is not touched from previous value - clear_config other other2 && - test_must_fail git fetch --set-upstream http://nosuchdomain.example.com && - check_config master upstream refs/heads/other && - check_config_missing other && - check_config_missing other2 -' - -test_expect_success 'fetch --set-upstream with valid URL sets upstream to URL' ' - clear_config other other2 && - url="file://'"$PWD"'" && - git fetch --set-upstream "$url" && - check_config master "$url" HEAD && - check_config_missing other && - check_config_missing other2 -' - -# tests for pull --set-upstream - -test_expect_success 'setup bare parent pull' ' - git remote rm upstream && - ensure_fresh_upstream && - git remote add upstream parent -' - -test_expect_success 'setup commit on master and other pull' ' - test_commit three && - git push --tags upstream master && - test_commit four && - git push upstream other -' - -test_expect_success 'pull --set-upstream upstream master sets branch master but not other' ' - clear_config master other && - git pull --set-upstream upstream master && - check_config master upstream refs/heads/master && - check_config_missing other -' - -test_expect_success 'pull --set-upstream master:other2 does not set the branch other2' ' - clear_config other2 && - git pull --set-upstream upstream master:other2 && - check_config_missing other2 -' - -test_expect_success 'pull --set-upstream upstream other sets branch master' ' - clear_config master other && - git pull --set-upstream upstream other && - check_config master upstream refs/heads/other && - check_config_missing other -' - -test_expect_success 'pull --set-upstream upstream tag does not set the tag' ' - clear_config three && - git pull --tags --set-upstream upstream three && - check_config_missing three -' - -test_expect_success 'pull --set-upstream http://nosuchdomain.example.com fails with invalid url' ' - # master explicitly not cleared, we check that it is not touched from previous value - clear_config other other2 three && - test_must_fail git pull --set-upstream http://nosuchdomain.example.com && - check_config master upstream refs/heads/other && - check_config_missing other && - check_config_missing other2 && - check_config_missing three -' - -test_expect_success 'pull --set-upstream upstream HEAD sets branch HEAD' ' - clear_config master other && - git pull --set-upstream upstream HEAD && - check_config master upstream HEAD && - git checkout other && - git pull --set-upstream upstream HEAD && - check_config other upstream HEAD -' - -test_expect_success 'pull --set-upstream upstream with more than one branch does nothing' ' - clear_config master three && - git pull --set-upstream upstream master three && - check_config_missing master && - check_config_missing three -' - -test_expect_success 'pull --set-upstream with valid URL sets upstream to URL' ' - clear_config master other other2 && - git checkout master && - url="file://'"$PWD"'" && - git pull --set-upstream "$url" && - check_config master "$url" HEAD && - check_config_missing other && - check_config_missing other2 -' - -test_expect_success 'pull --set-upstream with valid URL and branch sets branch' ' - clear_config master other other2 && - git checkout master && - url="file://'"$PWD"'" && - git pull --set-upstream "$url" master && - check_config master "$url" refs/heads/master && - check_config_missing other && - check_config_missing other2 -' - -test_done diff --git a/third_party/git/t/t5562-http-backend-content-length.sh b/third_party/git/t/t5562-http-backend-content-length.sh index 4a110b307ee5..f0f425b2cf57 100755 --- a/third_party/git/t/t5562-http-backend-content-length.sh +++ b/third_party/git/t/t5562-http-backend-content-length.sh @@ -59,7 +59,7 @@ test_expect_success 'setup' ' printf done | packetize >>fetch_body && test_copy_bytes 10 fetch_body.trunc && hash_next=$(git commit-tree -p HEAD -m next HEAD^{tree}) && - printf "%s %s refs/heads/newbranch\\0report-status\\n" "$ZERO_OID" "$hash_next" | packetize >push_body && + printf "%s %s refs/heads/newbranch\\0report-status\\n" "$_z40" "$hash_next" | packetize >push_body && printf 0000 >>push_body && echo "$hash_next" | git pack-objects --stdout >>push_body && test_copy_bytes 10 push_body.trunc && diff --git a/third_party/git/t/t5573-pull-verify-signatures.sh b/third_party/git/t/t5573-pull-verify-signatures.sh index a53dd8550d0b..3e9876e19713 100755 --- a/third_party/git/t/t5573-pull-verify-signatures.sh +++ b/third_party/git/t/t5573-pull-verify-signatures.sh @@ -60,27 +60,6 @@ test_expect_success GPG 'pull commit with untrusted signature with --verify-sign test_i18ngrep "has an untrusted GPG signature" pullerror ' -test_expect_success GPG 'pull commit with untrusted signature with --verify-signatures and minTrustLevel=ultimate' ' - test_when_finished "git reset --hard && git checkout initial" && - test_config gpg.minTrustLevel ultimate && - test_must_fail git pull --ff-only --verify-signatures untrusted 2>pullerror && - test_i18ngrep "has an untrusted GPG signature" pullerror -' - -test_expect_success GPG 'pull commit with untrusted signature with --verify-signatures and minTrustLevel=marginal' ' - test_when_finished "git reset --hard && git checkout initial" && - test_config gpg.minTrustLevel marginal && - test_must_fail git pull --ff-only --verify-signatures untrusted 2>pullerror && - test_i18ngrep "has an untrusted GPG signature" pullerror -' - -test_expect_success GPG 'pull commit with untrusted signature with --verify-signatures and minTrustLevel=undefined' ' - test_when_finished "git reset --hard && git checkout initial" && - test_config gpg.minTrustLevel undefined && - git pull --ff-only --verify-signatures untrusted >pulloutput && - test_i18ngrep "has a good GPG signature" pulloutput -' - test_expect_success GPG 'pull signed commit with --verify-signatures' ' test_when_finished "git reset --hard && git checkout initial" && git pull --verify-signatures signed >pulloutput && @@ -100,53 +79,10 @@ test_expect_success GPG 'pull commit with bad signature with --no-verify-signatu ' test_expect_success GPG 'pull unsigned commit into unborn branch' ' - test_when_finished "rm -rf empty-repo" && git init empty-repo && test_must_fail \ git -C empty-repo pull --verify-signatures .. 2>pullerror && test_i18ngrep "does not have a GPG signature" pullerror ' -test_expect_success GPG 'pull commit into unborn branch with bad signature and --verify-signatures' ' - test_when_finished "rm -rf empty-repo" && - git init empty-repo && - test_must_fail \ - git -C empty-repo pull --ff-only --verify-signatures ../bad 2>pullerror && - test_i18ngrep "has a bad GPG signature" pullerror -' - -test_expect_success GPG 'pull commit into unborn branch with untrusted signature and --verify-signatures' ' - test_when_finished "rm -rf empty-repo" && - git init empty-repo && - test_must_fail \ - git -C empty-repo pull --ff-only --verify-signatures ../untrusted 2>pullerror && - test_i18ngrep "has an untrusted GPG signature" pullerror -' - -test_expect_success GPG 'pull commit into unborn branch with untrusted signature and --verify-signatures and minTrustLevel=ultimate' ' - test_when_finished "rm -rf empty-repo" && - git init empty-repo && - test_config_global gpg.minTrustLevel ultimate && - test_must_fail \ - git -C empty-repo pull --ff-only --verify-signatures ../untrusted 2>pullerror && - test_i18ngrep "has an untrusted GPG signature" pullerror -' - -test_expect_success GPG 'pull commit into unborn branch with untrusted signature and --verify-signatures and minTrustLevel=marginal' ' - test_when_finished "rm -rf empty-repo" && - git init empty-repo && - test_config_global gpg.minTrustLevel marginal && - test_must_fail \ - git -C empty-repo pull --ff-only --verify-signatures ../untrusted 2>pullerror && - test_i18ngrep "has an untrusted GPG signature" pullerror -' - -test_expect_success GPG 'pull commit into unborn branch with untrusted signature and --verify-signatures and minTrustLevel=undefined' ' - test_when_finished "rm -rf empty-repo" && - git init empty-repo && - test_config_global gpg.minTrustLevel undefined && - git -C empty-repo pull --ff-only --verify-signatures ../untrusted >pulloutput && - test_i18ngrep "has a good GPG signature" pulloutput -' - test_done diff --git a/third_party/git/t/t5580-clone-push-unc.sh b/third_party/git/t/t5580-clone-push-unc.sh new file mode 100755 index 000000000000..b3c8a92450bc --- /dev/null +++ b/third_party/git/t/t5580-clone-push-unc.sh @@ -0,0 +1,77 @@ +#!/bin/sh + +test_description='various Windows-only path tests' +. ./test-lib.sh + +if test_have_prereq CYGWIN +then + alias winpwd='cygpath -aw .' +elif test_have_prereq MINGW +then + alias winpwd=pwd +else + skip_all='skipping Windows-only path tests' + test_done +fi + +UNCPATH="$(winpwd)" +case "$UNCPATH" in +[A-Z]:*) + # Use administrative share e.g. \\localhost\C$\git-sdk-64\usr\src\git + # (we use forward slashes here because MSYS2 and Git accept them, and + # they are easier on the eyes) + UNCPATH="//localhost/${UNCPATH%%:*}\$/${UNCPATH#?:}" + test -d "$UNCPATH" || { + skip_all='could not access administrative share; skipping' + test_done + } + ;; +*) + skip_all='skipping UNC path tests, cannot determine current path as UNC' + test_done + ;; +esac + +test_expect_success setup ' + test_commit initial +' + +test_expect_success clone ' + git clone "file://$UNCPATH" clone +' + +test_expect_success 'clone with backslashed path' ' + BACKSLASHED="$(echo "$UNCPATH" | tr / \\\\)" && + git clone "$BACKSLASHED" backslashed +' + +test_expect_success push ' + ( + cd clone && + git checkout -b to-push && + test_commit to-push && + git push origin HEAD + ) && + rev="$(git -C clone rev-parse --verify refs/heads/to-push)" && + test "$rev" = "$(git rev-parse --verify refs/heads/to-push)" +' + +test_expect_success MINGW 'remote nick cannot contain backslashes' ' + BACKSLASHED="$(winpwd | tr / \\\\)" && + git ls-remote "$BACKSLASHED" >out 2>err && + test_i18ngrep ! "unable to access" err +' + +test_expect_success 'unc alternates' ' + tree="$(git rev-parse HEAD:)" && + mkdir test-unc-alternate && + ( + cd test-unc-alternate && + git init && + test_must_fail git show $tree && + echo "$UNCPATH/.git/objects" >.git/objects/info/alternates && + git show $tree + ) +' + +test_done diff --git a/third_party/git/t/t5580-unc-paths.sh b/third_party/git/t/t5580-unc-paths.sh deleted file mode 100755 index cf768b3a2790..000000000000 --- a/third_party/git/t/t5580-unc-paths.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh - -test_description='various Windows-only path tests' -. ./test-lib.sh - -if test_have_prereq CYGWIN -then - alias winpwd='cygpath -aw .' -elif test_have_prereq MINGW -then - alias winpwd=pwd -else - skip_all='skipping Windows-only path tests' - test_done -fi - -UNCPATH="$(winpwd)" -case "$UNCPATH" in -[A-Z]:*) - # Use administrative share e.g. \\localhost\C$\git-sdk-64\usr\src\git - # (we use forward slashes here because MSYS2 and Git accept them, and - # they are easier on the eyes) - UNCPATH="//localhost/${UNCPATH%%:*}\$/${UNCPATH#?:}" - test -d "$UNCPATH" || { - skip_all='could not access administrative share; skipping' - test_done - } - ;; -*) - skip_all='skipping UNC path tests, cannot determine current path as UNC' - test_done - ;; -esac - -test_expect_success setup ' - test_commit initial -' - -test_expect_success clone ' - git clone "file://$UNCPATH" clone -' - -test_expect_success 'clone without file://' ' - git clone "$UNCPATH" clone-without-file -' - -test_expect_success 'clone with backslashed path' ' - BACKSLASHED="$(echo "$UNCPATH" | tr / \\\\)" && - git clone "$BACKSLASHED" backslashed -' - -test_expect_success fetch ' - git init to-fetch && - ( - cd to-fetch && - git fetch "$UNCPATH" master - ) -' - -test_expect_success push ' - ( - cd clone && - git checkout -b to-push && - test_commit to-push && - git push origin HEAD - ) && - rev="$(git -C clone rev-parse --verify refs/heads/to-push)" && - test "$rev" = "$(git rev-parse --verify refs/heads/to-push)" -' - -test_expect_success MINGW 'remote nick cannot contain backslashes' ' - BACKSLASHED="$(winpwd | tr / \\\\)" && - git ls-remote "$BACKSLASHED" 2>err && - test_i18ngrep ! "unable to access" err -' - -test_expect_success 'unc alternates' ' - tree="$(git rev-parse HEAD:)" && - mkdir test-unc-alternate && - ( - cd test-unc-alternate && - git init && - test_must_fail git show $tree && - echo "$UNCPATH/.git/objects" >.git/objects/info/alternates && - git show $tree - ) -' - -test_done diff --git a/third_party/git/t/t5601-clone.sh b/third_party/git/t/t5601-clone.sh index 84ea2a3eb707..37d76808d4a7 100755 --- a/third_party/git/t/t5601-clone.sh +++ b/third_party/git/t/t5601-clone.sh @@ -434,6 +434,7 @@ test_expect_success 'double quoted plink.exe in GIT_SSH_COMMAND' ' expect_ssh "-v -P 123" myhost src ' +SQ="'" test_expect_success 'single quoted plink.exe in GIT_SSH_COMMAND' ' copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" && GIT_SSH_COMMAND="$SQ$TRASH_DIRECTORY/plink.exe$SQ -v" \ @@ -635,10 +636,10 @@ partial_clone_server () { rm -rf "$SERVER" client && test_create_repo "$SERVER" && test_commit -C "$SERVER" one && - HASH1=$(git -C "$SERVER" hash-object one.t) && + HASH1=$(git hash-object "$SERVER/one.t") && git -C "$SERVER" revert HEAD && test_commit -C "$SERVER" two && - HASH2=$(git -C "$SERVER" hash-object two.t) && + HASH2=$(git hash-object "$SERVER/two.t") && test_config -C "$SERVER" uploadpack.allowfilter 1 && test_config -C "$SERVER" uploadpack.allowanysha1inwant 1 } @@ -653,8 +654,7 @@ partial_clone () { git -C client fsck && # Ensure that unneeded blobs are not inadvertently fetched. - test_config -C client remote.origin.promisor "false" && - git -C client config --unset remote.origin.partialclonefilter && + test_config -C client extensions.partialclone "not a remote" && test_must_fail git -C client cat-file -e "$HASH1" && # But this blob was fetched, because clone performs an initial checkout @@ -739,7 +739,4 @@ test_expect_success 'partial clone using HTTP' ' partial_clone "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server" ' -# DO NOT add non-httpd-specific tests here, because the last part of this -# test script is only executed when httpd is available and enabled. - test_done diff --git a/third_party/git/t/t5604-clone-reference.sh b/third_party/git/t/t5604-clone-reference.sh index 0c74b4e21a3e..4894237ab805 100755 --- a/third_party/git/t/t5604-clone-reference.sh +++ b/third_party/git/t/t5604-clone-reference.sh @@ -326,16 +326,15 @@ test_expect_success SYMLINKS 'clone repo with symlinked or unknown files at obje for raw in $(ls T*.raw) do sed -e "s!/../!/Y/!; s![0-9a-f]\{38,\}!Z!" -e "/commit-graph/d" \ - -e "/multi-pack-index/d" <$raw >$raw.de-sha-1 && - sort $raw.de-sha-1 >$raw.de-sha || return 1 + -e "/multi-pack-index/d" <$raw >$raw.de-sha || return 1 done && cat >expected-files <<-EOF && ./Y/Z ./Y/Z - ./Y/Z ./a-loose-dir/Z ./an-object + ./Y/Z ./info/packs ./pack/pack-Z.idx ./pack/pack-Z.pack diff --git a/third_party/git/t/t5607-clone-bundle.sh b/third_party/git/t/t5607-clone-bundle.sh index 9108ff6fbd6f..2a0fb15cf175 100755 --- a/third_party/git/t/t5607-clone-bundle.sh +++ b/third_party/git/t/t5607-clone-bundle.sh @@ -64,7 +64,7 @@ test_expect_success 'ridiculously long subject in boundary' ' test -s heads && git fetch long-subject-bundle.bdl && sed -n "/^-/{p;q;}" long-subject-bundle.bdl >boundary && - grep "^-$OID_REGEX " boundary + grep "^-[0-9a-f]\\{40\\} " boundary ' test_expect_success 'prerequisites with an empty commit message' ' @@ -83,15 +83,4 @@ test_expect_success 'failed bundle creation does not leave cruft' ' test_path_is_missing fail.bundle.lock ' -test_expect_success 'fetch SHA-1 from bundle' ' - test_create_repo foo && - test_commit -C foo x && - git -C foo bundle create tip.bundle -1 master && - git -C foo rev-parse HEAD >hash && - - # Exercise to ensure that fetching a SHA-1 from a bundle works with no - # errors - git fetch --no-tags foo/tip.bundle "$(cat hash)" -' - test_done diff --git a/third_party/git/t/t5608-clone-2gb.sh b/third_party/git/t/t5608-clone-2gb.sh index eee084288841..2c6bc07344cc 100755 --- a/third_party/git/t/t5608-clone-2gb.sh +++ b/third_party/git/t/t5608-clone-2gb.sh @@ -3,7 +3,7 @@ test_description='Test cloning a repository larger than 2 gigabyte' . ./test-lib.sh -if ! test_bool_env GIT_TEST_CLONE_2GB false +if test -z "$GIT_TEST_CLONE_2GB" then say 'Skipping expensive 2GB clone test; enable it with GIT_TEST_CLONE_2GB=t' else diff --git a/third_party/git/t/t5616-partial-clone.sh b/third_party/git/t/t5616-partial-clone.sh index 77bb91e97692..b91ef548f86b 100755 --- a/third_party/git/t/t5616-partial-clone.sh +++ b/third_party/git/t/t5616-partial-clone.sh @@ -42,16 +42,8 @@ test_expect_success 'do partial clone 1' ' test_cmp expect_1.oids observed.oids && test "$(git -C pc1 config --local core.repositoryformatversion)" = "1" && - test "$(git -C pc1 config --local remote.origin.promisor)" = "true" && - test "$(git -C pc1 config --local remote.origin.partialclonefilter)" = "blob:none" -' - -test_expect_success 'verify that .promisor file contains refs fetched' ' - ls pc1/.git/objects/pack/pack-*.promisor >promisorlist && - test_line_count = 1 promisorlist && - git -C srv.bare rev-list HEAD >headhash && - grep "$(cat headhash) HEAD" $(cat promisorlist) && - grep "$(cat headhash) refs/heads/master" $(cat promisorlist) + test "$(git -C pc1 config --local extensions.partialclone)" = "origin" && + test "$(git -C pc1 config --local core.partialclonefilter)" = "blob:none" ' # checkout master to force dynamic object fetch of blobs at HEAD. @@ -216,25 +208,6 @@ test_expect_success 'use fsck before and after manually fetching a missing subtr test_cmp unique_types.expected unique_types.observed ' -test_expect_success 'implicitly construct combine: filter with repeated flags' ' - GIT_TRACE=$(pwd)/trace git clone --bare \ - --filter=blob:none --filter=tree:1 \ - "file://$(pwd)/srv.bare" pc2 && - grep "trace:.* git pack-objects .*--filter=combine:blob:none+tree:1" \ - trace && - git -C pc2 rev-list --objects --missing=allow-any HEAD >objects && - - # We should have gotten some root trees. - grep " $" objects && - # Should not have gotten any non-root trees or blobs. - ! grep " ." objects && - - xargs -n 1 git -C pc2 cat-file -t types && - sort -u types >unique_types.actual && - test_write_lines commit tree >unique_types.expected && - test_cmp unique_types.expected unique_types.actual -' - test_expect_success 'partial clone fetches blobs pointed to by refs even if normally filtered out' ' rm -rf src dst && git init src && @@ -268,153 +241,6 @@ test_expect_success 'fetch what is specified on CLI even if already promised' ' ! grep "?$(cat blob)" missing_after ' -test_expect_success 'setup src repo for sparse filter' ' - git init sparse-src && - git -C sparse-src config --local uploadpack.allowfilter 1 && - git -C sparse-src config --local uploadpack.allowanysha1inwant 1 && - test_commit -C sparse-src one && - test_commit -C sparse-src two && - echo /one.t >sparse-src/only-one && - git -C sparse-src add . && - git -C sparse-src commit -m "add sparse checkout files" -' - -test_expect_success 'partial clone with sparse filter succeeds' ' - rm -rf dst.git && - git clone --no-local --bare \ - --filter=sparse:oid=master:only-one \ - sparse-src dst.git && - ( - cd dst.git && - git rev-list --objects --missing=print HEAD >out && - grep "^$(git rev-parse HEAD:one.t)" out && - grep "^?$(git rev-parse HEAD:two.t)" out - ) -' - -test_expect_success 'partial clone with unresolvable sparse filter fails cleanly' ' - rm -rf dst.git && - test_must_fail git clone --no-local --bare \ - --filter=sparse:oid=master:no-such-name \ - sparse-src dst.git 2>err && - test_i18ngrep "unable to access sparse blob in .master:no-such-name" err && - test_must_fail git clone --no-local --bare \ - --filter=sparse:oid=master \ - sparse-src dst.git 2>err && - test_i18ngrep "unable to parse sparse filter data in" err -' - -setup_triangle () { - rm -rf big-blob.txt server client promisor-remote && - - printf "line %d\n" $(test_seq 1 100) >big-blob.txt && - - # Create a server with 2 commits: a commit with a big tree and a child - # commit with an incremental change. Also, create a partial clone - # client that only contains the first commit. - git init server && - git -C server config --local uploadpack.allowfilter 1 && - for i in $(test_seq 1 100) - do - echo "make the tree big" >server/file$i && - git -C server add file$i - done && - git -C server commit -m "initial" && - git clone --bare --filter=tree:0 "file://$(pwd)/server" client && - echo another line >>server/file1 && - git -C server commit -am "incremental change" && - - # Create a promisor remote that only contains the tree and blob from - # the first commit. - git init promisor-remote && - git -C server config --local uploadpack.allowanysha1inwant 1 && - TREE_HASH=$(git -C server rev-parse HEAD~1^{tree}) && - git -C promisor-remote fetch --keep "file://$(pwd)/server" "$TREE_HASH" && - git -C promisor-remote count-objects -v >object-count && - test_i18ngrep "count: 0" object-count && - test_i18ngrep "in-pack: 2" object-count && - - # Set it as the promisor remote of client. Thus, whenever - # the client lazy fetches, the lazy fetch will succeed only if it is - # for this tree or blob. - test_commit -C promisor-remote one && # so that ref advertisement is not empty - git -C promisor-remote config --local uploadpack.allowanysha1inwant 1 && - git -C client remote set-url origin "file://$(pwd)/promisor-remote" -} - -# NEEDSWORK: The tests beginning with "fetch lazy-fetches" below only -# test that "fetch" avoid fetching trees and blobs, but not commits or -# tags. Revisit this if Git is ever taught to support partial clones -# with commits and/or tags filtered out. - -test_expect_success 'fetch lazy-fetches only to resolve deltas' ' - setup_triangle && - - # Exercise to make sure it works. Git will not fetch anything from the - # promisor remote other than for the big tree (because it needs to - # resolve the delta). - GIT_TRACE_PACKET="$(pwd)/trace" git -C client \ - fetch "file://$(pwd)/server" master && - - # Verify the assumption that the client needed to fetch the delta base - # to resolve the delta. - git -C server rev-parse HEAD~1^{tree} >hash && - grep "want $(cat hash)" trace -' - -test_expect_success 'fetch lazy-fetches only to resolve deltas, protocol v2' ' - setup_triangle && - - git -C server config --local protocol.version 2 && - git -C client config --local protocol.version 2 && - git -C promisor-remote config --local protocol.version 2 && - - # Exercise to make sure it works. Git will not fetch anything from the - # promisor remote other than for the big blob (because it needs to - # resolve the delta). - GIT_TRACE_PACKET="$(pwd)/trace" git -C client \ - fetch "file://$(pwd)/server" master && - - # Verify that protocol version 2 was used. - grep "fetch< version 2" trace && - - # Verify the assumption that the client needed to fetch the delta base - # to resolve the delta. - git -C server rev-parse HEAD~1^{tree} >hash && - grep "want $(cat hash)" trace -' - -# The following two tests must be in this order, or else -# the first will not fail. It is important that the srv.bare -# repository did not have tags during clone, but has tags -# in the fetch. - -test_expect_failure 'verify fetch succeeds when asking for new tags' ' - git clone --filter=blob:none "file://$(pwd)/srv.bare" tag-test && - for i in I J K - do - test_commit -C src $i && - git -C src branch $i || return 1 - done && - git -C srv.bare fetch --tags origin +refs/heads/*:refs/heads/* && - git -C tag-test -c protocol.version=2 fetch --tags origin -' - -test_expect_success 'verify fetch downloads only one pack when updating refs' ' - git clone --filter=blob:none "file://$(pwd)/srv.bare" pack-test && - ls pack-test/.git/objects/pack/*pack >pack-list && - test_line_count = 2 pack-list && - for i in A B C - do - test_commit -C src $i && - git -C src branch $i || return 1 - done && - git -C srv.bare fetch origin +refs/heads/*:refs/heads/* && - git -C pack-test fetch origin && - ls pack-test/.git/objects/pack/*pack >pack-list && - test_line_count = 3 pack-list -' - . "$TEST_DIRECTORY"/lib-httpd.sh start_httpd @@ -429,18 +255,14 @@ intersperse () { sed 's/\(..\)/'$1'\1/g' } -# Create a one-time-perl command to replace the existing packfile with $1. +# Create a one-time-sed command to replace the existing packfile with $1. replace_packfile () { # The protocol requires that the packfile be sent in sideband 1, hence # the extra \x01 byte at the beginning. - cp $1 "$HTTPD_ROOT_PATH/one-time-pack" && - echo 'if (/packfile/) { - print; - my $length = -s "one-time-pack"; - printf "%04x\x01", $length + 5; - print `cat one-time-pack` . "0000"; - last - }' >"$HTTPD_ROOT_PATH/one-time-perl" + printf "1,/packfile/!c %04x\\\\x01%s0000" \ + "$(($(wc -c <$1) + 5))" \ + "$(hex_unpack <$1 | intersperse '\\x')" \ + >"$HTTPD_ROOT_PATH/one-time-sed" } test_expect_success 'upon cloning, check that all refs point to objects' ' @@ -464,16 +286,16 @@ test_expect_success 'upon cloning, check that all refs point to objects' ' # \x01 byte at the beginning. replace_packfile incomplete.pack && - # Use protocol v2 because the perl command looks for the "packfile" + # Use protocol v2 because the sed command looks for the "packfile" # section header. test_config -C "$SERVER" protocol.version 2 && test_must_fail git -c protocol.version=2 clone \ - --filter=blob:none $HTTPD_URL/one_time_perl/server repo 2>err && + --filter=blob:none $HTTPD_URL/one_time_sed/server repo 2>err && test_i18ngrep "did not send all necessary objects" err && - # Ensure that the one-time-perl script was used. - ! test -e "$HTTPD_ROOT_PATH/one-time-perl" + # Ensure that the one-time-sed script was used. + ! test -e "$HTTPD_ROOT_PATH/one-time-sed" ' test_expect_success 'when partial cloning, tolerate server not sending target of tag' ' @@ -504,17 +326,17 @@ test_expect_success 'when partial cloning, tolerate server not sending target of # \x01 byte at the beginning. replace_packfile incomplete.pack && - # Use protocol v2 because the perl command looks for the "packfile" + # Use protocol v2 because the sed command looks for the "packfile" # section header. test_config -C "$SERVER" protocol.version 2 && # Exercise to make sure it works. git -c protocol.version=2 clone \ - --filter=blob:none $HTTPD_URL/one_time_perl/server repo 2> err && + --filter=blob:none $HTTPD_URL/one_time_sed/server repo 2> err && ! grep "missing object referenced by" err && - # Ensure that the one-time-perl script was used. - ! test -e "$HTTPD_ROOT_PATH/one-time-perl" + # Ensure that the one-time-sed script was used. + ! test -e "$HTTPD_ROOT_PATH/one-time-sed" ' test_expect_success 'tolerate server sending REF_DELTA against missing promisor objects' ' @@ -537,7 +359,7 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor # Clone. The client has deltabase_have but not deltabase_missing. git -c protocol.version=2 clone --no-checkout \ - --filter=blob:none $HTTPD_URL/one_time_perl/server repo && + --filter=blob:none $HTTPD_URL/one_time_sed/server repo && git -C repo hash-object -w -- "$SERVER/have.txt" && # Sanity check to ensure that the client does not have @@ -578,7 +400,7 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor replace_packfile thin.pack && - # Use protocol v2 because the perl command looks for the "packfile" + # Use protocol v2 because the sed command looks for the "packfile" # section header. test_config -C "$SERVER" protocol.version 2 && @@ -591,11 +413,8 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor grep "want $(cat deltabase_missing)" trace && ! grep "want $(cat deltabase_have)" trace && - # Ensure that the one-time-perl script was used. - ! test -e "$HTTPD_ROOT_PATH/one-time-perl" + # Ensure that the one-time-sed script was used. + ! test -e "$HTTPD_ROOT_PATH/one-time-sed" ' -# DO NOT add non-httpd-specific tests here, because the last part of this -# test script is only executed when httpd is available and enabled. - test_done diff --git a/third_party/git/t/t5617-clone-submodules-remote.sh b/third_party/git/t/t5617-clone-submodules-remote.sh index 1a041df10bee..37fcce9c40c9 100755 --- a/third_party/git/t/t5617-clone-submodules-remote.sh +++ b/third_party/git/t/t5617-clone-submodules-remote.sh @@ -14,8 +14,7 @@ test_expect_success 'setup' ' cd sub && git init && test_commit subcommit1 && - git tag sub_when_added_to_super && - git branch other + git tag sub_when_added_to_super ) && git submodule add "file://$pwd/sub" sub && git commit -m "add submodule" && @@ -52,14 +51,4 @@ test_expect_success 'check the default is --no-remote-submodules' ' ) ' -test_expect_success 'clone with --single-branch' ' - test_when_finished "rm -rf super_clone" && - git clone --recurse-submodules --single-branch "file://$pwd/." super_clone && - ( - cd super_clone/sub && - git rev-parse --verify origin/master && - test_must_fail git rev-parse --verify origin/other - ) -' - test_done diff --git a/third_party/git/t/t5700-protocol-v1.sh b/third_party/git/t/t5700-protocol-v1.sh index 022901b9eb6f..7c9511c593c1 100755 --- a/third_party/git/t/t5700-protocol-v1.sh +++ b/third_party/git/t/t5700-protocol-v1.sh @@ -5,8 +5,7 @@ test_description='test git wire-protocol transition' TEST_NO_CREATE_REPO=1 # This is a protocol-specific test. -GIT_TEST_PROTOCOL_VERSION=0 -export GIT_TEST_PROTOCOL_VERSION +GIT_TEST_PROTOCOL_VERSION= . ./test-lib.sh @@ -293,7 +292,4 @@ test_expect_success 'push with http:// using protocol v1' ' grep "git< version 1" log ' -# DO NOT add non-httpd-specific tests here, because the last part of this -# test script is only executed when httpd is available and enabled. - test_done diff --git a/third_party/git/t/t5702-protocol-v2.sh b/third_party/git/t/t5702-protocol-v2.sh index 5039e66dc47c..011b81d4fc27 100755 --- a/third_party/git/t/t5702-protocol-v2.sh +++ b/third_party/git/t/t5702-protocol-v2.sh @@ -32,7 +32,7 @@ test_expect_success 'list refs with git:// using protocol v2' ' test_cmp expect actual ' -test_expect_success 'ref advertisement is filtered with ls-remote using protocol v2' ' +test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' ' test_when_finished "rm -f log" && GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \ @@ -154,7 +154,7 @@ test_expect_success 'list refs with file:// using protocol v2' ' test_cmp expect actual ' -test_expect_success 'ref advertisement is filtered with ls-remote using protocol v2' ' +test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' ' test_when_finished "rm -f log" && GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \ @@ -225,7 +225,7 @@ test_expect_success 'fetch with file:// using protocol v2' ' grep "fetch< version 2" log ' -test_expect_success 'ref advertisement is filtered during fetch using protocol v2' ' +test_expect_success 'ref advertisment is filtered during fetch using protocol v2' ' test_when_finished "rm -f log" && test_commit -C file_parent three && @@ -631,19 +631,6 @@ test_expect_success 'fetch with http:// using protocol v2' ' grep "git< version 2" log ' -test_expect_success 'fetch with http:// by hash without tag following with protocol v2 does not list refs' ' - test_when_finished "rm -f log" && - - test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" two_a && - git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" rev-parse two_a >two_a_hash && - - GIT_TRACE_PACKET="$(pwd)/log" git -C http_child -c protocol.version=2 \ - fetch --no-tags origin $(cat two_a_hash) && - - grep "fetch< version 2" log && - ! grep "fetch> command=ls-refs" log -' - test_expect_success 'fetch from namespaced repo respects namespaces' ' test_when_finished "rm -f log" && @@ -665,18 +652,6 @@ test_expect_success 'fetch from namespaced repo respects namespaces' ' test_cmp expect actual ' -test_expect_success 'ls-remote with v2 http sends only one POST' ' - test_when_finished "rm -f log" && - - git ls-remote "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" >expect && - GIT_TRACE_CURL="$(pwd)/log" git -c protocol.version=2 \ - ls-remote "$HTTPD_URL/smart/http_parent" >actual && - test_cmp expect actual && - - grep "Send header: POST" log >posts && - test_line_count = 1 posts -' - test_expect_success 'push with http:// and a config of v2 does not request v2' ' test_when_finished "rm -f log" && # Till v2 for push is designed, make sure that if a client has @@ -694,9 +669,9 @@ test_expect_success 'push with http:// and a config of v2 does not request v2' ' git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" log -1 --format=%s client_branch >expect && test_cmp expect actual && - # Client did not request to use protocol v2 + # Client didnt request to use protocol v2 ! grep "Git-Protocol: version=2" log && - # Server did not respond using protocol v2 + # Server didnt respond using protocol v2 ! grep "git< version 2" log ' @@ -712,11 +687,11 @@ test_expect_success 'when server sends "ready", expect DELIM' ' # After "ready" in the acknowledgments section, pretend that a FLUSH # (0000) was sent instead of a DELIM (0001). - printf "\$ready = 1 if /ready/; \$ready && s/0001/0000/" \ - >"$HTTPD_ROOT_PATH/one-time-perl" && + printf "/ready/,$ s/0001/0000/" \ + >"$HTTPD_ROOT_PATH/one-time-sed" && test_must_fail git -C http_child -c protocol.version=2 \ - fetch "$HTTPD_URL/one_time_perl/http_parent" 2> err && + fetch "$HTTPD_URL/one_time_sed/http_parent" 2> err && test_i18ngrep "expected packfile to be sent after .ready." err ' @@ -737,18 +712,15 @@ test_expect_success 'when server does not send "ready", expect FLUSH' ' # After the acknowledgments section, pretend that a DELIM # (0001) was sent instead of a FLUSH (0000). - printf "\$ack = 1 if /acknowledgments/; \$ack && s/0000/0001/" \ - >"$HTTPD_ROOT_PATH/one-time-perl" && + printf "/acknowledgments/,$ s/0000/0001/" \ + >"$HTTPD_ROOT_PATH/one-time-sed" && test_must_fail env GIT_TRACE_PACKET="$(pwd)/log" git -C http_child \ -c protocol.version=2 \ - fetch "$HTTPD_URL/one_time_perl/http_parent" 2> err && + fetch "$HTTPD_URL/one_time_sed/http_parent" 2> err && grep "fetch< .*acknowledgments" log && ! grep "fetch< .*ready" log && test_i18ngrep "expected no other sections to be sent after no .ready." err ' -# DO NOT add non-httpd-specific tests here, because the last part of this -# test script is only executed when httpd is available and enabled. - test_done diff --git a/third_party/git/t/t5703-upload-pack-ref-in-want.sh b/third_party/git/t/t5703-upload-pack-ref-in-want.sh index 7fba3063bf91..de4b6106ef4a 100755 --- a/third_party/git/t/t5703-upload-pack-ref-in-want.sh +++ b/third_party/git/t/t5703-upload-pack-ref-in-want.sh @@ -18,16 +18,14 @@ get_actual_commits () { p }' o.pack && git index-pack o.pack && - git verify-pack -v o.idx >objs && - grep commit objs | cut -d" " -f1 | sort >actual_commits + git verify-pack -v o.idx | grep commit | cut -c-40 | sort >actual_commits } check_output () { get_actual_refs && test_cmp expected_refs actual_refs && get_actual_commits && - sort expected_commits >sorted_commits && - test_cmp sorted_commits actual_commits + test_cmp expected_commits actual_commits } # c(o/foo) d(o/bar) @@ -37,7 +35,6 @@ check_output () { # \ | / # a test_expect_success 'setup repository' ' - test_oid_init && test_commit a && git checkout -b o/foo && test_commit b && @@ -78,19 +75,17 @@ test_expect_success 'invalid want-ref line' ' ' test_expect_success 'basic want-ref' ' - oid=$(git rev-parse f) && cat >expected_refs <<-EOF && - $oid refs/heads/master + $(git rev-parse f) refs/heads/master EOF - git rev-parse f >expected_commits && + git rev-parse f | sort >expected_commits && - oid=$(git rev-parse a) && test-tool pkt-line pack >in <<-EOF && command=fetch 0001 no-progress want-ref refs/heads/master - have $oid + have $(git rev-parse a) done 0000 EOF @@ -100,22 +95,19 @@ test_expect_success 'basic want-ref' ' ' test_expect_success 'multiple want-ref lines' ' - oid_c=$(git rev-parse c) && - oid_d=$(git rev-parse d) && cat >expected_refs <<-EOF && - $oid_c refs/heads/o/foo - $oid_d refs/heads/o/bar + $(git rev-parse c) refs/heads/o/foo + $(git rev-parse d) refs/heads/o/bar EOF - git rev-parse c d >expected_commits && + git rev-parse c d | sort >expected_commits && - oid=$(git rev-parse b) && test-tool pkt-line pack >in <<-EOF && command=fetch 0001 no-progress want-ref refs/heads/o/foo want-ref refs/heads/o/bar - have $oid + have $(git rev-parse b) done 0000 EOF @@ -125,11 +117,10 @@ test_expect_success 'multiple want-ref lines' ' ' test_expect_success 'mix want and want-ref' ' - oid=$(git rev-parse f) && cat >expected_refs <<-EOF && - $oid refs/heads/master + $(git rev-parse f) refs/heads/master EOF - git rev-parse e f >expected_commits && + git rev-parse e f | sort >expected_commits && test-tool pkt-line pack >in <<-EOF && command=fetch @@ -147,19 +138,17 @@ test_expect_success 'mix want and want-ref' ' ' test_expect_success 'want-ref with ref we already have commit for' ' - oid=$(git rev-parse c) && cat >expected_refs <<-EOF && - $oid refs/heads/o/foo + $(git rev-parse c) refs/heads/o/foo EOF >expected_commits && - oid=$(git rev-parse c) && test-tool pkt-line pack >in <<-EOF && command=fetch 0001 no-progress want-ref refs/heads/o/foo - have $oid + have $(git rev-parse c) done 0000 EOF @@ -168,6 +157,106 @@ test_expect_success 'want-ref with ref we already have commit for' ' check_output ' +. "$TEST_DIRECTORY"/lib-httpd.sh +start_httpd + +REPO="$HTTPD_DOCUMENT_ROOT_PATH/repo" +LOCAL_PRISTINE="$(pwd)/local_pristine" + +test_expect_success 'setup repos for change-while-negotiating test' ' + ( + git init "$REPO" && + cd "$REPO" && + >.git/git-daemon-export-ok && + test_commit m1 && + git tag -d m1 && + + # Local repo with many commits (so that negotiation will take + # more than 1 request/response pair) + git clone "http://127.0.0.1:$LIB_HTTPD_PORT/smart/repo" "$LOCAL_PRISTINE" && + cd "$LOCAL_PRISTINE" && + git checkout -b side && + test_commit_bulk --id=s 33 && + + # Add novel commits to upstream + git checkout master && + cd "$REPO" && + test_commit m2 && + test_commit m3 && + git tag -d m2 m3 + ) && + git -C "$LOCAL_PRISTINE" remote set-url origin "http://127.0.0.1:$LIB_HTTPD_PORT/one_time_sed/repo" && + git -C "$LOCAL_PRISTINE" config protocol.version 2 +' + +inconsistency () { + # Simulate that the server initially reports $2 as the ref + # corresponding to $1, and after that, $1 as the ref corresponding to + # $1. This corresponds to the real-life situation where the server's + # repository appears to change during negotiation, for example, when + # different servers in a load-balancing arrangement serve (stateless) + # RPCs during a single negotiation. + printf "s/%s/%s/" \ + $(git -C "$REPO" rev-parse $1 | tr -d "\n") \ + $(git -C "$REPO" rev-parse $2 | tr -d "\n") \ + >"$HTTPD_ROOT_PATH/one-time-sed" +} + +test_expect_success 'server is initially ahead - no ref in want' ' + git -C "$REPO" config uploadpack.allowRefInWant false && + rm -rf local && + cp -r "$LOCAL_PRISTINE" local && + inconsistency master 1234567890123456789012345678901234567890 && + test_must_fail git -C local fetch 2>err && + test_i18ngrep "fatal: remote error: upload-pack: not our ref" err +' + +test_expect_success 'server is initially ahead - ref in want' ' + git -C "$REPO" config uploadpack.allowRefInWant true && + rm -rf local && + cp -r "$LOCAL_PRISTINE" local && + inconsistency master 1234567890123456789012345678901234567890 && + git -C local fetch && + + git -C "$REPO" rev-parse --verify master >expected && + git -C local rev-parse --verify refs/remotes/origin/master >actual && + test_cmp expected actual +' + +test_expect_success 'server is initially behind - no ref in want' ' + git -C "$REPO" config uploadpack.allowRefInWant false && + rm -rf local && + cp -r "$LOCAL_PRISTINE" local && + inconsistency master "master^" && + git -C local fetch && + + git -C "$REPO" rev-parse --verify "master^" >expected && + git -C local rev-parse --verify refs/remotes/origin/master >actual && + test_cmp expected actual +' + +test_expect_success 'server is initially behind - ref in want' ' + git -C "$REPO" config uploadpack.allowRefInWant true && + rm -rf local && + cp -r "$LOCAL_PRISTINE" local && + inconsistency master "master^" && + git -C local fetch && + + git -C "$REPO" rev-parse --verify "master" >expected && + git -C local rev-parse --verify refs/remotes/origin/master >actual && + test_cmp expected actual +' + +test_expect_success 'server loses a ref - ref in want' ' + git -C "$REPO" config uploadpack.allowRefInWant true && + rm -rf local && + cp -r "$LOCAL_PRISTINE" local && + echo "s/master/raster/" >"$HTTPD_ROOT_PATH/one-time-sed" && + test_must_fail git -C local fetch 2>err && + + test_i18ngrep "fatal: remote error: unknown ref refs/heads/raster" err +' + REPO="$(pwd)/repo" LOCAL_PRISTINE="$(pwd)/local_pristine" @@ -222,14 +311,13 @@ test_expect_success 'fetching with exact OID' ' rm -rf local && cp -r "$LOCAL_PRISTINE" local && - oid=$(git -C "$REPO" rev-parse d) && GIT_TRACE_PACKET="$(pwd)/log" git -C local fetch origin \ - "$oid":refs/heads/actual && + $(git -C "$REPO" rev-parse d):refs/heads/actual && git -C "$REPO" rev-parse "d" >expected && git -C local rev-parse refs/heads/actual >actual && test_cmp expected actual && - grep "want $oid" log + grep "want $(git -C "$REPO" rev-parse d)" log ' test_expect_success 'fetching multiple refs' ' @@ -251,14 +339,13 @@ test_expect_success 'fetching ref and exact OID' ' rm -rf local && cp -r "$LOCAL_PRISTINE" local && - oid=$(git -C "$REPO" rev-parse b) && GIT_TRACE_PACKET="$(pwd)/log" git -C local fetch origin \ - master "$oid":refs/heads/actual && + master $(git -C "$REPO" rev-parse b):refs/heads/actual && git -C "$REPO" rev-parse "master" "b" >expected && git -C local rev-parse refs/remotes/origin/master refs/heads/actual >actual && test_cmp expected actual && - grep "want $oid" log && + grep "want $(git -C "$REPO" rev-parse b)" log && grep "want-ref refs/heads/master" log ' @@ -285,107 +372,4 @@ test_expect_success 'fetching with wildcard that matches multiple refs' ' grep "want-ref refs/heads/o/bar" log ' -. "$TEST_DIRECTORY"/lib-httpd.sh -start_httpd - -REPO="$HTTPD_DOCUMENT_ROOT_PATH/repo" -LOCAL_PRISTINE="$(pwd)/local_pristine" - -test_expect_success 'setup repos for change-while-negotiating test' ' - ( - git init "$REPO" && - cd "$REPO" && - >.git/git-daemon-export-ok && - test_commit m1 && - git tag -d m1 && - - # Local repo with many commits (so that negotiation will take - # more than 1 request/response pair) - rm -rf "$LOCAL_PRISTINE" && - git clone "http://127.0.0.1:$LIB_HTTPD_PORT/smart/repo" "$LOCAL_PRISTINE" && - cd "$LOCAL_PRISTINE" && - git checkout -b side && - test_commit_bulk --id=s 33 && - - # Add novel commits to upstream - git checkout master && - cd "$REPO" && - test_commit m2 && - test_commit m3 && - git tag -d m2 m3 - ) && - git -C "$LOCAL_PRISTINE" remote set-url origin "http://127.0.0.1:$LIB_HTTPD_PORT/one_time_perl/repo" && - git -C "$LOCAL_PRISTINE" config protocol.version 2 -' - -inconsistency () { - # Simulate that the server initially reports $2 as the ref - # corresponding to $1, and after that, $1 as the ref corresponding to - # $1. This corresponds to the real-life situation where the server's - # repository appears to change during negotiation, for example, when - # different servers in a load-balancing arrangement serve (stateless) - # RPCs during a single negotiation. - oid1=$(git -C "$REPO" rev-parse $1) && - oid2=$(git -C "$REPO" rev-parse $2) && - echo "s/$oid1/$oid2/" >"$HTTPD_ROOT_PATH/one-time-perl" -} - -test_expect_success 'server is initially ahead - no ref in want' ' - git -C "$REPO" config uploadpack.allowRefInWant false && - rm -rf local && - cp -r "$LOCAL_PRISTINE" local && - inconsistency master $(test_oid numeric) && - test_must_fail git -C local fetch 2>err && - test_i18ngrep "fatal: remote error: upload-pack: not our ref" err -' - -test_expect_success 'server is initially ahead - ref in want' ' - git -C "$REPO" config uploadpack.allowRefInWant true && - rm -rf local && - cp -r "$LOCAL_PRISTINE" local && - inconsistency master $(test_oid numeric) && - git -C local fetch && - - git -C "$REPO" rev-parse --verify master >expected && - git -C local rev-parse --verify refs/remotes/origin/master >actual && - test_cmp expected actual -' - -test_expect_success 'server is initially behind - no ref in want' ' - git -C "$REPO" config uploadpack.allowRefInWant false && - rm -rf local && - cp -r "$LOCAL_PRISTINE" local && - inconsistency master "master^" && - git -C local fetch && - - git -C "$REPO" rev-parse --verify "master^" >expected && - git -C local rev-parse --verify refs/remotes/origin/master >actual && - test_cmp expected actual -' - -test_expect_success 'server is initially behind - ref in want' ' - git -C "$REPO" config uploadpack.allowRefInWant true && - rm -rf local && - cp -r "$LOCAL_PRISTINE" local && - inconsistency master "master^" && - git -C local fetch && - - git -C "$REPO" rev-parse --verify "master" >expected && - git -C local rev-parse --verify refs/remotes/origin/master >actual && - test_cmp expected actual -' - -test_expect_success 'server loses a ref - ref in want' ' - git -C "$REPO" config uploadpack.allowRefInWant true && - rm -rf local && - cp -r "$LOCAL_PRISTINE" local && - echo "s/master/raster/" >"$HTTPD_ROOT_PATH/one-time-perl" && - test_must_fail git -C local fetch 2>err && - - test_i18ngrep "fatal: remote error: unknown ref refs/heads/raster" err -' - -# DO NOT add non-httpd-specific tests here, because the last part of this -# test script is only executed when httpd is available and enabled. - test_done diff --git a/third_party/git/t/t5801-remote-helpers.sh b/third_party/git/t/t5801-remote-helpers.sh index 121e5c6edb0a..2d6c4a281edb 100755 --- a/third_party/git/t/t5801-remote-helpers.sh +++ b/third_party/git/t/t5801-remote-helpers.sh @@ -247,6 +247,7 @@ clean_mark () { test_expect_success 'proper failure checks for fetching' ' (cd local && test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error && + cat error && test_i18ngrep -q "error while running fast-import" error ) ' diff --git a/third_party/git/t/t6000-rev-list-misc.sh b/third_party/git/t/t6000-rev-list-misc.sh index 3dc1ad8f7199..52a9e38d66f3 100755 --- a/third_party/git/t/t6000-rev-list-misc.sh +++ b/third_party/git/t/t6000-rev-list-misc.sh @@ -104,16 +104,13 @@ test_expect_success 'rev-list can show index objects' ' # - we do not show the root tree; since we updated the index, it # does not have a valid cache tree # + cat >expect <<-\EOF && + 8e4020bb5a8d8c873b25de15933e75cc0fc275df one + d9d3a7417b9605cfd88ee6306b28dadc29e6ab08 only-in-index + 9200b628cf9dc883a85a7abc8d6e6730baee589c two + EOF echo only-in-index >only-in-index && test_when_finished "git reset --hard" && - rev1=$(git rev-parse HEAD:one) && - rev2=$(git rev-parse HEAD:two) && - revi=$(git hash-object only-in-index) && - cat >expect <<-EOF && - $rev1 one - $revi only-in-index - $rev2 two - EOF git add only-in-index && git rev-list --objects --indexed-objects >actual && test_cmp expect actual @@ -143,24 +140,4 @@ test_expect_success '--header shows a NUL after each commit' ' test_cmp expect actual ' -test_expect_success 'rev-list --end-of-options' ' - git update-ref refs/heads/--output=yikes HEAD && - git rev-list --end-of-options --output=yikes >actual && - test_path_is_missing yikes && - git rev-list HEAD >expect && - test_cmp expect actual -' - -test_expect_success 'rev-list --count' ' - count=$(git rev-list --count HEAD) && - git rev-list HEAD >actual && - test_line_count = $count actual -' - -test_expect_success 'rev-list --count --objects' ' - count=$(git rev-list --count --objects HEAD) && - git rev-list --objects HEAD >actual && - test_line_count = $count actual -' - test_done diff --git a/third_party/git/t/t6006-rev-list-format.sh b/third_party/git/t/t6006-rev-list-format.sh index 7e82e43a634a..da113d975b16 100755 --- a/third_party/git/t/t6006-rev-list-format.sh +++ b/third_party/git/t/t6006-rev-list-format.sh @@ -32,7 +32,6 @@ changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t $test_encoding) truncate_count=20 test_expect_success 'setup' ' - test_oid_init && : >foo && git add foo && git config i18n.commitEncoding $test_encoding && @@ -110,35 +109,31 @@ commit $head1 EOF # we don't test relative here -test_format author %an%n%ae%n%al%n%ad%n%aD%n%at <actual && len=$(wc -c expect && + echo "C O Mitter:committer@example.com" >expect && git log -g -1 --format="%gn:%ge" >actual && test_cmp expect actual ' test_expect_success 'oneline with empty message' ' - git commit --allow-empty --cleanup=verbatim -m "$LF" && - git commit --allow-empty --allow-empty-message && + git commit -m "dummy" --allow-empty && + git commit -m "dummy" --allow-empty && + git filter-branch --msg-filter "sed -e s/dummy//" HEAD^^.. && git rev-list --oneline HEAD >test.txt && test_line_count = 5 test.txt && git rev-list --oneline --graph HEAD >testg.txt && diff --git a/third_party/git/t/t6011-rev-list-with-bad-commit.sh b/third_party/git/t/t6011-rev-list-with-bad-commit.sh index bad02cf5b83d..545b461e51d4 100755 --- a/third_party/git/t/t6011-rev-list-with-bad-commit.sh +++ b/third_party/git/t/t6011-rev-list-with-bad-commit.sh @@ -42,7 +42,7 @@ test_expect_success 'corrupt second commit object' \ ' test_expect_success 'rev-list should fail' ' - test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git -c core.commitGraph=false rev-list --all > /dev/null + test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git rev-list --all > /dev/null ' test_expect_success 'git repack _MUST_ fail' \ diff --git a/third_party/git/t/t6016-rev-list-graph-simplify-history.sh b/third_party/git/t/t6016-rev-list-graph-simplify-history.sh index f5e6e92f5b30..f7181d1d6a14 100755 --- a/third_party/git/t/t6016-rev-list-graph-simplify-history.sh +++ b/third_party/git/t/t6016-rev-list-graph-simplify-history.sh @@ -67,10 +67,11 @@ test_expect_success '--graph --all' ' echo "| * $C4" >> expected && echo "| * $C3" >> expected && echo "* | $A5" >> expected && - echo "| | " >> expected && - echo "| \\ " >> expected && - echo "*-. | $A4" >> expected && - echo "|\\ \\| " >> expected && + echo "| | " >> expected && + echo "| \\ " >> expected && + echo "*-. \\ $A4" >> expected && + echo "|\\ \\ \\ " >> expected && + echo "| | |/ " >> expected && echo "| | * $C2" >> expected && echo "| | * $C1" >> expected && echo "| * | $B2" >> expected && @@ -96,10 +97,11 @@ test_expect_success '--graph --simplify-by-decoration' ' echo "| * $C4" >> expected && echo "| * $C3" >> expected && echo "* | $A5" >> expected && - echo "| | " >> expected && - echo "| \\ " >> expected && - echo "*-. | $A4" >> expected && - echo "|\\ \\| " >> expected && + echo "| | " >> expected && + echo "| \\ " >> expected && + echo "*-. \\ $A4" >> expected && + echo "|\\ \\ \\ " >> expected && + echo "| | |/ " >> expected && echo "| | * $C2" >> expected && echo "| | * $C1" >> expected && echo "| * | $B2" >> expected && @@ -129,8 +131,9 @@ test_expect_success '--graph --simplify-by-decoration prune branch B' ' echo "| * $C4" >> expected && echo "| * $C3" >> expected && echo "* | $A5" >> expected && - echo "* | $A4" >> expected && - echo "|\\| " >> expected && + echo "* | $A4" >> expected && + echo "|\\ \\ " >> expected && + echo "| |/ " >> expected && echo "| * $C2" >> expected && echo "| * $C1" >> expected && echo "* | $A3" >> expected && @@ -148,8 +151,9 @@ test_expect_success '--graph --full-history -- bar.txt' ' echo "|\\ " >> expected && echo "| * $C4" >> expected && echo "* | $A5" >> expected && - echo "* | $A4" >> expected && - echo "|\\| " >> expected && + echo "* | $A4" >> expected && + echo "|\\ \\ " >> expected && + echo "| |/ " >> expected && echo "* | $A3" >> expected && echo "|/ " >> expected && echo "* $A2" >> expected && @@ -251,7 +255,7 @@ test_expect_success '--graph --boundary ^C3' ' echo "* | | | $A3" >> expected && echo "o | | | $A2" >> expected && echo "|/ / / " >> expected && - echo "o / / $A1" >> expected && + echo "o | | $A1" >> expected && echo " / / " >> expected && echo "| o $C3" >> expected && echo "|/ " >> expected && diff --git a/third_party/git/t/t6019-rev-list-ancestry-path.sh b/third_party/git/t/t6019-rev-list-ancestry-path.sh index 353f84313f33..beadaf6cca05 100755 --- a/third_party/git/t/t6019-rev-list-ancestry-path.sh +++ b/third_party/git/t/t6019-rev-list-ancestry-path.sh @@ -143,14 +143,14 @@ test_expect_success 'setup criss-cross' ' test_expect_success 'criss-cross: rev-list --ancestry-path cb..bc' ' (cd criss-cross && git rev-list --ancestry-path xcb..xbc > actual && - test_must_be_empty actual) + test -z "$(cat actual)") ' # no commits in repository descend from cb test_expect_success 'criss-cross: rev-list --ancestry-path --all ^cb' ' (cd criss-cross && git rev-list --ancestry-path --all ^xcb > actual && - test_must_be_empty actual) + test -z "$(cat actual)") ' test_done diff --git a/third_party/git/t/t6020-merge-df.sh b/third_party/git/t/t6020-merge-df.sh index 400a4cd13928..46b506b3b7b6 100755 --- a/third_party/git/t/t6020-merge-df.sh +++ b/third_party/git/t/t6020-merge-df.sh @@ -83,9 +83,9 @@ test_expect_success 'modify/delete + directory/file conflict' ' test 4 -eq $(git ls-files -u | wc -l) && test 1 -eq $(git ls-files -o | wc -l) && - test_path_is_file letters/file && - test_path_is_file letters.txt && - test_path_is_file letters~modify + test -f letters/file && + test -f letters.txt && + test -f letters~modify ' test_expect_success 'modify/delete + directory/file conflict; other way' ' @@ -99,52 +99,9 @@ test_expect_success 'modify/delete + directory/file conflict; other way' ' test 4 -eq $(git ls-files -u | wc -l) && test 1 -eq $(git ls-files -o | wc -l) && - test_path_is_file letters/file && - test_path_is_file letters.txt && - test_path_is_file letters~HEAD -' - -test_expect_success 'Simple merge in repo with interesting pathnames' ' - # Simple lexicographic ordering of files and directories would be: - # foo - # foo/bar - # foo/bar-2 - # foo/bar/baz - # foo/bar-2/baz - # The fact that foo/bar-2 appears between foo/bar and foo/bar/baz - # can trip up some codepaths, and is the point of this test. - test_create_repo name-ordering && - ( - cd name-ordering && - - mkdir -p foo/bar && - mkdir -p foo/bar-2 && - >foo/bar/baz && - >foo/bar-2/baz && - git add . && - git commit -m initial && - - git branch main && - git branch other && - - git checkout other && - echo other >foo/bar-2/baz && - git add -u && - git commit -m other && - - git checkout main && - echo main >foo/bar/baz && - git add -u && - git commit -m main && - - git merge other && - git ls-files -s >out && - test_line_count = 2 out && - git rev-parse :0:foo/bar/baz :0:foo/bar-2/baz >actual && - git rev-parse HEAD~1:foo/bar/baz other:foo/bar-2/baz >expect && - test_cmp expect actual - ) - + test -f letters/file && + test -f letters.txt && + test -f letters~HEAD ' test_done diff --git a/third_party/git/t/t6021-merge-criss-cross.sh b/third_party/git/t/t6021-merge-criss-cross.sh index 9d5e992878fa..213deecab1e8 100755 --- a/third_party/git/t/t6021-merge-criss-cross.sh +++ b/third_party/git/t/t6021-merge-criss-cross.sh @@ -3,65 +3,94 @@ # Copyright (c) 2005 Fredrik Kuivinen # -# See https://lore.kernel.org/git/Pine.LNX.4.44.0504271254120.4678-100000@wax.eds.org/ for a +# See http://marc.info/?l=git&m=111463358500362&w=2 for a # nice description of what this is about. test_description='Test criss-cross merge' . ./test-lib.sh -test_expect_success 'prepare repository' ' - test_write_lines 1 2 3 4 5 6 7 8 9 >file && - git add file && - git commit -m "Initial commit" file && - - git branch A && - git branch B && - git checkout A && - - test_write_lines 1 2 3 4 5 6 7 "8 changed in B8, branch A" 9 >file && - git commit -m "B8" file && - git checkout B && - - test_write_lines 1 2 "3 changed in C3, branch B" 4 5 6 7 8 9 >file && - git commit -m "C3" file && - git branch C3 && - - git merge -m "pre E3 merge" A && - - test_write_lines 1 2 "3 changed in E3, branch B. New file size" 4 5 6 7 "8 changed in B8, branch A" 9 >file && - git commit -m "E3" file && - - git checkout A && - git merge -m "pre D8 merge" C3 && - test_write_lines 1 2 "3 changed in C3, branch B" 4 5 6 7 "8 changed in D8, branch A. New file size 2" 9 >file && - - git commit -m D8 file -' - -test_expect_success 'Criss-cross merge' ' - git merge -m "final merge" B -' - -test_expect_success 'Criss-cross merge result' ' - cat <<-\EOF >file-expect && - 1 - 2 - 3 changed in E3, branch B. New file size - 4 - 5 - 6 - 7 - 8 changed in D8, branch A. New file size 2 - 9 - EOF - - test_cmp file-expect file -' - -test_expect_success 'Criss-cross merge fails (-s resolve)' ' - git reset --hard A^ && - test_must_fail git merge -s resolve -m "final merge" B -' +test_expect_success 'prepare repository' \ +'echo "1 +2 +3 +4 +5 +6 +7 +8 +9" > file && +git add file && +git commit -m "Initial commit" file && +git branch A && +git branch B && +git checkout A && +echo "1 +2 +3 +4 +5 +6 +7 +8 changed in B8, branch A +9" > file && +git commit -m "B8" file && +git checkout B && +echo "1 +2 +3 changed in C3, branch B +4 +5 +6 +7 +8 +9 +" > file && +git commit -m "C3" file && +git branch C3 && +git merge -m "pre E3 merge" A && +echo "1 +2 +3 changed in E3, branch B. New file size +4 +5 +6 +7 +8 changed in B8, branch A +9 +" > file && +git commit -m "E3" file && +git checkout A && +git merge -m "pre D8 merge" C3 && +echo "1 +2 +3 changed in C3, branch B +4 +5 +6 +7 +8 changed in D8, branch A. New file size 2 +9" > file && +git commit -m D8 file' + +test_expect_success 'Criss-cross merge' 'git merge -m "final merge" B' + +cat > file-expect <A <<-\EOF && - a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - c cccccccccccccccccccccccccccccccccccccccccccccccc - d dddddddddddddddddddddddddddddddddddddddddddddddd - e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - f ffffffffffffffffffffffffffffffffffffffffffffffff - g gggggggggggggggggggggggggggggggggggggggggggggggg - h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh - i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii - j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj - k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk - l llllllllllllllllllllllllllllllllllllllllllllllll - m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn - o oooooooooooooooooooooooooooooooooooooooooooooooo - EOF - - cat >M <<-\EOF && - A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB - C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD - E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE - F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG - H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH - I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII - J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ - K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK - L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL - M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM - N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN - O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO - EOF - - git add A M && - git commit -m "initial has A and M" && - git branch white && - git branch red && - git branch blue && - git branch yellow && - git branch change && - git branch change+rename && - - sed -e "/^g /s/.*/g : master changes a line/" A+ && - mv A+ A && - git commit -a -m "master updates A" && - - git checkout yellow && - rm -f M && - git commit -a -m "yellow removes M" && - - git checkout white && - sed -e "/^g /s/.*/g : white changes a line/" B && - sed -e "/^G /s/.*/G : colored branch changes a line/" N && - rm -f A M && - git update-index --add --remove A B M N && - git commit -m "white renames A->B, M->N" && - - git checkout red && - sed -e "/^g /s/.*/g : red changes a line/" B && - sed -e "/^G /s/.*/G : colored branch changes a line/" N && - rm -f A M && - git update-index --add --remove A B M N && - git commit -m "red renames A->B, M->N" && - - git checkout blue && - sed -e "/^g /s/.*/g : blue changes a line/" C && - sed -e "/^G /s/.*/G : colored branch changes a line/" N && - rm -f A M && - git update-index --add --remove A C M N && - git commit -m "blue renames A->C, M->N" && - - git checkout change && - sed -e "/^g /s/.*/g : changed line/" A+ && - mv A+ A && - git commit -q -a -m "changed" && - - git checkout change+rename && - sed -e "/^g /s/.*/g : changed line/" B && - rm A && - git update-index --add B && - git commit -q -a -m "changed and renamed" && - - git checkout master -' +test_expect_success setup \ +' +cat >A <<\EOF && +a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +c cccccccccccccccccccccccccccccccccccccccccccccccc +d dddddddddddddddddddddddddddddddddddddddddddddddd +e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +f ffffffffffffffffffffffffffffffffffffffffffffffff +g gggggggggggggggggggggggggggggggggggggggggggggggg +h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh +i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii +j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj +k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk +l llllllllllllllllllllllllllllllllllllllllllllllll +m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm +n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn +o oooooooooooooooooooooooooooooooooooooooooooooooo +EOF + +cat >M <<\EOF && +A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG +H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH +I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII +J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ +K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK +L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL +M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN +O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO +EOF + +git add A M && +git commit -m "initial has A and M" && +git branch white && +git branch red && +git branch blue && +git branch yellow && +git branch change && +git branch change+rename && + +sed -e "/^g /s/.*/g : master changes a line/" A+ && +mv A+ A && +git commit -a -m "master updates A" && + +git checkout yellow && +rm -f M && +git commit -a -m "yellow removes M" && + +git checkout white && +sed -e "/^g /s/.*/g : white changes a line/" B && +sed -e "/^G /s/.*/G : colored branch changes a line/" N && +rm -f A M && +git update-index --add --remove A B M N && +git commit -m "white renames A->B, M->N" && + +git checkout red && +sed -e "/^g /s/.*/g : red changes a line/" B && +sed -e "/^G /s/.*/G : colored branch changes a line/" N && +rm -f A M && +git update-index --add --remove A B M N && +git commit -m "red renames A->B, M->N" && + +git checkout blue && +sed -e "/^g /s/.*/g : blue changes a line/" C && +sed -e "/^G /s/.*/G : colored branch changes a line/" N && +rm -f A M && +git update-index --add --remove A C M N && +git commit -m "blue renames A->C, M->N" && + +git checkout change && +sed -e "/^g /s/.*/g : changed line/" A+ && +mv A+ A && +git commit -q -a -m "changed" && + +git checkout change+rename && +sed -e "/^g /s/.*/g : changed line/" B && +rm A && +git update-index --add B && +git commit -q -a -m "changed and renamed" && + +git checkout master' test_expect_success 'pull renaming branch into unrenaming one' \ ' @@ -242,24 +242,12 @@ test_expect_success 'merge of identical changes in a renamed file' ' rm -f A M N && git reset --hard && git checkout change+rename && - - test-tool chmtime --get -3600 B >old-mtime && GIT_MERGE_VERBOSITY=3 git merge change >out && - - test-tool chmtime --get B >new-mtime && - test_cmp old-mtime new-mtime && - + test_i18ngrep "^Skipped B" out && git reset --hard HEAD^ && git checkout change && - - # A will be renamed to B; we check mtimes and file presence - test_path_is_missing B && - test-tool chmtime --get -3600 A >old-mtime && GIT_MERGE_VERBOSITY=3 git merge change+rename >out && - - test_path_is_missing A && - test-tool chmtime --get B >new-mtime && - test $(cat old-mtime) -lt $(cat new-mtime) + test_i18ngrep ! "^Skipped B" out ' test_expect_success 'setup for rename + d/f conflicts' ' @@ -300,15 +288,14 @@ test_expect_success 'setup for rename + d/f conflicts' ' git commit -m "Conflicting change" ' +printf "1\n2\n3\n4\n5555\n6\n7\n8\n9\n10\n11\n" >expected + test_expect_success 'Rename+D/F conflict; renamed file merges + dir not in way' ' git reset --hard && git checkout -q renamed-file-has-no-conflicts^0 && - git merge --strategy=recursive dir-not-in-way && - git diff --quiet && - test_path_is_file dir && - test_write_lines 1 2 3 4 5555 6 7 8 9 10 11 >expected && + test -f dir && test_cmp expected dir ' @@ -328,8 +315,8 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' ' test_must_fail git diff --quiet && test_must_fail git diff --cached --quiet && - test_path_is_file dir/file-in-the-way && - test_path_is_file dir~HEAD && + test -f dir/file-in-the-way && + test -f dir~HEAD && test_cmp expected dir~HEAD ' @@ -350,11 +337,29 @@ test_expect_success 'Same as previous, but merged other way' ' test_must_fail git diff --quiet && test_must_fail git diff --cached --quiet && - test_path_is_file dir/file-in-the-way && - test_path_is_file dir~renamed-file-has-no-conflicts && + test -f dir/file-in-the-way && + test -f dir~renamed-file-has-no-conflicts && test_cmp expected dir~renamed-file-has-no-conflicts ' +cat >expected <<\EOF && +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +<<<<<<< HEAD:dir +12 +======= +11 +>>>>>>> dir-not-in-way:sub/file +EOF + test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in way' ' git reset --hard && rm -rf dir~* && @@ -367,24 +372,7 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in test_must_fail git diff --quiet && test_must_fail git diff --cached --quiet && - test_path_is_file dir && - cat >expected <<-\EOF && - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - <<<<<<< HEAD:dir - 12 - ======= - 11 - >>>>>>> dir-not-in-way:sub/file - EOF + test -f dir && test_cmp expected dir ' @@ -403,11 +391,29 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge and dir in t test_must_fail git diff --quiet && test_must_fail git diff --cached --quiet && - test_path_is_file dir/file-in-the-way && - test_path_is_file dir~HEAD && + test -f dir/file-in-the-way && + test -f dir~HEAD && test_cmp expected dir~HEAD ' +cat >expected <<\EOF && +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +<<<<<<< HEAD:sub/file +11 +======= +12 +>>>>>>> renamed-file-has-conflicts:dir +EOF + test_expect_success 'Same as previous, but merged other way' ' git reset --hard && rm -rf dir~* && @@ -421,25 +427,8 @@ test_expect_success 'Same as previous, but merged other way' ' test_must_fail git diff --quiet && test_must_fail git diff --cached --quiet && - test_path_is_file dir/file-in-the-way && - test_path_is_file dir~renamed-file-has-conflicts && - cat >expected <<-\EOF && - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - <<<<<<< HEAD:sub/file - 11 - ======= - 12 - >>>>>>> renamed-file-has-conflicts:dir - EOF + test -f dir/file-in-the-way && + test -f dir~renamed-file-has-conflicts && test_cmp expected dir~renamed-file-has-conflicts ' @@ -475,9 +464,9 @@ test_expect_success 'both rename source and destination involved in D/F conflict test_must_fail git diff --quiet && - test_path_is_file destdir/foo && - test_path_is_file one && - test_path_is_file destdir~HEAD && + test -f destdir/foo && + test -f one && + test -f destdir~HEAD && test "stuff" = "$(cat destdir~HEAD)" ' @@ -518,9 +507,9 @@ test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked test 4 -eq $(find . | grep -v .git | wc -l) && - test_path_is_dir one && - test_path_is_file one~rename-two && - test_path_is_file two && + test -d one && + test -f one~rename-two && + test -f two && test "other" = $(cat one~rename-two) && test "stuff" = $(cat two) ' @@ -538,8 +527,8 @@ test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean sta test 3 -eq $(find . | grep -v .git | wc -l) && - test_path_is_file one && - test_path_is_file two && + test -f one && + test -f two && test "other" = $(cat one) && test "stuff" = $(cat two) ' @@ -579,11 +568,11 @@ test_expect_success 'check handling of differently renamed file with D/F conflic test 1 -eq "$(git ls-files -u original | wc -l)" && test 2 -eq "$(git ls-files -o | wc -l)" && - test_path_is_file one/file && - test_path_is_file two/file && - test_path_is_file one~HEAD && - test_path_is_file two~second-rename && - test_path_is_missing original + test -f one/file && + test -f two/file && + test -f one~HEAD && + test -f two~second-rename && + ! test -f original ' test_expect_success 'setup rename one file to two; directories moving out of the way' ' @@ -618,9 +607,9 @@ test_expect_success 'check handling of differently renamed file with D/F conflic test 1 -eq "$(git ls-files -u original | wc -l)" && test 0 -eq "$(git ls-files -o | wc -l)" && - test_path_is_file one && - test_path_is_file two && - test_path_is_missing original + test -f one && + test -f two && + ! test -f original ' test_expect_success 'setup avoid unnecessary update, normal rename' ' @@ -646,7 +635,7 @@ test_expect_success 'setup avoid unnecessary update, normal rename' ' test_expect_success 'avoid unnecessary update, normal rename' ' git checkout -q avoid-unnecessary-update-1^0 && - test-tool chmtime --get -3600 rename >expect && + test-tool chmtime --get =1000000000 rename >expect && git merge merge-branch-1 && test-tool chmtime --get rename >actual && test_cmp expect actual # "rename" should have stayed intact @@ -678,7 +667,7 @@ test_expect_success 'setup to test avoiding unnecessary update, with D/F conflic test_expect_success 'avoid unnecessary update, with D/F conflict' ' git checkout -q avoid-unnecessary-update-2^0 && - test-tool chmtime --get -3600 df >expect && + test-tool chmtime --get =1000000000 df >expect && git merge merge-branch-2 && test-tool chmtime --get df >actual && test_cmp expect actual # "df" should have stayed intact @@ -709,7 +698,7 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' ' test_expect_success 'avoid unnecessary update, dir->(file,nothing)' ' git checkout -q master^0 && - test-tool chmtime --get -3600 df >expect && + test-tool chmtime --get =1000000000 df >expect && git merge side && test-tool chmtime --get df >actual && test_cmp expect actual # "df" should have stayed intact @@ -738,7 +727,7 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' ' test_expect_success 'avoid unnecessary update, modify/delete' ' git checkout -q master^0 && - test-tool chmtime --get -3600 file >expect && + test-tool chmtime --get =1000000000 file >expect && test_must_fail git merge side && test-tool chmtime --get file >actual && test_cmp expect actual # "file" should have stayed intact @@ -766,7 +755,7 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' ' test_expect_success 'avoid unnecessary update, rename/add-dest' ' git checkout -q master^0 && - test-tool chmtime --get -3600 newfile >expect && + test-tool chmtime --get =1000000000 newfile >expect && git merge side && test-tool chmtime --get newfile >actual && test_cmp expect actual # "file" should have stayed intact @@ -821,48 +810,48 @@ test_expect_success 'setup for use of extended merge markers' ' git commit -mC ' +cat >expected <<\EOF && +1 +2 +3 +4 +5 +6 +7 +8 +<<<<<<< HEAD:renamed_file +9 +======= +8.5 +>>>>>>> master^0:original_file +EOF + test_expect_success 'merge master into rename has correct extended markers' ' git checkout rename^0 && test_must_fail git merge -s recursive master^0 && - - cat >expected <<-\EOF && - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - <<<<<<< HEAD:renamed_file - 9 - ======= - 8.5 - >>>>>>> master^0:original_file - EOF test_cmp expected renamed_file ' +cat >expected <<\EOF && +1 +2 +3 +4 +5 +6 +7 +8 +<<<<<<< HEAD:original_file +8.5 +======= +9 +>>>>>>> rename^0:renamed_file +EOF + test_expect_success 'merge rename into master has correct extended markers' ' git reset --hard && git checkout master^0 && test_must_fail git merge -s recursive rename^0 && - - cat >expected <<-\EOF && - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - <<<<<<< HEAD:original_file - 8.5 - ======= - 9 - >>>>>>> rename^0:renamed_file - EOF test_cmp expected renamed_file ' diff --git a/third_party/git/t/t6023-merge-file.sh b/third_party/git/t/t6023-merge-file.sh index 2f421d967abe..51ee887a7763 100755 --- a/third_party/git/t/t6023-merge-file.sh +++ b/third_party/git/t/t6023-merge-file.sh @@ -3,59 +3,56 @@ test_description='RCS merge replacement: merge-file' . ./test-lib.sh -test_expect_success 'setup' ' - cat >orig.txt <<-\EOF && - Dominus regit me, - et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - EOF - - cat >new1.txt <<-\EOF && - Dominus regit me, - et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - Nam et si ambulavero in medio umbrae mortis, - non timebo mala, quoniam tu mecum es: - virga tua et baculus tuus ipsa me consolata sunt. - EOF - - cat >new2.txt <<-\EOF && - Dominus regit me, et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - EOF - - cat >new3.txt <<-\EOF && - DOMINUS regit me, - et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - EOF - - cat >new4.txt <<-\EOF && - Dominus regit me, et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - EOF - - printf "propter nomen suum." >>new4.txt -' +cat > orig.txt << EOF +Dominus regit me, +et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +EOF + +cat > new1.txt << EOF +Dominus regit me, +et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +Nam et si ambulavero in medio umbrae mortis, +non timebo mala, quoniam tu mecum es: +virga tua et baculus tuus ipsa me consolata sunt. +EOF + +cat > new2.txt << EOF +Dominus regit me, et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +EOF + +cat > new3.txt << EOF +DOMINUS regit me, +et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +EOF + +cat > new4.txt << EOF +Dominus regit me, et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +EOF +printf "propter nomen suum." >> new4.txt test_expect_success 'merge with no changes' ' cp orig.txt test.txt && @@ -63,10 +60,9 @@ test_expect_success 'merge with no changes' ' test_cmp test.txt orig.txt ' -test_expect_success "merge without conflict" ' - cp new1.txt test.txt && - git merge-file test.txt orig.txt new2.txt -' +cp new1.txt test.txt +test_expect_success "merge without conflict" \ + "git merge-file test.txt orig.txt new2.txt" test_expect_success 'works in subdirectory' ' mkdir dir && @@ -77,176 +73,151 @@ test_expect_success 'works in subdirectory' ' test_path_is_missing a.txt ' -test_expect_success "merge without conflict (--quiet)" ' - cp new1.txt test.txt && - git merge-file --quiet test.txt orig.txt new2.txt -' - -test_expect_failure "merge without conflict (missing LF at EOF)" ' - cp new1.txt test2.txt && - git merge-file test2.txt orig.txt new4.txt -' - -test_expect_failure "merge result added missing LF" ' - test_cmp test.txt test2.txt -' - -test_expect_success "merge without conflict (missing LF at EOF, away from change in the other file)" ' - cp new4.txt test3.txt && - git merge-file --quiet test3.txt new2.txt new3.txt -' - -test_expect_success "merge does not add LF away of change" ' - cat >expect.txt <<-\EOF && - DOMINUS regit me, - et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - EOF - printf "propter nomen suum." >>expect.txt && - - test_cmp expect.txt test3.txt -' - -test_expect_success "merge with conflicts" ' - cp test.txt backup.txt && - test_must_fail git merge-file test.txt orig.txt new3.txt -' - -test_expect_success "expected conflict markers" ' - cat >expect.txt <<-\EOF && - <<<<<<< test.txt - Dominus regit me, et nihil mihi deerit. - ======= - DOMINUS regit me, - et nihil mihi deerit. - >>>>>>> new3.txt - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - Nam et si ambulavero in medio umbrae mortis, - non timebo mala, quoniam tu mecum es: - virga tua et baculus tuus ipsa me consolata sunt. - EOF - - test_cmp expect.txt test.txt -' - -test_expect_success "merge conflicting with --ours" ' - cp backup.txt test.txt && - - cat >expect.txt <<-\EOF && - Dominus regit me, et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - Nam et si ambulavero in medio umbrae mortis, - non timebo mala, quoniam tu mecum es: - virga tua et baculus tuus ipsa me consolata sunt. - EOF - - git merge-file --ours test.txt orig.txt new3.txt && - test_cmp expect.txt test.txt -' - -test_expect_success "merge conflicting with --theirs" ' - cp backup.txt test.txt && - - cat >expect.txt <<-\EOF && - DOMINUS regit me, - et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - Nam et si ambulavero in medio umbrae mortis, - non timebo mala, quoniam tu mecum es: - virga tua et baculus tuus ipsa me consolata sunt. - EOF - - git merge-file --theirs test.txt orig.txt new3.txt && - test_cmp expect.txt test.txt -' - -test_expect_success "merge conflicting with --union" ' - cp backup.txt test.txt && - - cat >expect.txt <<-\EOF && - Dominus regit me, et nihil mihi deerit. - DOMINUS regit me, - et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - Nam et si ambulavero in medio umbrae mortis, - non timebo mala, quoniam tu mecum es: - virga tua et baculus tuus ipsa me consolata sunt. - EOF - - git merge-file --union test.txt orig.txt new3.txt && - test_cmp expect.txt test.txt -' - -test_expect_success "merge with conflicts, using -L" ' - cp backup.txt test.txt && - - test_must_fail git merge-file -L 1 -L 2 test.txt orig.txt new3.txt -' - -test_expect_success "expected conflict markers, with -L" ' - cat >expect.txt <<-\EOF && - <<<<<<< 1 - Dominus regit me, et nihil mihi deerit. - ======= - DOMINUS regit me, - et nihil mihi deerit. - >>>>>>> new3.txt - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - Nam et si ambulavero in medio umbrae mortis, - non timebo mala, quoniam tu mecum es: - virga tua et baculus tuus ipsa me consolata sunt. - EOF - - test_cmp expect.txt test.txt -' - -test_expect_success "conflict in removed tail" ' - sed "s/ tu / TU /" new5.txt && - test_must_fail git merge-file -p orig.txt new1.txt new5.txt >out -' - -test_expect_success "expected conflict markers" ' - cat >expect <<-\EOF && - Dominus regit me, - et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - <<<<<<< orig.txt - ======= - Nam et si ambulavero in medio umbrae mortis, - non timebo mala, quoniam TU mecum es: - virga tua et baculus tuus ipsa me consolata sunt. - >>>>>>> new5.txt - EOF - - test_cmp expect out -' +cp new1.txt test.txt +test_expect_success "merge without conflict (--quiet)" \ + "git merge-file --quiet test.txt orig.txt new2.txt" + +cp new1.txt test2.txt +test_expect_failure "merge without conflict (missing LF at EOF)" \ + "git merge-file test2.txt orig.txt new4.txt" + +test_expect_failure "merge result added missing LF" \ + "test_cmp test.txt test2.txt" + +cp new4.txt test3.txt +test_expect_success "merge without conflict (missing LF at EOF, away from change in the other file)" \ + "git merge-file --quiet test3.txt new2.txt new3.txt" + +cat > expect.txt << EOF +DOMINUS regit me, +et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +EOF +printf "propter nomen suum." >> expect.txt + +test_expect_success "merge does not add LF away of change" \ + "test_cmp expect.txt test3.txt" + +cp test.txt backup.txt +test_expect_success "merge with conflicts" \ + "test_must_fail git merge-file test.txt orig.txt new3.txt" + +cat > expect.txt << EOF +<<<<<<< test.txt +Dominus regit me, et nihil mihi deerit. +======= +DOMINUS regit me, +et nihil mihi deerit. +>>>>>>> new3.txt +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +Nam et si ambulavero in medio umbrae mortis, +non timebo mala, quoniam tu mecum es: +virga tua et baculus tuus ipsa me consolata sunt. +EOF + +test_expect_success "expected conflict markers" "test_cmp expect.txt test.txt" + +cp backup.txt test.txt + +cat > expect.txt << EOF +Dominus regit me, et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +Nam et si ambulavero in medio umbrae mortis, +non timebo mala, quoniam tu mecum es: +virga tua et baculus tuus ipsa me consolata sunt. +EOF +test_expect_success "merge conflicting with --ours" \ + "git merge-file --ours test.txt orig.txt new3.txt && test_cmp expect.txt test.txt" +cp backup.txt test.txt + +cat > expect.txt << EOF +DOMINUS regit me, +et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +Nam et si ambulavero in medio umbrae mortis, +non timebo mala, quoniam tu mecum es: +virga tua et baculus tuus ipsa me consolata sunt. +EOF +test_expect_success "merge conflicting with --theirs" \ + "git merge-file --theirs test.txt orig.txt new3.txt && test_cmp expect.txt test.txt" +cp backup.txt test.txt + +cat > expect.txt << EOF +Dominus regit me, et nihil mihi deerit. +DOMINUS regit me, +et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +Nam et si ambulavero in medio umbrae mortis, +non timebo mala, quoniam tu mecum es: +virga tua et baculus tuus ipsa me consolata sunt. +EOF +test_expect_success "merge conflicting with --union" \ + "git merge-file --union test.txt orig.txt new3.txt && test_cmp expect.txt test.txt" +cp backup.txt test.txt + +test_expect_success "merge with conflicts, using -L" \ + "test_must_fail git merge-file -L 1 -L 2 test.txt orig.txt new3.txt" + +cat > expect.txt << EOF +<<<<<<< 1 +Dominus regit me, et nihil mihi deerit. +======= +DOMINUS regit me, +et nihil mihi deerit. +>>>>>>> new3.txt +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +Nam et si ambulavero in medio umbrae mortis, +non timebo mala, quoniam tu mecum es: +virga tua et baculus tuus ipsa me consolata sunt. +EOF + +test_expect_success "expected conflict markers, with -L" \ + "test_cmp expect.txt test.txt" + +sed "s/ tu / TU /" < new1.txt > new5.txt +test_expect_success "conflict in removed tail" \ + "test_must_fail git merge-file -p orig.txt new1.txt new5.txt > out" + +cat > expect << EOF +Dominus regit me, +et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +<<<<<<< orig.txt +======= +Nam et si ambulavero in medio umbrae mortis, +non timebo mala, quoniam TU mecum es: +virga tua et baculus tuus ipsa me consolata sunt. +>>>>>>> new5.txt +EOF + +test_expect_success "expected conflict markers" "test_cmp expect out" test_expect_success 'binary files cannot be merged' ' test_must_fail git merge-file -p \ @@ -254,55 +225,59 @@ test_expect_success 'binary files cannot be merged' ' grep "Cannot merge binary files" merge.err ' +sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" < new5.txt > new6.txt +sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" < new5.txt > new7.txt + test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' ' - sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" new6.txt && - sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" new7.txt && test_must_fail git merge-file -p new6.txt new5.txt new7.txt > output && - test 1 = $(grep ======= new8.txt +sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit --/" < new7.txt | tr '%' '\012' > new9.txt + test_expect_success 'ZEALOUS_ALNUM' ' - sed -e "s/deerit./&%%%%/" -e "s/locavit,/locavit;/" new8.txt && - sed -e "s/deerit./&%%%%/" -e "s/locavit,/locavit --/" new9.txt && test_must_fail git merge-file -p \ - new8.txt new5.txt new9.txt >merge.out && - test 1 = $(grep ======= merge.out && + test 1 = $(grep ======= < merge.out | wc -l) + ' -test_expect_success '"diff3 -m" style output (1)' ' - cat >expect <<-\EOF && - Dominus regit me, - <<<<<<< new8.txt - et nihil mihi deerit; +cat >expect <<\EOF +Dominus regit me, +<<<<<<< new8.txt +et nihil mihi deerit; - In loco pascuae ibi me collocavit; - super aquam refectionis educavit me. - ||||||| new5.txt - et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - ======= - et nihil mihi deerit, +In loco pascuae ibi me collocavit; +super aquam refectionis educavit me. +||||||| new5.txt +et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +======= +et nihil mihi deerit, - In loco pascuae ibi me collocavit -- - super aquam refectionis educavit me, - >>>>>>> new9.txt - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - Nam et si ambulavero in medio umbrae mortis, - non timebo mala, quoniam TU mecum es: - virga tua et baculus tuus ipsa me consolata sunt. - EOF +In loco pascuae ibi me collocavit -- +super aquam refectionis educavit me, +>>>>>>> new9.txt +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +Nam et si ambulavero in medio umbrae mortis, +non timebo mala, quoniam TU mecum es: +virga tua et baculus tuus ipsa me consolata sunt. +EOF +test_expect_success '"diff3 -m" style output (1)' ' test_must_fail git merge-file -p --diff3 \ new8.txt new5.txt new9.txt >actual && test_cmp expect actual @@ -315,64 +290,61 @@ test_expect_success '"diff3 -m" style output (2)' ' test_cmp expect actual ' -test_expect_success 'marker size' ' - cat >expect <<-\EOF && - Dominus regit me, - <<<<<<<<<< new8.txt - et nihil mihi deerit; +cat >expect <<\EOF +Dominus regit me, +<<<<<<<<<< new8.txt +et nihil mihi deerit; - In loco pascuae ibi me collocavit; - super aquam refectionis educavit me. - |||||||||| new5.txt - et nihil mihi deerit. - In loco pascuae ibi me collocavit, - super aquam refectionis educavit me; - ========== - et nihil mihi deerit, +In loco pascuae ibi me collocavit; +super aquam refectionis educavit me. +|||||||||| new5.txt +et nihil mihi deerit. +In loco pascuae ibi me collocavit, +super aquam refectionis educavit me; +========== +et nihil mihi deerit, - In loco pascuae ibi me collocavit -- - super aquam refectionis educavit me, - >>>>>>>>>> new9.txt - animam meam convertit, - deduxit me super semitas jusitiae, - propter nomen suum. - Nam et si ambulavero in medio umbrae mortis, - non timebo mala, quoniam TU mecum es: - virga tua et baculus tuus ipsa me consolata sunt. - EOF +In loco pascuae ibi me collocavit -- +super aquam refectionis educavit me, +>>>>>>>>>> new9.txt +animam meam convertit, +deduxit me super semitas jusitiae, +propter nomen suum. +Nam et si ambulavero in medio umbrae mortis, +non timebo mala, quoniam TU mecum es: +virga tua et baculus tuus ipsa me consolata sunt. +EOF +test_expect_success 'marker size' ' test_must_fail git merge-file -p --marker-size=10 \ new8.txt new5.txt new9.txt >actual && test_cmp expect actual ' -test_expect_success 'conflict at EOF without LF resolved by --ours' ' - printf "line1\nline2\nline3" >nolf-orig.txt && - printf "line1\nline2\nline3x" >nolf-diff1.txt && - printf "line1\nline2\nline3y" >nolf-diff2.txt && +printf "line1\nline2\nline3" >nolf-orig.txt +printf "line1\nline2\nline3x" >nolf-diff1.txt +printf "line1\nline2\nline3y" >nolf-diff2.txt - git merge-file -p --ours nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt && - printf "line1\nline2\nline3x" >expect.txt && - test_cmp expect.txt output.txt -' +test_expect_success 'conflict at EOF without LF resolved by --ours' \ + 'git merge-file -p --ours nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt && + printf "line1\nline2\nline3x" >expect.txt && + test_cmp expect.txt output.txt' -test_expect_success 'conflict at EOF without LF resolved by --theirs' ' - git merge-file -p --theirs nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt && - printf "line1\nline2\nline3y" >expect.txt && - test_cmp expect.txt output.txt -' +test_expect_success 'conflict at EOF without LF resolved by --theirs' \ + 'git merge-file -p --theirs nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt && + printf "line1\nline2\nline3y" >expect.txt && + test_cmp expect.txt output.txt' -test_expect_success 'conflict at EOF without LF resolved by --union' ' - git merge-file -p --union nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt && - printf "line1\nline2\nline3x\nline3y" >expect.txt && - test_cmp expect.txt output.txt -' +test_expect_success 'conflict at EOF without LF resolved by --union' \ + 'git merge-file -p --union nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt && + printf "line1\nline2\nline3x\nline3y" >expect.txt && + test_cmp expect.txt output.txt' test_expect_success 'conflict sections match existing line endings' ' printf "1\\r\\n2\\r\\n3" >crlf-orig.txt && diff --git a/third_party/git/t/t6024-recursive-merge.sh b/third_party/git/t/t6024-recursive-merge.sh index 332cfc53fd88..27c7de90ce64 100755 --- a/third_party/git/t/t6024-recursive-merge.sh +++ b/third_party/git/t/t6024-recursive-merge.sh @@ -14,95 +14,85 @@ test_description='Test merge without common ancestors' GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100" export GIT_COMMITTER_DATE -test_expect_success 'setup tests' ' - echo 1 >a1 && - git add a1 && - GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1 && - - git checkout -b A master && - echo A >a1 && - GIT_AUTHOR_DATE="2006-12-12 23:00:01" git commit -m A a1 && - - git checkout -b B master && - echo B >a1 && - GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1 && - - git checkout -b D A && - git rev-parse B >.git/MERGE_HEAD && - echo D >a1 && - git update-index a1 && - GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D && - - git symbolic-ref HEAD refs/heads/other && - echo 2 >a1 && - GIT_AUTHOR_DATE="2006-12-12 23:00:04" git commit -m 2 a1 && - - git checkout -b C && - echo C >a1 && - GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1 && - - git checkout -b E C && - git rev-parse B >.git/MERGE_HEAD && - echo E >a1 && - git update-index a1 && - GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E && - - git checkout -b G E && - git rev-parse A >.git/MERGE_HEAD && - echo G >a1 && - git update-index a1 && - GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G && - - git checkout -b F D && - git rev-parse C >.git/MERGE_HEAD && - echo F >a1 && - git update-index a1 && - GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F && - - test_oid_cache <<-EOF - idxstage1 sha1:ec3fe2a791706733f2d8fa7ad45d9a9672031f5e - idxstage1 sha256:b3c8488929903aaebdeb22270cb6d36e5b8724b01ae0d4da24632f158c99676f - EOF +test_expect_success "setup tests" ' +echo 1 > a1 && +git add a1 && +GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1 && + +git checkout -b A master && +echo A > a1 && +GIT_AUTHOR_DATE="2006-12-12 23:00:01" git commit -m A a1 && + +git checkout -b B master && +echo B > a1 && +GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1 && + +git checkout -b D A && +git rev-parse B > .git/MERGE_HEAD && +echo D > a1 && +git update-index a1 && +GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D && + +git symbolic-ref HEAD refs/heads/other && +echo 2 > a1 && +GIT_AUTHOR_DATE="2006-12-12 23:00:04" git commit -m 2 a1 && + +git checkout -b C && +echo C > a1 && +GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1 && + +git checkout -b E C && +git rev-parse B > .git/MERGE_HEAD && +echo E > a1 && +git update-index a1 && +GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E && + +git checkout -b G E && +git rev-parse A > .git/MERGE_HEAD && +echo G > a1 && +git update-index a1 && +GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G && + +git checkout -b F D && +git rev-parse C > .git/MERGE_HEAD && +echo F > a1 && +git update-index a1 && +GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F ' test_expect_success 'combined merge conflicts' ' test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git merge -m final G ' -test_expect_success 'result contains a conflict' ' - cat >expect <<-\EOF && - <<<<<<< HEAD - F - ======= - G - >>>>>>> G - EOF +cat > expect << EOF +<<<<<<< HEAD +F +======= +G +>>>>>>> G +EOF - test_cmp expect a1 -' - -test_expect_success 'virtual trees were processed' ' - git ls-files --stage >out && +test_expect_success "result contains a conflict" "test_cmp expect a1" - cat >expect <<-EOF && - 100644 $(test_oid idxstage1) 1 a1 - 100644 $(git rev-parse F:a1) 2 a1 - 100644 $(git rev-parse G:a1) 3 a1 - EOF +git ls-files --stage > out +cat > expect << EOF +100644 ec3fe2a791706733f2d8fa7ad45d9a9672031f5e 1 a1 +100644 cf84443e49e1b366fac938711ddf4be2d4d1d9e9 2 a1 +100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1 +EOF - test_cmp expect out -' +test_expect_success "virtual trees were processed" "test_cmp expect out" test_expect_success 'refuse to merge binary files' ' git reset --hard && - printf "\0" >binary-file && + printf "\0" > binary-file && git add binary-file && git commit -m binary && git checkout G && - printf "\0\0" >binary-file && + printf "\0\0" > binary-file && git add binary-file && git commit -m binary2 && - test_must_fail git merge F >merge.out 2>merge.err && + test_must_fail git merge F > merge.out 2> merge.err && grep "Cannot merge binary files: binary-file (HEAD vs. F)" merge.err ' @@ -126,6 +116,7 @@ test_expect_success 'mark rename/delete as unmerged' ' test 1 = $(git ls-files --unmerged | wc -l) && test_must_fail git rev-parse --verify :2:a2 && git rev-parse --verify :3:a2 + ' test_done diff --git a/third_party/git/t/t6025-merge-symlinks.sh b/third_party/git/t/t6025-merge-symlinks.sh index 6c0a90d044c5..433c4de08f0c 100755 --- a/third_party/git/t/t6025-merge-symlinks.sh +++ b/third_party/git/t/t6025-merge-symlinks.sh @@ -10,53 +10,52 @@ if core.symlinks is false.' . ./test-lib.sh -test_expect_success 'setup' ' - git config core.symlinks false && - >file && - git add file && - git commit -m initial && - git branch b-symlink && - git branch b-file && - l=$(printf file | git hash-object -t blob -w --stdin) && - echo "120000 $l symlink" | git update-index --index-info && - git commit -m master && - git checkout b-symlink && - l=$(printf file-different | git hash-object -t blob -w --stdin) && - echo "120000 $l symlink" | git update-index --index-info && - git commit -m b-symlink && - git checkout b-file && - echo plain-file >symlink && - git add symlink && - git commit -m b-file -' - -test_expect_success 'merge master into b-symlink, which has a different symbolic link' ' - git checkout b-symlink && - test_must_fail git merge master -' - -test_expect_success 'the merge result must be a file' ' - test_path_is_file symlink -' - -test_expect_success 'merge master into b-file, which has a file instead of a symbolic link' ' - git reset --hard && - git checkout b-file && - test_must_fail git merge master -' - -test_expect_success 'the merge result must be a file' ' - test_path_is_file symlink -' - -test_expect_success 'merge b-file, which has a file instead of a symbolic link, into master' ' - git reset --hard && - git checkout master && - test_must_fail git merge b-file -' - -test_expect_success 'the merge result must be a file' ' - test_path_is_file symlink -' +test_expect_success \ +'setup' ' +git config core.symlinks false && +> file && +git add file && +git commit -m initial && +git branch b-symlink && +git branch b-file && +l=$(printf file | git hash-object -t blob -w --stdin) && +echo "120000 $l symlink" | git update-index --index-info && +git commit -m master && +git checkout b-symlink && +l=$(printf file-different | git hash-object -t blob -w --stdin) && +echo "120000 $l symlink" | git update-index --index-info && +git commit -m b-symlink && +git checkout b-file && +echo plain-file > symlink && +git add symlink && +git commit -m b-file' + +test_expect_success \ +'merge master into b-symlink, which has a different symbolic link' ' +git checkout b-symlink && +test_must_fail git merge master' + +test_expect_success \ +'the merge result must be a file' ' +test -f symlink' + +test_expect_success \ +'merge master into b-file, which has a file instead of a symbolic link' ' +git reset --hard && git checkout b-file && +test_must_fail git merge master' + +test_expect_success \ +'the merge result must be a file' ' +test -f symlink' + +test_expect_success \ +'merge b-file, which has a file instead of a symbolic link, into master' ' +git reset --hard && +git checkout master && +test_must_fail git merge b-file' + +test_expect_success \ +'the merge result must be a file' ' +test -f symlink' test_done diff --git a/third_party/git/t/t6026-merge-attr.sh b/third_party/git/t/t6026-merge-attr.sh index 5900358ce9c0..8f9b48a4937b 100755 --- a/third_party/git/t/t6026-merge-attr.sh +++ b/third_party/git/t/t6026-merge-attr.sh @@ -32,29 +32,7 @@ test_expect_success setup ' test_tick && git commit -m Side && - git tag anchor && - - cat >./custom-merge <<-\EOF && - #!/bin/sh - - orig="$1" ours="$2" theirs="$3" exit="$4" path=$5 - ( - echo "orig is $orig" - echo "ours is $ours" - echo "theirs is $theirs" - echo "path is $path" - echo "=== orig ===" - cat "$orig" - echo "=== ours ===" - cat "$ours" - echo "=== theirs ===" - cat "$theirs" - ) >"$ours+" - cat "$ours+" >"$ours" - rm -f "$ours+" - exit "$exit" - EOF - chmod +x ./custom-merge + git tag anchor ' test_expect_success merge ' @@ -104,6 +82,28 @@ test_expect_success 'retry the merge with longer context' ' grep "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" actual ' +cat >./custom-merge <<\EOF +#!/bin/sh + +orig="$1" ours="$2" theirs="$3" exit="$4" path=$5 +( + echo "orig is $orig" + echo "ours is $ours" + echo "theirs is $theirs" + echo "path is $path" + echo "=== orig ===" + cat "$orig" + echo "=== ours ===" + cat "$ours" + echo "=== theirs ===" + cat "$theirs" +) >"$ours+" +cat "$ours+" >"$ours" +rm -f "$ours+" +exit "$exit" +EOF +chmod +x ./custom-merge + test_expect_success 'custom merge backend' ' echo "* merge=union" >.gitattributes && diff --git a/third_party/git/t/t6030-bisect-porcelain.sh b/third_party/git/t/t6030-bisect-porcelain.sh index 821a0c88cf02..bdc42e9440cb 100755 --- a/third_party/git/t/t6030-bisect-porcelain.sh +++ b/third_party/git/t/t6030-bisect-porcelain.sh @@ -482,7 +482,7 @@ test_expect_success 'optimized merge base checks' ' git bisect good > my_bisect_log2.txt && test -f ".git/BISECT_ANCESTORS_OK" && test "$HASH6" = $(git rev-parse --verify HEAD) && - git bisect bad && + git bisect bad > my_bisect_log3.txt && git bisect good "$A_HASH" > my_bisect_log4.txt && test_i18ngrep "merge base must be tested" my_bisect_log4.txt && test_must_fail test -f ".git/BISECT_ANCESTORS_OK" diff --git a/third_party/git/t/t6034-merge-rename-nocruft.sh b/third_party/git/t/t6034-merge-rename-nocruft.sh index a25e7304604e..89871aa5b044 100755 --- a/third_party/git/t/t6034-merge-rename-nocruft.sh +++ b/third_party/git/t/t6034-merge-rename-nocruft.sh @@ -3,73 +3,74 @@ test_description='Merge-recursive merging renames' . ./test-lib.sh -test_expect_success 'setup' ' - cat >A <<-\EOF && - a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - c cccccccccccccccccccccccccccccccccccccccccccccccc - d dddddddddddddddddddddddddddddddddddddddddddddddd - e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - f ffffffffffffffffffffffffffffffffffffffffffffffff - g gggggggggggggggggggggggggggggggggggggggggggggggg - h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh - i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii - j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj - k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk - l llllllllllllllllllllllllllllllllllllllllllllllll - m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn - o oooooooooooooooooooooooooooooooooooooooooooooooo - EOF +test_expect_success setup \ +' +cat >A <<\EOF && +a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +c cccccccccccccccccccccccccccccccccccccccccccccccc +d dddddddddddddddddddddddddddddddddddddddddddddddd +e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +f ffffffffffffffffffffffffffffffffffffffffffffffff +g gggggggggggggggggggggggggggggggggggggggggggggggg +h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh +i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii +j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj +k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk +l llllllllllllllllllllllllllllllllllllllllllllllll +m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm +n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn +o oooooooooooooooooooooooooooooooooooooooooooooooo +EOF - cat >M <<-\EOF && - A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB - C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD - E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE - F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG - H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH - I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII - J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ - K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK - L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL - M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM - N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN - O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO - EOF +cat >M <<\EOF && +A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG +H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH +I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII +J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ +K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK +L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL +M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN +O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO +EOF - git add A M && - git commit -m "initial has A and M" && - git branch white && - git branch red && - git branch blue && +git add A M && +git commit -m "initial has A and M" && +git branch white && +git branch red && +git branch blue && - git checkout white && - sed -e "/^g /s/.*/g : white changes a line/" B && - sed -e "/^G /s/.*/G : colored branch changes a line/" N && - rm -f A M && - git update-index --add --remove A B M N && - git commit -m "white renames A->B, M->N" && +git checkout white && +sed -e "/^g /s/.*/g : white changes a line/" B && +sed -e "/^G /s/.*/G : colored branch changes a line/" N && +rm -f A M && +git update-index --add --remove A B M N && +git commit -m "white renames A->B, M->N" && - git checkout red && - echo created by red >R && - git update-index --add R && - git commit -m "red creates R" && +git checkout red && +echo created by red >R && +git update-index --add R && +git commit -m "red creates R" && - git checkout blue && - sed -e "/^o /s/.*/g : blue changes a line/" B && - rm -f A && - mv B A && - git update-index A && - git commit -m "blue modify A" && +git checkout blue && +sed -e "/^o /s/.*/g : blue changes a line/" B && +rm -f A && +mv B A && +git update-index A && +git commit -m "blue modify A" && - git checkout master -' +git checkout master' # This test broke in 65ac6e9c3f47807cb603af07a6a9e1a43bc119ae -test_expect_success 'merge white into red (A->B,M->N)' ' +test_expect_success 'merge white into red (A->B,M->N)' \ +' git checkout -b red-white red && git merge white && git write-tree && @@ -81,7 +82,8 @@ test_expect_success 'merge white into red (A->B,M->N)' ' ' # This test broke in 8371234ecaaf6e14fe3f2082a855eff1bbd79ae9 -test_expect_success 'merge blue into white (A->B, mod A, A untracked)' ' +test_expect_success 'merge blue into white (A->B, mod A, A untracked)' \ +' git checkout -b white-blue white && echo dirty >A && git merge blue && diff --git a/third_party/git/t/t6035-merge-dir-to-symlink.sh b/third_party/git/t/t6035-merge-dir-to-symlink.sh index 2eddcc7664e8..9324ea441621 100755 --- a/third_party/git/t/t6035-merge-dir-to-symlink.sh +++ b/third_party/git/t/t6035-merge-dir-to-symlink.sh @@ -31,19 +31,19 @@ test_expect_success 'a/b-2/c/d is kept when clobbering symlink b' ' git rm --cached a/b && git commit -m "untracked symlink remains" && git checkout -f start^0 && - test_path_is_file a/b-2/c/d + test -f a/b-2/c/d ' test_expect_success 'checkout should not have deleted a/b-2/c/d' ' git checkout HEAD^0 && git reset --hard master && git checkout start^0 && - test_path_is_file a/b-2/c/d + test -f a/b-2/c/d ' test_expect_success 'setup for merge test' ' git reset --hard && - test_path_is_file a/b-2/c/d && + test -f a/b-2/c/d && echo x > a/x && git add a/x && git commit -m x && @@ -54,7 +54,7 @@ test_expect_success 'Handle D/F conflict, do not lose a/b-2/c/d in merge (resolv git reset --hard && git checkout baseline^0 && git merge -s resolve master && - test_path_is_file a/b-2/c/d + test -f a/b-2/c/d ' test_expect_success SYMLINKS 'a/b was resolved as symlink' ' @@ -65,7 +65,7 @@ test_expect_success 'Handle D/F conflict, do not lose a/b-2/c/d in merge (recurs git reset --hard && git checkout baseline^0 && git merge -s recursive master && - test_path_is_file a/b-2/c/d + test -f a/b-2/c/d ' test_expect_success SYMLINKS 'a/b was resolved as symlink' ' @@ -76,7 +76,7 @@ test_expect_success 'Handle F/D conflict, do not lose a/b-2/c/d in merge (resolv git reset --hard && git checkout master^0 && git merge -s resolve baseline^0 && - test_path_is_file a/b-2/c/d + test -f a/b-2/c/d ' test_expect_success SYMLINKS 'a/b was resolved as symlink' ' @@ -87,7 +87,7 @@ test_expect_success 'Handle F/D conflict, do not lose a/b-2/c/d in merge (recurs git reset --hard && git checkout master^0 && git merge -s recursive baseline^0 && - test_path_is_file a/b-2/c/d + test -f a/b-2/c/d ' test_expect_success SYMLINKS 'a/b was resolved as symlink' ' @@ -99,8 +99,8 @@ test_expect_failure 'do not lose untracked in merge (resolve)' ' git checkout baseline^0 && >a/b/c/e && test_must_fail git merge -s resolve master && - test_path_is_file a/b/c/e && - test_path_is_file a/b-2/c/d + test -f a/b/c/e && + test -f a/b-2/c/d ' test_expect_success 'do not lose untracked in merge (recursive)' ' @@ -108,8 +108,8 @@ test_expect_success 'do not lose untracked in merge (recursive)' ' git checkout baseline^0 && >a/b/c/e && test_must_fail git merge -s recursive master && - test_path_is_file a/b/c/e && - test_path_is_file a/b-2/c/d + test -f a/b/c/e && + test -f a/b-2/c/d ' test_expect_success 'do not lose modifications in merge (resolve)' ' @@ -140,7 +140,7 @@ test_expect_success 'merge should not have D/F conflicts (resolve)' ' git reset --hard && git checkout baseline^0 && git merge -s resolve test2 && - test_path_is_file a/b/c/d + test -f a/b/c/d ' test_expect_success SYMLINKS 'a/b-2 was resolved as symlink' ' @@ -151,7 +151,7 @@ test_expect_success 'merge should not have D/F conflicts (recursive)' ' git reset --hard && git checkout baseline^0 && git merge -s recursive test2 && - test_path_is_file a/b/c/d + test -f a/b/c/d ' test_expect_success SYMLINKS 'a/b-2 was resolved as symlink' ' @@ -162,7 +162,7 @@ test_expect_success 'merge should not have F/D conflicts (recursive)' ' git reset --hard && git checkout -b foo test2 && git merge -s recursive baseline^0 && - test_path_is_file a/b/c/d + test -f a/b/c/d ' test_expect_success SYMLINKS 'a/b-2 was resolved as symlink' ' diff --git a/third_party/git/t/t6036-recursive-corner-cases.sh b/third_party/git/t/t6036-recursive-corner-cases.sh index b3bf46261786..d23b948f27f1 100755 --- a/third_party/git/t/t6036-recursive-corner-cases.sh +++ b/third_party/git/t/t6036-recursive-corner-cases.sh @@ -60,9 +60,9 @@ test_expect_success 'merge simple rename+criss-cross with no modifications' ' test_must_fail git merge -s recursive R2^0 && git ls-files -s >out && - test_line_count = 5 out && + test_line_count = 2 out && git ls-files -u >out && - test_line_count = 3 out && + test_line_count = 2 out && git ls-files -o >out && test_line_count = 1 out && @@ -133,9 +133,9 @@ test_expect_success 'merge criss-cross + rename merges with basic modification' test_must_fail git merge -s recursive R2^0 && git ls-files -s >out && - test_line_count = 5 out && + test_line_count = 2 out && git ls-files -u >out && - test_line_count = 3 out && + test_line_count = 2 out && git ls-files -o >out && test_line_count = 1 out && @@ -218,18 +218,8 @@ test_expect_success 'git detects differently handled merges conflict' ' git ls-files -o >out && test_line_count = 1 out && - git cat-file -p C:new_a >ours && - git cat-file -p C:a >theirs && - >empty && - test_must_fail git merge-file \ - -L "Temporary merge branch 1" \ - -L "" \ - -L "Temporary merge branch 2" \ - ours empty theirs && - sed -e "s/^\([<=>]\)/\1\1\1/" ours >ours-tweaked && - git hash-object ours-tweaked >expect && - git rev-parse >>expect \ - D:new_a E:new_a && + git rev-parse >expect \ + C:new_a D:new_a E:new_a && git rev-parse >actual \ :1:new_a :2:new_a :3:new_a && test_cmp expect actual && @@ -267,8 +257,7 @@ test_expect_success 'git detects differently handled merges conflict, swapped' ' ctime=$(git log --no-walk --date=raw --format=%cd C | awk "{print \$1}") && newctime=$(($btime+1)) && git fast-export --no-data --all | sed -e s/$ctime/$newctime/ | git fast-import --force --quiet && - # End of most differences; rest is copy-paste of last test, - # other than swapping C:a and C:new_a due to order switch + # End of differences; rest is copy-paste of last test git checkout D^0 && test_must_fail git merge -s recursive E^0 && @@ -280,18 +269,8 @@ test_expect_success 'git detects differently handled merges conflict, swapped' ' git ls-files -o >out && test_line_count = 1 out && - git cat-file -p C:a >ours && - git cat-file -p C:new_a >theirs && - >empty && - test_must_fail git merge-file \ - -L "Temporary merge branch 1" \ - -L "" \ - -L "Temporary merge branch 2" \ - ours empty theirs && - sed -e "s/^\([<=>]\)/\1\1\1/" ours >ours-tweaked && - git hash-object ours-tweaked >expect && - git rev-parse >>expect \ - D:new_a E:new_a && + git rev-parse >expect \ + C:new_a D:new_a E:new_a && git rev-parse >actual \ :1:new_a :2:new_a :3:new_a && test_cmp expect actual && @@ -1553,7 +1532,7 @@ test_expect_success 'setup nested conflicts' ' mv -f b_R1 b && mv -f a_R1 a && git add b a && - test_tick && git commit -m "version R1 of files" && + test_tick && git commit -m "verson R1 of files" && git tag R1 && # Create first merge on left side @@ -1583,7 +1562,6 @@ test_expect_success 'check nested conflicts' ' cd nested_conflicts && git clean -f && - MASTER=$(git rev-parse --short master) && git checkout L2^0 && # Merge must fail; there is a conflict @@ -1604,7 +1582,7 @@ test_expect_success 'check nested conflicts' ' git cat-file -p R1:a >theirs && test_must_fail git merge-file --diff3 \ -L "Temporary merge branch 1" \ - -L "$MASTER" \ + -L "merged common ancestors" \ -L "Temporary merge branch 2" \ ours \ base \ @@ -1616,7 +1594,7 @@ test_expect_success 'check nested conflicts' ' git cat-file -p R1:b >theirs && test_must_fail git merge-file --diff3 \ -L "Temporary merge branch 1" \ - -L "$MASTER" \ + -L "merged common ancestors" \ -L "Temporary merge branch 2" \ ours \ base \ @@ -1717,7 +1695,7 @@ test_expect_success 'setup virtual merge base with nested conflicts' ' git checkout R && echo right >>content && git add content && - test_tick && git commit -m "version R1 of content" && + test_tick && git commit -m "verson R1 of content" && git tag R1 && # Create L2 @@ -1754,7 +1732,6 @@ test_expect_success 'check virtual merge base with nested conflicts' ' ( cd virtual_merge_base_has_nested_conflicts && - MASTER=$(git rev-parse --short master) && git checkout L3^0 && # Merge must fail; there is a conflict @@ -1783,7 +1760,7 @@ test_expect_success 'check virtual merge base with nested conflicts' ' cp left merged-once && test_must_fail git merge-file --diff3 \ -L "Temporary merge branch 1" \ - -L "$MASTER" \ + -L "merged common ancestors" \ -L "Temporary merge branch 2" \ merged-once \ base \ diff --git a/third_party/git/t/t6042-merge-rename-corner-cases.sh b/third_party/git/t/t6042-merge-rename-corner-cases.sh index b047cf1c1c37..c5b57f40c3d1 100755 --- a/third_party/git/t/t6042-merge-rename-corner-cases.sh +++ b/third_party/git/t/t6042-merge-rename-corner-cases.sh @@ -5,7 +5,7 @@ test_description="recursive merge corner cases w/ renames but not criss-crosses" . ./test-lib.sh -test_setup_rename_delete_untracked () { +test_expect_success 'setup rename/delete + untracked file' ' test_create_repo rename-delete-untracked && ( cd rename-delete-untracked && @@ -29,10 +29,9 @@ test_setup_rename_delete_untracked () { git commit -m track-people-instead-of-objects && echo "Myyy PRECIOUSSS" >ring ) -} +' test_expect_success "Does git preserve Gollum's precious artifact?" ' - test_setup_rename_delete_untracked && ( cd rename-delete-untracked && @@ -50,7 +49,7 @@ test_expect_success "Does git preserve Gollum's precious artifact?" ' # # We should be able to merge B & C cleanly -test_setup_rename_modify_add_source () { +test_expect_success 'setup rename/modify/add-source conflict' ' test_create_repo rename-modify-add-source && ( cd rename-modify-add-source && @@ -71,10 +70,9 @@ test_setup_rename_modify_add_source () { git add a && git commit -m C ) -} +' test_expect_failure 'rename/modify/add-source conflict resolvable' ' - test_setup_rename_modify_add_source && ( cd rename-modify-add-source && @@ -90,7 +88,7 @@ test_expect_failure 'rename/modify/add-source conflict resolvable' ' ) ' -test_setup_break_detection_1 () { +test_expect_success 'setup resolvable conflict missed if rename missed' ' test_create_repo break-detection-1 && ( cd break-detection-1 && @@ -112,10 +110,9 @@ test_setup_break_detection_1 () { git add a && git commit -m C ) -} +' test_expect_failure 'conflict caused if rename not detected' ' - test_setup_break_detection_1 && ( cd break-detection-1 && @@ -138,7 +135,7 @@ test_expect_failure 'conflict caused if rename not detected' ' ) ' -test_setup_break_detection_2 () { +test_expect_success 'setup conflict resolved wrong if rename missed' ' test_create_repo break-detection-2 && ( cd break-detection-2 && @@ -163,10 +160,9 @@ test_setup_break_detection_2 () { git add a && git commit -m E ) -} +' test_expect_failure 'missed conflict if rename not detected' ' - test_setup_break_detection_2 && ( cd break-detection-2 && @@ -186,7 +182,7 @@ test_expect_failure 'missed conflict if rename not detected' ' # Commit B: rename a->b # Commit C: rename a->b, add unrelated a -test_setup_break_detection_3 () { +test_expect_success 'setup undetected rename/add-source causes data loss' ' test_create_repo break-detection-3 && ( cd break-detection-3 && @@ -206,10 +202,9 @@ test_setup_break_detection_3 () { git add a && git commit -m C ) -} +' test_expect_failure 'detect rename/add-source and preserve all data' ' - test_setup_break_detection_3 && ( cd break-detection-3 && @@ -236,7 +231,6 @@ test_expect_failure 'detect rename/add-source and preserve all data' ' ' test_expect_failure 'detect rename/add-source and preserve all data, merge other way' ' - test_setup_break_detection_3 && ( cd break-detection-3 && @@ -262,10 +256,10 @@ test_expect_failure 'detect rename/add-source and preserve all data, merge other ) ' -test_setup_rename_directory () { - test_create_repo rename-directory-$1 && +test_expect_success 'setup content merge + rename/directory conflict' ' + test_create_repo rename-directory-1 && ( - cd rename-directory-$1 && + cd rename-directory-1 && printf "1\n2\n3\n4\n5\n6\n" >file && git add file && @@ -296,12 +290,11 @@ test_setup_rename_directory () { test_tick && git commit -m left ) -} +' test_expect_success 'rename/directory conflict + clean content merge' ' - test_setup_rename_directory 1a && ( - cd rename-directory-1a && + cd rename-directory-1 && git checkout left-clean^0 && @@ -327,9 +320,8 @@ test_expect_success 'rename/directory conflict + clean content merge' ' ' test_expect_success 'rename/directory conflict + content merge conflict' ' - test_setup_rename_directory 1b && ( - cd rename-directory-1b && + cd rename-directory-1 && git reset --hard && git clean -fdqx && @@ -366,7 +358,7 @@ test_expect_success 'rename/directory conflict + content merge conflict' ' ) ' -test_setup_rename_directory_2 () { +test_expect_success 'setup content merge + rename/directory conflict w/ disappearing dir' ' test_create_repo rename-directory-2 && ( cd rename-directory-2 && @@ -393,10 +385,9 @@ test_setup_rename_directory_2 () { test_tick && git commit -m left ) -} +' test_expect_success 'disappearing dir in rename/directory conflict handled' ' - test_setup_rename_directory_2 && ( cd rename-directory-2 && @@ -425,10 +416,10 @@ test_expect_success 'disappearing dir in rename/directory conflict handled' ' # Commit A: rename a->b, modifying b too # Commit B: modify a, add different b -test_setup_rename_with_content_merge_and_add () { - test_create_repo rename-with-content-merge-and-add-$1 && +test_expect_success 'setup rename-with-content-merge vs. add' ' + test_create_repo rename-with-content-merge-and-add && ( - cd rename-with-content-merge-and-add-$1 && + cd rename-with-content-merge-and-add && test_seq 1 5 >a && git add a && @@ -447,12 +438,11 @@ test_setup_rename_with_content_merge_and_add () { git add a b && git commit -m B ) -} +' test_expect_success 'handle rename-with-content-merge vs. add' ' - test_setup_rename_with_content_merge_and_add AB && ( - cd rename-with-content-merge-and-add-AB && + cd rename-with-content-merge-and-add && git checkout A^0 && @@ -493,9 +483,8 @@ test_expect_success 'handle rename-with-content-merge vs. add' ' ' test_expect_success 'handle rename-with-content-merge vs. add, merge other way' ' - test_setup_rename_with_content_merge_and_add BA && ( - cd rename-with-content-merge-and-add-BA && + cd rename-with-content-merge-and-add && git reset --hard && git clean -fdx && @@ -550,7 +539,7 @@ test_expect_success 'handle rename-with-content-merge vs. add, merge other way' # * The working copy should have two files, both of form c~; does it? # * Nothing else should be present. Is anything? -test_setup_rename_rename_2to1 () { +test_expect_success 'setup rename/rename (2to1) + modify/modify' ' test_create_repo rename-rename-2to1 && ( cd rename-rename-2to1 && @@ -573,10 +562,9 @@ test_setup_rename_rename_2to1 () { git add a && git commit -m C ) -} +' test_expect_success 'handle rename/rename (2to1) conflict correctly' ' - test_setup_rename_rename_2to1 && ( cd rename-rename-2to1 && @@ -622,7 +610,7 @@ test_expect_success 'handle rename/rename (2to1) conflict correctly' ' # Commit A: new file: a # Commit B: rename a->b # Commit C: rename a->c -test_setup_rename_rename_1to2 () { +test_expect_success 'setup simple rename/rename (1to2) conflict' ' test_create_repo rename-rename-1to2 && ( cd rename-rename-1to2 && @@ -643,10 +631,9 @@ test_setup_rename_rename_1to2 () { test_tick && git commit -m C ) -} +' test_expect_success 'merge has correct working tree contents' ' - test_setup_rename_rename_1to2 && ( cd rename-rename-1to2 && @@ -680,7 +667,7 @@ test_expect_success 'merge has correct working tree contents' ' # # Merging of B & C should NOT be clean; there's a rename/rename conflict -test_setup_rename_rename_1to2_add_source_1 () { +test_expect_success 'setup rename/rename(1to2)/add-source conflict' ' test_create_repo rename-rename-1to2-add-source-1 && ( cd rename-rename-1to2-add-source-1 && @@ -700,10 +687,9 @@ test_setup_rename_rename_1to2_add_source_1 () { git add a && git commit -m C ) -} +' test_expect_failure 'detect conflict with rename/rename(1to2)/add-source merge' ' - test_setup_rename_rename_1to2_add_source_1 && ( cd rename-rename-1to2-add-source-1 && @@ -728,7 +714,7 @@ test_expect_failure 'detect conflict with rename/rename(1to2)/add-source merge' ) ' -test_setup_rename_rename_1to2_add_source_2 () { +test_expect_success 'setup rename/rename(1to2)/add-source resolvable conflict' ' test_create_repo rename-rename-1to2-add-source-2 && ( cd rename-rename-1to2-add-source-2 && @@ -751,10 +737,9 @@ test_setup_rename_rename_1to2_add_source_2 () { test_tick && git commit -m two ) -} +' test_expect_failure 'rename/rename/add-source still tracks new a file' ' - test_setup_rename_rename_1to2_add_source_2 && ( cd rename-rename-1to2-add-source-2 && @@ -774,7 +759,7 @@ test_expect_failure 'rename/rename/add-source still tracks new a file' ' ) ' -test_setup_rename_rename_1to2_add_dest () { +test_expect_success 'setup rename/rename(1to2)/add-dest conflict' ' test_create_repo rename-rename-1to2-add-dest && ( cd rename-rename-1to2-add-dest && @@ -799,10 +784,9 @@ test_setup_rename_rename_1to2_add_dest () { test_tick && git commit -m two ) -} +' test_expect_success 'rename/rename/add-dest merge still knows about conflicting file versions' ' - test_setup_rename_rename_1to2_add_dest && ( cd rename-rename-1to2-add-dest && @@ -854,7 +838,7 @@ test_expect_success 'rename/rename/add-dest merge still knows about conflicting # Commit B: rename foo->bar # Expected: CONFLICT (rename/add/delete), two-way merged bar -test_setup_rad () { +test_expect_success 'rad-setup: rename/add/delete conflict' ' test_create_repo rad && ( cd rad && @@ -876,10 +860,9 @@ test_setup_rad () { git mv foo bar && git commit -m "rename foo to bar" ) -} +' test_expect_failure 'rad-check: rename/add/delete conflict' ' - test_setup_rad && ( cd rad && @@ -921,7 +904,7 @@ test_expect_failure 'rad-check: rename/add/delete conflict' ' # Commit B: rename bar->baz, rm foo # Expected: CONFLICT (rename/rename/delete/delete), two-way merged baz -test_setup_rrdd () { +test_expect_success 'rrdd-setup: rename/rename(2to1)/delete/delete conflict' ' test_create_repo rrdd && ( cd rrdd && @@ -944,10 +927,9 @@ test_setup_rrdd () { git rm foo && git commit -m "Rename bar, remove foo" ) -} +' test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' ' - test_setup_rrdd && ( cd rrdd && @@ -991,7 +973,7 @@ test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' ' # Expected: six CONFLICT(rename/rename) messages, each path in two of the # multi-way merged contents found in two, four, six -test_setup_mod6 () { +test_expect_success 'mod6-setup: chains of rename/rename(1to2) and rename/rename(2to1)' ' test_create_repo mod6 && ( cd mod6 && @@ -1027,10 +1009,9 @@ test_setup_mod6 () { test_tick && git commit -m "B" ) -} +' test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' ' - test_setup_mod6 && ( cd mod6 && @@ -1127,8 +1108,7 @@ test_conflicts_with_adds_and_renames() { # files. Is it present? # 4) There should not be any three~* files in the working # tree - test_setup_collision_conflict () { - #test_expect_success "setup simple $sideL/$sideR conflict" ' + test_expect_success "setup simple $sideL/$sideR conflict" ' test_create_repo simple_${sideL}_${sideR} && ( cd simple_${sideL}_${sideR} && @@ -1205,11 +1185,9 @@ test_conflicts_with_adds_and_renames() { fi && test_tick && git commit -m R ) - #' - } + ' test_expect_success "check simple $sideL/$sideR conflict" ' - test_setup_collision_conflict && ( cd simple_${sideL}_${sideR} && @@ -1276,7 +1254,7 @@ test_conflicts_with_adds_and_renames add add # # So, we have four different conflicting files that all end up at path # 'three'. -test_setup_nested_conflicts_from_rename_rename () { +test_expect_success 'setup nested conflicts from rename/rename(2to1)' ' test_create_repo nested_conflicts_from_rename_rename && ( cd nested_conflicts_from_rename_rename && @@ -1327,10 +1305,9 @@ test_setup_nested_conflicts_from_rename_rename () { git add one three && test_tick && git commit -m german ) -} +' test_expect_success 'check nested conflicts from rename/rename(2to1)' ' - test_setup_nested_conflicts_from_rename_rename && ( cd nested_conflicts_from_rename_rename && diff --git a/third_party/git/t/t6043-merge-rename-directories.sh b/third_party/git/t/t6043-merge-rename-directories.sh index 83792c5ef1f5..c966147d5d73 100755 --- a/third_party/git/t/t6043-merge-rename-directories.sh +++ b/third_party/git/t/t6043-merge-rename-directories.sh @@ -38,7 +38,7 @@ test_description="recursive merge with directory renames" # Commit B: z/{b,c,d,e/f} # Expected: y/{b,c,d,e/f} -test_setup_1a () { +test_expect_success '1a-setup: Simple directory rename detection' ' test_create_repo 1a && ( cd 1a && @@ -67,10 +67,9 @@ test_setup_1a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '1a: Simple directory rename detection' ' - test_setup_1a && +test_expect_success '1a-check: Simple directory rename detection' ' ( cd 1a && @@ -104,7 +103,7 @@ test_expect_success '1a: Simple directory rename detection' ' # Commit B: y/{b,c,d} # Expected: y/{b,c,d,e} -test_setup_1b () { +test_expect_success '1b-setup: Merge a directory with another' ' test_create_repo 1b && ( cd 1b && @@ -135,10 +134,9 @@ test_setup_1b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '1b: Merge a directory with another' ' - test_setup_1b && +test_expect_success '1b-check: Merge a directory with another' ' ( cd 1b && @@ -167,7 +165,7 @@ test_expect_success '1b: Merge a directory with another' ' # Commit B: z/{b,c,d} # Expected: y/{b,c,d} (because x/d -> z/d -> y/d) -test_setup_1c () { +test_expect_success '1c-setup: Transitive renaming' ' test_create_repo 1c && ( cd 1c && @@ -195,10 +193,9 @@ test_setup_1c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '1c: Transitive renaming' ' - test_setup_1c && +test_expect_success '1c-check: Transitive renaming' ' ( cd 1c && @@ -230,7 +227,7 @@ test_expect_success '1c: Transitive renaming' ' # Note: y/m & z/n should definitely move into x. By the same token, both # y/wham_1 & z/wham_2 should too...giving us a conflict. -test_setup_1d () { +test_expect_success '1d-setup: Directory renames cause a rename/rename(2to1) conflict' ' test_create_repo 1d && ( cd 1d && @@ -265,10 +262,9 @@ test_setup_1d () { test_tick && git commit -m "B" ) -} +' -test_expect_success '1d: Directory renames cause a rename/rename(2to1) conflict' ' - test_setup_1d && +test_expect_success '1d-check: Directory renames cause a rename/rename(2to1) conflict' ' ( cd 1d && @@ -317,7 +313,7 @@ test_expect_success '1d: Directory renames cause a rename/rename(2to1) conflict' # Commit B: z/{oldb,oldc,d} # Expected: y/{newb,newc,d} -test_setup_1e () { +test_expect_success '1e-setup: Renamed directory, with all files being renamed too' ' test_create_repo 1e && ( cd 1e && @@ -346,10 +342,9 @@ test_setup_1e () { test_tick && git commit -m "B" ) -} +' -test_expect_success '1e: Renamed directory, with all files being renamed too' ' - test_setup_1e && +test_expect_success '1e-check: Renamed directory, with all files being renamed too' ' ( cd 1e && @@ -376,7 +371,7 @@ test_expect_success '1e: Renamed directory, with all files being renamed too' ' # Commit B: y/{b,c}, x/{d,e,f} # Expected: y/{b,c}, x/{d,e,f,g} -test_setup_1f () { +test_expect_success '1f-setup: Split a directory into two other directories' ' test_create_repo 1f && ( cd 1f && @@ -413,10 +408,9 @@ test_setup_1f () { test_tick && git commit -m "B" ) -} +' -test_expect_success '1f: Split a directory into two other directories' ' - test_setup_1f && +test_expect_success '1f-check: Split a directory into two other directories' ' ( cd 1f && @@ -465,7 +459,7 @@ test_expect_success '1f: Split a directory into two other directories' ' # Commit A: y/b, w/c # Commit B: z/{b,c,d} # Expected: y/b, w/c, z/d, with warning about z/ -> (y/ vs. w/) conflict -test_setup_2a () { +test_expect_success '2a-setup: Directory split into two on one side, with equal numbers of paths' ' test_create_repo 2a && ( cd 2a && @@ -495,10 +489,9 @@ test_setup_2a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '2a: Directory split into two on one side, with equal numbers of paths' ' - test_setup_2a && +test_expect_success '2a-check: Directory split into two on one side, with equal numbers of paths' ' ( cd 2a && @@ -527,7 +520,7 @@ test_expect_success '2a: Directory split into two on one side, with equal number # Commit A: y/b, w/c # Commit B: z/{b,c}, x/d # Expected: y/b, w/c, x/d; No warning about z/ -> (y/ vs. w/) conflict -test_setup_2b () { +test_expect_success '2b-setup: Directory split into two on one side, with equal numbers of paths' ' test_create_repo 2b && ( cd 2b && @@ -558,10 +551,9 @@ test_setup_2b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '2b: Directory split into two on one side, with equal numbers of paths' ' - test_setup_2b && +test_expect_success '2b-check: Directory split into two on one side, with equal numbers of paths' ' ( cd 2b && @@ -609,7 +601,7 @@ test_expect_success '2b: Directory split into two on one side, with equal number # Commit A: z/{b,c,d} (no change) # Commit B: y/{b,c}, x/d # Expected: y/{b,c}, x/d -test_setup_3a () { +test_expect_success '3a-setup: Avoid implicit rename if involved as source on other side' ' test_create_repo 3a && ( cd 3a && @@ -640,10 +632,9 @@ test_setup_3a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '3a: Avoid implicit rename if involved as source on other side' ' - test_setup_3a && +test_expect_success '3a-check: Avoid implicit rename if involved as source on other side' ' ( cd 3a && @@ -673,7 +664,7 @@ test_expect_success '3a: Avoid implicit rename if involved as source on other si # get it involved in directory rename detection. If it were, we might # end up with CONFLICT:(z/d -> y/d vs. x/d vs. w/d), i.e. a # rename/rename/rename(1to3) conflict, which is just weird. -test_setup_3b () { +test_expect_success '3b-setup: Avoid implicit rename if involved as source on current side' ' test_create_repo 3b && ( cd 3b && @@ -706,10 +697,9 @@ test_setup_3b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '3b: Avoid implicit rename if involved as source on current side' ' - test_setup_3b && +test_expect_success '3b-check: Avoid implicit rename if involved as source on current side' ' ( cd 3b && @@ -754,7 +744,7 @@ test_expect_success '3b: Avoid implicit rename if involved as source on current # # What if we were to attempt to do directory rename detection when someone # "mostly" moved a directory but still left some files around, or, -# equivalently, fully renamed a directory in one commit and then recreated +# equivalently, fully renamed a directory in one commmit and then recreated # that directory in a later commit adding some new files and then tried to # merge? # @@ -796,7 +786,7 @@ test_expect_success '3b: Avoid implicit rename if involved as source on current # Expected: y/{b,c,d}, z/{e,f} # NOTE: Even though most files from z moved to y, we don't want f to follow. -test_setup_4a () { +test_expect_success '4a-setup: Directory split, with original directory still present' ' test_create_repo 4a && ( cd 4a && @@ -828,10 +818,9 @@ test_setup_4a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '4a: Directory split, with original directory still present' ' - test_setup_4a && +test_expect_success '4a-check: Directory split, with original directory still present' ' ( cd 4a && @@ -885,7 +874,7 @@ test_expect_success '4a: Directory split, with original directory still present' # of history, giving us no way to represent this conflict in the # index. -test_setup_5a () { +test_expect_success '5a-setup: Merge directories, other side adds files to original and target' ' test_create_repo 5a && ( cd 5a && @@ -918,10 +907,9 @@ test_setup_5a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '5a: Merge directories, other side adds files to original and target' ' - test_setup_5a && +test_expect_success '5a-check: Merge directories, other side adds files to original and target' ' ( cd 5a && @@ -953,14 +941,14 @@ test_expect_success '5a: Merge directories, other side adds files to original an # Commit B: z/{b,c,d_1,e}, y/d_3 # Expected: y/{b,c,e}, CONFLICT(add/add: y/d_2 vs. y/d_3) # NOTE: If z/d_1 in commit B were to be involved in dir rename detection, as -# we normally would since z/ is being renamed to y/, then this would be +# we normaly would since z/ is being renamed to y/, then this would be # a rename/delete (z/d_1 -> y/d_1 vs. deleted) AND an add/add/add # conflict of y/d_1 vs. y/d_2 vs. y/d_3. Add/add/add is not # representable in the index, so the existence of y/d_3 needs to # cause us to bail on directory rename detection for that path, falling # back to git behavior without the directory rename detection. -test_setup_5b () { +test_expect_success '5b-setup: Rename/delete in order to get add/add/add conflict' ' test_create_repo 5b && ( cd 5b && @@ -993,10 +981,9 @@ test_setup_5b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '5b: Rename/delete in order to get add/add/add conflict' ' - test_setup_5b && +test_expect_success '5b-check: Rename/delete in order to get add/add/add conflict' ' ( cd 5b && @@ -1037,7 +1024,7 @@ test_expect_success '5b: Rename/delete in order to get add/add/add conflict' ' # y/d are y/d_2 and y/d_4. We still do the move from z/e to y/e, # though, because it doesn't have anything in the way. -test_setup_5c () { +test_expect_success '5c-setup: Transitive rename would cause rename/rename/rename/add/add/add' ' test_create_repo 5c && ( cd 5c && @@ -1074,10 +1061,9 @@ test_setup_5c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '5c: Transitive rename would cause rename/rename/rename/add/add/add' ' - test_setup_5c && +test_expect_success '5c-check: Transitive rename would cause rename/rename/rename/add/add/add' ' ( cd 5c && @@ -1127,7 +1113,7 @@ test_expect_success '5c: Transitive rename would cause rename/rename/rename/add/ # detection for z/d_2, but that doesn't prevent us from applying the # directory rename detection for z/f -> y/f. -test_setup_5d () { +test_expect_success '5d-setup: Directory/file/file conflict due to directory rename' ' test_create_repo 5d && ( cd 5d && @@ -1159,10 +1145,9 @@ test_setup_5d () { test_tick && git commit -m "B" ) -} +' -test_expect_success '5d: Directory/file/file conflict due to directory rename' ' - test_setup_5d && +test_expect_success '5d-check: Directory/file/file conflict due to directory rename' ' ( cd 5d && @@ -1220,7 +1205,7 @@ test_expect_success '5d: Directory/file/file conflict due to directory rename' ' # them under y/ doesn't accidentally catch z/d and make it look like # it is also involved in a rename/delete conflict. -test_setup_6a () { +test_expect_success '6a-setup: Tricky rename/delete' ' test_create_repo 6a && ( cd 6a && @@ -1250,10 +1235,9 @@ test_setup_6a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '6a: Tricky rename/delete' ' - test_setup_6a && +test_expect_success '6a-check: Tricky rename/delete' ' ( cd 6a && @@ -1287,7 +1271,7 @@ test_expect_success '6a: Tricky rename/delete' ' # but B did that rename and still decided to put the file into z/, # so we probably shouldn't apply directory rename detection for it. -test_setup_6b () { +test_expect_success '6b-setup: Same rename done on both sides' ' test_create_repo 6b && ( cd 6b && @@ -1316,10 +1300,9 @@ test_setup_6b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '6b: Same rename done on both sides' ' - test_setup_6b && +test_expect_success '6b-check: Same rename done on both sides' ' ( cd 6b && @@ -1351,7 +1334,7 @@ test_expect_success '6b: Same rename done on both sides' ' # NOTE: Seems obvious, but just checking that the implementation doesn't # "accidentally detect a rename" and give us y/{b,c,d}. -test_setup_6c () { +test_expect_success '6c-setup: Rename only done on same side' ' test_create_repo 6c && ( cd 6c && @@ -1379,10 +1362,9 @@ test_setup_6c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '6c: Rename only done on same side' ' - test_setup_6c && +test_expect_success '6c-check: Rename only done on same side' ' ( cd 6c && @@ -1414,7 +1396,7 @@ test_expect_success '6c: Rename only done on same side' ' # NOTE: Again, this seems obvious but just checking that the implementation # doesn't "accidentally detect a rename" and give us y/{b,c,d}. -test_setup_6d () { +test_expect_success '6d-setup: We do not always want transitive renaming' ' test_create_repo 6d && ( cd 6d && @@ -1442,10 +1424,9 @@ test_setup_6d () { test_tick && git commit -m "B" ) -} +' -test_expect_success '6d: We do not always want transitive renaming' ' - test_setup_6d && +test_expect_success '6d-check: We do not always want transitive renaming' ' ( cd 6d && @@ -1477,7 +1458,7 @@ test_expect_success '6d: We do not always want transitive renaming' ' # doesn't "accidentally detect a rename" and give us y/{b,c} + # add/add conflict on y/d_1 vs y/d_2. -test_setup_6e () { +test_expect_success '6e-setup: Add/add from one side' ' test_create_repo 6e && ( cd 6e && @@ -1506,10 +1487,9 @@ test_setup_6e () { test_tick && git commit -m "B" ) -} +' -test_expect_success '6e: Add/add from one side' ' - test_setup_6e && +test_expect_success '6e-check: Add/add from one side' ' ( cd 6e && @@ -1572,7 +1552,7 @@ test_expect_success '6e: Add/add from one side' ' # Expected: y/d, CONFLICT(rename/rename for both z/b and z/c) # NOTE: There's a rename of z/ here, y/ has more renames, so z/d -> y/d. -test_setup_7a () { +test_expect_success '7a-setup: rename-dir vs. rename-dir (NOT split evenly) PLUS add-other-file' ' test_create_repo 7a && ( cd 7a && @@ -1603,10 +1583,9 @@ test_setup_7a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '7a: rename-dir vs. rename-dir (NOT split evenly) PLUS add-other-file' ' - test_setup_7a && +test_expect_success '7a-check: rename-dir vs. rename-dir (NOT split evenly) PLUS add-other-file' ' ( cd 7a && @@ -1644,7 +1623,7 @@ test_expect_success '7a: rename-dir vs. rename-dir (NOT split evenly) PLUS add-o # Commit B: z/{b,c,d_1}, w/d_2 # Expected: y/{b,c}, CONFLICT(rename/rename(2to1): x/d_1, w/d_2 -> y_d) -test_setup_7b () { +test_expect_success '7b-setup: rename/rename(2to1), but only due to transitive rename' ' test_create_repo 7b && ( cd 7b && @@ -1676,10 +1655,9 @@ test_setup_7b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '7b: rename/rename(2to1), but only due to transitive rename' ' - test_setup_7b && +test_expect_success '7b-check: rename/rename(2to1), but only due to transitive rename' ' ( cd 7b && @@ -1724,7 +1702,7 @@ test_expect_success '7b: rename/rename(2to1), but only due to transitive rename' # neither CONFLICT(x/d -> w/d vs. z/d) # nor CONFLiCT x/d -> w/d vs. y/d vs. z/d) -test_setup_7c () { +test_expect_success '7c-setup: rename/rename(1to...2or3); transitive rename may add complexity' ' test_create_repo 7c && ( cd 7c && @@ -1754,10 +1732,9 @@ test_setup_7c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '7c: rename/rename(1to...2or3); transitive rename may add complexity' ' - test_setup_7c && +test_expect_success '7c-check: rename/rename(1to...2or3); transitive rename may add complexity' ' ( cd 7c && @@ -1789,7 +1766,7 @@ test_expect_success '7c: rename/rename(1to...2or3); transitive rename may add co # Expected: y/{b,c}, CONFLICT(delete x/d vs rename to y/d) # NOTE: z->y so NOT CONFLICT(delete x/d vs rename to z/d) -test_setup_7d () { +test_expect_success '7d-setup: transitive rename involved in rename/delete; how is it reported?' ' test_create_repo 7d && ( cd 7d && @@ -1819,10 +1796,9 @@ test_setup_7d () { test_tick && git commit -m "B" ) -} +' -test_expect_success '7d: transitive rename involved in rename/delete; how is it reported?' ' - test_setup_7d && +test_expect_success '7d-check: transitive rename involved in rename/delete; how is it reported?' ' ( cd 7d && @@ -1875,7 +1851,7 @@ test_expect_success '7d: transitive rename involved in rename/delete; how is it # see testcases 9c and 9d for further discussion of this issue and # how it's resolved. -test_setup_7e () { +test_expect_success '7e-setup: transitive rename in rename/delete AND dirs in the way' ' test_create_repo 7e && ( cd 7e && @@ -1910,10 +1886,9 @@ test_setup_7e () { test_tick && git commit -m "B" ) -} +' -test_expect_success '7e: transitive rename in rename/delete AND dirs in the way' ' - test_setup_7e && +test_expect_success '7e-check: transitive rename in rename/delete AND dirs in the way' ' ( cd 7e && @@ -1970,7 +1945,7 @@ test_expect_success '7e: transitive rename in rename/delete AND dirs in the way' # simple rule from section 5 prevents me from handling this as optimally as # we potentially could. -test_setup_8a () { +test_expect_success '8a-setup: Dual-directory rename, one into the others way' ' test_create_repo 8a && ( cd 8a && @@ -2002,10 +1977,9 @@ test_setup_8a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '8a: Dual-directory rename, one into the others way' ' - test_setup_8a && +test_expect_success '8a-check: Dual-directory rename, one into the others way' ' ( cd 8a && @@ -2049,7 +2023,7 @@ test_expect_success '8a: Dual-directory rename, one into the others way' ' # making us fall back to pre-directory-rename-detection behavior for both # e_1 and e_2. -test_setup_8b () { +test_expect_success '8b-setup: Dual-directory rename, one into the others way, with conflicting filenames' ' test_create_repo 8b && ( cd 8b && @@ -2081,10 +2055,9 @@ test_setup_8b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '8b: Dual-directory rename, one into the others way, with conflicting filenames' ' - test_setup_8b && +test_expect_success '8b-check: Dual-directory rename, one into the others way, with conflicting filenames' ' ( cd 8b && @@ -2116,14 +2089,14 @@ test_expect_success '8b: Dual-directory rename, one into the others way, with co # # Note: It could easily be argued that the correct resolution here is # y/{b,c,e}, CONFLICT(rename/delete: z/d -> y/d vs deleted) -# and that the modified version of d should be present in y/ after +# and that the modifed version of d should be present in y/ after # the merge, just marked as conflicted. Indeed, I previously did # argue that. But applying directory renames to the side of # history where a file is merely modified results in spurious # rename/rename(1to2) conflicts -- see testcase 9h. See also # notes in 8d. -test_setup_8c () { +test_expect_success '8c-setup: modify/delete or rename+modify/delete?' ' test_create_repo 8c && ( cd 8c && @@ -2154,10 +2127,9 @@ test_setup_8c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '8c: modify/delete or rename+modify/delete' ' - test_setup_8c && +test_expect_success '8c-check: modify/delete or rename+modify/delete' ' ( cd 8c && @@ -2203,7 +2175,7 @@ test_expect_success '8c: modify/delete or rename+modify/delete' ' # during merging are supposed to be about opposite sides doing things # differently. -test_setup_8d () { +test_expect_success '8d-setup: rename/delete...or not?' ' test_create_repo 8d && ( cd 8d && @@ -2232,10 +2204,9 @@ test_setup_8d () { test_tick && git commit -m "B" ) -} +' -test_expect_success '8d: rename/delete...or not?' ' - test_setup_8d && +test_expect_success '8d-check: rename/delete...or not?' ' ( cd 8d && @@ -2279,7 +2250,7 @@ test_expect_success '8d: rename/delete...or not?' ' # about the ramifications of doing that, I didn't know how to rule out # that opening other weird edge and corner cases so I just punted. -test_setup_8e () { +test_expect_success '8e-setup: Both sides rename, one side adds to original directory' ' test_create_repo 8e && ( cd 8e && @@ -2308,10 +2279,9 @@ test_setup_8e () { test_tick && git commit -m "B" ) -} +' -test_expect_success '8e: Both sides rename, one side adds to original directory' ' - test_setup_8e && +test_expect_success '8e-check: Both sides rename, one side adds to original directory' ' ( cd 8e && @@ -2363,7 +2333,7 @@ test_expect_success '8e: Both sides rename, one side adds to original directory' # of which one had the most paths going to it. A naive implementation # of that could take the new file in commit B at z/i to x/w/i or x/i. -test_setup_9a () { +test_expect_success '9a-setup: Inner renamed directory within outer renamed directory' ' test_create_repo 9a && ( cd 9a && @@ -2396,10 +2366,9 @@ test_setup_9a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '9a: Inner renamed directory within outer renamed directory' ' - test_setup_9a && +test_expect_success '9a-check: Inner renamed directory within outer renamed directory' ' ( cd 9a && @@ -2435,7 +2404,7 @@ test_expect_success '9a: Inner renamed directory within outer renamed directory' # Commit B: z/{b,c,d_3} # Expected: y/{b,c,d_merged} -test_setup_9b () { +test_expect_success '9b-setup: Transitive rename with content merge' ' test_create_repo 9b && ( cd 9b && @@ -2467,10 +2436,9 @@ test_setup_9b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '9b: Transitive rename with content merge' ' - test_setup_9b && +test_expect_success '9b-check: Transitive rename with content merge' ' ( cd 9b && @@ -2523,7 +2491,7 @@ test_expect_success '9b: Transitive rename with content merge' ' # away, then ignore that particular rename from the other side of # history for any implicit directory renames. -test_setup_9c () { +test_expect_success '9c-setup: Doubly transitive rename?' ' test_create_repo 9c && ( cd 9c && @@ -2558,10 +2526,9 @@ test_setup_9c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '9c: Doubly transitive rename?' ' - test_setup_9c && +test_expect_success '9c-check: Doubly transitive rename?' ' ( cd 9c && @@ -2612,7 +2579,7 @@ test_expect_success '9c: Doubly transitive rename?' ' # simple rules that are consistent with what we need for all the other # testcases and simplifies things for the user. -test_setup_9d () { +test_expect_success '9d-setup: N-way transitive rename?' ' test_create_repo 9d && ( cd 9d && @@ -2647,10 +2614,9 @@ test_setup_9d () { test_tick && git commit -m "B" ) -} +' -test_expect_success '9d: N-way transitive rename?' ' - test_setup_9d && +test_expect_success '9d-check: N-way transitive rename?' ' ( cd 9d && @@ -2687,7 +2653,7 @@ test_expect_success '9d: N-way transitive rename?' ' # Expected: combined/{a,b,c,d,e,f,g,h,i,j,k,l}, CONFLICT(Nto1) warnings, # dir1/yo, dir2/yo, dir3/yo, dirN/yo -test_setup_9e () { +test_expect_success '9e-setup: N-to-1 whammo' ' test_create_repo 9e && ( cd 9e && @@ -2730,10 +2696,9 @@ test_setup_9e () { test_tick && git commit -m "B" ) -} +' -test_expect_success C_LOCALE_OUTPUT '9e: N-to-1 whammo' ' - test_setup_9e && +test_expect_success C_LOCALE_OUTPUT '9e-check: N-to-1 whammo' ' ( cd 9e && @@ -2780,7 +2745,7 @@ test_expect_success C_LOCALE_OUTPUT '9e: N-to-1 whammo' ' # Commit B: goal/{a,b}/$more_files, goal/c # Expected: priority/{a,b}/$more_files, priority/c -test_setup_9f () { +test_expect_success '9f-setup: Renamed directory that only contained immediate subdirs' ' test_create_repo 9f && ( cd 9f && @@ -2809,10 +2774,9 @@ test_setup_9f () { test_tick && git commit -m "B" ) -} +' -test_expect_success '9f: Renamed directory that only contained immediate subdirs' ' - test_setup_9f && +test_expect_success '9f-check: Renamed directory that only contained immediate subdirs' ' ( cd 9f && @@ -2845,7 +2809,7 @@ test_expect_success '9f: Renamed directory that only contained immediate subdirs # Commit B: goal/{a,b}/$more_files, goal/c # Expected: priority/{alpha,bravo}/$more_files, priority/c -test_setup_9g () { +test_expect_success '9g-setup: Renamed directory that only contained immediate subdirs, immediate subdirs renamed' ' test_create_repo 9g && ( cd 9g && @@ -2877,9 +2841,9 @@ test_setup_9g () { test_tick && git commit -m "B" ) -} +' -test_expect_failure '9g: Renamed directory that only contained immediate subdirs, immediate subdirs renamed' ' +test_expect_failure '9g-check: Renamed directory that only contained immediate subdirs, immediate subdirs renamed' ' ( cd 9g && @@ -2913,7 +2877,7 @@ test_expect_failure '9g: Renamed directory that only contained immediate subdirs # Expected: y/{b,c}, x/d_2 # NOTE: If we applied the z/ -> y/ rename to z/d, then we'd end up with # a rename/rename(1to2) conflict (z/d -> y/d vs. x/d) -test_setup_9h () { +test_expect_success '9h-setup: Avoid dir rename on merely modified path' ' test_create_repo 9h && ( cd 9h && @@ -2946,10 +2910,9 @@ test_setup_9h () { test_tick && git commit -m "B" ) -} +' -test_expect_success '9h: Avoid dir rename on merely modified path' ' - test_setup_9h && +test_expect_success '9h-check: Avoid dir rename on merely modified path' ' ( cd 9h && @@ -2994,7 +2957,7 @@ test_expect_success '9h: Avoid dir rename on merely modified path' ' # Expected: Aborted Merge + # ERROR_MSG(untracked working tree files would be overwritten by merge) -test_setup_10a () { +test_expect_success '10a-setup: Overwrite untracked with normal rename/delete' ' test_create_repo 10a && ( cd 10a && @@ -3020,10 +2983,9 @@ test_setup_10a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '10a: Overwrite untracked with normal rename/delete' ' - test_setup_10a && +test_expect_success '10a-check: Overwrite untracked with normal rename/delete' ' ( cd 10a && @@ -3059,7 +3021,7 @@ test_expect_success '10a: Overwrite untracked with normal rename/delete' ' # z/c_1 -> z/d_1 rename recorded at stage 3 for y/d + # ERROR_MSG(refusing to lose untracked file at 'y/d') -test_setup_10b () { +test_expect_success '10b-setup: Overwrite untracked with dir rename + delete' ' test_create_repo 10b && ( cd 10b && @@ -3088,10 +3050,9 @@ test_setup_10b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '10b: Overwrite untracked with dir rename + delete' ' - test_setup_10b && +test_expect_success '10b-check: Overwrite untracked with dir rename + delete' ' ( cd 10b && @@ -3137,10 +3098,10 @@ test_expect_success '10b: Overwrite untracked with dir rename + delete' ' # y/c~B^0 + # ERROR_MSG(Refusing to lose untracked file at y/c) -test_setup_10c () { - test_create_repo 10c_$1 && +test_expect_success '10c-setup: Overwrite untracked with dir rename/rename(1to2)' ' + test_create_repo 10c && ( - cd 10c_$1 && + cd 10c && mkdir z x && echo a >z/a && @@ -3167,12 +3128,11 @@ test_setup_10c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '10c1: Overwrite untracked with dir rename/rename(1to2)' ' - test_setup_10c 1 && +test_expect_success '10c-check: Overwrite untracked with dir rename/rename(1to2)' ' ( - cd 10c_1 && + cd 10c && git checkout A^0 && echo important >y/c && @@ -3203,10 +3163,9 @@ test_expect_success '10c1: Overwrite untracked with dir rename/rename(1to2)' ' ) ' -test_expect_success '10c2: Overwrite untracked with dir rename/rename(1to2), other direction' ' - test_setup_10c 2 && +test_expect_success '10c-check: Overwrite untracked with dir rename/rename(1to2), other direction' ' ( - cd 10c_2 && + cd 10c && git reset --hard && git clean -fdqx && @@ -3249,7 +3208,7 @@ test_expect_success '10c2: Overwrite untracked with dir rename/rename(1to2), oth # CONFLICT(rename/rename) z/c_1 vs x/f_2 -> y/wham # ERROR_MSG(Refusing to lose untracked file at y/wham) -test_setup_10d () { +test_expect_success '10d-setup: Delete untracked with dir rename/rename(2to1)' ' test_create_repo 10d && ( cd 10d && @@ -3281,10 +3240,9 @@ test_setup_10d () { test_tick && git commit -m "B" ) -} +' -test_expect_success '10d: Delete untracked with dir rename/rename(2to1)' ' - test_setup_10d && +test_expect_success '10d-check: Delete untracked with dir rename/rename(2to1)' ' ( cd 10d && @@ -3332,7 +3290,7 @@ test_expect_success '10d: Delete untracked with dir rename/rename(2to1)' ' # Commit B: z/{a,b,c} # Expected: y/{a,b,c} + untracked z/c -test_setup_10e () { +test_expect_success '10e-setup: Does git complain about untracked file that is not really in the way?' ' test_create_repo 10e && ( cd 10e && @@ -3359,9 +3317,9 @@ test_setup_10e () { test_tick && git commit -m "B" ) -} +' -test_expect_failure '10e: Does git complain about untracked file that is not really in the way?' ' +test_expect_failure '10e-check: Does git complain about untracked file that is not really in the way?' ' ( cd 10e && @@ -3413,7 +3371,7 @@ test_expect_failure '10e: Does git complain about untracked file that is not rea # z/c~HEAD with contents of B:z/b_v2, # z/c with uncommitted mods on top of A:z/c_v1 -test_setup_11a () { +test_expect_success '11a-setup: Avoid losing dirty contents with simple rename' ' test_create_repo 11a && ( cd 11a && @@ -3440,10 +3398,9 @@ test_setup_11a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '11a: Avoid losing dirty contents with simple rename' ' - test_setup_11a && +test_expect_success '11a-check: Avoid losing dirty contents with simple rename' ' ( cd 11a && @@ -3484,7 +3441,7 @@ test_expect_success '11a: Avoid losing dirty contents with simple rename' ' # ERROR_MSG(Refusing to lose dirty file at z/c) -test_setup_11b () { +test_expect_success '11b-setup: Avoid losing dirty file involved in directory rename' ' test_create_repo 11b && ( cd 11b && @@ -3513,10 +3470,9 @@ test_setup_11b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '11b: Avoid losing dirty file involved in directory rename' ' - test_setup_11b && +test_expect_success '11b-check: Avoid losing dirty file involved in directory rename' ' ( cd 11b && @@ -3559,7 +3515,7 @@ test_expect_success '11b: Avoid losing dirty file involved in directory rename' # Expected: Abort_msg("following files would be overwritten by merge") + # y/c left untouched (still has uncommitted mods) -test_setup_11c () { +test_expect_success '11c-setup: Avoid losing not-uptodate with rename + D/F conflict' ' test_create_repo 11c && ( cd 11c && @@ -3589,10 +3545,9 @@ test_setup_11c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '11c: Avoid losing not-uptodate with rename + D/F conflict' ' - test_setup_11c && +test_expect_success '11c-check: Avoid losing not-uptodate with rename + D/F conflict' ' ( cd 11c && @@ -3626,7 +3581,7 @@ test_expect_success '11c: Avoid losing not-uptodate with rename + D/F conflict' # Warning_Msg("Refusing to lose dirty file at z/c) + # y/{a,c~HEAD,c/d}, x/b, now-untracked z/c_v1 with uncommitted mods -test_setup_11d () { +test_expect_success '11d-setup: Avoid losing not-uptodate with rename + D/F conflict' ' test_create_repo 11d && ( cd 11d && @@ -3657,10 +3612,9 @@ test_setup_11d () { test_tick && git commit -m "B" ) -} +' -test_expect_success '11d: Avoid losing not-uptodate with rename + D/F conflict' ' - test_setup_11d && +test_expect_success '11d-check: Avoid losing not-uptodate with rename + D/F conflict' ' ( cd 11d && @@ -3705,7 +3659,7 @@ test_expect_success '11d: Avoid losing not-uptodate with rename + D/F conflict' # y/c~HEAD has A:y/c_2 contents # y/c has dirty file from before merge -test_setup_11e () { +test_expect_success '11e-setup: Avoid deleting not-uptodate with dir rename/rename(1to2)/add' ' test_create_repo 11e && ( cd 11e && @@ -3737,10 +3691,9 @@ test_setup_11e () { test_tick && git commit -m "B" ) -} +' -test_expect_success '11e: Avoid deleting not-uptodate with dir rename/rename(1to2)/add' ' - test_setup_11e && +test_expect_success '11e-check: Avoid deleting not-uptodate with dir rename/rename(1to2)/add' ' ( cd 11e && @@ -3791,7 +3744,7 @@ test_expect_success '11e: Avoid deleting not-uptodate with dir rename/rename(1to # CONFLICT(rename/rename) x/c vs x/d -> y/wham # ERROR_MSG(Refusing to lose dirty file at y/wham) -test_setup_11f () { +test_expect_success '11f-setup: Avoid deleting not-uptodate with dir rename/rename(2to1)' ' test_create_repo 11f && ( cd 11f && @@ -3820,10 +3773,9 @@ test_setup_11f () { test_tick && git commit -m "B" ) -} +' -test_expect_success '11f: Avoid deleting not-uptodate with dir rename/rename(2to1)' ' - test_setup_11f && +test_expect_success '11f-check: Avoid deleting not-uptodate with dir rename/rename(2to1)' ' ( cd 11f && @@ -3880,7 +3832,7 @@ test_expect_success '11f: Avoid deleting not-uptodate with dir rename/rename(2to # Commit B: node1/{leaf1,leaf2,leaf5}, node2/{leaf3,leaf4,leaf6} # Expected: node1/{leaf1,leaf2,leaf5,node2/{leaf3,leaf4,leaf6}} -test_setup_12a () { +test_expect_success '12a-setup: Moving one directory hierarchy into another' ' test_create_repo 12a && ( cd 12a && @@ -3910,10 +3862,9 @@ test_setup_12a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '12a: Moving one directory hierarchy into another' ' - test_setup_12a && +test_expect_success '12a-check: Moving one directory hierarchy into another' ' ( cd 12a && @@ -3959,7 +3910,7 @@ test_expect_success '12a: Moving one directory hierarchy into another' ' # To which, I can do no more than shrug my shoulders and say that # even simple rules give weird results when given weird inputs. -test_setup_12b () { +test_expect_success '12b-setup: Moving two directory hierarchies into each other' ' test_create_repo 12b && ( cd 12b && @@ -3987,10 +3938,9 @@ test_setup_12b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '12b: Moving two directory hierarchies into each other' ' - test_setup_12b && +test_expect_success '12b-check: Moving two directory hierarchies into each other' ' ( cd 12b && @@ -4026,7 +3976,7 @@ test_expect_success '12b: Moving two directory hierarchies into each other' ' # NOTE: This is *exactly* like 12c, except that every path is modified on # each side of the merge. -test_setup_12c () { +test_expect_success '12c-setup: Moving one directory hierarchy into another w/ content merge' ' test_create_repo 12c && ( cd 12c && @@ -4058,10 +4008,9 @@ test_setup_12c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '12c: Moving one directory hierarchy into another w/ content merge' ' - test_setup_12c && +test_expect_success '12c-check: Moving one directory hierarchy into another w/ content merge' ' ( cd 12c && @@ -4102,122 +4051,6 @@ test_expect_success '12c: Moving one directory hierarchy into another w/ content ) ' -# Testcase 12d, Rename/merge of subdirectory into the root -# Commit O: a/b/subdir/foo -# Commit A: subdir/foo -# Commit B: a/b/subdir/foo, a/b/bar -# Expected: subdir/foo, bar - -test_setup_12d () { - test_create_repo 12d && - ( - cd 12d && - - mkdir -p a/b/subdir && - test_commit a/b/subdir/foo && - - git branch O && - git branch A && - git branch B && - - git checkout A && - mkdir subdir && - git mv a/b/subdir/foo.t subdir/foo.t && - test_tick && - git commit -m "A" && - - git checkout B && - test_commit a/b/bar - ) -} - -test_expect_success '12d: Rename/merge subdir into the root, variant 1' ' - test_setup_12d && - ( - cd 12d && - - git checkout A^0 && - - git -c merge.directoryRenames=true merge -s recursive B^0 && - - git ls-files -s >out && - test_line_count = 2 out && - - git rev-parse >actual \ - HEAD:subdir/foo.t HEAD:bar.t && - git rev-parse >expect \ - O:a/b/subdir/foo.t B:a/b/bar.t && - test_cmp expect actual && - - git hash-object bar.t >actual && - git rev-parse B:a/b/bar.t >expect && - test_cmp expect actual && - - test_must_fail git rev-parse HEAD:a/b/subdir/foo.t && - test_must_fail git rev-parse HEAD:a/b/bar.t && - test_path_is_missing a/ && - test_path_is_file bar.t - ) -' - -# Testcase 12e, Rename/merge of subdirectory into the root -# Commit O: a/b/foo -# Commit A: foo -# Commit B: a/b/foo, a/b/bar -# Expected: foo, bar - -test_setup_12e () { - test_create_repo 12e && - ( - cd 12e && - - mkdir -p a/b && - test_commit a/b/foo && - - git branch O && - git branch A && - git branch B && - - git checkout A && - mkdir subdir && - git mv a/b/foo.t foo.t && - test_tick && - git commit -m "A" && - - git checkout B && - test_commit a/b/bar - ) -} - -test_expect_success '12e: Rename/merge subdir into the root, variant 2' ' - test_setup_12e && - ( - cd 12e && - - git checkout A^0 && - - git -c merge.directoryRenames=true merge -s recursive B^0 && - - git ls-files -s >out && - test_line_count = 2 out && - - git rev-parse >actual \ - HEAD:foo.t HEAD:bar.t && - git rev-parse >expect \ - O:a/b/foo.t B:a/b/bar.t && - test_cmp expect actual && - - git hash-object bar.t >actual && - git rev-parse B:a/b/bar.t >expect && - test_cmp expect actual && - - test_must_fail git rev-parse HEAD:a/b/foo.t && - test_must_fail git rev-parse HEAD:a/b/bar.t && - test_path_is_missing a/ && - test_path_is_file bar.t - ) -' - ########################################################################### # SECTION 13: Checking informational and conflict messages # @@ -4235,10 +4068,10 @@ test_expect_success '12e: Rename/merge subdir into the root, variant 2' ' # Commit B: z/{b,c,d,e/f} # Expected: y/{b,c,d,e/f}, with notices/conflicts for both y/d and y/e/f -test_setup_13a () { - test_create_repo 13a_$1 && +test_expect_success '13a-setup: messages for newly added files' ' + test_create_repo 13a && ( - cd 13a_$1 && + cd 13a && mkdir z && echo b >z/b && @@ -4264,12 +4097,11 @@ test_setup_13a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '13a(conflict): messages for newly added files' ' - test_setup_13a conflict && +test_expect_success '13a-check(conflict): messages for newly added files' ' ( - cd 13a_conflict && + cd 13a && git checkout A^0 && @@ -4289,10 +4121,9 @@ test_expect_success '13a(conflict): messages for newly added files' ' ) ' -test_expect_success '13a(info): messages for newly added files' ' - test_setup_13a info && +test_expect_success '13a-check(info): messages for newly added files' ' ( - cd 13a_info && + cd 13a && git reset --hard && git checkout A^0 && @@ -4322,10 +4153,10 @@ test_expect_success '13a(info): messages for newly added files' ' # Expected: y/{b,c,d_merged}, with two conflict messages for y/d, # one about content, and one about file location -test_setup_13b () { - test_create_repo 13b_$1 && +test_expect_success '13b-setup: messages for transitive rename with conflicted content' ' + test_create_repo 13b && ( - cd 13b_$1 && + cd 13b && mkdir x && mkdir z && @@ -4354,12 +4185,11 @@ test_setup_13b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '13b(conflict): messages for transitive rename with conflicted content' ' - test_setup_13b conflict && +test_expect_success '13b-check(conflict): messages for transitive rename with conflicted content' ' ( - cd 13b_conflict && + cd 13b && git checkout A^0 && @@ -4377,10 +4207,9 @@ test_expect_success '13b(conflict): messages for transitive rename with conflict ) ' -test_expect_success '13b(info): messages for transitive rename with conflicted content' ' - test_setup_13b info && +test_expect_success '13b-check(info): messages for transitive rename with conflicted content' ' ( - cd 13b_info && + cd 13b && git reset --hard && git checkout A^0 && @@ -4409,10 +4238,10 @@ test_expect_success '13b(info): messages for transitive rename with conflicted c # d and B had full knowledge, but that's a slippery slope as # shown in testcase 13d. -test_setup_13c () { - test_create_repo 13c_$1 && +test_expect_success '13c-setup: messages for rename/rename(1to1) via transitive rename' ' + test_create_repo 13c && ( - cd 13c_$1 && + cd 13c && mkdir x && mkdir z && @@ -4440,12 +4269,11 @@ test_setup_13c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '13c(conflict): messages for rename/rename(1to1) via transitive rename' ' - test_setup_13c conflict && +test_expect_success '13c-check(conflict): messages for rename/rename(1to1) via transitive rename' ' ( - cd 13c_conflict && + cd 13c && git checkout A^0 && @@ -4462,10 +4290,9 @@ test_expect_success '13c(conflict): messages for rename/rename(1to1) via transit ) ' -test_expect_success '13c(info): messages for rename/rename(1to1) via transitive rename' ' - test_setup_13c info && +test_expect_success '13c-check(info): messages for rename/rename(1to1) via transitive rename' ' ( - cd 13c_info && + cd 13c && git reset --hard && git checkout A^0 && @@ -4497,10 +4324,10 @@ test_expect_success '13c(info): messages for rename/rename(1to1) via transitive # * B renames a/y to c/y, and A renames c/->d/ => a/y -> d/y # No conflict in where a/y ends up, so put it in d/y. -test_setup_13d () { - test_create_repo 13d_$1 && +test_expect_success '13d-setup: messages for rename/rename(1to1) via dual transitive rename' ' + test_create_repo 13d && ( - cd 13d_$1 && + cd 13d && mkdir a && mkdir b && @@ -4529,12 +4356,11 @@ test_setup_13d () { test_tick && git commit -m "B" ) -} +' -test_expect_success '13d(conflict): messages for rename/rename(1to1) via dual transitive rename' ' - test_setup_13d conflict && +test_expect_success '13d-check(conflict): messages for rename/rename(1to1) via dual transitive rename' ' ( - cd 13d_conflict && + cd 13d && git checkout A^0 && @@ -4554,10 +4380,9 @@ test_expect_success '13d(conflict): messages for rename/rename(1to1) via dual tr ) ' -test_expect_success '13d(info): messages for rename/rename(1to1) via dual transitive rename' ' - test_setup_13d info && +test_expect_success '13d-check(info): messages for rename/rename(1to1) via dual transitive rename' ' ( - cd 13d_info && + cd 13d && git reset --hard && git checkout A^0 && @@ -4623,7 +4448,7 @@ test_expect_success '13d(info): messages for rename/rename(1to1) via dual transi # in the outer merge for this special kind of setup, but it at # least avoids hitting a BUG(). # -test_setup_13e () { +test_expect_success '13e-setup: directory rename detection in recursive case' ' test_create_repo 13e && ( cd 13e && @@ -4668,10 +4493,9 @@ test_setup_13e () { test_tick && git commit -m "D" ) -} +' -test_expect_success '13e: directory rename detection in recursive case' ' - test_setup_13e && +test_expect_success '13e-check: directory rename detection in recursive case' ' ( cd 13e && diff --git a/third_party/git/t/t6046-merge-skip-unneeded-updates.sh b/third_party/git/t/t6046-merge-skip-unneeded-updates.sh index 1ddc9e6626b8..3a47623ed316 100755 --- a/third_party/git/t/t6046-merge-skip-unneeded-updates.sh +++ b/third_party/git/t/t6046-merge-skip-unneeded-updates.sh @@ -36,10 +36,10 @@ test_description="merge cases" # Commit B: b_3 # Expected: b_2 -test_setup_1a () { - test_create_repo 1a_$1 && +test_expect_success '1a-setup: Modify(A)/Modify(B), change on B subset of A' ' + test_create_repo 1a && ( - cd 1a_$1 && + cd 1a && test_write_lines 1 2 3 4 5 6 7 8 9 10 >b && git add b && @@ -62,24 +62,26 @@ test_setup_1a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '1a-L: Modify(A)/Modify(B), change on B subset of A' ' - test_setup_1a L && +test_expect_success '1a-check-L: Modify(A)/Modify(B), change on B subset of A' ' + test_when_finished "git -C 1a reset --hard" && + test_when_finished "git -C 1a clean -fd" && ( - cd 1a_L && + cd 1a && git checkout A^0 && - test-tool chmtime --get -3600 b >old-mtime && + test-tool chmtime =31337 b && + test-tool chmtime -v +0 b >expected-mtime && GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err && + test_i18ngrep "Skipped b" out && test_must_be_empty err && - # Make sure b was NOT updated - test-tool chmtime --get b >new-mtime && - test_cmp old-mtime new-mtime && + test-tool chmtime -v +0 b >actual-mtime && + test_cmp expected-mtime actual-mtime && git ls-files -s >index_files && test_line_count = 1 index_files && @@ -94,20 +96,17 @@ test_expect_success '1a-L: Modify(A)/Modify(B), change on B subset of A' ' ) ' -test_expect_success '1a-R: Modify(A)/Modify(B), change on B subset of A' ' - test_setup_1a R && +test_expect_success '1a-check-R: Modify(A)/Modify(B), change on B subset of A' ' + test_when_finished "git -C 1a reset --hard" && + test_when_finished "git -C 1a clean -fd" && ( - cd 1a_R && + cd 1a && git checkout B^0 && - test-tool chmtime --get -3600 b >old-mtime && GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err && - # Make sure b WAS updated - test-tool chmtime --get b >new-mtime && - test $(cat old-mtime) -lt $(cat new-mtime) && - + test_i18ngrep "Auto-merging b" out && test_must_be_empty err && git ls-files -s >index_files && @@ -134,10 +133,10 @@ test_expect_success '1a-R: Modify(A)/Modify(B), change on B subset of A' ' # Commit B: c_1 # Expected: c_2 -test_setup_2a () { - test_create_repo 2a_$1 && +test_expect_success '2a-setup: Modify(A)/rename(B)' ' + test_create_repo 2a && ( - cd 2a_$1 && + cd 2a && test_seq 1 10 >b && git add b && @@ -159,19 +158,20 @@ test_setup_2a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '2a-L: Modify/rename, merge into modify side' ' - test_setup_2a L && +test_expect_success '2a-check-L: Modify/rename, merge into modify side' ' + test_when_finished "git -C 2a reset --hard" && + test_when_finished "git -C 2a clean -fd" && ( - cd 2a_L && + cd 2a && git checkout A^0 && - test_path_is_missing c && GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err && - test_path_is_file c && + test_i18ngrep ! "Skipped c" out && + test_must_be_empty err && git ls-files -s >index_files && test_line_count = 1 index_files && @@ -189,20 +189,17 @@ test_expect_success '2a-L: Modify/rename, merge into modify side' ' ) ' -test_expect_success '2a-R: Modify/rename, merge into rename side' ' - test_setup_2a R && +test_expect_success '2a-check-R: Modify/rename, merge into rename side' ' + test_when_finished "git -C 2a reset --hard" && + test_when_finished "git -C 2a clean -fd" && ( - cd 2a_R && + cd 2a && git checkout B^0 && - test-tool chmtime --get -3600 c >old-mtime && GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err && - # Make sure c WAS updated - test-tool chmtime --get c >new-mtime && - test $(cat old-mtime) -lt $(cat new-mtime) && - + test_i18ngrep ! "Skipped c" out && test_must_be_empty err && git ls-files -s >index_files && @@ -227,10 +224,10 @@ test_expect_success '2a-R: Modify/rename, merge into rename side' ' # Commit B: b_3 # Expected: c_2 -test_setup_2b () { - test_create_repo 2b_$1 && +test_expect_success '2b-setup: Rename+Mod(A)/Mod(B), B mods subset of A' ' + test_create_repo 2b && ( - cd 2b_$1 && + cd 2b && test_write_lines 1 2 3 4 5 6 7 8 9 10 >b && git add b && @@ -254,23 +251,26 @@ test_setup_2b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '2b-L: Rename+Mod(A)/Mod(B), B mods subset of A' ' - test_setup_2b L && +test_expect_success '2b-check-L: Rename+Mod(A)/Mod(B), B mods subset of A' ' + test_when_finished "git -C 2b reset --hard" && + test_when_finished "git -C 2b clean -fd" && ( - cd 2b_L && + cd 2b && git checkout A^0 && - test-tool chmtime --get -3600 c >old-mtime && + test-tool chmtime =31337 c && + test-tool chmtime -v +0 c >expected-mtime && + GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err && + test_i18ngrep "Skipped c" out && test_must_be_empty err && - # Make sure c WAS updated - test-tool chmtime --get c >new-mtime && - test_cmp old-mtime new-mtime && + test-tool chmtime -v +0 c >actual-mtime && + test_cmp expected-mtime actual-mtime && git ls-files -s >index_files && test_line_count = 1 index_files && @@ -288,19 +288,17 @@ test_expect_success '2b-L: Rename+Mod(A)/Mod(B), B mods subset of A' ' ) ' -test_expect_success '2b-R: Rename+Mod(A)/Mod(B), B mods subset of A' ' - test_setup_2b R && +test_expect_success '2b-check-R: Rename+Mod(A)/Mod(B), B mods subset of A' ' + test_when_finished "git -C 2b reset --hard" && + test_when_finished "git -C 2b clean -fd" && ( - cd 2b_R && + cd 2b && git checkout B^0 && - test_path_is_missing c && GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err && - # Make sure c now present (and thus was updated) - test_path_is_file c && - + test_i18ngrep "Auto-merging c" out && test_must_be_empty err && git ls-files -s >index_files && @@ -334,7 +332,7 @@ test_expect_success '2b-R: Rename+Mod(A)/Mod(B), B mods subset of A' ' # skip the update, then we're in trouble. This test verifies we do # not make that particular mistake. -test_setup_2c () { +test_expect_success '2c-setup: Modify b & add c VS rename b->c' ' test_create_repo 2c && ( cd 2c && @@ -360,26 +358,21 @@ test_setup_2c () { test_tick && git commit -m "B" ) -} +' -test_expect_success '2c: Modify b & add c VS rename b->c' ' - test_setup_2c && +test_expect_success '2c-check: Modify b & add c VS rename b->c' ' ( cd 2c && git checkout A^0 && - test-tool chmtime --get -3600 c >old-mtime && GIT_MERGE_VERBOSITY=3 && export GIT_MERGE_VERBOSITY && test_must_fail git merge -s recursive B^0 >out 2>err && test_i18ngrep "CONFLICT (rename/add): Rename b->c" out && - test_must_be_empty err && - - # Make sure c WAS updated - test-tool chmtime --get c >new-mtime && - test $(cat old-mtime) -lt $(cat new-mtime) + test_i18ngrep ! "Skipped c" out && + test_must_be_empty err # FIXME: rename/add conflicts are horribly broken right now; # when I get back to my patch series fixing it and @@ -435,10 +428,10 @@ test_expect_success '2c: Modify b & add c VS rename b->c' ' # Commit B: bq_1, bar/whatever # Expected: bar/{bq_2, whatever} -test_setup_3a () { - test_create_repo 3a_$1 && +test_expect_success '3a-setup: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' + test_create_repo 3a && ( - cd 3a_$1 && + cd 3a && mkdir foo && test_seq 1 10 >bq && @@ -463,22 +456,21 @@ test_setup_3a () { test_tick && git commit -m "B" ) -} +' -test_expect_success '3a-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' - test_setup_3a L && +test_expect_success '3a-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' + test_when_finished "git -C 3a reset --hard" && + test_when_finished "git -C 3a clean -fd" && ( - cd 3a_L && + cd 3a && git checkout A^0 && - test_path_is_missing bar/bq && GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && + test_i18ngrep ! "Skipped bar/bq" out && test_must_be_empty err && - test_path_is_file bar/bq && - git ls-files -s >index_files && test_line_count = 2 index_files && @@ -495,20 +487,19 @@ test_expect_success '3a-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' ) ' -test_expect_success '3a-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' - test_setup_3a R && +test_expect_success '3a-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' + test_when_finished "git -C 3a reset --hard" && + test_when_finished "git -C 3a clean -fd" && ( - cd 3a_R && + cd 3a && git checkout B^0 && - test_path_is_missing bar/bq && GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive A^0 >out 2>err && + test_i18ngrep ! "Skipped bar/bq" out && test_must_be_empty err && - test_path_is_file bar/bq && - git ls-files -s >index_files && test_line_count = 2 index_files && @@ -531,10 +522,10 @@ test_expect_success '3a-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' # Commit B: bq_2, bar/whatever # Expected: bar/{bq_2, whatever} -test_setup_3b () { - test_create_repo 3b_$1 && +test_expect_success '3b-setup: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' + test_create_repo 3b && ( - cd 3b_$1 && + cd 3b && mkdir foo && test_seq 1 10 >bq && @@ -559,22 +550,21 @@ test_setup_3b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '3b-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' - test_setup_3b L && +test_expect_success '3b-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' + test_when_finished "git -C 3b reset --hard" && + test_when_finished "git -C 3b clean -fd" && ( - cd 3b_L && + cd 3b && git checkout A^0 && - test_path_is_missing bar/bq && GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && + test_i18ngrep ! "Skipped bar/bq" out && test_must_be_empty err && - test_path_is_file bar/bq && - git ls-files -s >index_files && test_line_count = 2 index_files && @@ -591,20 +581,19 @@ test_expect_success '3b-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' ) ' -test_expect_success '3b-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' - test_setup_3b R && +test_expect_success '3b-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' + test_when_finished "git -C 3b reset --hard" && + test_when_finished "git -C 3b clean -fd" && ( - cd 3b_R && + cd 3b && git checkout B^0 && - test_path_is_missing bar/bq && GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive A^0 >out 2>err && + test_i18ngrep ! "Skipped bar/bq" out && test_must_be_empty err && - test_path_is_file bar/bq && - git ls-files -s >index_files && test_line_count = 2 index_files && @@ -632,7 +621,7 @@ test_expect_success '3b-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' # Working copy: b_4 # Expected: b_2 for merge, b_4 in working copy -test_setup_4a () { +test_expect_success '4a-setup: Change on A, change on B subset of A, dirty mods present' ' test_create_repo 4a && ( cd 4a && @@ -658,7 +647,7 @@ test_setup_4a () { test_tick && git commit -m "B" ) -} +' # NOTE: For as long as we continue using unpack_trees() without index_only # set to true, it will error out on a case like this claiming the the locally @@ -666,23 +655,25 @@ test_setup_4a () { # correct requires doing the merge in-memory first, then realizing that no # updates to the file are necessary, and thus that we can just leave the path # alone. -test_expect_failure '4a: Change on A, change on B subset of A, dirty mods present' ' - test_setup_4a && +test_expect_failure '4a-check: Change on A, change on B subset of A, dirty mods present' ' + test_when_finished "git -C 4a reset --hard" && + test_when_finished "git -C 4a clean -fd" && ( cd 4a && git checkout A^0 && echo "File rewritten" >b && - test-tool chmtime --get -3600 b >old-mtime && + test-tool chmtime =31337 b && + test-tool chmtime -v +0 b >expected-mtime && GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err && + test_i18ngrep "Skipped b" out && test_must_be_empty err && - # Make sure b was NOT updated - test-tool chmtime --get b >new-mtime && - test_cmp old-mtime new-mtime && + test-tool chmtime -v +0 b >actual-mtime && + test_cmp expected-mtime actual-mtime && git ls-files -s >index_files && test_line_count = 1 index_files && @@ -704,7 +695,7 @@ test_expect_failure '4a: Change on A, change on B subset of A, dirty mods presen # Working copy: c_4 # Expected: c_2 -test_setup_4b () { +test_expect_success '4b-setup: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mods present' ' test_create_repo 4b && ( cd 4b && @@ -731,25 +722,27 @@ test_setup_4b () { test_tick && git commit -m "B" ) -} +' -test_expect_success '4b: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mods present' ' - test_setup_4b && +test_expect_success '4b-check: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mods present' ' + test_when_finished "git -C 4b reset --hard" && + test_when_finished "git -C 4b clean -fd" && ( cd 4b && git checkout A^0 && echo "File rewritten" >c && - test-tool chmtime --get -3600 c >old-mtime && + test-tool chmtime =31337 c && + test-tool chmtime -v +0 c >expected-mtime && GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err && + test_i18ngrep "Skipped c" out && test_must_be_empty err && - # Make sure c was NOT updated - test-tool chmtime --get c >new-mtime && - test_cmp old-mtime new-mtime && + test-tool chmtime -v +0 c >actual-mtime && + test_cmp expected-mtime actual-mtime && git ls-files -s >index_files && test_line_count = 1 index_files && diff --git a/third_party/git/t/t6047-diff3-conflict-markers.sh b/third_party/git/t/t6047-diff3-conflict-markers.sh deleted file mode 100755 index f4655bb358ff..000000000000 --- a/third_party/git/t/t6047-diff3-conflict-markers.sh +++ /dev/null @@ -1,211 +0,0 @@ -#!/bin/sh - -test_description='recursive merge diff3 style conflict markers' - -. ./test-lib.sh - -# Setup: -# L1 -# \ -# ? -# / -# R1 -# -# Where: -# L1 and R1 both have a file named 'content' but have no common history -# - -test_expect_success 'setup no merge base' ' - test_create_repo no_merge_base && - ( - cd no_merge_base && - - git checkout -b L && - test_commit A content A && - - git checkout --orphan R && - test_commit B content B - ) -' - -test_expect_success 'check no merge base' ' - ( - cd no_merge_base && - - git checkout L^0 && - - test_must_fail git -c merge.conflictstyle=diff3 merge --allow-unrelated-histories -s recursive R^0 && - - grep "|||||| empty tree" content - ) -' - -# Setup: -# L1 -# / \ -# master ? -# \ / -# R1 -# -# Where: -# L1 and R1 have modified the same file ('content') in conflicting ways -# - -test_expect_success 'setup unique merge base' ' - test_create_repo unique_merge_base && - ( - cd unique_merge_base && - - test_commit base content "1 -2 -3 -4 -5 -" && - - git branch L && - git branch R && - - git checkout L && - test_commit L content "1 -2 -3 -4 -5 -7" && - - git checkout R && - git rm content && - test_commit R renamed "1 -2 -3 -4 -5 -six" - ) -' - -test_expect_success 'check unique merge base' ' - ( - cd unique_merge_base && - - git checkout L^0 && - MASTER=$(git rev-parse --short master) && - - test_must_fail git -c merge.conflictstyle=diff3 merge -s recursive R^0 && - - grep "|||||| $MASTER:content" renamed - ) -' - -# Setup: -# L1---L2--L3 -# / \ / \ -# master X1 ? -# \ / \ / -# R1---R2--R3 -# -# Where: -# commits L1 and R1 have modified the same file in non-conflicting ways -# X1 is an auto-generated merge-base used when merging L1 and R1 -# commits L2 and R2 are merges of R1 and L1 into L1 and R1, respectively -# commits L3 and R3 both modify 'content' in conflicting ways -# - -test_expect_success 'setup multiple merge bases' ' - test_create_repo multiple_merge_bases && - ( - cd multiple_merge_bases && - - test_commit initial content "1 -2 -3 -4 -5" && - - git branch L && - git branch R && - - # Create L1 - git checkout L && - test_commit L1 content "0 -1 -2 -3 -4 -5" && - - # Create R1 - git checkout R && - test_commit R1 content "1 -2 -3 -4 -5 -6" && - - # Create L2 - git checkout L && - git merge R1 && - - # Create R2 - git checkout R && - git merge L1 && - - # Create L3 - git checkout L && - test_commit L3 content "0 -1 -2 -3 -4 -5 -A" && - - # Create R3 - git checkout R && - git rm content && - test_commit R3 renamed "0 -2 -3 -4 -5 -six" - ) -' - -test_expect_success 'check multiple merge bases' ' - ( - cd multiple_merge_bases && - - git checkout L^0 && - - test_must_fail git -c merge.conflictstyle=diff3 merge -s recursive R^0 && - - grep "|||||| merged common ancestors:content" renamed - ) -' - -test_expect_success 'rebase --merge describes parent of commit being picked' ' - test_create_repo rebase && - ( - cd rebase && - test_commit base file && - test_commit master file && - git checkout -b side HEAD^ && - test_commit side file && - test_must_fail git -c merge.conflictstyle=diff3 rebase --merge master && - grep "||||||| parent of" file - ) -' - -test_expect_success 'rebase --apply describes fake ancestor base' ' - ( - cd rebase && - git rebase --abort && - test_must_fail git -c merge.conflictstyle=diff3 rebase --apply master && - grep "||||||| constructed merge base" file - ) -' - -test_done diff --git a/third_party/git/t/t6102-rev-list-unexpected-objects.sh b/third_party/git/t/t6102-rev-list-unexpected-objects.sh index 52cde097dd5c..28611c978e6c 100755 --- a/third_party/git/t/t6102-rev-list-unexpected-objects.sh +++ b/third_party/git/t/t6102-rev-list-unexpected-objects.sh @@ -52,7 +52,7 @@ test_expect_success 'traverse unexpected non-commit parent (lone)' ' ' test_expect_success 'traverse unexpected non-commit parent (seen)' ' - test_must_fail git rev-list --objects $blob $broken_commit \ + test_must_fail git rev-list --objects $commit $broken_commit \ >output 2>&1 && test_i18ngrep "not a commit" output ' diff --git a/third_party/git/t/t6112-rev-list-filters-objects.sh b/third_party/git/t/t6112-rev-list-filters-objects.sh index de0e5a5d3646..acd7f5ab80d9 100755 --- a/third_party/git/t/t6112-rev-list-filters-objects.sh +++ b/third_party/git/t/t6112-rev-list-filters-objects.sh @@ -278,19 +278,7 @@ test_expect_success 'verify skipping tree iteration when not collecting omits' ' test_line_count = 2 actual && # Make sure no other trees were considered besides the root. - ! grep "Skipping contents of tree [^.]" filter_trace && - - # Try this again with "combine:". If both sub-filters are skipping - # trees, the composite filter should also skip trees. This is not - # important unless the user does combine:tree:X+tree:Y or another filter - # besides "tree:" is implemented in the future which can skip trees. - GIT_TRACE=1 git -C r3 rev-list \ - --objects --filter=combine:tree:1+tree:3 HEAD 2>filter_trace && - - # Only skip the dir1/ tree, which is shared between the two commits. - grep "Skipping contents of tree " filter_trace >actual && - test_write_lines "Skipping contents of tree dir1/..." >expected && - test_cmp expected actual + ! grep "Skipping contents of tree [^.]" filter_trace ' # Test tree:# filters. @@ -342,148 +330,6 @@ test_expect_success 'verify tree:3 includes everything expected' ' test_line_count = 10 actual ' -test_expect_success 'combine:... for a simple combination' ' - git -C r3 rev-list --objects --filter=combine:tree:2+blob:none HEAD \ - >actual && - - expect_has HEAD "" && - expect_has HEAD~1 "" && - expect_has HEAD dir1 && - - # There are also 2 commit objects - test_line_count = 5 actual && - - cp actual expected && - - # Try again using repeated --filter - this is equivalent to a manual - # combine with "combine:...+..." - git -C r3 rev-list --objects --filter=combine:tree:2 \ - --filter=blob:none HEAD >actual && - - test_cmp expected actual -' - -test_expect_success 'combine:... with URL encoding' ' - git -C r3 rev-list --objects \ - --filter=combine:tree%3a2+blob:%6Eon%65 HEAD >actual && - - expect_has HEAD "" && - expect_has HEAD~1 "" && - expect_has HEAD dir1 && - - # There are also 2 commit objects - test_line_count = 5 actual -' - -expect_invalid_filter_spec () { - spec="$1" && - err="$2" && - - test_must_fail git -C r3 rev-list --objects --filter="$spec" HEAD \ - >actual 2>actual_stderr && - test_must_be_empty actual && - test_i18ngrep "$err" actual_stderr -} - -test_expect_success 'combine:... while URL-encoding things that should not be' ' - expect_invalid_filter_spec combine%3Atree:2+blob:none \ - "invalid filter-spec" -' - -test_expect_success 'combine: with nothing after the :' ' - expect_invalid_filter_spec combine: "expected something after combine:" -' - -test_expect_success 'parse error in first sub-filter in combine:' ' - expect_invalid_filter_spec combine:tree:asdf+blob:none \ - "expected .tree:." -' - -test_expect_success 'combine:... with non-encoded reserved chars' ' - expect_invalid_filter_spec combine:tree:2+sparse:@xyz \ - "must escape char in sub-filter-spec: .@." && - expect_invalid_filter_spec combine:tree:2+sparse:\` \ - "must escape char in sub-filter-spec: .\`." && - expect_invalid_filter_spec combine:tree:2+sparse:~abc \ - "must escape char in sub-filter-spec: .\~." -' - -test_expect_success 'validate err msg for "combine:+"' ' - expect_invalid_filter_spec combine:tree:2+ "expected .tree:." -' - -test_expect_success 'combine:... with edge-case hex digits: Ff Aa 0 9' ' - git -C r3 rev-list --objects --filter="combine:tree:2+bl%6Fb:n%6fne" \ - HEAD >actual && - test_line_count = 5 actual && - git -C r3 rev-list --objects --filter="combine:tree%3A2+blob%3anone" \ - HEAD >actual && - test_line_count = 5 actual && - git -C r3 rev-list --objects --filter="combine:tree:%30" HEAD >actual && - test_line_count = 2 actual && - git -C r3 rev-list --objects --filter="combine:tree:%39+blob:none" \ - HEAD >actual && - test_line_count = 5 actual -' - -test_expect_success 'add sparse pattern blobs whose paths have reserved chars' ' - cp r3/pattern r3/pattern1+renamed% && - cp r3/pattern "r3/p;at%ter+n" && - cp r3/pattern r3/^~pattern && - git -C r3 add pattern1+renamed% "p;at%ter+n" ^~pattern && - git -C r3 commit -m "add sparse pattern files with reserved chars" -' - -test_expect_success 'combine:... with more than two sub-filters' ' - git -C r3 rev-list --objects \ - --filter=combine:tree:3+blob:limit=40+sparse:oid=master:pattern \ - HEAD >actual && - - expect_has HEAD "" && - expect_has HEAD~1 "" && - expect_has HEAD~2 "" && - expect_has HEAD dir1 && - expect_has HEAD dir1/sparse1 && - expect_has HEAD dir1/sparse2 && - - # Should also have 3 commits - test_line_count = 9 actual && - - # Try again, this time making sure the last sub-filter is only - # URL-decoded once. - cp actual expect && - - git -C r3 rev-list --objects \ - --filter=combine:tree:3+blob:limit=40+sparse:oid=master:pattern1%2brenamed%25 \ - HEAD >actual && - test_cmp expect actual && - - # Use the same composite filter again, but with a pattern file name that - # requires encoding multiple characters, and use implicit filter - # combining. - test_when_finished "rm -f trace1" && - GIT_TRACE=$(pwd)/trace1 git -C r3 rev-list --objects \ - --filter=tree:3 --filter=blob:limit=40 \ - --filter=sparse:oid="master:p;at%ter+n" \ - HEAD >actual && - - test_cmp expect actual && - grep "Add to combine filter-spec: sparse:oid=master:p%3bat%25ter%2bn" \ - trace1 && - - # Repeat the above test, but this time, the characters to encode are in - # the LHS of the combined filter. - test_when_finished "rm -f trace2" && - GIT_TRACE=$(pwd)/trace2 git -C r3 rev-list --objects \ - --filter=sparse:oid=master:^~pattern \ - --filter=tree:3 --filter=blob:limit=40 \ - HEAD >actual && - - test_cmp expect actual && - grep "Add to combine filter-spec: sparse:oid=master:%5e%7epattern" \ - trace2 -' - # Test provisional omit collection logic with a repo that has objects appearing # at multiple depths - first deeper than the filter's threshold, then shallow. @@ -527,37 +373,6 @@ test_expect_success 'verify skipping tree iteration when collecting omits' ' test_cmp expect actual ' -test_expect_success 'setup r5' ' - git init r5 && - mkdir -p r5/subdir && - - echo 1 >r5/short-root && - echo 12345 >r5/long-root && - echo a >r5/subdir/short-subdir && - echo abcde >r5/subdir/long-subdir && - - git -C r5 add short-root long-root subdir && - git -C r5 commit -m "commit msg" -' - -test_expect_success 'verify collecting omits in combined: filter' ' - # Note that this test guards against the naive implementation of simply - # giving both filters the same "omits" set and expecting it to - # automatically merge them. - git -C r5 rev-list --objects --quiet --filter-print-omitted \ - --filter=combine:tree:2+blob:limit=3 HEAD >actual && - - # Expect 0 trees/commits, 3 blobs omitted (all blobs except short-root) - omitted_1=$(echo 12345 | git hash-object --stdin) && - omitted_2=$(echo a | git hash-object --stdin) && - omitted_3=$(echo abcde | git hash-object --stdin) && - - grep ~$omitted_1 actual && - grep ~$omitted_2 actual && - grep ~$omitted_3 actual && - test_line_count = 3 actual -' - # Test tree: where a tree is iterated to twice - once where a subentry is # too deep to be included, and again where the blob inside it is shallow enough # to be included. This makes sure we don't use LOFR_MARK_SEEN incorrectly (we @@ -626,4 +441,11 @@ test_expect_success 'expand blob limit in protocol' ' grep "blob:limit=1024" trace ' +test_expect_success 'expand tree depth limit in protocol' ' + GIT_TRACE_PACKET="$(pwd)/tree_trace" git -c protocol.version=2 clone \ + --filter=tree:0k "file://$(pwd)/r2" tree && + ! grep "tree:0k" tree_trace && + grep "tree:0" tree_trace +' + test_done diff --git a/third_party/git/t/t6113-rev-list-bitmap-filters.sh b/third_party/git/t/t6113-rev-list-bitmap-filters.sh deleted file mode 100755 index 145603f12457..000000000000 --- a/third_party/git/t/t6113-rev-list-bitmap-filters.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -test_description='rev-list combining bitmaps and filters' -. ./test-lib.sh - -test_expect_success 'set up bitmapped repo' ' - # one commit will have bitmaps, the other will not - test_commit one && - test_commit much-larger-blob-one && - git repack -adb && - test_commit two && - test_commit much-larger-blob-two -' - -test_expect_success 'filters fallback to non-bitmap traversal' ' - # use a path-based filter, since they are inherently incompatible with - # bitmaps (i.e., this test will never get confused by later code to - # combine the features) - filter=$(echo "!one" | git hash-object -w --stdin) && - git rev-list --objects --filter=sparse:oid=$filter HEAD >expect && - git rev-list --use-bitmap-index \ - --objects --filter=sparse:oid=$filter HEAD >actual && - test_cmp expect actual -' - -test_expect_success 'blob:none filter' ' - git rev-list --objects --filter=blob:none HEAD >expect && - git rev-list --use-bitmap-index \ - --objects --filter=blob:none HEAD >actual && - test_bitmap_traversal expect actual -' - -test_expect_success 'blob:none filter with specified blob' ' - git rev-list --objects --filter=blob:none HEAD HEAD:two.t >expect && - git rev-list --use-bitmap-index \ - --objects --filter=blob:none HEAD HEAD:two.t >actual && - test_bitmap_traversal expect actual -' - -test_expect_success 'blob:limit filter' ' - git rev-list --objects --filter=blob:limit=5 HEAD >expect && - git rev-list --use-bitmap-index \ - --objects --filter=blob:limit=5 HEAD >actual && - test_bitmap_traversal expect actual -' - -test_expect_success 'blob:limit filter with specified blob' ' - git rev-list --objects --filter=blob:limit=5 \ - HEAD HEAD:much-larger-blob-two.t >expect && - git rev-list --use-bitmap-index \ - --objects --filter=blob:limit=5 \ - HEAD HEAD:much-larger-blob-two.t >actual && - test_bitmap_traversal expect actual -' - -test_done diff --git a/third_party/git/t/t6120-describe.sh b/third_party/git/t/t6120-describe.sh index 34502e3a5054..2b883d817403 100755 --- a/third_party/git/t/t6120-describe.sh +++ b/third_party/git/t/t6120-describe.sh @@ -1,27 +1,28 @@ #!/bin/sh -test_description='test describe' - -# o---o-----o----o----o-------o----x -# \ D,R e / -# \---o-------------o-' -# \ B / -# `-o----o----o-' -# A c -# -# First parent of a merge commit is on the same line, second parent below. +test_description='test describe + B + .--------------o----o----o----x + / / / + o----o----o----o----o----. / + \ A c / + .------------o---o---o + D,R e +' . ./test-lib.sh check_describe () { expect="$1" shift - describe_opts="$@" - test_expect_success "describe $describe_opts" ' - R=$(git describe $describe_opts 2>err.actual) && + R=$(git describe "$@" 2>err.actual) + S=$? + cat err.actual >&3 + test_expect_success "describe $*" ' + test $S = 0 && case "$R" in $expect) echo happy ;; - *) echo "Oops - $R is not $expect" && + *) echo "Oops - $R is not $expect"; false ;; esac ' @@ -381,7 +382,7 @@ test_expect_success 'describe tag object' ' test_i18ngrep "fatal: test-blob-1 is neither a commit nor blob" actual ' -test_expect_success ULIMIT_STACK_SIZE 'name-rev works in a deep repo' ' +test_expect_failure ULIMIT_STACK_SIZE 'name-rev works in a deep repo' ' i=1 && while test $i -lt 8000 do @@ -423,111 +424,4 @@ test_expect_success 'describe complains about missing object' ' test_must_fail git describe $ZERO_OID ' -test_expect_success 'name-rev a rev shortly after epoch' ' - test_when_finished "git checkout master" && - - git checkout --orphan no-timestamp-underflow && - # Any date closer to epoch than the CUTOFF_DATE_SLOP constant - # in builtin/name-rev.c. - GIT_COMMITTER_DATE="@1234 +0000" \ - git commit -m "committer date shortly after epoch" && - old_commit_oid=$(git rev-parse HEAD) && - - echo "$old_commit_oid no-timestamp-underflow" >expect && - git name-rev $old_commit_oid >actual && - test_cmp expect actual -' - -# A--------------master -# \ / -# \----------M2 -# \ / -# \---M1-C -# \ / -# B -test_expect_success 'name-rev covers all conditions while looking at parents' ' - git init repo && - ( - cd repo && - - echo A >file && - git add file && - git commit -m A && - A=$(git rev-parse HEAD) && - - git checkout --detach && - echo B >file && - git commit -m B file && - B=$(git rev-parse HEAD) && - - git checkout $A && - git merge --no-ff $B && # M1 - - echo C >file && - git commit -m C file && - - git checkout $A && - git merge --no-ff HEAD@{1} && # M2 - - git checkout master && - git merge --no-ff HEAD@{1} && - - echo "$B master^2^2~1^2" >expect && - git name-rev $B >actual && - - test_cmp expect actual - ) -' - -# B -# o -# \ -# o-----o---o----x -# A -# -test_expect_success 'describe commits with disjoint bases' ' - git init disjoint1 && - ( - cd disjoint1 && - - echo o >> file && git add file && git commit -m o && - echo A >> file && git add file && git commit -m A && - git tag A -a -m A && - echo o >> file && git add file && git commit -m o && - - git checkout --orphan branch && rm file && - echo B > file2 && git add file2 && git commit -m B && - git tag B -a -m B && - git merge --no-ff --allow-unrelated-histories master -m x && - - check_describe "A-3-*" HEAD - ) -' - -# B -# o---o---o------------. -# \ -# o---o---x -# A -# -test_expect_success 'describe commits with disjoint bases 2' ' - git init disjoint2 && - ( - cd disjoint2 && - - echo A >> file && git add file && GIT_COMMITTER_DATE="2020-01-01 18:00" git commit -m A && - git tag A -a -m A && - echo o >> file && git add file && GIT_COMMITTER_DATE="2020-01-01 18:01" git commit -m o && - - git checkout --orphan branch && - echo o >> file2 && git add file2 && GIT_COMMITTER_DATE="2020-01-01 15:00" git commit -m o && - echo o >> file2 && git add file2 && GIT_COMMITTER_DATE="2020-01-01 15:01" git commit -m o && - echo B >> file2 && git add file2 && GIT_COMMITTER_DATE="2020-01-01 15:02" git commit -m B && - git tag B -a -m B && - git merge --no-ff --allow-unrelated-histories master -m x && - - check_describe "B-3-*" HEAD - ) -' - test_done diff --git a/third_party/git/t/t6130-pathspec-noglob.sh b/third_party/git/t/t6130-pathspec-noglob.sh index ba7902c9cdcd..37760233a560 100755 --- a/third_party/git/t/t6130-pathspec-noglob.sh +++ b/third_party/git/t/t6130-pathspec-noglob.sh @@ -10,7 +10,6 @@ test_expect_success 'create commits with glob characters' ' # the name "f*" in the worktree, because it is not allowed # on Windows (the tests below do not depend on the presence # of the file in the worktree) - git config core.protectNTFS false && git update-index --add --cacheinfo 100644 "$(git rev-parse HEAD:foo)" "f*" && test_tick && git commit -m star && diff --git a/third_party/git/t/t6136-pathspec-in-bare.sh b/third_party/git/t/t6136-pathspec-in-bare.sh deleted file mode 100755 index b117251366dd..000000000000 --- a/third_party/git/t/t6136-pathspec-in-bare.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -test_description='diagnosing out-of-scope pathspec' - -. ./test-lib.sh - -test_expect_success 'setup a bare and non-bare repository' ' - test_commit file1 && - git clone --bare . bare -' - -test_expect_success 'log and ls-files in a bare repository' ' - ( - cd bare && - test_must_fail git log -- .. >out 2>err && - test_must_be_empty out && - test_i18ngrep "outside repository" err && - - test_must_fail git ls-files -- .. >out 2>err && - test_must_be_empty out && - test_i18ngrep "outside repository" err - ) -' - -test_expect_success 'log and ls-files in .git directory' ' - ( - cd .git && - test_must_fail git log -- .. >out 2>err && - test_must_be_empty out && - test_i18ngrep "outside repository" err && - - test_must_fail git ls-files -- .. >out 2>err && - test_must_be_empty out && - test_i18ngrep "outside repository" err - ) -' - -test_done diff --git a/third_party/git/t/t6300-for-each-ref.sh b/third_party/git/t/t6300-for-each-ref.sh index 9c910ce74673..ab69aa176d14 100755 --- a/third_party/git/t/t6300-for-each-ref.sh +++ b/third_party/git/t/t6300-for-each-ref.sh @@ -526,25 +526,6 @@ test_expect_success 'Check ambiguous head and tag refs II (loose)' ' test_cmp expected actual ' -test_expect_success 'create tag without tagger' ' - git tag -a -m "Broken tag" taggerless && - git tag -f taggerless $(git cat-file tag taggerless | - sed -e "/^tagger /d" | - git hash-object --stdin -w -t tag) -' - -test_atom refs/tags/taggerless type 'commit' -test_atom refs/tags/taggerless tag 'taggerless' -test_atom refs/tags/taggerless tagger '' -test_atom refs/tags/taggerless taggername '' -test_atom refs/tags/taggerless taggeremail '' -test_atom refs/tags/taggerless taggerdate '' -test_atom refs/tags/taggerless committer '' -test_atom refs/tags/taggerless committername '' -test_atom refs/tags/taggerless committeremail '' -test_atom refs/tags/taggerless committerdate '' -test_atom refs/tags/taggerless subject 'Broken tag' - test_expect_success 'an unusual tag with an incomplete line' ' git tag -m "bogo" bogo && diff --git a/third_party/git/t/t6500-gc.sh b/third_party/git/t/t6500-gc.sh index 0a69a6711768..c0f04dc6b0e1 100755 --- a/third_party/git/t/t6500-gc.sh +++ b/third_party/git/t/t6500-gc.sh @@ -103,14 +103,14 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre ' test_expect_success 'gc --no-quiet' ' - GIT_PROGRESS_DELAY=0 git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr && + git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr && test_must_be_empty stdout && + test_line_count = 1 stderr && test_i18ngrep "Computing commit graph generation numbers" stderr ' test_expect_success TTY 'with TTY: gc --no-quiet' ' - test_terminal env GIT_PROGRESS_DELAY=0 \ - git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr && + test_terminal git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr && test_must_be_empty stdout && test_i18ngrep "Enumerating objects" stderr && test_i18ngrep "Computing commit graph generation numbers" stderr diff --git a/third_party/git/t/t6501-freshen-objects.sh b/third_party/git/t/t6501-freshen-objects.sh index f30b4849b64e..033871ee5f35 100755 --- a/third_party/git/t/t6501-freshen-objects.sh +++ b/third_party/git/t/t6501-freshen-objects.sh @@ -137,7 +137,7 @@ test_expect_success 'do not complain about existing broken links (commit)' ' some message EOF commit=$(git hash-object -t commit -w broken-commit) && - git gc -q 2>stderr && + git gc 2>stderr && verbose git cat-file -e $commit && test_must_be_empty stderr ' @@ -147,7 +147,7 @@ test_expect_success 'do not complain about existing broken links (tree)' ' 100644 blob 0000000000000000000000000000000000000003 foo EOF tree=$(git mktree --missing stderr && + git gc 2>stderr && git cat-file -e $tree && test_must_be_empty stderr ' @@ -162,7 +162,7 @@ test_expect_success 'do not complain about existing broken links (tag)' ' this is a broken tag EOF tag=$(git hash-object -t tag -w broken-tag) && - git gc -q 2>stderr && + git gc 2>stderr && git cat-file -e $tag && test_must_be_empty stderr ' diff --git a/third_party/git/t/t7004-tag.sh b/third_party/git/t/t7004-tag.sh index 6db92bd3ba62..80eb13d94e2a 100755 --- a/third_party/git/t/t7004-tag.sh +++ b/third_party/git/t/t7004-tag.sh @@ -227,10 +227,10 @@ test_expect_success \ test_expect_success \ 'trying to delete two tags, existing and not, should fail in the 2nd' ' tag_exists mytag && - ! tag_exists nonexistingtag && - test_must_fail git tag -d mytag nonexistingtag && + ! tag_exists myhead && + test_must_fail git tag -d mytag anothertag && ! tag_exists mytag && - ! tag_exists nonexistingtag + ! tag_exists myhead ' test_expect_success 'trying to delete an already deleted tag should fail' \ @@ -517,6 +517,7 @@ test_expect_success \ test_expect_success \ 'trying to create tags giving both -m or -F options should fail' ' echo "message file 1" >msgfile1 && + echo "message file 2" >msgfile2 && ! tag_exists msgtag && test_must_fail git tag -m "message 1" -F msgfile1 msgtag && ! tag_exists msgtag && @@ -1419,7 +1420,7 @@ test_expect_success \ get_tag_header reuse $commit commit $time >expect echo "An annotation to be reused" >> expect test_expect_success \ - 'overwriting an annotated tag should use its previous body' ' + 'overwriting an annoted tag should use its previous body' ' git tag -a -m "An annotation to be reused" reuse && GIT_EDITOR=true git tag -f -a reuse && get_tag_msg reuse >actual && diff --git a/third_party/git/t/t7008-filter-branch-null-sha1.sh b/third_party/git/t/t7008-filter-branch-null-sha1.sh deleted file mode 100755 index 9ba9f24ad2fb..000000000000 --- a/third_party/git/t/t7008-filter-branch-null-sha1.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh - -test_description='filter-branch removal of trees with null sha1' -. ./test-lib.sh - -test_expect_success 'setup: base commits' ' - test_commit one && - test_commit two && - test_commit three -' - -test_expect_success 'setup: a commit with a bogus null sha1 in the tree' ' - { - git ls-tree HEAD && - printf "160000 commit $ZERO_OID\\tbroken\\n" - } >broken-tree && - echo "add broken entry" >msg && - - tree=$(git mktree expect && - git filter-branch \ - --force --prune-empty \ - --index-filter "git rm --cached --ignore-unmatch broken" && - git log -1 --format=%s >actual && - test_cmp expect actual -' - -test_done diff --git a/third_party/git/t/t7008-grep-binary.sh b/third_party/git/t/t7008-grep-binary.sh new file mode 100755 index 000000000000..2d87c49b7539 --- /dev/null +++ b/third_party/git/t/t7008-grep-binary.sh @@ -0,0 +1,249 @@ +#!/bin/sh + +test_description='git grep in binary files' + +. ./test-lib.sh + +nul_match () { + matches=$1 + flags=$2 + pattern=$3 + pattern_human=$(echo "$pattern" | sed 's/Q//g') + + if test "$matches" = 1 + then + test_expect_success "git grep -f f $flags '$pattern_human' a" " + printf '$pattern' | q_to_nul >f && + git grep -f f $flags a + " + elif test "$matches" = 0 + then + test_expect_success "git grep -f f $flags '$pattern_human' a" " + printf '$pattern' | q_to_nul >f && + test_must_fail git grep -f f $flags a + " + elif test "$matches" = T1 + then + test_expect_failure "git grep -f f $flags '$pattern_human' a" " + printf '$pattern' | q_to_nul >f && + git grep -f f $flags a + " + elif test "$matches" = T0 + then + test_expect_failure "git grep -f f $flags '$pattern_human' a" " + printf '$pattern' | q_to_nul >f && + test_must_fail git grep -f f $flags a + " + else + test_expect_success "PANIC: Test framework error. Unknown matches value $matches" 'false' + fi +} + +test_expect_success 'setup' " + echo 'binaryQfileQm[*]cQ*æQð' | q_to_nul >a && + git add a && + git commit -m. +" + +test_expect_success 'git grep ina a' ' + echo Binary file a matches >expect && + git grep ina a >actual && + test_cmp expect actual +' + +test_expect_success 'git grep -ah ina a' ' + git grep -ah ina a >actual && + test_cmp a actual +' + +test_expect_success 'git grep -I ina a' ' + test_must_fail git grep -I ina a >actual && + test_must_be_empty actual +' + +test_expect_success 'git grep -c ina a' ' + echo a:1 >expect && + git grep -c ina a >actual && + test_cmp expect actual +' + +test_expect_success 'git grep -l ina a' ' + echo a >expect && + git grep -l ina a >actual && + test_cmp expect actual +' + +test_expect_success 'git grep -L bar a' ' + echo a >expect && + git grep -L bar a >actual && + test_cmp expect actual +' + +test_expect_success 'git grep -q ina a' ' + git grep -q ina a >actual && + test_must_be_empty actual +' + +test_expect_success 'git grep -F ile a' ' + git grep -F ile a +' + +test_expect_success 'git grep -Fi iLE a' ' + git grep -Fi iLE a +' + +# This test actually passes on platforms where regexec() supports the +# flag REG_STARTEND. +test_expect_success 'git grep ile a' ' + git grep ile a +' + +test_expect_failure 'git grep .fi a' ' + git grep .fi a +' + +nul_match 1 '-F' 'yQf' +nul_match 0 '-F' 'yQx' +nul_match 1 '-Fi' 'YQf' +nul_match 0 '-Fi' 'YQx' +nul_match 1 '' 'yQf' +nul_match 0 '' 'yQx' +nul_match 1 '' 'æQð' +nul_match 1 '-F' 'eQm[*]c' +nul_match 1 '-Fi' 'EQM[*]C' + +# Regex patterns that would match but shouldn't with -F +nul_match 0 '-F' 'yQ[f]' +nul_match 0 '-F' '[y]Qf' +nul_match 0 '-Fi' 'YQ[F]' +nul_match 0 '-Fi' '[Y]QF' +nul_match 0 '-F' 'æQ[ð]' +nul_match 0 '-F' '[æ]Qð' +nul_match 0 '-Fi' 'ÆQ[Ð]' +nul_match 0 '-Fi' '[Æ]QÐ' + +# kwset is disabled on -i & non-ASCII. No way to match non-ASCII \0 +# patterns case-insensitively. +nul_match T1 '-i' 'ÆQÐ' + +# \0 implicitly disables regexes. This is an undocumented internal +# limitation. +nul_match T1 '' 'yQ[f]' +nul_match T1 '' '[y]Qf' +nul_match T1 '-i' 'YQ[F]' +nul_match T1 '-i' '[Y]Qf' +nul_match T1 '' 'æQ[ð]' +nul_match T1 '' '[æ]Qð' +nul_match T1 '-i' 'ÆQ[Ð]' + +# ... because of \0 implicitly disabling regexes regexes that +# should/shouldn't match don't do the right thing. +nul_match T1 '' 'eQm.*cQ' +nul_match T1 '-i' 'EQM.*cQ' +nul_match T0 '' 'eQm[*]c' +nul_match T0 '-i' 'EQM[*]C' + +# Due to the REG_STARTEND extension when kwset() is disabled on -i & +# non-ASCII the string will be matched in its entirety, but the +# pattern will be cut off at the first \0. +nul_match 0 '-i' 'NOMATCHQð' +nul_match T0 '-i' '[Æ]QNOMATCH' +nul_match T0 '-i' '[æ]QNOMATCH' +# Matches, but for the wrong reasons, just stops at [æ] +nul_match 1 '-i' '[Æ]Qð' +nul_match 1 '-i' '[æ]Qð' + +# Ensure that the matcher doesn't regress to something that stops at +# \0 +nul_match 0 '-F' 'yQ[f]' +nul_match 0 '-Fi' 'YQ[F]' +nul_match 0 '' 'yQNOMATCH' +nul_match 0 '' 'QNOMATCH' +nul_match 0 '-i' 'YQNOMATCH' +nul_match 0 '-i' 'QNOMATCH' +nul_match 0 '-F' 'æQ[ð]' +nul_match 0 '-Fi' 'ÆQ[Ð]' +nul_match 0 '' 'yQNÓMATCH' +nul_match 0 '' 'QNÓMATCH' +nul_match 0 '-i' 'YQNÓMATCH' +nul_match 0 '-i' 'QNÓMATCH' + +test_expect_success 'grep respects binary diff attribute' ' + echo text >t && + git add t && + echo t:text >expect && + git grep text t >actual && + test_cmp expect actual && + echo "t -diff" >.gitattributes && + echo "Binary file t matches" >expect && + git grep text t >actual && + test_cmp expect actual +' + +test_expect_success 'grep --cached respects binary diff attribute' ' + git grep --cached text t >actual && + test_cmp expect actual +' + +test_expect_success 'grep --cached respects binary diff attribute (2)' ' + git add .gitattributes && + rm .gitattributes && + git grep --cached text t >actual && + test_when_finished "git rm --cached .gitattributes" && + test_when_finished "git checkout .gitattributes" && + test_cmp expect actual +' + +test_expect_success 'grep revision respects binary diff attribute' ' + git commit -m new && + echo "Binary file HEAD:t matches" >expect && + git grep text HEAD -- t >actual && + test_when_finished "git reset HEAD^" && + test_cmp expect actual +' + +test_expect_success 'grep respects not-binary diff attribute' ' + echo binQary | q_to_nul >b && + git add b && + echo "Binary file b matches" >expect && + git grep bin b >actual && + test_cmp expect actual && + echo "b diff" >.gitattributes && + echo "b:binQary" >expect && + git grep bin b >actual.raw && + nul_to_q actual && + test_cmp expect actual +' + +cat >nul_to_q_textconv <<'EOF' +#!/bin/sh +"$PERL_PATH" -pe 'y/\000/Q/' < "$1" +EOF +chmod +x nul_to_q_textconv + +test_expect_success 'setup textconv filters' ' + echo a diff=foo >.gitattributes && + git config diff.foo.textconv "\"$(pwd)\""/nul_to_q_textconv +' + +test_expect_success 'grep does not honor textconv' ' + test_must_fail git grep Qfile +' + +test_expect_success 'grep --textconv honors textconv' ' + echo "a:binaryQfileQm[*]cQ*æQð" >expect && + git grep --textconv Qfile >actual && + test_cmp expect actual +' + +test_expect_success 'grep --no-textconv does not honor textconv' ' + test_must_fail git grep --no-textconv Qfile +' + +test_expect_success 'grep --textconv blob honors textconv' ' + echo "HEAD:a:binaryQfileQm[*]cQ*æQð" >expect && + git grep --textconv Qfile HEAD:a >actual && + test_cmp expect actual +' + +test_done diff --git a/third_party/git/t/t7009-filter-branch-null-sha1.sh b/third_party/git/t/t7009-filter-branch-null-sha1.sh new file mode 100755 index 000000000000..9ba9f24ad2fb --- /dev/null +++ b/third_party/git/t/t7009-filter-branch-null-sha1.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +test_description='filter-branch removal of trees with null sha1' +. ./test-lib.sh + +test_expect_success 'setup: base commits' ' + test_commit one && + test_commit two && + test_commit three +' + +test_expect_success 'setup: a commit with a bogus null sha1 in the tree' ' + { + git ls-tree HEAD && + printf "160000 commit $ZERO_OID\\tbroken\\n" + } >broken-tree && + echo "add broken entry" >msg && + + tree=$(git mktree expect && + git filter-branch \ + --force --prune-empty \ + --index-filter "git rm --cached --ignore-unmatch broken" && + git log -1 --format=%s >actual && + test_cmp expect actual +' + +test_done diff --git a/third_party/git/t/t7012-skip-worktree-writing.sh b/third_party/git/t/t7012-skip-worktree-writing.sh index 7476781979c3..9d1abe50eff6 100755 --- a/third_party/git/t/t7012-skip-worktree-writing.sh +++ b/third_party/git/t/t7012-skip-worktree-writing.sh @@ -134,21 +134,6 @@ test_expect_success 'git-clean, dirty case' ' test_i18ncmp expected result ' -test_expect_success '--ignore-skip-worktree-entries leaves worktree alone' ' - test_commit keep-me && - git update-index --skip-worktree keep-me.t && - rm keep-me.t && - - : ignoring the worktree && - git update-index --remove --ignore-skip-worktree-entries keep-me.t && - git diff-index --cached --exit-code HEAD && - - : not ignoring the worktree, a deletion is staged && - git update-index --remove keep-me.t && - test_must_fail git diff-index --cached --exit-code HEAD \ - --diff-filter=D -- keep-me.t -' - #TODO test_expect_failure 'git-apply adds file' false #TODO test_expect_failure 'git-apply updates file' false #TODO test_expect_failure 'git-apply removes file' false diff --git a/third_party/git/t/t7030-verify-tag.sh b/third_party/git/t/t7030-verify-tag.sh index 5c5bc32ccb13..041e319e79aa 100755 --- a/third_party/git/t/t7030-verify-tag.sh +++ b/third_party/git/t/t7030-verify-tag.sh @@ -44,8 +44,8 @@ test_expect_success GPG 'create signed tags' ' test_expect_success GPGSM 'create signed tags x509 ' ' test_config gpg.format x509 && test_config user.signingkey $GIT_COMMITTER_EMAIL && - echo 9 >file && test_tick && git commit -a -m "ninth gpgsm-signed" && - git tag -s -m ninth ninth-signed-x509 + echo 9 >file && test_tick && git commit -a -m "nineth gpgsm-signed" && + git tag -s -m nineth nineth-signed-x509 ' test_expect_success GPG 'verify and show signatures' ' @@ -80,34 +80,10 @@ test_expect_success GPG 'verify and show signatures' ' ' test_expect_success GPGSM 'verify and show signatures x509' ' - git verify-tag ninth-signed-x509 2>actual && + git verify-tag nineth-signed-x509 2>actual && grep "Good signature from" actual && ! grep "BAD signature from" actual && - echo ninth-signed-x509 OK -' - -test_expect_success GPGSM 'verify and show signatures x509 with low minTrustLevel' ' - test_config gpg.minTrustLevel undefined && - git verify-tag ninth-signed-x509 2>actual && - grep "Good signature from" actual && - ! grep "BAD signature from" actual && - echo ninth-signed-x509 OK -' - -test_expect_success GPGSM 'verify and show signatures x509 with matching minTrustLevel' ' - test_config gpg.minTrustLevel fully && - git verify-tag ninth-signed-x509 2>actual && - grep "Good signature from" actual && - ! grep "BAD signature from" actual && - echo ninth-signed-x509 OK -' - -test_expect_success GPGSM 'verify and show signatures x509 with high minTrustLevel' ' - test_config gpg.minTrustLevel ultimate && - test_must_fail git verify-tag ninth-signed-x509 2>actual && - grep "Good signature from" actual && - ! grep "BAD signature from" actual && - echo ninth-signed-x509 OK + echo nineth-signed-x509 OK ' test_expect_success GPG 'detect fudged signature' ' @@ -151,10 +127,10 @@ test_expect_success GPG 'verify signatures with --raw' ' ' test_expect_success GPGSM 'verify signatures with --raw x509' ' - git verify-tag --raw ninth-signed-x509 2>actual && + git verify-tag --raw nineth-signed-x509 2>actual && grep "GOODSIG" actual && ! grep "BADSIG" actual && - echo ninth-signed-x509 OK + echo nineth-signed-x509 OK ' test_expect_success GPG 'verify multiple tags' ' @@ -171,7 +147,7 @@ test_expect_success GPG 'verify multiple tags' ' ' test_expect_success GPGSM 'verify multiple tags x509' ' - tags="seventh-signed ninth-signed-x509" && + tags="seventh-signed nineth-signed-x509" && for i in $tags do git verify-tag -v --raw $i || return 1 diff --git a/third_party/git/t/t7061-wtstatus-ignore.sh b/third_party/git/t/t7061-wtstatus-ignore.sh index e4cf5484f97a..0c394cf995cb 100755 --- a/third_party/git/t/t7061-wtstatus-ignore.sh +++ b/third_party/git/t/t7061-wtstatus-ignore.sh @@ -43,16 +43,11 @@ test_expect_success 'status untracked directory with --ignored -u' ' test_cmp expected actual ' cat >expected <<\EOF -?? untracked/ +?? untracked/uncommitted !! untracked/ignored EOF -test_expect_success 'status of untracked directory with --ignored works with or without prefix' ' - git status --porcelain --ignored >tmp && - grep untracked/ tmp >actual && - rm tmp && - test_cmp expected actual && - +test_expect_success 'status prefixed untracked directory with --ignored' ' git status --porcelain --ignored untracked/ >actual && test_cmp expected actual ' diff --git a/third_party/git/t/t7105-reset-patch.sh b/third_party/git/t/t7105-reset-patch.sh index fc2a6cf5c7a4..bd10a96727c5 100755 --- a/third_party/git/t/t7105-reset-patch.sh +++ b/third_party/git/t/t7105-reset-patch.sh @@ -38,27 +38,6 @@ test_expect_success PERL 'git reset -p HEAD^' ' test_i18ngrep "Apply" output ' -test_expect_success PERL 'git reset -p HEAD^^{tree}' ' - test_write_lines n y | git reset -p HEAD^^{tree} >output && - verify_state dir/foo work parent && - verify_saved_state bar && - test_i18ngrep "Apply" output -' - -test_expect_success PERL 'git reset -p HEAD^:dir/foo (blob fails)' ' - set_and_save_state dir/foo work work && - test_must_fail git reset -p HEAD^:dir/foo && - verify_saved_state dir/foo && - verify_saved_state bar -' - -test_expect_success PERL 'git reset -p aaaaaaaa (unknown fails)' ' - set_and_save_state dir/foo work work && - test_must_fail git reset -p aaaaaaaa && - verify_saved_state dir/foo && - verify_saved_state bar -' - # The idea in the rest is that bar sorts first, so we always say 'y' # first and if the path limiter fails it'll apply to bar instead of # dir/foo. There's always an extra 'n' to reject edits to dir/foo in diff --git a/third_party/git/t/t7107-reset-pathspec-file.sh b/third_party/git/t/t7107-reset-pathspec-file.sh deleted file mode 100755 index cad3a9de9efc..000000000000 --- a/third_party/git/t/t7107-reset-pathspec-file.sh +++ /dev/null @@ -1,173 +0,0 @@ -#!/bin/sh - -test_description='reset --pathspec-from-file' - -. ./test-lib.sh - -test_tick - -test_expect_success setup ' - echo A >fileA.t && - echo B >fileB.t && - echo C >fileC.t && - echo D >fileD.t && - git add . && - git commit --include . -m "Commit" && - git tag checkpoint -' - -restore_checkpoint () { - git reset --hard checkpoint -} - -verify_expect () { - git status --porcelain -- fileA.t fileB.t fileC.t fileD.t >actual && - test_cmp expect actual -} - -test_expect_success '--pathspec-from-file from stdin' ' - restore_checkpoint && - - git rm fileA.t && - echo fileA.t | git reset --pathspec-from-file=- && - - cat >expect <<-\EOF && - D fileA.t - EOF - verify_expect -' - -test_expect_success '--pathspec-from-file from file' ' - restore_checkpoint && - - git rm fileA.t && - echo fileA.t >list && - git reset --pathspec-from-file=list && - - cat >expect <<-\EOF && - D fileA.t - EOF - verify_expect -' - -test_expect_success 'NUL delimiters' ' - restore_checkpoint && - - git rm fileA.t fileB.t && - printf "fileA.t\0fileB.t\0" | git reset --pathspec-from-file=- --pathspec-file-nul && - - cat >expect <<-\EOF && - D fileA.t - D fileB.t - EOF - verify_expect -' - -test_expect_success 'LF delimiters' ' - restore_checkpoint && - - git rm fileA.t fileB.t && - printf "fileA.t\nfileB.t\n" | git reset --pathspec-from-file=- && - - cat >expect <<-\EOF && - D fileA.t - D fileB.t - EOF - verify_expect -' - -test_expect_success 'no trailing delimiter' ' - restore_checkpoint && - - git rm fileA.t fileB.t && - printf "fileA.t\nfileB.t" | git reset --pathspec-from-file=- && - - cat >expect <<-\EOF && - D fileA.t - D fileB.t - EOF - verify_expect -' - -test_expect_success 'CRLF delimiters' ' - restore_checkpoint && - - git rm fileA.t fileB.t && - printf "fileA.t\r\nfileB.t\r\n" | git reset --pathspec-from-file=- && - - cat >expect <<-\EOF && - D fileA.t - D fileB.t - EOF - verify_expect -' - -test_expect_success 'quotes' ' - restore_checkpoint && - - cat >list <<-\EOF && - "file\101.t" - EOF - - git rm fileA.t && - git reset --pathspec-from-file=list && - - cat >expect <<-\EOF && - D fileA.t - EOF - verify_expect -' - -test_expect_success 'quotes not compatible with --pathspec-file-nul' ' - restore_checkpoint && - - cat >list <<-\EOF && - "file\101.t" - EOF - - # Note: "git reset" has not yet learned to fail on wrong pathspecs - git reset --pathspec-from-file=list --pathspec-file-nul && - - cat >expect <<-\EOF && - D fileA.t - EOF - test_must_fail verify_expect -' - -test_expect_success 'only touches what was listed' ' - restore_checkpoint && - - git rm fileA.t fileB.t fileC.t fileD.t && - printf "fileB.t\nfileC.t\n" | git reset --pathspec-from-file=- && - - cat >expect <<-\EOF && - D fileA.t - D fileB.t - D fileC.t - D fileD.t - EOF - verify_expect -' - -test_expect_success 'error conditions' ' - restore_checkpoint && - echo fileA.t >list && - git rm fileA.t && - - test_must_fail git reset --pathspec-from-file=list --patch 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with --patch" err && - - test_must_fail git reset --pathspec-from-file=list -- fileA.t 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err && - - test_must_fail git reset --pathspec-file-nul 2>err && - test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err && - - test_must_fail git reset --soft --pathspec-from-file=list 2>err && - test_i18ngrep -e "fatal: Cannot do soft reset with paths" err && - - test_must_fail git reset --hard --pathspec-from-file=list 2>err && - test_i18ngrep -e "fatal: Cannot do hard reset with paths" err -' - -test_done diff --git a/third_party/git/t/t7300-clean.sh b/third_party/git/t/t7300-clean.sh index cb5e34d94c3a..a2c45d1902ac 100755 --- a/third_party/git/t/t7300-clean.sh +++ b/third_party/git/t/t7300-clean.sh @@ -117,7 +117,6 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with relative prefix' ' would_clean=$( cd docs && git clean -n ../src | - grep part3 | sed -n -e "s|^Would remove ||p" ) && verbose test "$would_clean" = ../src/part3.c @@ -130,7 +129,6 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' ' would_clean=$( cd docs && git clean -n "$(pwd)/../src" | - grep part3 | sed -n -e "s|^Would remove ||p" ) && verbose test "$would_clean" = ../src/part3.c @@ -549,7 +547,7 @@ test_expect_failure 'nested (non-empty) bare repositories should be cleaned even test_path_is_missing strange_bare ' -test_expect_success 'giving path in nested git work tree will NOT remove it' ' +test_expect_success 'giving path in nested git work tree will remove it' ' rm -fr repo && mkdir repo && ( @@ -561,7 +559,7 @@ test_expect_success 'giving path in nested git work tree will NOT remove it' ' git clean -f -d repo/bar/baz && test_path_is_file repo/.git/HEAD && test_path_is_dir repo/bar/ && - test_path_is_file repo/bar/baz/hello.world + test_path_is_missing repo/bar/baz ' test_expect_success 'giving path to nested .git will not remove it' ' @@ -579,7 +577,7 @@ test_expect_success 'giving path to nested .git will not remove it' ' test_path_is_dir untracked/ ' -test_expect_success 'giving path to nested .git/ will NOT remove contents' ' +test_expect_success 'giving path to nested .git/ will remove contents' ' rm -fr repo untracked && mkdir repo untracked && ( @@ -589,7 +587,7 @@ test_expect_success 'giving path to nested .git/ will NOT remove contents' ' ) && git clean -f -d repo/.git/ && test_path_is_dir repo/.git && - test_path_is_file repo/.git/HEAD && + test_dir_is_empty repo/.git && test_path_is_dir untracked/ ' @@ -671,60 +669,6 @@ test_expect_success 'git clean -d skips untracked dirs containing ignored files' test_path_is_missing foo/b/bb ' -test_expect_success 'git clean -d skips nested repo containing ignored files' ' - test_when_finished "rm -rf nested-repo-with-ignored-file" && - - git init nested-repo-with-ignored-file && - ( - cd nested-repo-with-ignored-file && - >file && - git add file && - git commit -m Initial && - - # This file is ignored by a .gitignore rule in the outer repo - # added in the previous test. - >ignoreme - ) && - - git clean -fd && - - test_path_is_file nested-repo-with-ignored-file/.git/index && - test_path_is_file nested-repo-with-ignored-file/ignoreme && - test_path_is_file nested-repo-with-ignored-file/file -' - -test_expect_success 'git clean handles being told what to clean' ' - mkdir -p d1 d2 && - touch d1/ut d2/ut && - git clean -f */ut && - test_path_is_missing d1/ut && - test_path_is_missing d2/ut -' - -test_expect_success 'git clean handles being told what to clean, with -d' ' - mkdir -p d1 d2 && - touch d1/ut d2/ut && - git clean -ffd */ut && - test_path_is_missing d1/ut && - test_path_is_missing d2/ut -' - -test_expect_success 'git clean works if a glob is passed without -d' ' - mkdir -p d1 d2 && - touch d1/ut d2/ut && - git clean -f "*ut" && - test_path_is_missing d1/ut && - test_path_is_missing d2/ut -' - -test_expect_success 'git clean works if a glob is passed with -d' ' - mkdir -p d1 d2 && - touch d1/ut d2/ut && - git clean -ffd "*ut" && - test_path_is_missing d1/ut && - test_path_is_missing d2/ut -' - test_expect_success MINGW 'handle clean & core.longpaths = false nicely' ' test_config core.longpaths false && a50=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && @@ -737,13 +681,4 @@ test_expect_success MINGW 'handle clean & core.longpaths = false nicely' ' test_i18ngrep "too long" .git/err ' -test_expect_success 'clean untracked paths by pathspec' ' - git init untracked && - mkdir untracked/dir && - echo >untracked/dir/file.txt && - git -C untracked clean -f dir/file.txt && - ls untracked/dir >actual && - test_must_be_empty actual -' - test_done diff --git a/third_party/git/t/t7400-submodule-basic.sh b/third_party/git/t/t7400-submodule-basic.sh index e3e2aab3b0a1..a208cb26e1df 100755 --- a/third_party/git/t/t7400-submodule-basic.sh +++ b/third_party/git/t/t7400-submodule-basic.sh @@ -55,21 +55,6 @@ test_expect_success 'add aborts on repository with no commits' ' test_i18ncmp expect actual ' -test_expect_success 'status should ignore inner git repo when not added' ' - rm -fr inner && - mkdir inner && - ( - cd inner && - git init && - >t && - git add t && - git commit -m "initial" - ) && - test_must_fail git submodule status inner 2>output.err && - rm -fr inner && - test_i18ngrep "^error: .*did not match any file(s) known to git" output.err -' - test_expect_success 'setup - repository in init subdirectory' ' mkdir init && ( @@ -171,11 +156,9 @@ test_expect_success 'submodule add to .gitignored path fails' ' ( cd addtest-ignore && cat <<-\EOF >expect && - The following paths are ignored by one of your .gitignore files: + The following path is ignored by one of your .gitignore files: submod - hint: Use -f if you really want to add them. - hint: Turn this message off by running - hint: "git config advice.addIgnoredFile false" + Use -f if you really want to add it. EOF # Does not use test_commit due to the ignore echo "*" > .gitignore && @@ -208,17 +191,6 @@ test_expect_success 'submodule add to reconfigure existing submodule with --forc ) ' -test_expect_success 'submodule add relays add --dry-run stderr' ' - test_when_finished "rm -rf addtest/.git/index.lock" && - ( - cd addtest && - : >.git/index.lock && - ! git submodule add "$submodurl" sub-while-locked 2>output.err && - test_i18ngrep "^fatal: .*index\.lock" output.err && - test_path_is_missing sub-while-locked - ) -' - test_expect_success 'submodule add --branch' ' echo "refs/heads/initial" >expect-head && cat <<-\EOF >expect-heads && @@ -384,28 +356,6 @@ test_expect_success 'status should only print one line' ' test_line_count = 1 lines ' -test_expect_success 'status from subdirectory should have the same SHA1' ' - test_when_finished "rmdir addtest/subdir" && - ( - cd addtest && - mkdir subdir && - git submodule status >output && - awk "{print \$1}" expect && - cd subdir && - git submodule status >../output && - awk "{print \$1}" <../output >../actual && - test_cmp ../expect ../actual && - git -C ../submod checkout HEAD^ && - git submodule status >../output && - awk "{print \$1}" <../output >../actual2 && - cd .. && - git submodule status >output && - awk "{print \$1}" expect2 && - test_cmp expect2 actual2 && - ! test_cmp actual actual2 - ) -' - test_expect_success 'setup - fetch commit name from submodule' ' rev1=$(cd .subrepo && git rev-parse HEAD) && printf "rev1: %s\n" "$rev1" && @@ -427,14 +377,6 @@ test_expect_success 'init should register submodule url in .git/config' ' test_cmp expect url ' -test_expect_success 'status should still be "missing" after initializing' ' - rm -fr init && - mkdir init && - git submodule status >lines && - rm -fr init && - grep "^-$rev1" lines -' - test_failure_with_unknown_submodule () { test_must_fail git submodule $1 no-such-submodule 2>output.err && test_i18ngrep "^error: .*no-such-submodule" output.err @@ -585,6 +527,7 @@ test_expect_success 'update --init' ' test_must_fail git config submodule.example.url && git submodule update init 2> update.out && + cat update.out && test_i18ngrep "not initialized" update.out && test_must_fail git rev-parse --resolve-git-dir init/.git && @@ -602,6 +545,7 @@ test_expect_success 'update --init from subdirectory' ' ( cd sub && git submodule update ../init 2>update.out && + cat update.out && test_i18ngrep "not initialized" update.out && test_must_fail git rev-parse --resolve-git-dir ../init/.git && diff --git a/third_party/git/t/t7406-submodule-update.sh b/third_party/git/t/t7406-submodule-update.sh index 4fb447a143e6..c973278300a5 100755 --- a/third_party/git/t/t7406-submodule-update.sh +++ b/third_party/git/t/t7406-submodule-update.sh @@ -158,6 +158,7 @@ test_expect_success 'submodule update --init from and of subdirectory' ' test_i18ncmp expect2 actual2 ' +apos="'"; test_expect_success 'submodule update does not fetch already present commits' ' (cd submodule && echo line3 >> file && @@ -167,7 +168,7 @@ test_expect_success 'submodule update does not fetch already present commits' ' ) && (cd super/submodule && head=$(git rev-parse --verify HEAD) && - echo "Submodule path ${SQ}submodule$SQ: checked out $SQ$head$SQ" > ../../expected && + echo "Submodule path ${apos}submodule$apos: checked out $apos$head$apos" > ../../expected && git reset --hard HEAD~1 ) && (cd super && @@ -406,26 +407,12 @@ test_expect_success 'submodule update - command in .git/config' ' ) ' -test_expect_success 'submodule update - command in .gitmodules is rejected' ' +test_expect_success 'submodule update - command in .gitmodules is ignored' ' test_when_finished "git -C super reset --hard HEAD^" && git -C super config -f .gitmodules submodule.submodule.update "!false" && git -C super commit -a -m "add command to .gitmodules file" && git -C super/submodule reset --hard $submodulesha1^ && - test_must_fail git -C super submodule update submodule -' - -test_expect_success 'fsck detects command in .gitmodules' ' - git init command-in-gitmodules && - ( - cd command-in-gitmodules && - git submodule add ../submodule submodule && - test_commit adding-submodule && - - git config -f .gitmodules submodule.submodule.update "!false" && - git add .gitmodules && - test_commit configuring-update && - test_must_fail git fsck - ) + git -C super submodule update submodule ' cat << EOF >expect @@ -494,9 +481,6 @@ test_expect_success 'recursive submodule update - command in .git/config catches ' test_expect_success 'submodule init does not copy command into .git/config' ' - test_when_finished "git -C super update-index --force-remove submodule1" && - test_when_finished git config -f super/.gitmodules \ - --remove-section submodule.submodule1 && (cd super && git ls-files -s submodule >out && H=$(cut -d" " -f2 out) && @@ -505,9 +489,10 @@ test_expect_success 'submodule init does not copy command into .git/config' ' git config -f .gitmodules submodule.submodule1.path submodule1 && git config -f .gitmodules submodule.submodule1.url ../submodule && git config -f .gitmodules submodule.submodule1.update !false && - test_must_fail git submodule init submodule1 && - test_expect_code 1 git config submodule.submodule1.update >actual && - test_must_be_empty actual + git submodule init submodule1 && + echo "none" >expect && + git config submodule.submodule1.update >actual && + test_cmp expect actual ) ' @@ -960,7 +945,7 @@ test_expect_success 'submodule update clone shallow submodule outside of depth' mv -f .gitmodules.tmp .gitmodules && # Some protocol versions (e.g. 2) support fetching # unadvertised objects, so restrict this test to v0. - test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ git submodule update --init --depth=1 2>actual && test_i18ngrep "Direct fetching of that commit failed." actual && git -C ../submodule config uploadpack.allowReachableSHA1InWant true && diff --git a/third_party/git/t/t7410-submodule-checkout-to.sh b/third_party/git/t/t7410-submodule-checkout-to.sh new file mode 100755 index 000000000000..f1b492ebc46a --- /dev/null +++ b/third_party/git/t/t7410-submodule-checkout-to.sh @@ -0,0 +1,77 @@ +#!/bin/sh + +test_description='Combination of submodules and multiple workdirs' + +. ./test-lib.sh + +base_path=$(pwd -P) + +test_expect_success 'setup: make origin' ' + mkdir -p origin/sub && + ( + cd origin/sub && git init && + echo file1 >file1 && + git add file1 && + git commit -m file1 + ) && + mkdir -p origin/main && + ( + cd origin/main && git init && + git submodule add ../sub && + git commit -m "add sub" + ) && + ( + cd origin/sub && + echo file1updated >file1 && + git add file1 && + git commit -m "file1 updated" + ) && + git -C origin/main/sub pull && + ( + cd origin/main && + git add sub && + git commit -m "sub updated" + ) +' + +test_expect_success 'setup: clone' ' + mkdir clone && + git -C clone clone --recursive "$base_path/origin/main" +' + +rev1_hash_main=$(git --git-dir=origin/main/.git show --pretty=format:%h -q "HEAD~1") +rev1_hash_sub=$(git --git-dir=origin/sub/.git show --pretty=format:%h -q "HEAD~1") + +test_expect_success 'checkout main' ' + mkdir default_checkout && + git -C clone/main worktree add "$base_path/default_checkout/main" "$rev1_hash_main" +' + +test_expect_failure 'can see submodule diffs just after checkout' ' + git -C default_checkout/main diff --submodule master"^!" >out && + grep "file1 updated" out +' + +test_expect_success 'checkout main and initialize independent clones' ' + mkdir fully_cloned_submodule && + git -C clone/main worktree add "$base_path/fully_cloned_submodule/main" "$rev1_hash_main" && + git -C fully_cloned_submodule/main submodule update +' + +test_expect_success 'can see submodule diffs after independent cloning' ' + git -C fully_cloned_submodule/main diff --submodule master"^!" >out && + grep "file1 updated" out +' + +test_expect_success 'checkout sub manually' ' + mkdir linked_submodule && + git -C clone/main worktree add "$base_path/linked_submodule/main" "$rev1_hash_main" && + git -C clone/main/sub worktree add "$base_path/linked_submodule/main/sub" "$rev1_hash_sub" +' + +test_expect_success 'can see submodule diffs after manual checkout of linked submodule' ' + git -C linked_submodule/main diff --submodule master"^!" >out && + grep "file1 updated" out +' + +test_done diff --git a/third_party/git/t/t7415-submodule-names.sh b/third_party/git/t/t7415-submodule-names.sh index f70368bc2e9d..49a37efe9c1d 100755 --- a/third_party/git/t/t7415-submodule-names.sh +++ b/third_party/git/t/t7415-submodule-names.sh @@ -191,61 +191,4 @@ test_expect_success 'fsck detects corrupt .gitmodules' ' ) ' -test_expect_success MINGW 'prevent git~1 squatting on Windows' ' - git init squatting && - ( - cd squatting && - mkdir a && - touch a/..git && - git add a/..git && - test_tick && - git commit -m initial && - - modules="$(test_write_lines \ - "[submodule \"b.\"]" "url = ." "path = c" \ - "[submodule \"b\"]" "url = ." "path = d\\\\a" | - git hash-object -w --stdin)" && - rev="$(git rev-parse --verify HEAD)" && - hash="$(echo x | git hash-object -w --stdin)" && - test_must_fail git update-index --add \ - --cacheinfo 160000,$rev,d\\a 2>err && - test_i18ngrep "Invalid path" err && - git -c core.protectNTFS=false update-index --add \ - --cacheinfo 100644,$modules,.gitmodules \ - --cacheinfo 160000,$rev,c \ - --cacheinfo 160000,$rev,d\\a \ - --cacheinfo 100644,$hash,d./a/x \ - --cacheinfo 100644,$hash,d./a/..git && - test_tick && - git -c core.protectNTFS=false commit -m "module" - ) && - test_must_fail git -c core.protectNTFS=false \ - clone --recurse-submodules squatting squatting-clone 2>err && - test_i18ngrep -e "directory not empty" -e "not an empty directory" err && - ! grep gitdir squatting-clone/d/a/git~2 -' - -test_expect_success 'git dirs of sibling submodules must not be nested' ' - git init nested && - test_commit -C nested nested && - ( - cd nested && - cat >.gitmodules <<-EOF && - [submodule "hippo"] - url = . - path = thing1 - [submodule "hippo/hooks"] - url = . - path = thing2 - EOF - git clone . thing1 && - git clone . thing2 && - git add .gitmodules thing1 thing2 && - test_tick && - git commit -m nested - ) && - test_must_fail git clone --recurse-submodules nested clone 2>err && - test_i18ngrep "is inside git dir" err -' - test_done diff --git a/third_party/git/t/t7416-submodule-dash-url.sh b/third_party/git/t/t7416-submodule-dash-url.sh index eec96e0ba9e3..1cd2c1c1ea2d 100755 --- a/third_party/git/t/t7416-submodule-dash-url.sh +++ b/third_party/git/t/t7416-submodule-dash-url.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='check handling of disallowed .gitmodule urls' +test_description='check handling of .gitmodule url with dash' . ./test-lib.sh test_expect_success 'create submodule with protected dash in url' ' @@ -46,159 +46,4 @@ test_expect_success 'fsck rejects unprotected dash' ' grep gitmodulesUrl err ' -test_expect_success 'trailing backslash is handled correctly' ' - git init testmodule && - test_commit -C testmodule c && - git submodule add ./testmodule && - : ensure that the name ends in a double backslash && - sed -e "s|\\(submodule \"testmodule\\)\"|\\1\\\\\\\\\"|" \ - -e "s|url = .*|url = \" --should-not-be-an-option\"|" \ - <.gitmodules >.new && - mv .new .gitmodules && - git commit -am "Add testmodule" && - test_must_fail git clone --verbose --recurse-submodules . dolly 2>err && - test_i18ngrep ! "unknown option" err -' - -test_expect_success 'fsck rejects missing URL scheme' ' - git checkout --orphan missing-scheme && - cat >.gitmodules <<-\EOF && - [submodule "foo"] - url = http::one.example.com/foo.git - EOF - git add .gitmodules && - test_tick && - git commit -m "gitmodules with missing URL scheme" && - test_when_finished "rm -rf dst" && - git init --bare dst && - git -C dst config transfer.fsckObjects true && - test_must_fail git push dst HEAD 2>err && - grep gitmodulesUrl err -' - -test_expect_success 'fsck rejects relative URL resolving to missing scheme' ' - git checkout --orphan relative-missing-scheme && - cat >.gitmodules <<-\EOF && - [submodule "foo"] - url = "..\\../.\\../:one.example.com/foo.git" - EOF - git add .gitmodules && - test_tick && - git commit -m "gitmodules with relative URL that strips off scheme" && - test_when_finished "rm -rf dst" && - git init --bare dst && - git -C dst config transfer.fsckObjects true && - test_must_fail git push dst HEAD 2>err && - grep gitmodulesUrl err -' - -test_expect_success 'fsck rejects empty URL scheme' ' - git checkout --orphan empty-scheme && - cat >.gitmodules <<-\EOF && - [submodule "foo"] - url = http::://one.example.com/foo.git - EOF - git add .gitmodules && - test_tick && - git commit -m "gitmodules with empty URL scheme" && - test_when_finished "rm -rf dst" && - git init --bare dst && - git -C dst config transfer.fsckObjects true && - test_must_fail git push dst HEAD 2>err && - grep gitmodulesUrl err -' - -test_expect_success 'fsck rejects relative URL resolving to empty scheme' ' - git checkout --orphan relative-empty-scheme && - cat >.gitmodules <<-\EOF && - [submodule "foo"] - url = ../../../:://one.example.com/foo.git - EOF - git add .gitmodules && - test_tick && - git commit -m "relative gitmodules URL resolving to empty scheme" && - test_when_finished "rm -rf dst" && - git init --bare dst && - git -C dst config transfer.fsckObjects true && - test_must_fail git push dst HEAD 2>err && - grep gitmodulesUrl err -' - -test_expect_success 'fsck rejects empty hostname' ' - git checkout --orphan empty-host && - cat >.gitmodules <<-\EOF && - [submodule "foo"] - url = http:///one.example.com/foo.git - EOF - git add .gitmodules && - test_tick && - git commit -m "gitmodules with extra slashes" && - test_when_finished "rm -rf dst" && - git init --bare dst && - git -C dst config transfer.fsckObjects true && - test_must_fail git push dst HEAD 2>err && - grep gitmodulesUrl err -' - -test_expect_success 'fsck rejects relative url that produced empty hostname' ' - git checkout --orphan messy-relative && - cat >.gitmodules <<-\EOF && - [submodule "foo"] - url = ../../..//one.example.com/foo.git - EOF - git add .gitmodules && - test_tick && - git commit -m "gitmodules abusing relative_path" && - test_when_finished "rm -rf dst" && - git init --bare dst && - git -C dst config transfer.fsckObjects true && - test_must_fail git push dst HEAD 2>err && - grep gitmodulesUrl err -' - -test_expect_success 'fsck permits embedded newline with unrecognized scheme' ' - git checkout --orphan newscheme && - cat >.gitmodules <<-\EOF && - [submodule "foo"] - url = "data://acjbkd%0akajfdickajkd" - EOF - git add .gitmodules && - git commit -m "gitmodules with unrecognized scheme" && - test_when_finished "rm -rf dst" && - git init --bare dst && - git -C dst config transfer.fsckObjects true && - git push dst HEAD -' - -test_expect_success 'fsck rejects embedded newline in url' ' - # create an orphan branch to avoid existing .gitmodules objects - git checkout --orphan newline && - cat >.gitmodules <<-\EOF && - [submodule "foo"] - url = "https://one.example.com?%0ahost=two.example.com/foo.git" - EOF - git add .gitmodules && - git commit -m "gitmodules with newline" && - test_when_finished "rm -rf dst" && - git init --bare dst && - git -C dst config transfer.fsckObjects true && - test_must_fail git push dst HEAD 2>err && - grep gitmodulesUrl err -' - -test_expect_success 'fsck rejects embedded newline in relative url' ' - git checkout --orphan relative-newline && - cat >.gitmodules <<-\EOF && - [submodule "foo"] - url = "./%0ahost=two.example.com/foo.git" - EOF - git add .gitmodules && - git commit -m "relative url with newline" && - test_when_finished "rm -rf dst" && - git init --bare dst && - git -C dst config transfer.fsckObjects true && - test_must_fail git push dst HEAD 2>err && - grep gitmodulesUrl err -' - test_done diff --git a/third_party/git/t/t7417-submodule-path-url.sh b/third_party/git/t/t7417-submodule-path-url.sh index f7e7e94d7b6c..756af8c4d6fb 100755 --- a/third_party/git/t/t7417-submodule-path-url.sh +++ b/third_party/git/t/t7417-submodule-path-url.sh @@ -25,21 +25,4 @@ test_expect_success 'fsck rejects unprotected dash' ' grep gitmodulesPath err ' -test_expect_success MINGW 'submodule paths disallows trailing spaces' ' - git init super && - test_must_fail git -C super submodule add ../upstream "sub " && - - : add "sub", then rename "sub" to "sub ", the hard way && - git -C super submodule add ../upstream sub && - tree=$(git -C super write-tree) && - git -C super ls-tree $tree >tree && - sed "s/sub/sub /" tree.new && - tree=$(git -C super mktree err && - test_i18ngrep "sub " err -' - test_done diff --git a/third_party/git/t/t7419-submodule-set-branch.sh b/third_party/git/t/t7419-submodule-set-branch.sh index fd25f786a365..c4b370ea8533 100755 --- a/third_party/git/t/t7419-submodule-set-branch.sh +++ b/third_party/git/t/t7419-submodule-set-branch.sh @@ -34,7 +34,7 @@ test_expect_success 'submodule config cache setup' ' test_expect_success 'ensure submodule branch is unset' ' (cd super && - ! grep branch .gitmodules + test_must_fail grep branch .gitmodules ) ' @@ -54,7 +54,7 @@ test_expect_success 'test submodule set-branch --branch' ' test_expect_success 'test submodule set-branch --default' ' (cd super && git submodule set-branch --default submodule && - ! grep branch .gitmodules && + test_must_fail grep branch .gitmodules && git submodule update --remote && cat <<-\EOF >expect && a @@ -80,7 +80,7 @@ test_expect_success 'test submodule set-branch -b' ' test_expect_success 'test submodule set-branch -d' ' (cd super && git submodule set-branch -d submodule && - ! grep branch .gitmodules && + test_must_fail grep branch .gitmodules && git submodule update --remote && cat <<-\EOF >expect && a diff --git a/third_party/git/t/t7420-submodule-set-url.sh b/third_party/git/t/t7420-submodule-set-url.sh deleted file mode 100755 index ef0cb6e8e185..000000000000 --- a/third_party/git/t/t7420-submodule-set-url.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2019 Denton Liu -# - -test_description='Test submodules set-url subcommand - -This test verifies that the set-url subcommand of git-submodule is working -as expected. -' - -TEST_NO_CREATE_REPO=1 -. ./test-lib.sh - -test_expect_success 'submodule config cache setup' ' - mkdir submodule && - ( - cd submodule && - git init && - echo a >file && - git add file && - git commit -ma - ) && - mkdir super && - ( - cd super && - git init && - git submodule add ../submodule && - git commit -m "add submodule" - ) -' - -test_expect_success 'test submodule set-url' ' - # add a commit and move the submodule (change the url) - ( - cd submodule && - echo b >>file && - git add file && - git commit -mb - ) && - mv submodule newsubmodule && - - git -C newsubmodule show >expect && - ( - cd super && - test_must_fail git submodule update --remote && - git submodule set-url submodule ../newsubmodule && - grep -F "url = ../newsubmodule" .gitmodules && - git submodule update --remote - ) && - git -C super/submodule show >actual && - test_cmp expect actual -' - -test_done diff --git a/third_party/git/t/t7500-commit-template-squash-signoff.sh b/third_party/git/t/t7500-commit-template-squash-signoff.sh index 6d19ece05dd3..46a5cd4b7395 100755 --- a/third_party/git/t/t7500-commit-template-squash-signoff.sh +++ b/third_party/git/t/t7500-commit-template-squash-signoff.sh @@ -382,13 +382,4 @@ test_expect_success 'check commit with unstaged rename and copy' ' ) ' -test_expect_success 'commit without staging files fails and displays hints' ' - echo "initial" >file && - git add file && - git commit -m initial && - echo "changes" >>file && - test_must_fail git commit -m update >actual && - test_i18ngrep "no changes added to commit (use \"git add\" and/or \"git commit -a\")" actual -' - test_done diff --git a/third_party/git/t/t7501-commit-basic-functionality.sh b/third_party/git/t/t7501-commit-basic-functionality.sh index 110b4bf459bf..f1349af56edd 100755 --- a/third_party/git/t/t7501-commit-basic-functionality.sh +++ b/third_party/git/t/t7501-commit-basic-functionality.sh @@ -150,7 +150,7 @@ test_expect_success 'setup: commit message from file' ' test_expect_success 'amend commit' ' cat >editor <<-\EOF && #!/bin/sh - sed -e "s/a file/an amend commit/g" <"$1" >"$1-" + sed -e "s/a file/an amend commit/g" < "$1" > "$1-" mv "$1-" "$1" EOF chmod 755 editor && @@ -263,7 +263,7 @@ test_expect_success 'using message from other commit' ' test_expect_success 'editing message from other commit' ' cat >editor <<-\EOF && #!/bin/sh - sed -e "s/amend/older/g" <"$1" >"$1-" + sed -e "s/amend/older/g" < "$1" > "$1-" mv "$1-" "$1" EOF chmod 755 editor && @@ -285,8 +285,9 @@ test_expect_success 'overriding author from command line' ' ' test_expect_success PERL 'interactive add' ' - echo 7 | test_must_fail git commit --interactive >out && - grep "What now" out + echo 7 | + git commit --interactive | + grep "What now" ' test_expect_success PERL "commit --interactive doesn't change index if editor aborts" ' @@ -361,12 +362,12 @@ test_expect_success 'amend commit to fix author' ' oldtick=$GIT_AUTHOR_DATE && test_tick && git reset --hard && - git cat-file -p HEAD >commit && + git cat-file -p HEAD | sed -e "s/author.*/author $author $oldtick/" \ - -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" \ - commit >expected && + -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ + expected && git commit --amend --author="$author" && - git cat-file -p HEAD >current && + git cat-file -p HEAD > current && test_cmp expected current ' @@ -376,12 +377,12 @@ test_expect_success 'amend commit to fix date' ' test_tick && newtick=$GIT_AUTHOR_DATE && git reset --hard && - git cat-file -p HEAD >commit && + git cat-file -p HEAD | sed -e "s/author.*/author $author $newtick/" \ - -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" \ - commit >expected && + -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ + expected && git commit --amend --date="$newtick" && - git cat-file -p HEAD >current && + git cat-file -p HEAD > current && test_cmp expected current ' @@ -408,13 +409,12 @@ test_expect_success 'sign off (1)' ' echo 1 >positive && git add positive && git commit -s -m "thank you" && - git cat-file commit HEAD >commit && - sed -e "1,/^\$/d" commit >actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && ( echo thank you && echo && - git var GIT_COMMITTER_IDENT >ident && - sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ident + git var GIT_COMMITTER_IDENT | + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ) >expected && test_cmp expected actual @@ -428,14 +428,13 @@ test_expect_success 'sign off (2)' ' git commit -s -m "thank you $existing" && - git cat-file commit HEAD >commit && - sed -e "1,/^\$/d" commit >actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && ( echo thank you && echo && echo $existing && - git var GIT_COMMITTER_IDENT >ident && - sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ident + git var GIT_COMMITTER_IDENT | + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ) >expected && test_cmp expected actual @@ -449,14 +448,13 @@ test_expect_success 'signoff gap' ' git commit -s -m "welcome $alt" && - git cat-file commit HEAD >commit && - sed -e "1,/^\$/d" commit >actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" > actual && ( echo welcome && echo && echo $alt && - git var GIT_COMMITTER_IDENT >ident && - sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ident + git var GIT_COMMITTER_IDENT | + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ) >expected && test_cmp expected actual ' @@ -470,16 +468,15 @@ test_expect_success 'signoff gap 2' ' We have now $alt" && - git cat-file commit HEAD >commit && - sed -e "1,/^\$/d" commit >actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" > actual && ( echo welcome && echo && echo We have now && echo $alt && echo && - git var GIT_COMMITTER_IDENT >ident && - sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ident + git var GIT_COMMITTER_IDENT | + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ) >expected && test_cmp expected actual ' @@ -492,8 +489,7 @@ test_expect_success 'signoff respects trailer config' ' non-trailer line Myfooter: x" && - git cat-file commit HEAD >commit && - sed -e "1,/^\$/d" commit >actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" > actual && ( echo subject && echo && @@ -510,8 +506,7 @@ Myfooter: x" && non-trailer line Myfooter: x" && - git cat-file commit HEAD >commit && - sed -e "1,/^\$/d" commit >actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" > actual && ( echo subject && echo && @@ -543,8 +538,7 @@ test_expect_success 'multiple -m' ' >negative && git add negative && git commit -m "one" -m "two" -m "three" && - git cat-file commit HEAD >commit && - sed -e "1,/^\$/d" commit >actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && ( echo one && echo && @@ -561,25 +555,23 @@ test_expect_success 'amend commit to fix author' ' oldtick=$GIT_AUTHOR_DATE && test_tick && git reset --hard && - git cat-file -p HEAD >commit && + git cat-file -p HEAD | sed -e "s/author.*/author $author $oldtick/" \ - -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" \ - commit >expected && + -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ + expected && git commit --amend --author="$author" && - git cat-file -p HEAD >current && + git cat-file -p HEAD > current && test_cmp expected current ' test_expect_success 'git commit with dirty index' ' - echo tacocat >elif && - echo tehlulz >chz && + echo tacocat > elif && + echo tehlulz > chz && git add chz && git commit elif -m "tacocat is a palindrome" && - git show --stat >stat && - grep elif stat && - git diff --cached >diff && - grep chz diff + git show --stat | grep elif && + git diff --cached | grep chz ' test_expect_success 'same tree (single parent)' ' @@ -592,8 +584,7 @@ test_expect_success 'same tree (single parent)' ' test_expect_success 'same tree (single parent) --allow-empty' ' git commit --allow-empty -m "forced empty" && - git cat-file commit HEAD >commit && - grep forced commit + git cat-file commit HEAD | grep forced ' diff --git a/third_party/git/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh b/third_party/git/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh deleted file mode 100755 index b3485450a205..000000000000 --- a/third_party/git/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh +++ /dev/null @@ -1,281 +0,0 @@ -#!/bin/sh - -test_description='pre-commit and pre-merge-commit hooks' - -. ./test-lib.sh - -HOOKDIR="$(git rev-parse --git-dir)/hooks" -PRECOMMIT="$HOOKDIR/pre-commit" -PREMERGE="$HOOKDIR/pre-merge-commit" - -# Prepare sample scripts that write their $0 to actual_hooks -test_expect_success 'sample script setup' ' - mkdir -p "$HOOKDIR" && - write_script "$HOOKDIR/success.sample" <<-\EOF && - echo $0 >>actual_hooks - exit 0 - EOF - write_script "$HOOKDIR/fail.sample" <<-\EOF && - echo $0 >>actual_hooks - exit 1 - EOF - write_script "$HOOKDIR/non-exec.sample" <<-\EOF && - echo $0 >>actual_hooks - exit 1 - EOF - chmod -x "$HOOKDIR/non-exec.sample" && - write_script "$HOOKDIR/require-prefix.sample" <<-\EOF && - echo $0 >>actual_hooks - test $GIT_PREFIX = "success/" - EOF - write_script "$HOOKDIR/check-author.sample" <<-\EOF - echo $0 >>actual_hooks - test "$GIT_AUTHOR_NAME" = "New Author" && - test "$GIT_AUTHOR_EMAIL" = "newauthor@example.com" - EOF -' - -test_expect_success 'root commit' ' - echo "root" >file && - git add file && - git commit -m "zeroth" && - git checkout -b side && - echo "foo" >foo && - git add foo && - git commit -m "make it non-ff" && - git branch side-orig side && - git checkout master -' - -test_expect_success 'setup conflicting branches' ' - test_when_finished "git checkout master" && - git checkout -b conflicting-a master && - echo a >conflicting && - git add conflicting && - git commit -m conflicting-a && - git checkout -b conflicting-b master && - echo b >conflicting && - git add conflicting && - git commit -m conflicting-b -' - -test_expect_success 'with no hook' ' - test_when_finished "rm -f actual_hooks" && - echo "foo" >file && - git add file && - git commit -m "first" && - test_path_is_missing actual_hooks -' - -test_expect_success 'with no hook (merge)' ' - test_when_finished "rm -f actual_hooks" && - git branch -f side side-orig && - git checkout side && - git merge -m "merge master" master && - git checkout master && - test_path_is_missing actual_hooks -' - -test_expect_success '--no-verify with no hook' ' - test_when_finished "rm -f actual_hooks" && - echo "bar" >file && - git add file && - git commit --no-verify -m "bar" && - test_path_is_missing actual_hooks -' - -test_expect_success '--no-verify with no hook (merge)' ' - test_when_finished "rm -f actual_hooks" && - git branch -f side side-orig && - git checkout side && - git merge --no-verify -m "merge master" master && - git checkout master && - test_path_is_missing actual_hooks -' - -test_expect_success 'with succeeding hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && - cp "$HOOKDIR/success.sample" "$PRECOMMIT" && - echo "$PRECOMMIT" >expected_hooks && - echo "more" >>file && - git add file && - git commit -m "more" && - test_cmp expected_hooks actual_hooks -' - -test_expect_success 'with succeeding hook (merge)' ' - test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" && - cp "$HOOKDIR/success.sample" "$PREMERGE" && - echo "$PREMERGE" >expected_hooks && - git checkout side && - git merge -m "merge master" master && - git checkout master && - test_cmp expected_hooks actual_hooks -' - -test_expect_success 'automatic merge fails; both hooks are available' ' - test_when_finished "rm -f \"$PREMERGE\" \"$PRECOMMIT\"" && - test_when_finished "rm -f expected_hooks actual_hooks" && - test_when_finished "git checkout master" && - cp "$HOOKDIR/success.sample" "$PREMERGE" && - cp "$HOOKDIR/success.sample" "$PRECOMMIT" && - - git checkout conflicting-a && - test_must_fail git merge -m "merge conflicting-b" conflicting-b && - test_path_is_missing actual_hooks && - - echo "$PRECOMMIT" >expected_hooks && - echo a+b >conflicting && - git add conflicting && - git commit -m "resolve conflict" && - test_cmp expected_hooks actual_hooks -' - -test_expect_success '--no-verify with succeeding hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" actual_hooks" && - cp "$HOOKDIR/success.sample" "$PRECOMMIT" && - echo "even more" >>file && - git add file && - git commit --no-verify -m "even more" && - test_path_is_missing actual_hooks -' - -test_expect_success '--no-verify with succeeding hook (merge)' ' - test_when_finished "rm -f \"$PREMERGE\" actual_hooks" && - cp "$HOOKDIR/success.sample" "$PREMERGE" && - git branch -f side side-orig && - git checkout side && - git merge --no-verify -m "merge master" master && - git checkout master && - test_path_is_missing actual_hooks -' - -test_expect_success 'with failing hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && - cp "$HOOKDIR/fail.sample" "$PRECOMMIT" && - echo "$PRECOMMIT" >expected_hooks && - echo "another" >>file && - git add file && - test_must_fail git commit -m "another" && - test_cmp expected_hooks actual_hooks -' - -test_expect_success '--no-verify with failing hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" actual_hooks" && - cp "$HOOKDIR/fail.sample" "$PRECOMMIT" && - echo "stuff" >>file && - git add file && - git commit --no-verify -m "stuff" && - test_path_is_missing actual_hooks -' - -test_expect_success 'with failing hook (merge)' ' - test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" && - cp "$HOOKDIR/fail.sample" "$PREMERGE" && - echo "$PREMERGE" >expected_hooks && - git checkout side && - test_must_fail git merge -m "merge master" master && - git checkout master && - test_cmp expected_hooks actual_hooks -' - -test_expect_success '--no-verify with failing hook (merge)' ' - test_when_finished "rm -f \"$PREMERGE\" actual_hooks" && - cp "$HOOKDIR/fail.sample" "$PREMERGE" && - git branch -f side side-orig && - git checkout side && - git merge --no-verify -m "merge master" master && - git checkout master && - test_path_is_missing actual_hooks -' - -test_expect_success POSIXPERM 'with non-executable hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" actual_hooks" && - cp "$HOOKDIR/non-exec.sample" "$PRECOMMIT" && - echo "content" >>file && - git add file && - git commit -m "content" && - test_path_is_missing actual_hooks -' - -test_expect_success POSIXPERM '--no-verify with non-executable hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" actual_hooks" && - cp "$HOOKDIR/non-exec.sample" "$PRECOMMIT" && - echo "more content" >>file && - git add file && - git commit --no-verify -m "more content" && - test_path_is_missing actual_hooks -' - -test_expect_success POSIXPERM 'with non-executable hook (merge)' ' - test_when_finished "rm -f \"$PREMERGE\" actual_hooks" && - cp "$HOOKDIR/non-exec.sample" "$PREMERGE" && - git branch -f side side-orig && - git checkout side && - git merge -m "merge master" master && - git checkout master && - test_path_is_missing actual_hooks -' - -test_expect_success POSIXPERM '--no-verify with non-executable hook (merge)' ' - test_when_finished "rm -f \"$PREMERGE\" actual_hooks" && - cp "$HOOKDIR/non-exec.sample" "$PREMERGE" && - git branch -f side side-orig && - git checkout side && - git merge --no-verify -m "merge master" master && - git checkout master && - test_path_is_missing actual_hooks -' - -test_expect_success 'with hook requiring GIT_PREFIX' ' - test_when_finished "rm -rf \"$PRECOMMIT\" expected_hooks actual_hooks success" && - cp "$HOOKDIR/require-prefix.sample" "$PRECOMMIT" && - echo "$PRECOMMIT" >expected_hooks && - echo "more content" >>file && - git add file && - mkdir success && - ( - cd success && - git commit -m "hook requires GIT_PREFIX = success/" - ) && - test_cmp expected_hooks actual_hooks -' - -test_expect_success 'with failing hook requiring GIT_PREFIX' ' - test_when_finished "rm -rf \"$PRECOMMIT\" expected_hooks actual_hooks fail" && - cp "$HOOKDIR/require-prefix.sample" "$PRECOMMIT" && - echo "$PRECOMMIT" >expected_hooks && - echo "more content" >>file && - git add file && - mkdir fail && - ( - cd fail && - test_must_fail git commit -m "hook must fail" - ) && - git checkout -- file && - test_cmp expected_hooks actual_hooks -' - -test_expect_success 'check the author in hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && - cp "$HOOKDIR/check-author.sample" "$PRECOMMIT" && - cat >expected_hooks <<-EOF && - $PRECOMMIT - $PRECOMMIT - $PRECOMMIT - EOF - test_must_fail git commit --allow-empty -m "by a.u.thor" && - ( - GIT_AUTHOR_NAME="New Author" && - GIT_AUTHOR_EMAIL="newauthor@example.com" && - export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL && - git commit --allow-empty -m "by new.author via env" && - git show -s - ) && - git commit --author="New Author " \ - --allow-empty -m "by new.author via command line" && - git show -s && - test_cmp expected_hooks actual_hooks -' - -test_done diff --git a/third_party/git/t/t7503-pre-commit-hook.sh b/third_party/git/t/t7503-pre-commit-hook.sh new file mode 100755 index 000000000000..984889b39d3f --- /dev/null +++ b/third_party/git/t/t7503-pre-commit-hook.sh @@ -0,0 +1,139 @@ +#!/bin/sh + +test_description='pre-commit hook' + +. ./test-lib.sh + +test_expect_success 'with no hook' ' + + echo "foo" > file && + git add file && + git commit -m "first" + +' + +test_expect_success '--no-verify with no hook' ' + + echo "bar" > file && + git add file && + git commit --no-verify -m "bar" + +' + +# now install hook that always succeeds +HOOKDIR="$(git rev-parse --git-dir)/hooks" +HOOK="$HOOKDIR/pre-commit" +mkdir -p "$HOOKDIR" +cat > "$HOOK" <> file && + git add file && + git commit -m "more" + +' + +test_expect_success '--no-verify with succeeding hook' ' + + echo "even more" >> file && + git add file && + git commit --no-verify -m "even more" + +' + +# now a hook that fails +cat > "$HOOK" <> file && + git add file && + test_must_fail git commit -m "another" + +' + +test_expect_success '--no-verify with failing hook' ' + + echo "stuff" >> file && + git add file && + git commit --no-verify -m "stuff" + +' + +chmod -x "$HOOK" +test_expect_success POSIXPERM 'with non-executable hook' ' + + echo "content" >> file && + git add file && + git commit -m "content" + +' + +test_expect_success POSIXPERM '--no-verify with non-executable hook' ' + + echo "more content" >> file && + git add file && + git commit --no-verify -m "more content" + +' +chmod +x "$HOOK" + +# a hook that checks $GIT_PREFIX and succeeds inside the +# success/ subdirectory only +cat > "$HOOK" <> file && + git add file && + mkdir success && + ( + cd success && + git commit -m "hook requires GIT_PREFIX = success/" + ) && + rmdir success +' + +test_expect_success 'with failing hook requiring GIT_PREFIX' ' + + echo "more content" >> file && + git add file && + mkdir fail && + ( + cd fail && + test_must_fail git commit -m "hook must fail" + ) && + rmdir fail && + git checkout -- file +' + +test_expect_success 'check the author in hook' ' + write_script "$HOOK" <<-\EOF && + test "$GIT_AUTHOR_NAME" = "New Author" && + test "$GIT_AUTHOR_EMAIL" = "newauthor@example.com" + EOF + test_must_fail git commit --allow-empty -m "by a.u.thor" && + ( + GIT_AUTHOR_NAME="New Author" && + GIT_AUTHOR_EMAIL="newauthor@example.com" && + export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL && + git commit --allow-empty -m "by new.author via env" && + git show -s + ) && + git commit --author="New Author " \ + --allow-empty -m "by new.author via command line" && + git show -s +' + +test_done diff --git a/third_party/git/t/t7505-prepare-commit-msg-hook.sh b/third_party/git/t/t7505-prepare-commit-msg-hook.sh index 94f85cdf8317..ba8bd1b51497 100755 --- a/third_party/git/t/t7505-prepare-commit-msg-hook.sh +++ b/third_party/git/t/t7505-prepare-commit-msg-hook.sh @@ -241,7 +241,13 @@ test_rebase () { git add b && git rebase --continue ) && - git log --pretty=%s -g -n18 HEAD@{1} >actual && + if test "$mode" = -p # reword amended after pick + then + n=18 + else + n=17 + fi && + git log --pretty=%s -g -n$n HEAD@{1} >actual && test_cmp "$TEST_DIRECTORY/t7505/expected-rebase${mode:--i}" actual ' } diff --git a/third_party/git/t/t7505/expected-rebase-i b/third_party/git/t/t7505/expected-rebase-i index 93bada596e25..c514bdbb9422 100644 --- a/third_party/git/t/t7505/expected-rebase-i +++ b/third_party/git/t/t7505/expected-rebase-i @@ -7,8 +7,7 @@ message (no editor) [edit rebase-10] message [fixup rebase-9] message (no editor) [fixup rebase-8] message (no editor) [squash rebase-7] -HEAD [reword rebase-6] -message (no editor) [reword rebase-6] +message [reword rebase-6] message [squash rebase-5] message (no editor) [fixup rebase-4] message (no editor) [pick rebase-3] diff --git a/third_party/git/t/t7508-status.sh b/third_party/git/t/t7508-status.sh index 482ce3510edd..4e676cdce8d6 100755 --- a/third_party/git/t/t7508-status.sh +++ b/third_party/git/t/t7508-status.sh @@ -1571,7 +1571,7 @@ test_expect_success '"status.showStash=true" weaker than "--no-show-stash"' ' test_cmp expected_without_stash actual ' -test_expect_success 'no additional info if no stash entries' ' +test_expect_success 'no additionnal info if no stash entries' ' git stash clear && git -c status.showStash=true status >actual && test_cmp expected_without_stash actual diff --git a/third_party/git/t/t7510-signed-commit.sh b/third_party/git/t/t7510-signed-commit.sh index 0c06d22a0079..682b23a06818 100755 --- a/third_party/git/t/t7510-signed-commit.sh +++ b/third_party/git/t/t7510-signed-commit.sh @@ -109,21 +109,6 @@ test_expect_success GPG 'verify-commit exits success on untrusted signature' ' grep "not certified" actual ' -test_expect_success GPG 'verify-commit exits success with matching minTrustLevel' ' - test_config gpg.minTrustLevel ultimate && - git verify-commit sixth-signed -' - -test_expect_success GPG 'verify-commit exits success with low minTrustLevel' ' - test_config gpg.minTrustLevel fully && - git verify-commit sixth-signed -' - -test_expect_success GPG 'verify-commit exits failure with high minTrustLevel' ' - test_config gpg.minTrustLevel ultimate && - test_must_fail git verify-commit eighth-signed-alt -' - test_expect_success GPG 'verify signatures with --raw' ' ( for commit in initial second merge fourth-signed fifth-signed sixth-signed seventh-signed @@ -234,30 +219,6 @@ test_expect_success GPG 'show untrusted signature with custom format' ' test_cmp expect actual ' -test_expect_success GPG 'show untrusted signature with undefined trust level' ' - cat >expect <<-\EOF && - undefined - 65A0EEA02E30CAD7 - Eris Discordia - F8364A59E07FFE9F4D63005A65A0EEA02E30CAD7 - D4BE22311AD3131E5EDA29A461092E85B7227189 - EOF - git log -1 --format="%GT%n%GK%n%GS%n%GF%n%GP" eighth-signed-alt >actual && - test_cmp expect actual -' - -test_expect_success GPG 'show untrusted signature with ultimate trust level' ' - cat >expect <<-\EOF && - ultimate - 13B6F51ECDDE430D - C O Mitter - 73D758744BE721698EC54E8713B6F51ECDDE430D - 73D758744BE721698EC54E8713B6F51ECDDE430D - EOF - git log -1 --format="%GT%n%GK%n%GS%n%GF%n%GP" sixth-signed >actual && - test_cmp expect actual -' - test_expect_success GPG 'show unknown signature with custom format' ' cat >expect <<-\EOF && E diff --git a/third_party/git/t/t7512-status-help.sh b/third_party/git/t/t7512-status-help.sh index 29518e0949bf..e01c285cbf8f 100755 --- a/third_party/git/t/t7512-status-help.sh +++ b/third_party/git/t/t7512-status-help.sh @@ -71,10 +71,10 @@ test_expect_success 'prepare for rebase conflicts' ' ' -test_expect_success 'status when rebase --apply in progress before resolving conflicts' ' +test_expect_success 'status when rebase in progress before resolving conflicts' ' test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short HEAD^^) && - test_must_fail git rebase --apply HEAD^ --onto HEAD^^ && + test_must_fail git rebase HEAD^ --onto HEAD^^ && cat >expected <main.txt && git add main.txt && cat >expected <expected <\"" && cat complex_message_body >expected && diff --git a/third_party/git/t/t7519-status-fsmonitor.sh b/third_party/git/t/t7519-status-fsmonitor.sh index fbfdcca00077..81a375fa0ff9 100755 --- a/third_party/git/t/t7519-status-fsmonitor.sh +++ b/third_party/git/t/t7519-status-fsmonitor.sh @@ -32,12 +32,11 @@ write_integration_script () { echo "$0: exactly 2 arguments expected" exit 2 fi - if test "$1" != 2 + if test "$1" != 1 then echo "Unsupported core.fsmonitor hook version." >&2 exit 1 fi - printf "last_update_token\0" printf "untracked\0" printf "dir1/untracked\0" printf "dir2/untracked\0" @@ -107,9 +106,6 @@ EOF # test that "update-index --fsmonitor-valid" sets the fsmonitor valid bit test_expect_success 'update-index --fsmonitor-valid" sets the fsmonitor valid bit' ' - write_script .git/hooks/fsmonitor-test<<-\EOF && - printf "last_update_token\0" - EOF git update-index --fsmonitor && git update-index --fsmonitor-valid dir1/modified && git update-index --fsmonitor-valid dir2/modified && @@ -168,9 +164,6 @@ EOF # test that newly added files are marked valid test_expect_success 'newly added files are marked valid' ' - write_script .git/hooks/fsmonitor-test<<-\EOF && - printf "last_update_token\0" - EOF git add new && git add dir1/new && git add dir2/new && @@ -210,7 +203,6 @@ EOF # test that *only* files returned by the integration script get flagged as invalid test_expect_success '*only* files returned by the integration script get flagged as invalid' ' write_script .git/hooks/fsmonitor-test<<-\EOF && - printf "last_update_token\0" printf "dir1/modified\0" EOF clean_repo && @@ -226,12 +218,11 @@ test_expect_success '*only* files returned by the integration script get flagged # Ensure commands that call refresh_index() to move the index back in time # properly invalidate the fsmonitor cache test_expect_success 'refresh_index() invalidates fsmonitor cache' ' + write_script .git/hooks/fsmonitor-test<<-\EOF && + EOF clean_repo && dirty_repo && - write_integration_script && git add . && - write_script .git/hooks/fsmonitor-test<<-\EOF && - EOF git commit -m "to reset" && git reset HEAD~1 && git status >actual && @@ -280,7 +271,6 @@ do # (if enabled) files unless it is told about them. test_expect_success "status doesn't detect unreported modifications" ' write_script .git/hooks/fsmonitor-test<<-\EOF && - printf "last_update_token\0" :>marker EOF clean_repo && @@ -304,7 +294,7 @@ do done done -# test that splitting the index doesn't interfere +# test that splitting the index dosn't interfere test_expect_success 'splitting the index results in the same state' ' write_integration_script && dirty_repo && @@ -364,23 +354,4 @@ test_expect_success 'discard_index() also discards fsmonitor info' ' test_cmp expect actual ' -# Test unstaging entries that: -# - Are not flagged with CE_FSMONITOR_VALID -# - Have a position in the index >= the number of entries present in the index -# after unstaging. -test_expect_success 'status succeeds after staging/unstaging' ' - test_create_repo fsmonitor-stage-unstage && - ( - cd fsmonitor-stage-unstage && - test_commit initial && - git update-index --fsmonitor && - removed=$(test_seq 1 100 | sed "s/^/z/") && - touch $removed && - git add $removed && - git config core.fsmonitor "$TEST_DIRECTORY/t7519/fsmonitor-env" && - FSMONITOR_LIST="$removed" git restore -S $removed && - FSMONITOR_LIST="$removed" git status - ) -' - test_done diff --git a/third_party/git/t/t7519/fsmonitor-all b/third_party/git/t/t7519/fsmonitor-all index 94ab66bd3d86..691bc94dc2c8 100755 --- a/third_party/git/t/t7519/fsmonitor-all +++ b/third_party/git/t/t7519/fsmonitor-all @@ -17,6 +17,7 @@ fi if test "$1" != 1 then + echo "Unsupported core.fsmonitor hook version." >&2 exit 1 fi diff --git a/third_party/git/t/t7519/fsmonitor-all-v2 b/third_party/git/t/t7519/fsmonitor-all-v2 deleted file mode 100755 index 061907e88b65..000000000000 --- a/third_party/git/t/t7519/fsmonitor-all-v2 +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -# -# An test hook script to integrate with git to test fsmonitor. -# -# The hook is passed a version (currently 2) and since token -# formatted as a string and outputs to stdout all files that have been -# modified since the given time. Paths must be relative to the root of -# the working tree and separated by a single NUL. -# -#echo "$0 $*" >&2 -my ($version, $last_update_token) = @ARGV; - -if ($version ne 2) { - print "Unsupported query-fsmonitor hook version '$version'.\n"; - exit 1; -} - -print "last_update_token\0/\0" diff --git a/third_party/git/t/t7519/fsmonitor-env b/third_party/git/t/t7519/fsmonitor-env deleted file mode 100755 index 8f1f7ab164e1..000000000000 --- a/third_party/git/t/t7519/fsmonitor-env +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# An test hook script to integrate with git to test fsmonitor. -# -# The hook is passed a version (currently 1) and a time in nanoseconds -# formatted as a string and outputs to stdout all files that have been -# modified since the given time. Paths must be relative to the root of -# the working tree and separated by a single NUL. -# -#echo "$0 $*" >&2 - -if test "$#" -ne 2 -then - echo "$0: exactly 2 arguments expected" >&2 - exit 2 -fi - -if test "$1" != 1 -then - echo "Unsupported core.fsmonitor hook version." >&2 - exit 1 -fi - -printf '%s\n' $FSMONITOR_LIST diff --git a/third_party/git/t/t7519/fsmonitor-watchman b/third_party/git/t/t7519/fsmonitor-watchman index 264b9daf834e..5514edcf68be 100755 --- a/third_party/git/t/t7519/fsmonitor-watchman +++ b/third_party/git/t/t7519/fsmonitor-watchman @@ -23,10 +23,10 @@ my ($version, $time) = @ARGV; if ($version == 1) { # convert nanoseconds to seconds - # subtract one second to make sure watchman will return all changes - $time = int ($time / 1000000000) - 1; + $time = int $time / 1000000000; } else { - exit 1; + die "Unsupported query-fsmonitor hook version '$version'.\n" . + "Falling back to scanning...\n"; } my $git_work_tree; @@ -54,12 +54,18 @@ sub launch_watchman { # # To accomplish this, we're using the "since" generator to use the # recency index to select candidate nodes and "fields" to limit the - # output to file names only. + # output to file names only. Then we're using the "expression" term to + # further constrain the results. + # + # The category of transient files that we want to ignore will have a + # creation clock (cclock) newer than $time_t value and will also not + # currently exist. my $query = <<" END"; ["query", "$git_work_tree", { "since": $time, - "fields": ["name"] + "fields": ["name"], + "expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]] }] END diff --git a/third_party/git/t/t7519/fsmonitor-watchman-v2 b/third_party/git/t/t7519/fsmonitor-watchman-v2 deleted file mode 100755 index 14ed0aa42de0..000000000000 --- a/third_party/git/t/t7519/fsmonitor-watchman-v2 +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use IPC::Open2; - -# An example hook script to integrate Watchman -# (https://facebook.github.io/watchman/) with git to speed up detecting -# new and modified files. -# -# The hook is passed a version (currently 2) and last update token -# formatted as a string and outputs to stdout a new update token and -# all files that have been modified since the update token. Paths must -# be relative to the root of the working tree and separated by a single NUL. -# -# To enable this hook, rename this file to "query-watchman" and set -# 'git config core.fsmonitor .git/hooks/query-watchman' -# -my ($version, $last_update_token) = @ARGV; - -# Uncomment for debugging -# print STDERR "$0 $version $last_update_token\n"; - -# Check the hook interface version -if ($version ne 2) { - die "Unsupported query-fsmonitor hook version '$version'.\n" . - "Falling back to scanning...\n"; -} - -my $git_work_tree = get_working_dir(); - -my $retry = 1; - -my $json_pkg; -eval { - require JSON::XS; - $json_pkg = "JSON::XS"; - 1; -} or do { - require JSON::PP; - $json_pkg = "JSON::PP"; -}; - -launch_watchman(); - -sub launch_watchman { - my $o = watchman_query(); - if (is_work_tree_watched($o)) { - output_result($o->{clock}, @{$o->{files}}); - } -} - -sub output_result { - my ($clockid, @files) = @_; - - # Uncomment for debugging watchman output - # open (my $fh, ">", ".git/watchman-output.out"); - # binmode $fh, ":utf8"; - # print $fh "$clockid\n@files\n"; - # close $fh; - - binmode STDOUT, ":utf8"; - print $clockid; - print "\0"; - local $, = "\0"; - print @files; -} - -sub watchman_clock { - my $response = qx/watchman clock "$git_work_tree"/; - die "Failed to get clock id on '$git_work_tree'.\n" . - "Falling back to scanning...\n" if $? != 0; - - return $json_pkg->new->utf8->decode($response); -} - -sub watchman_query { - my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') - or die "open2() failed: $!\n" . - "Falling back to scanning...\n"; - - # In the query expression below we're asking for names of files that - # changed since $last_update_token but not from the .git folder. - # - # To accomplish this, we're using the "since" generator to use the - # recency index to select candidate nodes and "fields" to limit the - # output to file names only. Then we're using the "expression" term to - # further constrain the results. - if (substr($last_update_token, 0, 1) eq "c") { - $last_update_token = "\"$last_update_token\""; - } - my $query = <<" END"; - ["query", "$git_work_tree", { - "since": $last_update_token, - "fields": ["name"], - "expression": ["not", ["dirname", ".git"]] - }] - END - - # Uncomment for debugging the watchman query - # open (my $fh, ">", ".git/watchman-query.json"); - # print $fh $query; - # close $fh; - - print CHLD_IN $query; - close CHLD_IN; - my $response = do {local $/; }; - - # Uncomment for debugging the watch response - # open ($fh, ">", ".git/watchman-response.json"); - # print $fh $response; - # close $fh; - - die "Watchman: command returned no output.\n" . - "Falling back to scanning...\n" if $response eq ""; - die "Watchman: command returned invalid output: $response\n" . - "Falling back to scanning...\n" unless $response =~ /^\{/; - - return $json_pkg->new->utf8->decode($response); -} - -sub is_work_tree_watched { - my ($output) = @_; - my $error = $output->{error}; - if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { - $retry--; - my $response = qx/watchman watch "$git_work_tree"/; - die "Failed to make watchman watch '$git_work_tree'.\n" . - "Falling back to scanning...\n" if $? != 0; - $output = $json_pkg->new->utf8->decode($response); - $error = $output->{error}; - die "Watchman: $error.\n" . - "Falling back to scanning...\n" if $error; - - # Uncomment for debugging watchman output - # open (my $fh, ">", ".git/watchman-output.out"); - # close $fh; - - # Watchman will always return all files on the first query so - # return the fast "everything is dirty" flag to git and do the - # Watchman query just to get it over with now so we won't pay - # the cost in git to look up each individual file. - my $o = watchman_clock(); - $error = $output->{error}; - - die "Watchman: $error.\n" . - "Falling back to scanning...\n" if $error; - - output_result($o->{clock}, ("/")); - $last_update_token = $o->{clock}; - - eval { launch_watchman() }; - return 0; - } - - die "Watchman: $error.\n" . - "Falling back to scanning...\n" if $error; - - return 1; -} - -sub get_working_dir { - my $working_dir; - if ($^O =~ 'msys' || $^O =~ 'cygwin') { - $working_dir = Win32::GetCwd(); - $working_dir =~ tr/\\/\//; - } else { - require Cwd; - $working_dir = Cwd::cwd(); - } - - return $working_dir; -} diff --git a/third_party/git/t/t7526-commit-pathspec-file.sh b/third_party/git/t/t7526-commit-pathspec-file.sh deleted file mode 100755 index 5fbe47ebcd02..000000000000 --- a/third_party/git/t/t7526-commit-pathspec-file.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh - -test_description='commit --pathspec-from-file' - -. ./test-lib.sh - -test_tick - -test_expect_success setup ' - test_commit file0 && - git tag checkpoint && - - echo A >fileA.t && - echo B >fileB.t && - echo C >fileC.t && - echo D >fileD.t && - git add fileA.t fileB.t fileC.t fileD.t -' - -restore_checkpoint () { - git reset --soft checkpoint -} - -verify_expect () { - git diff-tree --no-commit-id --name-status -r HEAD >actual && - test_cmp expect actual -} - -test_expect_success '--pathspec-from-file from stdin' ' - restore_checkpoint && - - echo fileA.t | git commit --pathspec-from-file=- -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - EOF - verify_expect -' - -test_expect_success '--pathspec-from-file from file' ' - restore_checkpoint && - - echo fileA.t >list && - git commit --pathspec-from-file=list -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - EOF - verify_expect -' - -test_expect_success 'NUL delimiters' ' - restore_checkpoint && - - printf "fileA.t\0fileB.t\0" | git commit --pathspec-from-file=- --pathspec-file-nul -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'LF delimiters' ' - restore_checkpoint && - - printf "fileA.t\nfileB.t\n" | git commit --pathspec-from-file=- -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'no trailing delimiter' ' - restore_checkpoint && - - printf "fileA.t\nfileB.t" | git commit --pathspec-from-file=- -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'CRLF delimiters' ' - restore_checkpoint && - - printf "fileA.t\r\nfileB.t\r\n" | git commit --pathspec-from-file=- -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'quotes' ' - restore_checkpoint && - - cat >list <<-\EOF && - "file\101.t" - EOF - - git commit --pathspec-from-file=list -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - EOF - verify_expect expect -' - -test_expect_success 'quotes not compatible with --pathspec-file-nul' ' - restore_checkpoint && - - cat >list <<-\EOF && - "file\101.t" - EOF - - test_must_fail git commit --pathspec-from-file=list --pathspec-file-nul -m "Commit" -' - -test_expect_success 'only touches what was listed' ' - restore_checkpoint && - - printf "fileB.t\nfileC.t\n" | git commit --pathspec-from-file=- -m "Commit" && - - cat >expect <<-\EOF && - A fileB.t - A fileC.t - EOF - verify_expect -' - -test_expect_success 'error conditions' ' - restore_checkpoint && - echo fileA.t >list && - >empty_list && - - test_must_fail git commit --pathspec-from-file=list --interactive -m "Commit" 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with --interactive/--patch" err && - - test_must_fail git commit --pathspec-from-file=list --patch -m "Commit" 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with --interactive/--patch" err && - - test_must_fail git commit --pathspec-from-file=list --all -m "Commit" 2>err && - test_i18ngrep -e "--pathspec-from-file with -a does not make sense" err && - - test_must_fail git commit --pathspec-from-file=list -m "Commit" -- fileA.t 2>err && - test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err && - - test_must_fail git commit --pathspec-file-nul -m "Commit" 2>err && - test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err && - - test_must_fail git commit --pathspec-from-file=empty_list --include -m "Commit" 2>err && - test_i18ngrep -e "No paths with --include/--only does not make sense." err && - - test_must_fail git commit --pathspec-from-file=empty_list --only -m "Commit" 2>err && - test_i18ngrep -e "No paths with --include/--only does not make sense." err -' - -test_done diff --git a/third_party/git/t/t7612-merge-verify-signatures.sh b/third_party/git/t/t7612-merge-verify-signatures.sh index a426f3a89aa7..d99218a725c5 100755 --- a/third_party/git/t/t7612-merge-verify-signatures.sh +++ b/third_party/git/t/t7612-merge-verify-signatures.sh @@ -66,20 +66,6 @@ test_expect_success GPG 'merge commit with untrusted signature with verification test_i18ngrep "has an untrusted GPG signature" mergeerror ' -test_expect_success GPG 'merge commit with untrusted signature with verification and high minTrustLevel' ' - test_when_finished "git reset --hard && git checkout initial" && - test_config gpg.minTrustLevel marginal && - test_must_fail git merge --ff-only --verify-signatures side-untrusted 2>mergeerror && - test_i18ngrep "has an untrusted GPG signature" mergeerror -' - -test_expect_success GPG 'merge commit with untrusted signature with verification and low minTrustLevel' ' - test_when_finished "git reset --hard && git checkout initial" && - test_config gpg.minTrustLevel undefined && - git merge --ff-only --verify-signatures side-untrusted >mergeoutput && - test_i18ngrep "has a good GPG signature" mergeoutput -' - test_expect_success GPG 'merge commit with untrusted signature with merge.verifySignatures=true' ' test_when_finished "git reset --hard && git checkout initial" && test_config merge.verifySignatures true && @@ -87,14 +73,6 @@ test_expect_success GPG 'merge commit with untrusted signature with merge.verify test_i18ngrep "has an untrusted GPG signature" mergeerror ' -test_expect_success GPG 'merge commit with untrusted signature with merge.verifySignatures=true and minTrustLevel' ' - test_when_finished "git reset --hard && git checkout initial" && - test_config merge.verifySignatures true && - test_config gpg.minTrustLevel marginal && - test_must_fail git merge --ff-only side-untrusted 2>mergeerror && - test_i18ngrep "has an untrusted GPG signature" mergeerror -' - test_expect_success GPG 'merge signed commit with verification' ' test_when_finished "git reset --hard && git checkout initial" && git merge --verbose --ff-only --verify-signatures side-signed >mergeoutput && diff --git a/third_party/git/t/t7700-repack.sh b/third_party/git/t/t7700-repack.sh index 25b235c06303..4e855bc21b45 100755 --- a/third_party/git/t/t7700-repack.sh +++ b/third_party/git/t/t7700-repack.sh @@ -4,104 +4,129 @@ test_description='git repack works correctly' . ./test-lib.sh -commit_and_pack () { - test_commit "$@" 1>&2 && - incrpackid=$(git pack-objects --all --unpacked --incremental .git/objects/pack/pack orig.raw && - sed -n -e "s/^\($OID_REGEX\).*/\1/p" orig.raw | sort >orig && - git verify-pack -v $myidx >dest.raw && - cut -d" " -f1 dest.raw | sort >dest && - comm -23 orig dest >missing && - test_must_be_empty missing -} - -# we expect $packid and $oid to be defined -test_has_duplicate_object () { - want_duplicate_object="$1" - found_duplicate_object=false - for p in .git/objects/pack/*.idx - do - idx=$(basename $p) - test "pack-$packid.idx" = "$idx" && continue - git verify-pack -v $p >packlist || return $? - if grep "^$oid" packlist - then - found_duplicate_object=true - echo "DUPLICATE OBJECT FOUND" - break - fi - done && - test "$want_duplicate_object" = "$found_duplicate_object" +commit_and_pack() { + test_commit "$@" >/dev/null && + SHA1=$(git pack-objects --all --unpacked --incremental .git/objects/pack/pack file1 && - echo content2 >file2 && + echo content1 > file1 && + echo content2 > file2 && git add . && test_tick && git commit -m initial_commit && # Create two packs # The first pack will contain all of the objects except one - git rev-list --objects --all >objs && - grep -v file2 objs | git pack-objects pack && + git rev-list --objects --all | grep -v file2 | + git pack-objects pack > /dev/null && # The second pack will contain the excluded object - packid=$(grep file2 objs | git pack-objects pack) && - >pack-$packid.keep && - git verify-pack -v pack-$packid.idx >packlist && - oid=$(head -n 1 packlist | sed -e "s/^\($OID_REGEX\).*/\1/") && + packsha1=$(git rev-list --objects --all | grep file2 | + git pack-objects pack) && + >pack-$packsha1.keep && + objsha1=$(git verify-pack -v pack-$packsha1.idx | head -n 1 | + sed -e "s/^\([0-9a-f]\{40\}\).*/\1/") && mv pack-* .git/objects/pack/ && git repack -A -d -l && git prune-packed && - test_has_duplicate_object false + for p in .git/objects/pack/*.idx; do + idx=$(basename $p) + test "pack-$packsha1.idx" = "$idx" && continue + if git verify-pack -v $p | egrep "^$objsha1"; then + found_duplicate_object=1 + echo "DUPLICATE OBJECT FOUND" + break + fi + done && + test -z "$found_duplicate_object" ' test_expect_success 'writing bitmaps via command-line can duplicate .keep objects' ' - # build on $oid, $packid, and .keep state from previous + # build on $objsha1, $packsha1, and .keep state from previous git repack -Adbl && - test_has_duplicate_object true + test_when_finished "found_duplicate_object=" && + for p in .git/objects/pack/*.idx; do + idx=$(basename $p) + test "pack-$packsha1.idx" = "$idx" && continue + if git verify-pack -v $p | egrep "^$objsha1"; then + found_duplicate_object=1 + echo "DUPLICATE OBJECT FOUND" + break + fi + done && + test "$found_duplicate_object" = 1 ' test_expect_success 'writing bitmaps via config can duplicate .keep objects' ' - # build on $oid, $packid, and .keep state from previous + # build on $objsha1, $packsha1, and .keep state from previous git -c repack.writebitmaps=true repack -Adl && - test_has_duplicate_object true + test_when_finished "found_duplicate_object=" && + for p in .git/objects/pack/*.idx; do + idx=$(basename $p) + test "pack-$packsha1.idx" = "$idx" && continue + if git verify-pack -v $p | egrep "^$objsha1"; then + found_duplicate_object=1 + echo "DUPLICATE OBJECT FOUND" + break + fi + done && + test "$found_duplicate_object" = 1 ' test_expect_success 'loose objects in alternate ODB are not repacked' ' mkdir alt_objects && - echo $(pwd)/alt_objects >.git/objects/info/alternates && - echo content3 >file3 && - oid=$(GIT_OBJECT_DIRECTORY=alt_objects git hash-object -w file3) && + echo $(pwd)/alt_objects > .git/objects/info/alternates && + echo content3 > file3 && + objsha1=$(GIT_OBJECT_DIRECTORY=alt_objects git hash-object -w file3) && git add file3 && test_tick && git commit -m commit_file3 && git repack -a -d -l && git prune-packed && - test_has_duplicate_object false + for p in .git/objects/pack/*.idx; do + if git verify-pack -v $p | egrep "^$objsha1"; then + found_duplicate_object=1 + echo "DUPLICATE OBJECT FOUND" + break + fi + done && + test -z "$found_duplicate_object" ' test_expect_success 'packed obs in alt ODB are repacked even when local repo is packless' ' mkdir alt_objects/pack && mv .git/objects/pack/* alt_objects/pack && git repack -a && - test_no_missing_in_packs + myidx=$(ls -1 .git/objects/pack/*.idx) && + test -f "$myidx" && + for p in alt_objects/pack/*.idx; do + git verify-pack -v $p | sed -n -e "/^[0-9a-f]\{40\}/p" + done | while read sha1 rest; do + if ! ( git verify-pack -v $myidx | grep "^$sha1" ); then + echo "Missing object in local pack: $sha1" + return 1 + fi + done ' test_expect_success 'packed obs in alt ODB are repacked when local repo has packs' ' rm -f .git/objects/pack/* && - echo new_content >>file1 && + echo new_content >> file1 && git add file1 && test_tick && git commit -m more_content && git repack && git repack -a -d && - test_no_missing_in_packs + myidx=$(ls -1 .git/objects/pack/*.idx) && + test -f "$myidx" && + for p in alt_objects/pack/*.idx; do + git verify-pack -v $p | sed -n -e "/^[0-9a-f]\{40\}/p" + done | while read sha1 rest; do + if ! ( git verify-pack -v $myidx | grep "^$sha1" ); then + echo "Missing object in local pack: $sha1" + return 1 + fi + done ' test_expect_success 'packed obs in alternate ODB kept pack are repacked' ' @@ -109,7 +134,7 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' ' for p in alt_objects/pack/*.pack do base_name=$(basename $p .pack) && - if test_path_is_file alt_objects/pack/$base_name.keep + if test -f alt_objects/pack/$base_name.keep then rm alt_objects/pack/$base_name.keep else @@ -117,13 +142,22 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' ' fi done && git repack -a -d && - test_no_missing_in_packs + myidx=$(ls -1 .git/objects/pack/*.idx) && + test -f "$myidx" && + for p in alt_objects/pack/*.idx; do + git verify-pack -v $p | sed -n -e "/^[0-9a-f]\{40\}/p" + done | while read sha1 rest; do + if ! ( git verify-pack -v $myidx | grep "^$sha1" ); then + echo "Missing object in local pack: $sha1" + return 1 + fi + done ' test_expect_success 'packed unreachable obs in alternate ODB are not loosened' ' rm -f alt_objects/pack/*.keep && mv .git/objects/pack/* alt_objects/pack/ && - coid=$(git rev-parse HEAD^{commit}) && + csha1=$(git rev-parse HEAD^{commit}) && git reset --hard HEAD^ && test_tick && git reflog expire --expire=$test_tick --expire-unreachable=$test_tick --all && @@ -133,15 +167,15 @@ test_expect_success 'packed unreachable obs in alternate ODB are not loosened' ' --unpack-unreachable packlist && - ! grep "^$coid " packlist && - echo >.git/objects/info/alternates && - test_must_fail git show $coid + test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx | + egrep "^$csha1 " | sort | uniq | wc -l) && + echo > .git/objects/info/alternates && + test_must_fail git show $csha1 ' test_expect_success 'local packed unreachable obs that exist in alternate ODB are not loosened' ' - echo $(pwd)/alt_objects >.git/objects/info/alternates && - echo "$coid" | git pack-objects --non-empty --all --reflog pack && + echo $(pwd)/alt_objects > .git/objects/info/alternates && + echo "$csha1" | git pack-objects --non-empty --all --reflog pack && rm -f .git/objects/pack/* && mv pack-* .git/objects/pack/ && # The pack-objects call on the next line is equivalent to @@ -150,10 +184,10 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar --unpack-unreachable packlist && - ! grep "^$coid " && - echo >.git/objects/info/alternates && - test_must_fail git show $coid + test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx | + egrep "^$csha1 " | sort | uniq | wc -l) && + echo > .git/objects/info/alternates && + test_must_fail git show $csha1 ' test_expect_success 'objects made unreachable by grafts only are kept' ' @@ -162,7 +196,7 @@ test_expect_success 'objects made unreachable by grafts only are kept' ' H0=$(git rev-parse HEAD) && H1=$(git rev-parse HEAD^) && H2=$(git rev-parse HEAD^^) && - echo "$H0 $H2" >.git/info/grafts && + echo "$H0 $H2" > .git/info/grafts && git reflog expire --expire=$test_tick --expire-unreachable=$test_tick --all && git repack -a -d && git cat-file -t $H1 @@ -201,7 +235,7 @@ test_expect_success 'incremental repack does not complain' ' test_expect_success 'bitmaps can be disabled on bare repos' ' git -c repack.writeBitmaps=false -C bare.git repack -ad && - bitmap=$(ls bare.git/objects/pack/*.bitmap || :) && + bitmap=$(ls bare.git/objects/pack/*.bitmap 2>/dev/null || :) && test -z "$bitmap" ' diff --git a/third_party/git/t/t7800-difftool.sh b/third_party/git/t/t7800-difftool.sh index 29b92907e2ad..6bac9ed180e7 100755 --- a/third_party/git/t/t7800-difftool.sh +++ b/third_party/git/t/t7800-difftool.sh @@ -125,14 +125,15 @@ test_expect_success 'difftool stops on error with --trust-exit-code' ' test_when_finished "rm -f for-diff .git/fail-right-file" && test_when_finished "git reset -- for-diff" && write_script .git/fail-right-file <<-\EOF && - echo failed + echo "$2" exit 1 EOF >for-diff && git add for-diff && + echo file >expect && test_must_fail git difftool -y --trust-exit-code \ --extcmd .git/fail-right-file branch >actual && - test_line_count = 1 actual + test_cmp expect actual ' test_expect_success 'difftool honors exit status if command not found' ' diff --git a/third_party/git/t/t7811-grep-open.sh b/third_party/git/t/t7811-grep-open.sh index a98785da7955..d1ebfd88c7a9 100755 --- a/third_party/git/t/t7811-grep-open.sh +++ b/third_party/git/t/t7811-grep-open.sh @@ -113,6 +113,7 @@ test_expect_success 'modified file' ' subdir/grep.c unrelated EOF + >empty && echo "enum grep_pat_token" >unrelated && test_when_finished "git checkout HEAD unrelated" && diff --git a/third_party/git/t/t7812-grep-icase-non-ascii.sh b/third_party/git/t/t7812-grep-icase-non-ascii.sh index 03dba6685ab7..0c685d35986e 100755 --- a/third_party/git/t/t7812-grep-icase-non-ascii.sh +++ b/third_party/git/t/t7812-grep-icase-non-ascii.sh @@ -53,35 +53,4 @@ test_expect_success REGEX_LOCALE 'pickaxe -i on non-ascii' ' test_cmp expected actual ' -test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: setup invalid UTF-8 data' ' - printf "\\200\\n" >invalid-0x80 && - echo "ævar" >expected && - cat expected >>invalid-0x80 && - git add invalid-0x80 -' - -test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep ASCII from invalid UTF-8 data' ' - git grep -h "var" invalid-0x80 >actual && - test_cmp expected actual && - git grep -h "(*NO_JIT)var" invalid-0x80 >actual && - test_cmp expected actual -' - -test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep non-ASCII from invalid UTF-8 data' ' - git grep -h "æ" invalid-0x80 >actual && - test_cmp expected actual && - git grep -h "(*NO_JIT)æ" invalid-0x80 >actual && - test_cmp expected actual -' - -test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep non-ASCII from invalid UTF-8 data with -i' ' - test_might_fail git grep -hi "Æ" invalid-0x80 >actual && - if test -s actual - then - test_cmp expected actual - fi && - test_must_fail git grep -hi "(*NO_JIT)Æ" invalid-0x80 >actual && - ! test_cmp expected actual -' - test_done diff --git a/third_party/git/t/t7814-grep-recurse-submodules.sh b/third_party/git/t/t7814-grep-recurse-submodules.sh index 828cb3ba5818..a11366b4cee4 100755 --- a/third_party/git/t/t7814-grep-recurse-submodules.sh +++ b/third_party/git/t/t7814-grep-recurse-submodules.sh @@ -345,16 +345,7 @@ test_incompatible_with_recurse_submodules () } test_incompatible_with_recurse_submodules --untracked - -test_expect_success 'grep --recurse-submodules --no-index ignores --recurse-submodules' ' - git grep --recurse-submodules --no-index -e "^(.|.)[\d]" >actual && - cat >expect <<-\EOF && - a:(1|2)d(3|4) - submodule/a:(1|2)d(3|4) - submodule/sub/a:(1|2)d(3|4) - EOF - test_cmp expect actual -' +test_incompatible_with_recurse_submodules --no-index test_expect_success 'grep --recurse-submodules should pass the pattern type along' ' # Fixed @@ -417,25 +408,4 @@ test_expect_success 'grep --recurse-submodules with submodules without .gitmodul test_cmp expect actual ' -reset_and_clean () { - git reset --hard && - git clean -fd && - git submodule foreach --recursive 'git reset --hard' && - git submodule foreach --recursive 'git clean -fd' -} - -test_expect_success 'grep --recurse-submodules without --cached considers worktree modifications' ' - reset_and_clean && - echo "A modified line in submodule" >>submodule/a && - echo "submodule/a:A modified line in submodule" >expect && - git grep --recurse-submodules "A modified line in submodule" >actual && - test_cmp expect actual -' - -test_expect_success 'grep --recurse-submodules with --cached ignores worktree modifications' ' - reset_and_clean && - echo "A modified line in submodule" >>submodule/a && - test_must_fail git grep --recurse-submodules --cached "A modified line in submodule" >actual 2>&1 && - test_must_be_empty actual -' test_done diff --git a/third_party/git/t/t7815-grep-binary.sh b/third_party/git/t/t7815-grep-binary.sh deleted file mode 100755 index 90ebb64f46eb..000000000000 --- a/third_party/git/t/t7815-grep-binary.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/sh - -test_description='git grep in binary files' - -. ./test-lib.sh - -test_expect_success 'setup' " - echo 'binaryQfileQm[*]cQ*æQð' | q_to_nul >a && - git add a && - git commit -m. -" - -test_expect_success 'git grep ina a' ' - echo Binary file a matches >expect && - git grep ina a >actual && - test_cmp expect actual -' - -test_expect_success 'git grep -ah ina a' ' - git grep -ah ina a >actual && - test_cmp a actual -' - -test_expect_success 'git grep -I ina a' ' - test_must_fail git grep -I ina a >actual && - test_must_be_empty actual -' - -test_expect_success 'git grep -c ina a' ' - echo a:1 >expect && - git grep -c ina a >actual && - test_cmp expect actual -' - -test_expect_success 'git grep -l ina a' ' - echo a >expect && - git grep -l ina a >actual && - test_cmp expect actual -' - -test_expect_success 'git grep -L bar a' ' - echo a >expect && - git grep -L bar a >actual && - test_cmp expect actual -' - -test_expect_success 'git grep -q ina a' ' - git grep -q ina a >actual && - test_must_be_empty actual -' - -test_expect_success 'git grep -F ile a' ' - git grep -F ile a -' - -test_expect_success 'git grep -Fi iLE a' ' - git grep -Fi iLE a -' - -# This test actually passes on platforms where regexec() supports the -# flag REG_STARTEND. -test_expect_success 'git grep ile a' ' - git grep ile a -' - -test_expect_failure 'git grep .fi a' ' - git grep .fi a -' - -test_expect_success 'grep respects binary diff attribute' ' - echo text >t && - git add t && - echo t:text >expect && - git grep text t >actual && - test_cmp expect actual && - echo "t -diff" >.gitattributes && - echo "Binary file t matches" >expect && - git grep text t >actual && - test_cmp expect actual -' - -test_expect_success 'grep --cached respects binary diff attribute' ' - git grep --cached text t >actual && - test_cmp expect actual -' - -test_expect_success 'grep --cached respects binary diff attribute (2)' ' - git add .gitattributes && - rm .gitattributes && - git grep --cached text t >actual && - test_when_finished "git rm --cached .gitattributes" && - test_when_finished "git checkout .gitattributes" && - test_cmp expect actual -' - -test_expect_success 'grep revision respects binary diff attribute' ' - git commit -m new && - echo "Binary file HEAD:t matches" >expect && - git grep text HEAD -- t >actual && - test_when_finished "git reset HEAD^" && - test_cmp expect actual -' - -test_expect_success 'grep respects not-binary diff attribute' ' - echo binQary | q_to_nul >b && - git add b && - echo "Binary file b matches" >expect && - git grep bin b >actual && - test_cmp expect actual && - echo "b diff" >.gitattributes && - echo "b:binQary" >expect && - git grep bin b >actual.raw && - nul_to_q actual && - test_cmp expect actual -' - -cat >nul_to_q_textconv <<'EOF' -#!/bin/sh -"$PERL_PATH" -pe 'y/\000/Q/' < "$1" -EOF -chmod +x nul_to_q_textconv - -test_expect_success 'setup textconv filters' ' - echo a diff=foo >.gitattributes && - git config diff.foo.textconv "\"$(pwd)\""/nul_to_q_textconv -' - -test_expect_success 'grep does not honor textconv' ' - test_must_fail git grep Qfile -' - -test_expect_success 'grep --textconv honors textconv' ' - echo "a:binaryQfileQm[*]cQ*æQð" >expect && - git grep --textconv Qfile >actual && - test_cmp expect actual -' - -test_expect_success 'grep --no-textconv does not honor textconv' ' - test_must_fail git grep --no-textconv Qfile -' - -test_expect_success 'grep --textconv blob honors textconv' ' - echo "HEAD:a:binaryQfileQm[*]cQ*æQð" >expect && - git grep --textconv Qfile HEAD:a >actual && - test_cmp expect actual -' - -test_done diff --git a/third_party/git/t/t7816-grep-binary-pattern.sh b/third_party/git/t/t7816-grep-binary-pattern.sh deleted file mode 100755 index 60bab291e49c..000000000000 --- a/third_party/git/t/t7816-grep-binary-pattern.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/sh - -test_description='git grep with a binary pattern files' - -. ./lib-gettext.sh - -nul_match_internal () { - matches=$1 - prereqs=$2 - lc_all=$3 - extra_flags=$4 - flags=$5 - pattern=$6 - pattern_human=$(echo "$pattern" | sed 's/Q//g') - - if test "$matches" = 1 - then - test_expect_success $prereqs "LC_ALL='$lc_all' git grep $extra_flags -f f $flags '$pattern_human' a" " - printf '$pattern' | q_to_nul >f && - LC_ALL='$lc_all' git grep $extra_flags -f f $flags a - " - elif test "$matches" = 0 - then - test_expect_success $prereqs "LC_ALL='$lc_all' git grep $extra_flags -f f $flags '$pattern_human' a" " - >stderr && - printf '$pattern' | q_to_nul >f && - test_must_fail env LC_ALL=\"$lc_all\" git grep $extra_flags -f f $flags a 2>stderr && - test_i18ngrep ! 'This is only supported with -P under PCRE v2' stderr - " - elif test "$matches" = P - then - test_expect_success $prereqs "error, PCRE v2 only: LC_ALL='$lc_all' git grep -f f $flags '$pattern_human' a" " - >stderr && - printf '$pattern' | q_to_nul >f && - test_must_fail env LC_ALL=\"$lc_all\" git grep -f f $flags a 2>stderr && - test_i18ngrep 'This is only supported with -P under PCRE v2' stderr - " - else - test_expect_success "PANIC: Test framework error. Unknown matches value $matches" 'false' - fi -} - -nul_match () { - matches=$1 - matches_pcre2=$2 - matches_pcre2_locale=$3 - flags=$4 - pattern=$5 - pattern_human=$(echo "$pattern" | sed 's/Q//g') - - nul_match_internal "$matches" "" "C" "" "$flags" "$pattern" - nul_match_internal "$matches_pcre2" "LIBPCRE2" "C" "-P" "$flags" "$pattern" - nul_match_internal "$matches_pcre2_locale" "LIBPCRE2,GETTEXT_LOCALE" "$is_IS_locale" "-P" "$flags" "$pattern" -} - -test_expect_success 'setup' " - echo 'binaryQfileQm[*]cQ*æQð' | q_to_nul >a && - git add a && - git commit -m. -" - -# Simple fixed-string matching that can use kwset (no -i && non-ASCII) -nul_match P P P '-F' 'yQf' -nul_match P P P '-F' 'yQx' -nul_match P P P '-Fi' 'YQf' -nul_match P P P '-Fi' 'YQx' -nul_match P P 1 '' 'yQf' -nul_match P P 0 '' 'yQx' -nul_match P P 1 '' 'æQð' -nul_match P P P '-F' 'eQm[*]c' -nul_match P P P '-Fi' 'EQM[*]C' - -# Regex patterns that would match but shouldn't with -F -nul_match P P P '-F' 'yQ[f]' -nul_match P P P '-F' '[y]Qf' -nul_match P P P '-Fi' 'YQ[F]' -nul_match P P P '-Fi' '[Y]QF' -nul_match P P P '-F' 'æQ[ð]' -nul_match P P P '-F' '[æ]Qð' - -# The -F kwset codepath can't handle -i && non-ASCII... -nul_match P 1 1 '-i' '[æ]Qð' - -# ...PCRE v2 only matches non-ASCII with -i casefolding under UTF-8 -# semantics -nul_match P P P '-Fi' 'ÆQ[Ð]' -nul_match P 0 1 '-i' 'ÆQ[Ð]' -nul_match P 0 1 '-i' '[Æ]QÐ' -nul_match P 0 1 '-i' '[Æ]Qð' -nul_match P 0 1 '-i' 'ÆQÐ' - -# \0 in regexes can only work with -P & PCRE v2 -nul_match P P 1 '' 'yQ[f]' -nul_match P P 1 '' '[y]Qf' -nul_match P P 1 '-i' 'YQ[F]' -nul_match P P 1 '-i' '[Y]Qf' -nul_match P P 1 '' 'æQ[ð]' -nul_match P P 1 '' '[æ]Qð' -nul_match P P 1 '-i' 'ÆQ[Ð]' -nul_match P P 1 '' 'eQm.*cQ' -nul_match P P 1 '-i' 'EQM.*cQ' -nul_match P P 0 '' 'eQm[*]c' -nul_match P P 0 '-i' 'EQM[*]C' - -# Assert that we're using REG_STARTEND and the pattern doesn't match -# just because it's cut off at the first \0. -nul_match P P 0 '-i' 'NOMATCHQð' -nul_match P P 0 '-i' '[Æ]QNOMATCH' -nul_match P P 0 '-i' '[æ]QNOMATCH' - -# Ensure that the matcher doesn't regress to something that stops at -# \0 -nul_match P P P '-F' 'yQ[f]' -nul_match P P P '-Fi' 'YQ[F]' -nul_match P P 0 '' 'yQNOMATCH' -nul_match P P 0 '' 'QNOMATCH' -nul_match P P 0 '-i' 'YQNOMATCH' -nul_match P P 0 '-i' 'QNOMATCH' -nul_match P P P '-F' 'æQ[ð]' -nul_match P P P '-Fi' 'ÆQ[Ð]' -nul_match P P 1 '-i' 'ÆQ[Ð]' -nul_match P P 0 '' 'yQNÓMATCH' -nul_match P P 0 '' 'QNÓMATCH' -nul_match P P 0 '-i' 'YQNÓMATCH' -nul_match P P 0 '-i' 'QNÓMATCH' - -test_done diff --git a/third_party/git/t/t8003-blame-corner-cases.sh b/third_party/git/t/t8003-blame-corner-cases.sh index 9130b887d2cc..1c5fb1d1f8c9 100755 --- a/third_party/git/t/t8003-blame-corner-cases.sh +++ b/third_party/git/t/t8003-blame-corner-cases.sh @@ -173,6 +173,7 @@ test_expect_success 'blame during cherry-pick with file rename conflict' ' git show HEAD@{1}:rodent > rodent && git add rodent && git blame -f -C -C1 rodent | sed -e "$pick_fc" >current && + cat current && cat >expected <<-\EOF && mouse-Initial mouse-Second diff --git a/third_party/git/t/t9001-send-email.sh b/third_party/git/t/t9001-send-email.sh index 90f61c340095..997f90b42b3e 100755 --- a/third_party/git/t/t9001-send-email.sh +++ b/third_party/git/t/t9001-send-email.sh @@ -1194,8 +1194,8 @@ test_expect_success $PREREQ 'in-reply-to but no threading' ' --to=nobody@example.com \ --in-reply-to="" \ --no-thread \ - $patches >out && - grep "In-Reply-To: " out + $patches | + grep "In-Reply-To: " ' test_expect_success $PREREQ 'no in-reply-to and no threading' ' @@ -1260,7 +1260,7 @@ test_expect_success $PREREQ 'sendemail.identity: --no-identity clears previous i grep "To: default@example.com" stdout ' -test_expect_success $PREREQ 'sendemail.identity: bool identity variable existence overrides' ' +test_expect_success $PREREQ 'sendemail.identity: bool identity variable existance overrides' ' git -c sendemail.identity=cloud \ -c sendemail.xmailer=true \ -c sendemail.cloud.xmailer=false \ @@ -2066,7 +2066,7 @@ test_expect_success $PREREQ 'leading and trailing whitespaces are removed' ' TO1=$(echo "QTo 1 " | q_to_tab) && TO2=$(echo "QZto2" | qz_to_tab_space) && CC1=$(echo "cc1" | append_cr) && - BCC1=$(echo " bcc1@example.com Q" | q_to_nul) && + BCC1=$(echo "Q bcc1@example.com Q" | q_to_nul) && git send-email \ --dry-run \ --from=" Example " \ diff --git a/third_party/git/t/t9010-svn-fe.sh b/third_party/git/t/t9010-svn-fe.sh index c90fdc5c8940..0b20b07e6898 100755 --- a/third_party/git/t/t9010-svn-fe.sh +++ b/third_party/git/t/t9010-svn-fe.sh @@ -53,6 +53,8 @@ text_no_props () { printf "%s\n" "$text" } +>empty + test_expect_success 'empty dump' ' reinit_git && echo "SVN-fs-dump-format-version: 2" >input && @@ -206,7 +208,7 @@ test_expect_failure 'timestamp and empty file' ' test_cmp expect.date actual.date && test_cmp expect.files actual.files && git checkout HEAD empty-file && - test_must_be_empty file + test_cmp empty file ' test_expect_success 'directory with files' ' diff --git a/third_party/git/t/t9106-git-svn-commit-diff-clobber.sh b/third_party/git/t/t9106-git-svn-commit-diff-clobber.sh index aec45bca3b7b..dbe8deac0d2f 100755 --- a/third_party/git/t/t9106-git-svn-commit-diff-clobber.sh +++ b/third_party/git/t/t9106-git-svn-commit-diff-clobber.sh @@ -92,8 +92,7 @@ test_expect_success 'multiple dcommit from git svn will not clobber svn' " test_expect_success 'check that rebase really failed' ' - git status >output && - grep currently.rebasing output + test -d .git/rebase-apply ' test_expect_success 'resolve, continue the rebase and dcommit' " diff --git a/third_party/git/t/t9116-git-svn-log.sh b/third_party/git/t/t9116-git-svn-log.sh index 0a9f1ef366db..45773ee560da 100755 --- a/third_party/git/t/t9116-git-svn-log.sh +++ b/third_party/git/t/t9116-git-svn-log.sh @@ -43,18 +43,14 @@ test_expect_success 'setup repository and import' ' test_expect_success 'run log' " git reset --hard origin/a && - git svn log -r2 origin/trunk >out && - grep ^r2 out && - git svn log -r4 origin/trunk >out && - grep ^r4 out && - git svn log -r3 >out && - grep ^r3 out + git svn log -r2 origin/trunk | grep ^r2 && + git svn log -r4 origin/trunk | grep ^r4 && + git svn log -r3 | grep ^r3 " test_expect_success 'run log against a from trunk' " git reset --hard origin/trunk && - git svn log -r3 origin/a >out && - grep ^r3 out + git svn log -r3 origin/a | grep ^r3 " printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4 diff --git a/third_party/git/t/t9300-fast-import.sh b/third_party/git/t/t9300-fast-import.sh index 3e41c58a1368..141b7fa35e74 100755 --- a/third_party/git/t/t9300-fast-import.sh +++ b/third_party/git/t/t9300-fast-import.sh @@ -85,36 +85,6 @@ test_expect_success 'A: create pack from stdin' ' An annotated tag that annotates a blob. EOF - tag to-be-deleted - from :3 - data <expect <<-EOF && :2 $(git rev-parse --verify master:file2) :3 $(git rev-parse --verify master:file3) :4 $(git rev-parse --verify master:file4) :5 $(git rev-parse --verify master^0) - :6 $(git cat-file tag nested | grep object | cut -d" " -f 2) - :7 $(git rev-parse --verify nested) - :8 $(git rev-parse --verify master^0) EOF test_cmp expect marks.out ' @@ -1047,6 +1010,7 @@ test_expect_success 'M: rename root to subdirectory' ' EOF git fast-import actual && + cat actual && compare_diff_raw expect actual ' @@ -2142,27 +2106,12 @@ test_expect_success 'R: abort on receiving feature after data command' ' test_must_fail git fast-import git.marks && - echo "feature import-marks=git.marks" >input && - test_must_fail git fast-import input && - test_must_fail git fast-import git.marks && - >git2.marks && cat >input <<-EOF && feature import-marks=git.marks feature import-marks=git2.marks EOF - test_must_fail git fast-import --allow-unsafe-features input && test_must_fail git fast-import input <<-\EOF && - feature export-marks=feature-sub/git.marks - blob - mark :1 - data 3 - hi - - EOF - git fast-import --allow-unsafe-features \ - --export-marks=cmdline-sub/other.marks expect && echo ":2 $blob" >>expect && - git fast-import --export-marks=io.marks \ - --allow-unsafe-features <<-\EOF && + git fast-import --export-marks=io.marks <<-\EOF && feature import-marks-if-exists=io.marks blob mark :2 @@ -2279,8 +2216,7 @@ test_expect_success 'R: feature import-marks-if-exists' ' echo ":3 $blob" >>expect && git fast-import --import-marks=io.marks \ - --export-marks=io.marks \ - --allow-unsafe-features <<-\EOF && + --export-marks=io.marks <<-\EOF && feature import-marks-if-exists=not_io.marks blob mark :3 @@ -2291,8 +2227,7 @@ test_expect_success 'R: feature import-marks-if-exists' ' test_cmp expect io.marks && git fast-import --import-marks-if-exists=not_io.marks \ - --export-marks=io.marks \ - --allow-unsafe-features <<-\EOF && + --export-marks=io.marks <<-\EOF && feature import-marks-if-exists=io.marks EOF test_must_be_empty io.marks @@ -2304,7 +2239,7 @@ test_expect_success 'R: import to output marks works without any content' ' feature export-marks=marks.new EOF - git fast-import --allow-unsafe-features one.marks && tail -n +3 marks.out > two.marks && - git fast-import --import-marks=one.marks --import-marks=two.marks \ - --allow-unsafe-features expect.response && rm -f blobs && + cat >frontend <<-\FRONTEND_END && + #!/bin/sh + FRONTEND_END mkfifo blobs && ( @@ -2620,7 +2557,7 @@ test_expect_success 'R: quiet option results in no stats being output' ' EOF - git fast-import 2>output output && test_must_be_empty output ' @@ -2844,6 +2781,7 @@ test_expect_success 'S: filemodify with garbage after mark must fail' ' COMMIT M 100644 :403x hello.c EOF + cat err && test_i18ngrep "space after mark" err ' @@ -2860,6 +2798,7 @@ test_expect_success 'S: filemodify with garbage after inline must fail' ' inline BLOB EOF + cat err && test_i18ngrep "nvalid dataref" err ' @@ -2873,6 +2812,7 @@ test_expect_success 'S: filemodify with garbage after sha1 must fail' ' COMMIT M 100644 ${sha1}x hello.c EOF + cat err && test_i18ngrep "space after SHA1" err ' @@ -2888,6 +2828,7 @@ test_expect_success 'S: notemodify with garbage after mark dataref must fail' ' COMMIT N :202x :302 EOF + cat err && test_i18ngrep "space after mark" err ' @@ -2903,6 +2844,7 @@ test_expect_success 'S: notemodify with garbage after inline dataref must fail' note blob BLOB EOF + cat err && test_i18ngrep "nvalid dataref" err ' @@ -2916,6 +2858,7 @@ test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' ' COMMIT N ${sha1}x :302 EOF + cat err && test_i18ngrep "space after SHA1" err ' @@ -2931,6 +2874,7 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' COMMIT N :202 :302x EOF + cat err && test_i18ngrep "after mark" err ' @@ -2964,6 +2908,7 @@ test_expect_success 'S: from with garbage after mark must fail' ' EOF # now evaluate the error + cat err && test_i18ngrep "after mark" err ' @@ -2983,6 +2928,7 @@ test_expect_success 'S: merge with garbage after mark must fail' ' merge :303x M 100644 :403 hello.c EOF + cat err && test_i18ngrep "after mark" err ' @@ -2998,6 +2944,7 @@ test_expect_success 'S: tag with garbage after mark must fail' ' tag S TAG EOF + cat err && test_i18ngrep "after mark" err ' @@ -3008,6 +2955,7 @@ test_expect_success 'S: cat-blob with garbage after mark must fail' ' test_must_fail git fast-import --import-marks=marks <<-EOF 2>err && cat-blob :403x EOF + cat err && test_i18ngrep "after mark" err ' @@ -3018,6 +2966,7 @@ test_expect_success 'S: ls with garbage after mark must fail' ' test_must_fail git fast-import --import-marks=marks <<-EOF 2>err && ls :302x hello.c EOF + cat err && test_i18ngrep "space after mark" err ' @@ -3026,6 +2975,7 @@ test_expect_success 'S: ls with garbage after sha1 must fail' ' test_must_fail git fast-import --import-marks=marks <<-EOF 2>err && ls ${sha1}x hello.c EOF + cat err && test_i18ngrep "space after tree-ish" err ' @@ -3190,22 +3140,13 @@ background_import_then_checkpoint () { exec 9<>V.output rm V.output - ( - git fast-import $options <&8 >&9 & - echo $! >&9 - wait $! - echo >&2 "background fast-import terminated too early with exit code $?" - # Un-block the read loop in the main shell process. - echo >&9 UNEXPECTED - ) & - sh_pid=$! - read fi_pid <&9 + git fast-import $options <&8 >&9 & + echo $! >V.pid # We don't mind if fast-import has already died by the time the test # ends. test_when_finished " exec 8>&-; exec 9>&-; - kill $sh_pid && wait $sh_pid - kill $fi_pid && wait $fi_pid + kill $(cat V.pid) && wait $(cat V.pid) true" # Start in the background to ensure we adhere strictly to (blocking) @@ -3225,9 +3166,6 @@ background_import_then_checkpoint () { then error=0 break - elif test "$output" = "UNEXPECTED" - then - break fi # otherwise ignore cruft echo >&2 "cruft: $output" @@ -3240,7 +3178,7 @@ background_import_then_checkpoint () { } background_import_still_running () { - if ! kill -0 "$fi_pid" + if ! kill -0 "$(cat V.pid)" then echo >&2 "background fast-import terminated too early" false diff --git a/third_party/git/t/t9301-fast-import-notes.sh b/third_party/git/t/t9301-fast-import-notes.sh index ca223dca9888..dadc70b7d570 100755 --- a/third_party/git/t/t9301-fast-import-notes.sh +++ b/third_party/git/t/t9301-fast-import-notes.sh @@ -275,7 +275,7 @@ $whitespace third note for first commit EXPECT_END -test_expect_success 'add concatenation notes with M command' ' +test_expect_success 'add concatentation notes with M command' ' git fast-import actual && diff --git a/third_party/git/t/t9350-fast-export.sh b/third_party/git/t/t9350-fast-export.sh index 690c90fb8290..b4004e05c2a7 100755 --- a/third_party/git/t/t9350-fast-export.sh +++ b/third_party/git/t/t9350-fast-export.sh @@ -53,33 +53,6 @@ test_expect_success 'fast-export | fast-import' ' ' -test_expect_success 'fast-export ^muss^{commit} muss' ' - git fast-export --tag-of-filtered-object=rewrite ^muss^{commit} muss >actual && - cat >expected <<-EOF && - tag muss - from $(git rev-parse --verify muss^{commit}) - $(git cat-file tag muss | grep tagger) - data 9 - valentin - - EOF - test_cmp expected actual -' - -test_expect_success 'fast-export --mark-tags ^muss^{commit} muss' ' - git fast-export --mark-tags --tag-of-filtered-object=rewrite ^muss^{commit} muss >actual && - cat >expected <<-EOF && - tag muss - mark :1 - from $(git rev-parse --verify muss^{commit}) - $(git cat-file tag muss | grep tagger) - data 9 - valentin - - EOF - test_cmp expected actual -' - test_expect_success 'fast-export master~2..master' ' git fast-export master~2..master >actual && @@ -540,41 +513,10 @@ test_expect_success 'tree_tag' ' ' # NEEDSWORK: not just check return status, but validate the output -# Note that these tests DO NOTHING other than print a warning that -# they are omitting the one tag we asked them to export (because the -# tags resolve to a tree). They exist just to make sure we do not -# abort but instead just warn. test_expect_success 'tree_tag-obj' 'git fast-export tree_tag-obj' test_expect_success 'tag-obj_tag' 'git fast-export tag-obj_tag' test_expect_success 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj' -test_expect_success 'handling tags of blobs' ' - git tag -a -m "Tag of a blob" blobtag $(git rev-parse master:file) && - git fast-export blobtag >actual && - cat >expect <<-EOF && - blob - mark :1 - data 9 - die Luft - - tag blobtag - from :1 - tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE - data 14 - Tag of a blob - - EOF - test_cmp expect actual -' - -test_expect_success 'handling nested tags' ' - git tag -a -m "This is a nested tag" nested muss && - git fast-export --mark-tags nested >output && - grep "^from $ZERO_OID$" output && - grep "^tag nested$" output >tag_lines && - test_line_count = 2 tag_lines -' - test_expect_success 'directory becomes symlink' ' git init dirtosymlink && git init result && @@ -600,10 +542,9 @@ test_expect_success 'directory becomes symlink' ' test_expect_success 'fast-export quotes pathnames' ' git init crazy-paths && - test_config -C crazy-paths core.protectNTFS false && (cd crazy-paths && blob=$(echo foo | git hash-object -w --stdin) && - git -c core.protectNTFS=false update-index --add \ + git update-index --add \ --cacheinfo 100644 $blob "$(printf "path with\\nnewline")" \ --cacheinfo 100644 $blob "path with \"quote\"" \ --cacheinfo 100644 $blob "path with \\backslash" \ @@ -626,15 +567,17 @@ test_expect_success 'fast-export quotes pathnames' ' ' test_expect_success 'test bidirectionality' ' + >marks-cur && + >marks-new && git init marks-test && - git fast-export --export-marks=marks-cur --import-marks-if-exists=marks-cur --branches | \ - git --git-dir=marks-test/.git fast-import --export-marks=marks-new --import-marks-if-exists=marks-new && + git fast-export --export-marks=marks-cur --import-marks=marks-cur --branches | \ + git --git-dir=marks-test/.git fast-import --export-marks=marks-new --import-marks=marks-new && (cd marks-test && git reset --hard && echo Wohlauf > file && git commit -a -m "back in time") && - git --git-dir=marks-test/.git fast-export --export-marks=marks-new --import-marks-if-exists=marks-new --branches | \ - git fast-import --export-marks=marks-cur --import-marks-if-exists=marks-cur + git --git-dir=marks-test/.git fast-export --export-marks=marks-new --import-marks=marks-new --branches | \ + git fast-import --export-marks=marks-cur --import-marks=marks-cur ' cat > expected << EOF diff --git a/third_party/git/t/t9502-gitweb-standalone-parse-output.sh b/third_party/git/t/t9502-gitweb-standalone-parse-output.sh index e38cbc97d38e..0796a438bc77 100755 --- a/third_party/git/t/t9502-gitweb-standalone-parse-output.sh +++ b/third_party/git/t/t9502-gitweb-standalone-parse-output.sh @@ -188,8 +188,8 @@ test_expect_success 'forks: project_index lists all projects (incl. forks)' ' ' xss() { - echo >&2 "Checking $*..." && - gitweb_run "$@" && + echo >&2 "Checking $1..." && + gitweb_run "$1" && if grep "$TAG" gitweb.body; then echo >&2 "xss: $TAG should have been quoted in output" return 1 @@ -200,8 +200,7 @@ xss() { test_expect_success 'xss checks' ' TAG="" && xss "a=rss&p=$TAG" && - xss "a=rss&p=foo.git&f=$TAG" && - xss "" "$TAG+" + xss "a=rss&p=foo.git&f=$TAG" ' test_done diff --git a/third_party/git/t/t9800-git-p4-basic.sh b/third_party/git/t/t9800-git-p4-basic.sh index c98c1dfc2308..5856563068c7 100755 --- a/third_party/git/t/t9800-git-p4-basic.sh +++ b/third_party/git/t/t9800-git-p4-basic.sh @@ -202,6 +202,7 @@ test_expect_success 'exit when p4 fails to produce marshaled output' ' export PATH && test_expect_code 1 git p4 clone --dest="$git" //depot >errs 2>&1 ) && + cat errs && test_i18ngrep ! Traceback errs ' diff --git a/third_party/git/t/t9809-git-p4-client-view.sh b/third_party/git/t/t9809-git-p4-client-view.sh index 9c9710d8c7b8..3cff1fce1b74 100755 --- a/third_party/git/t/t9809-git-p4-client-view.sh +++ b/third_party/git/t/t9809-git-p4-client-view.sh @@ -407,7 +407,7 @@ test_expect_success 'reinit depot' ' ' # -# What happens when two files of the same name are overlaid together? +# What happens when two files of the same name are overlayed together? # The last-listed file should take preference. # # //depot diff --git a/third_party/git/t/t9810-git-p4-rcs.sh b/third_party/git/t/t9810-git-p4-rcs.sh index e3836888ec8b..57b533dc6fba 100755 --- a/third_party/git/t/t9810-git-p4-rcs.sh +++ b/third_party/git/t/t9810-git-p4-rcs.sh @@ -294,6 +294,7 @@ test_expect_success 'cope with rcs keyword file deletion' ' echo "\$Revision\$" >kwdelfile.c && p4 add -t ktext kwdelfile.c && p4 submit -d "Add file to be deleted" && + cat kwdelfile.c && grep 1 kwdelfile.c ) && git p4 clone --dest="$git" //depot && diff --git a/third_party/git/t/t9902-completion.sh b/third_party/git/t/t9902-completion.sh index 5505e5aa249e..75512c340366 100755 --- a/third_party/git/t/t9902-completion.sh +++ b/third_party/git/t/t9902-completion.sh @@ -28,10 +28,10 @@ complete () # # (2) A test makes sure that common subcommands are included in the # completion for "git ", and a plumbing is excluded. "add", -# "rebase" and "ls-files" are listed for this. +# "filter-branch" and "ls-files" are listed for this. -GIT_TESTING_ALL_COMMAND_LIST='add checkout check-attr rebase ls-files' -GIT_TESTING_PORCELAIN_COMMAND_LIST='add checkout rebase' +GIT_TESTING_ALL_COMMAND_LIST='add checkout check-attr filter-branch ls-files' +GIT_TESTING_PORCELAIN_COMMAND_LIST='add checkout filter-branch' . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" @@ -378,7 +378,7 @@ test_expect_success '__gitdir - finds repo' ' ' -test_expect_success '__gitdir - returns error when cannot find repo' ' +test_expect_success '__gitdir - returns error when cant find repo' ' ( __git_dir="non-existing" && test_must_fail __gitdir >"$actual" @@ -945,7 +945,7 @@ test_expect_success 'setup for filtering matching refs' ' rm -f .git/FETCH_HEAD ' -test_expect_success '__git_refs - do not filter refs unless told so' ' +test_expect_success '__git_refs - dont filter refs unless told so' ' cat >expected <<-EOF && HEAD master @@ -1257,7 +1257,7 @@ test_path_completion () # In the following tests calling this function we only # care about how __git_complete_index_file() deals with # unusual characters in path names. By requesting only - # untracked files we do not have to bother adding any + # untracked files we dont have to bother adding any # paths to the index in those tests. __git_complete_index_file --others && print_comp @@ -1363,63 +1363,6 @@ test_expect_success 'teardown after path completion tests' ' BS\\dir '$'separators\034in\035dir'' ' -test_expect_success '__git_find_on_cmdline - single match' ' - echo list >expect && - ( - words=(git command --opt list) && - cword=${#words[@]} && - __git_find_on_cmdline "add list remove" >actual - ) && - test_cmp expect actual -' - -test_expect_success '__git_find_on_cmdline - multiple matches' ' - echo remove >expect && - ( - words=(git command -o --opt remove list add) && - cword=${#words[@]} && - __git_find_on_cmdline "add list remove" >actual - ) && - test_cmp expect actual -' - -test_expect_success '__git_find_on_cmdline - no match' ' - ( - words=(git command --opt branch) && - cword=${#words[@]} && - __git_find_on_cmdline "add list remove" >actual - ) && - test_must_be_empty actual -' - -test_expect_success '__git_find_on_cmdline - single match with index' ' - echo "3 list" >expect && - ( - words=(git command --opt list) && - cword=${#words[@]} && - __git_find_on_cmdline --show-idx "add list remove" >actual - ) && - test_cmp expect actual -' - -test_expect_success '__git_find_on_cmdline - multiple matches with index' ' - echo "4 remove" >expect && - ( - words=(git command -o --opt remove list add) && - cword=${#words[@]} && - __git_find_on_cmdline --show-idx "add list remove" >actual - ) && - test_cmp expect actual -' - -test_expect_success '__git_find_on_cmdline - no match with index' ' - ( - words=(git command --opt branch) && - cword=${#words[@]} && - __git_find_on_cmdline --show-idx "add list remove" >actual - ) && - test_must_be_empty actual -' test_expect_success '__git_get_config_variables' ' cat >expect <<-EOF && @@ -1449,12 +1392,12 @@ test_expect_success 'basic' ' # built-in grep -q "^add \$" out && # script - grep -q "^rebase \$" out && + grep -q "^filter-branch \$" out && # plumbing ! grep -q "^ls-files \$" out && - run_completion "git r" && - ! grep -q -v "^r" out + run_completion "git f" && + ! grep -q -v "^f" out ' test_expect_success 'double dash "git" itself' ' @@ -1495,8 +1438,6 @@ test_expect_success 'double dash "git checkout"' ' --no-guess Z --no-... Z --overlay Z - --pathspec-file-nul Z - --pathspec-from-file=Z EOF ' @@ -1607,10 +1548,7 @@ test_expect_success 'complete tree filename with metacharacters' ' ' test_expect_success PERL 'send-email' ' - test_completion "git send-email --cov" <<-\EOF && - --cover-from-description=Z - --cover-letter Z - EOF + test_completion "git send-email --cov" "--cover-letter " && test_completion "git send-email ma" "master " ' @@ -1760,69 +1698,6 @@ do ' done -test_expect_success 'git config - section' ' - test_completion "git config br" <<-\EOF - branch.Z - browser.Z - EOF -' - -test_expect_success 'git config - variable name' ' - test_completion "git config log.d" <<-\EOF - log.date Z - log.decorate Z - EOF -' - -test_expect_success 'git config - value' ' - test_completion "git config color.pager " <<-\EOF - false Z - true Z - EOF -' - -test_expect_success 'git -c - section' ' - test_completion "git -c br" <<-\EOF - branch.Z - browser.Z - EOF -' - -test_expect_success 'git -c - variable name' ' - test_completion "git -c log.d" <<-\EOF - log.date=Z - log.decorate=Z - EOF -' - -test_expect_success 'git -c - value' ' - test_completion "git -c color.pager=" <<-\EOF - false Z - true Z - EOF -' - -test_expect_success 'git clone --config= - section' ' - test_completion "git clone --config=br" <<-\EOF - branch.Z - browser.Z - EOF -' - -test_expect_success 'git clone --config= - variable name' ' - test_completion "git clone --config=log.d" <<-\EOF - log.date=Z - log.decorate=Z - EOF -' - -test_expect_success 'git clone --config= - value' ' - test_completion "git clone --config=color.pager=" <<-\EOF - false Z - true Z - EOF -' - test_expect_success 'sourcing the completion script clears cached commands' ' __git_compute_all_commands && verbose test -n "$__git_all_commands" && diff --git a/third_party/git/t/t9903-bash-prompt.sh b/third_party/git/t/t9903-bash-prompt.sh index ab5da2cabc40..88bc733ad691 100755 --- a/third_party/git/t/t9903-bash-prompt.sh +++ b/third_party/git/t/t9903-bash-prompt.sh @@ -163,7 +163,7 @@ test_expect_success 'prompt - inside bare repository' ' ' test_expect_success 'prompt - interactive rebase' ' - printf " (b1|REBASE 2/3)" >expected && + printf " (b1|REBASE-i 2/3)" >expected && write_script fake_editor.sh <<-\EOF && echo "exec echo" >"$1" echo "edit $(git log -1 --format="%h")" >>"$1" @@ -180,7 +180,7 @@ test_expect_success 'prompt - interactive rebase' ' ' test_expect_success 'prompt - rebase merge' ' - printf " (b2|REBASE 1/3)" >expected && + printf " (b2|REBASE-i 1/3)" >expected && git checkout b2 && test_when_finished "git checkout master" && test_must_fail git rebase --merge b1 b2 && @@ -189,11 +189,11 @@ test_expect_success 'prompt - rebase merge' ' test_cmp expected "$actual" ' -test_expect_success 'prompt - rebase am' ' +test_expect_success 'prompt - rebase' ' printf " (b2|REBASE 1/3)" >expected && git checkout b2 && test_when_finished "git checkout master" && - test_must_fail git rebase --apply b1 b2 && + test_must_fail git rebase b1 b2 && test_when_finished "git rebase --abort" && __git_ps1 >"$actual" && test_cmp expected "$actual" diff --git a/third_party/git/t/test-lib-functions.sh b/third_party/git/t/test-lib-functions.sh index 352c213d52e2..e0b3f28d3a96 100644 --- a/third_party/git/t/test-lib-functions.sh +++ b/third_party/git/t/test-lib-functions.sh @@ -228,11 +228,9 @@ test_commit () { # can be a tag pointing to the commit-to-merge. test_merge () { - label="$1" && - shift && test_tick && - git merge -m "$label" "$@" && - git tag "$label" + git merge -m "$1" "$2" && + git tag "$1" } # Efficiently create commits, each with a unique number (from 1 to @@ -308,7 +306,7 @@ test_commit_bulk () { total=$1 add_from= - if git -C "$indir" rev-parse --quiet --verify "$ref" + if git -C "$indir" rev-parse --verify "$ref" then add_from=t fi @@ -582,7 +580,7 @@ test_expect_failure () { export test_prereq if ! test_skip "$@" then - say >&3 "checking known breakage of $TEST_NUMBER.$test_count '$1': $2" + say >&3 "checking known breakage: $2" if test_run_ "$2" expecting_failure then test_known_broken_ok_ "$1" @@ -602,7 +600,7 @@ test_expect_success () { export test_prereq if ! test_skip "$@" then - say >&3 "expecting success of $TEST_NUMBER.$test_count '$1': $2" + say >&3 "expecting success: $2" if test_run_ "$2" then test_ok_ "$1" @@ -1012,30 +1010,19 @@ test_must_be_empty () { fi } -# Tests that its two parameters refer to the same revision, or if '!' is -# provided first, that its other two parameters refer to different -# revisions. +# Tests that its two parameters refer to the same revision test_cmp_rev () { - local op='=' wrong_result=different - - if test $# -ge 1 && test "x$1" = 'x!' - then - op='!=' - wrong_result='the same' - shift - fi if test $# != 2 then error "bug in the test script: test_cmp_rev requires two revisions, but got $#" else local r1 r2 r1=$(git rev-parse --verify "$1") && - r2=$(git rev-parse --verify "$2") || return 1 - - if ! test "$r1" "$op" "$r2" + r2=$(git rev-parse --verify "$2") && + if test "$r1" != "$r2" then cat >&4 <<-EOF - error: two revisions point to $wrong_result objects: + error: two revisions point to different objects: '$1': $r1 '$2': $r2 EOF @@ -1186,34 +1173,6 @@ perl () { command "$PERL_PATH" "$@" 2>&7 } 7>&2 2>&4 -# Given the name of an environment variable with a bool value, normalize -# its value to a 0 (true) or 1 (false or empty string) return code. -# -# test_bool_env GIT_TEST_HTTPD -# -# Return with code corresponding to the given default value if the variable -# is unset. -# Abort the test script if either the value of the variable or the default -# are not valid bool values. - -test_bool_env () { - if test $# != 2 - then - BUG "test_bool_env requires two parameters (variable name and default value)" - fi - - git env--helper --type=bool --default="$2" --exit-code "$1" - ret=$? - case $ret in - 0|1) # unset or valid bool value - ;; - *) # invalid bool value or something unexpected - error >&7 "test_bool_env requires bool values both for \$$1 and for the default fallback" - ;; - esac - return $ret -} - # Exit the test suite, either by skipping all remaining tests or by # exiting with an error. If our prerequisite variable $1 falls back # on a default assume we were opportunistically trying to set up some @@ -1222,7 +1181,7 @@ test_bool_env () { # The error/skip message should be given by $2. # test_skip_or_die () { - if ! test_bool_env "$1" false + if ! git env--helper --type=bool --default=false --exit-code $1 then skip_all=$2 test_done @@ -1516,30 +1475,3 @@ test_set_port () { port=$(($port + ${GIT_TEST_STRESS_JOB_NR:-0})) eval $var=$port } - -# Compare a file containing rev-list bitmap traversal output to its non-bitmap -# counterpart. You can't just use test_cmp for this, because the two produce -# subtly different output: -# -# - regular output is in traversal order, whereas bitmap is split by type, -# with non-packed objects at the end -# -# - regular output has a space and the pathname appended to non-commit -# objects; bitmap output omits this -# -# This function normalizes and compares the two. The second file should -# always be the bitmap output. -test_bitmap_traversal () { - if test "$1" = "--no-confirm-bitmaps" - then - shift - elif cmp "$1" "$2" - then - echo >&2 "identical raw outputs; are you sure bitmaps were used?" - return 1 - fi && - cut -d' ' -f1 "$1" | sort >"$1.normalized" && - sort "$2" >"$2.normalized" && - test_cmp "$1.normalized" "$2.normalized" && - rm -f "$1.normalized" "$2.normalized" -} diff --git a/third_party/git/t/test-lib.sh b/third_party/git/t/test-lib.sh index 0ea1e5a05edd..30b07e310f59 100644 --- a/third_party/git/t/test-lib.sh +++ b/third_party/git/t/test-lib.sh @@ -212,8 +212,6 @@ fi TEST_STRESS_JOB_SFX="${GIT_TEST_STRESS_JOB_NR:+.stress-$GIT_TEST_STRESS_JOB_NR}" TEST_NAME="$(basename "$0" .sh)" -TEST_NUMBER="${TEST_NAME%%-*}" -TEST_NUMBER="${TEST_NUMBER#t}" TEST_RESULTS_DIR="$TEST_OUTPUT_DIRECTORY/test-results" TEST_RESULTS_BASE="$TEST_RESULTS_DIR/$TEST_NAME$TEST_STRESS_JOB_SFX" TRASH_DIRECTORY="trash directory.$TEST_NAME$TEST_STRESS_JOB_SFX" @@ -404,13 +402,9 @@ unset VISUAL EMAIL LANGUAGE COLUMNS $("$PERL_PATH" -e ' unset XDG_CACHE_HOME unset XDG_CONFIG_HOME unset GITPERLLIB -TEST_AUTHOR_LOCALNAME=author -TEST_AUTHOR_DOMAIN=example.com -GIT_AUTHOR_EMAIL=${TEST_AUTHOR_LOCALNAME}@${TEST_AUTHOR_DOMAIN} +GIT_AUTHOR_EMAIL=author@example.com GIT_AUTHOR_NAME='A U Thor' -TEST_COMMITTER_LOCALNAME=committer -TEST_COMMITTER_DOMAIN=example.com -GIT_COMMITTER_EMAIL=${TEST_COMMITTER_LOCALNAME}@${TEST_COMMITTER_DOMAIN} +GIT_COMMITTER_EMAIL=committer@example.com GIT_COMMITTER_NAME='C O Mitter' GIT_MERGE_VERBOSITY=5 GIT_MERGE_AUTOEDIT=no @@ -513,9 +507,6 @@ EMPTY_BLOB=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 LF=' ' -# Single quote -SQ=\' - # UTF-8 ZERO WIDTH NON-JOINER, which HFS+ ignores # when case-folding filenames u200c=$(printf '\342\200\214') @@ -576,7 +567,6 @@ export TERM error () { say_color error "error: $*" - finalize_junit_xml GIT_EXIT_OK=t exit 1 } @@ -705,7 +695,7 @@ test_failure_ () { say_color error "not ok $test_count - $1" shift printf '%s\n' "$*" | sed -e 's/^/# /' - test "$immediate" = "" || { finalize_junit_xml; GIT_EXIT_OK=t; exit 1; } + test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; } } test_known_broken_ok_ () { @@ -1004,12 +994,6 @@ test_skip () { to_skip=t skipped_reason="GIT_SKIP_TESTS" fi - if test -z "$to_skip" && test -n "$run_list" && - ! match_test_selector_list '--run' $test_count "$run_list" - then - to_skip=t - skipped_reason="--run" - fi if test -z "$to_skip" && test -n "$test_prereq" && ! test_have_prereq "$test_prereq" then @@ -1022,6 +1006,12 @@ test_skip () { fi skipped_reason="missing $missing_prereq${of_prereq}" fi + if test -z "$to_skip" && test -n "$run_list" && + ! match_test_selector_list '--run' $test_count "$run_list" + then + to_skip=t + skipped_reason="--run" + fi case "$to_skip" in t) @@ -1073,26 +1063,6 @@ write_junit_xml_testcase () { junit_have_testcase=t } -finalize_junit_xml () { - if test -n "$write_junit_xml" && test -n "$junit_xml_path" - then - test -n "$junit_have_testcase" || { - junit_start=$(test-tool date getnanos) - write_junit_xml_testcase "all tests skipped" - } - - # adjust the overall time - junit_time=$(test-tool date getnanos $junit_suite_start) - sed -e "s/\(]*/& time=\"$junit_time\"/" \ - <"$junit_xml_path" >"$junit_xml_path.new" - mv "$junit_xml_path.new" "$junit_xml_path" - - write_junit_xml " " "" - write_junit_xml= - fi -} - test_atexit_cleanup=: test_atexit_handler () { # In a succeeding test script 'test_atexit_handler' is invoked @@ -1115,7 +1085,21 @@ test_done () { # removed, so the commands can access pidfiles and socket files. test_atexit_handler - finalize_junit_xml + if test -n "$write_junit_xml" && test -n "$junit_xml_path" + then + test -n "$junit_have_testcase" || { + junit_start=$(test-tool date getnanos) + write_junit_xml_testcase "all tests skipped" + } + + # adjust the overall time + junit_time=$(test-tool date getnanos $junit_suite_start) + sed "s/]*/& time=\"$junit_time\"/" \ + <"$junit_xml_path" >"$junit_xml_path.new" + mv "$junit_xml_path.new" "$junit_xml_path" + + write_junit_xml " " "" + fi if test -z "$HARNESS_ACTIVE" then @@ -1407,23 +1391,23 @@ yes () { # The GIT_TEST_FAIL_PREREQS code hooks into test_set_prereq(), and # thus needs to be set up really early, and set an internal variable # for convenience so the hot test_set_prereq() codepath doesn't need -# to call "git env--helper" (via test_bool_env). Only do that work -# if needed by seeing if GIT_TEST_FAIL_PREREQS is set at all. +# to call "git env--helper". Only do that work if needed by seeing if +# GIT_TEST_FAIL_PREREQS is set at all. GIT_TEST_FAIL_PREREQS_INTERNAL= if test -n "$GIT_TEST_FAIL_PREREQS" then - if test_bool_env GIT_TEST_FAIL_PREREQS false + if git env--helper --type=bool --default=0 --exit-code GIT_TEST_FAIL_PREREQS then GIT_TEST_FAIL_PREREQS_INTERNAL=true test_set_prereq FAIL_PREREQS fi else test_lazy_prereq FAIL_PREREQS ' - test_bool_env GIT_TEST_FAIL_PREREQS false + git env--helper --type=bool --default=0 --exit-code GIT_TEST_FAIL_PREREQS ' fi -# Fix some commands on Windows, and other OS-specific things +# Fix some commands on Windows uname_s=$(uname -s) case $uname_s in *MINGW*) @@ -1454,12 +1438,6 @@ case $uname_s in test_set_prereq SED_STRIPS_CR test_set_prereq GREP_STRIPS_CR ;; -FreeBSD) - test_set_prereq REGEX_ILLSEQ - test_set_prereq POSIXPERM - test_set_prereq BSLASHPSPEC - test_set_prereq EXECKEEPSPID - ;; *) test_set_prereq POSIXPERM test_set_prereq BSLASHPSPEC @@ -1484,7 +1462,7 @@ then fi test_lazy_prereq C_LOCALE_OUTPUT ' - ! test_bool_env GIT_TEST_GETTEXT_POISON false + ! git env--helper --type=bool --default=0 --exit-code GIT_TEST_GETTEXT_POISON ' if test -z "$GIT_TEST_CHECK_CACHE_TREE" -- cgit 1.4.1