summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/.gitattributes4
-rw-r--r--t/README32
-rw-r--r--t/annotate-tests.sh8
-rw-r--r--t/helper/test-pcre2-config.c12
-rw-r--r--t/helper/test-read-graph.c4
-rw-r--r--t/helper/test-ref-store.c13
-rw-r--r--t/helper/test-tool.c1
-rw-r--r--t/helper/test-tool.h1
-rw-r--r--t/helper/test-trace2.c9
-rw-r--r--t/lib-bitmap.sh26
-rw-r--r--t/lib-bundle.sh (renamed from t/test-bundle-functions.sh)0
-rw-r--r--t/lib-credential.sh2
-rw-r--r--t/lib-diff.sh (renamed from t/diff-lib.sh)0
-rw-r--r--t/lib-diff/COPYING (renamed from t/diff-lib/COPYING)0
-rw-r--r--t/lib-diff/README (renamed from t/diff-lib/README)0
-rw-r--r--t/lib-gettext.sh2
-rw-r--r--t/lib-gitweb.sh (renamed from t/gitweb-lib.sh)0
-rw-r--r--t/lib-log-graph.sh4
-rw-r--r--t/lib-rebase.sh1
-rw-r--r--t/perf/.gitignore1
-rw-r--r--t/perf/Makefile4
-rwxr-xr-xt/perf/p4205-log-pretty-formats.sh2
-rwxr-xr-xt/perf/p5303-many-packs.sh12
-rwxr-xr-xt/perf/p7519-fsmonitor.sh71
-rwxr-xr-xt/t0000-basic.sh572
-rwxr-xr-xt/t0006-date.sh4
-rwxr-xr-xt/t0008-ignores.sh2
-rwxr-xr-xt/t0012-help.sh2
-rwxr-xr-xt/t0017-env-helper.sh8
-rwxr-xr-xt/t0018-advice.sh4
-rwxr-xr-xt/t0020-crlf.sh6
-rwxr-xr-xt/t0021-conversion.sh4
-rwxr-xr-xt/t0027-auto-crlf.sh2
-rwxr-xr-xt/t0040-parse-options.sh8
-rwxr-xr-xt/t0090-cache-tree.sh82
-rwxr-xr-xt/t0201-gettext-fallbacks.sh16
-rwxr-xr-xt/t0205-gettext-poison.sh39
-rwxr-xr-xt/t0210-trace2-normal.sh19
-rwxr-xr-xt/t0300-credentials.sh8
-rwxr-xr-xt/t0500-progress-display.sh25
-rwxr-xr-xt/t1011-read-tree-sparse-checkout.sh2
-rwxr-xr-xt/t1092-sparse-checkout-compatibility.sh301
-rwxr-xr-xt/t1300-config.sh7
-rwxr-xr-xt/t1305-config-include.sh4
-rwxr-xr-xt/t1308-config-set.sh4
-rwxr-xr-xt/t1400-update-ref.sh6
-rwxr-xr-xt/t1404-update-ref-errors.sh2
-rwxr-xr-xt/t1405-main-ref-store.sh8
-rwxr-xr-xt/t1406-submodule-ref-store.sh10
-rwxr-xr-xt/t1410-reflog.sh26
-rwxr-xr-xt/t1430-bad-ref-name.sh2
-rwxr-xr-xt/t1450-fsck.sh32
-rwxr-xr-xt/t1500-rev-parse.sh15
-rwxr-xr-xt/t1502-rev-parse-parseopt.sh10
-rwxr-xr-xt/t1506-rev-parse-diagnosis.sh2
-rwxr-xr-xt/t1507-rev-parse-upstream.sh10
-rwxr-xr-xt/t1509-root-work-tree.sh4
-rwxr-xr-xt/t1512-rev-parse-disambiguation.sh14
-rwxr-xr-xt/t1600-index.sh6
-rwxr-xr-xt/t2006-checkout-index-basic.sh23
-rwxr-xr-xt/t2018-checkout-branch.sh2
-rwxr-xr-xt/t2020-checkout-detach.sh20
-rwxr-xr-xt/t2104-update-index-skip-worktree.sh5
-rwxr-xr-xt/t2200-add-update.sh2
-rwxr-xr-xt/t2401-worktree-prune.sh4
-rwxr-xr-xt/t2402-worktree-list.sh96
-rwxr-xr-xt/t3005-ls-files-relative.sh4
-rwxr-xr-xt/t3012-ls-files-dedup.sh66
-rwxr-xr-xt/t3200-branch.sh26
-rwxr-xr-xt/t3201-branch-contains.sh2
-rwxr-xr-xt/t3203-branch-output.sh28
-rwxr-xr-xt/t3206-range-diff.sh28
-rwxr-xr-xt/t3300-funny-names.sh2
-rwxr-xr-xt/t3301-notes.sh6
-rwxr-xr-xt/t3400-rebase.sh2
-rwxr-xr-xt/t3404-rebase-interactive.sh41
-rwxr-xr-xt/t3406-rebase-message.sh7
-rwxr-xr-xt/t3415-rebase-autosquash.sh18
-rwxr-xr-xt/t3420-rebase-autostash.sh4
-rwxr-xr-xt/t3431-rebase-fork-point.sh55
-rwxr-xr-xt/t3504-cherry-pick-rerere.sh4
-rwxr-xr-xt/t3507-cherry-pick-conflict.sh12
-rwxr-xr-xt/t3508-cherry-pick-many-commits.sh4
-rwxr-xr-xt/t3510-cherry-pick-sequence.sh8
-rwxr-xr-xt/t3600-rm.sh32
-rwxr-xr-xt/t3700-add.sh54
-rwxr-xr-xt/t3701-add-interactive.sh4
-rwxr-xr-xt/t3800-mktag.sh12
-rwxr-xr-xt/t3903-stash.sh8
-rwxr-xr-xt/t3905-stash-include-untracked.sh194
-rwxr-xr-xt/t3910-mac-os-precompose.sh16
-rwxr-xr-xt/t4000-diff-format.sh2
-rwxr-xr-xt/t4001-diff-rename.sh26
-rwxr-xr-xt/t4003-diff-rename-1.sh6
-rwxr-xr-xt/t4004-diff-rename-symlink.sh2
-rwxr-xr-xt/t4005-diff-rename-2.sh6
-rwxr-xr-xt/t4006-diff-mode.sh8
-rwxr-xr-xt/t4007-rename-3.sh6
-rwxr-xr-xt/t4008-diff-break-rewrite.sh6
-rwxr-xr-xt/t4009-diff-rename-4.sh6
-rwxr-xr-xt/t4010-diff-pathspec.sh2
-rwxr-xr-xt/t4011-diff-symlink.sh2
-rwxr-xr-xt/t4012-diff-binary.sh10
-rwxr-xr-xt/t4013-diff-various.sh15
-rw-r--r--t/t4013/diff.log_--cc_-m_-p_master200
-rw-r--r--t/t4013/diff.log_--diff-merges=first-parent_master56
-rw-r--r--t/t4013/diff.log_-c_-m_-p_master200
-rw-r--r--t/t4013/diff.log_-p_--diff-merges=first-parent_master137
-rwxr-xr-xt/t4014-format-patch.sh6
-rwxr-xr-xt/t4015-diff-whitespace.sh2
-rwxr-xr-xt/t4016-diff-quote.sh2
-rwxr-xr-xt/t4027-diff-submodule.sh2
-rwxr-xr-xt/t4030-diff-textconv.sh2
-rwxr-xr-xt/t4034-diff-words.sh2
-rwxr-xr-xt/t4038-diff-combined.sh2
-rwxr-xr-xt/t4045-diff-relative.sh2
-rwxr-xr-xt/t4049-diff-stat-count.sh6
-rwxr-xr-xt/t4056-diff-order.sh72
-rwxr-xr-xt/t4061-diff-indent.sh2
-rwxr-xr-xt/t4100-apply-stat.sh4
-rwxr-xr-xt/t4150-am.sh2
-rwxr-xr-xt/t4153-am-resume-override-opts.sh2
-rwxr-xr-xt/t4203-mailmap.sh43
-rwxr-xr-xt/t4205-log-pretty-formats.sh4
-rwxr-xr-xt/t4206-log-follow-harder-copies.sh2
-rwxr-xr-xt/t4208-log-magic-pathspec.sh9
-rwxr-xr-xt/t4216-log-bloom.sh4
-rwxr-xr-xt/t4254-am-corrupt.sh2
-rwxr-xr-xt/t5000-tar-tree.sh24
-rwxr-xr-xt/t5004-archive-corner-cases.sh3
-rwxr-xr-xt/t5150-request-pull.sh4
-rwxr-xr-xt/t5300-pack-object.sh4
-rwxr-xr-xt/t5310-pack-bitmaps.sh2
-rwxr-xr-xt/t5316-pack-delta-depth.sh4
-rwxr-xr-xt/t5318-commit-graph.sh104
-rwxr-xr-xt/t5319-multi-pack-index.sh11
-rwxr-xr-xt/t5324-split-commit-graph.sh193
-rwxr-xr-xt/t5325-reverse-index.sh120
-rw-r--r--t/t5411/common-functions.sh20
-rw-r--r--t/t5411/once-0010-report-status-v1.sh5
-rw-r--r--t/t5411/test-0000-standard-git-push.sh32
-rw-r--r--t/t5411/test-0001-standard-git-push--porcelain.sh32
-rw-r--r--t/t5411/test-0002-pre-receive-declined.sh10
-rw-r--r--t/t5411/test-0003-pre-receive-declined--porcelain.sh10
-rw-r--r--t/t5411/test-0011-no-hook-error.sh20
-rw-r--r--t/t5411/test-0012-no-hook-error--porcelain.sh20
-rw-r--r--t/t5411/test-0013-bad-protocol.sh95
-rw-r--r--t/t5411/test-0014-bad-protocol--porcelain.sh95
-rw-r--r--t/t5411/test-0020-report-ng.sh20
-rw-r--r--t/t5411/test-0021-report-ng--porcelain.sh20
-rw-r--r--t/t5411/test-0022-report-unexpect-ref.sh10
-rw-r--r--t/t5411/test-0023-report-unexpect-ref--porcelain.sh10
-rw-r--r--t/t5411/test-0024-report-unknown-ref.sh10
-rw-r--r--t/t5411/test-0025-report-unknown-ref--porcelain.sh10
-rw-r--r--t/t5411/test-0026-push-options.sh22
-rw-r--r--t/t5411/test-0027-push-options--porcelain.sh22
-rw-r--r--t/t5411/test-0030-report-ok.sh6
-rw-r--r--t/t5411/test-0031-report-ok--porcelain.sh6
-rw-r--r--t/t5411/test-0032-report-with-options.sh9
-rw-r--r--t/t5411/test-0033-report-with-options--porcelain.sh9
-rw-r--r--t/t5411/test-0034-report-ft.sh6
-rw-r--r--t/t5411/test-0035-report-ft--porcelain.sh6
-rw-r--r--t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh18
-rw-r--r--t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh18
-rw-r--r--t/t5411/test-0038-report-mixed-refs.sh10
-rw-r--r--t/t5411/test-0039-report-mixed-refs--porcelain.sh10
-rw-r--r--t/t5411/test-0040-process-all-refs.sh6
-rw-r--r--t/t5411/test-0041-process-all-refs--porcelain.sh6
-rw-r--r--t/t5411/test-0050-proc-receive-refs-with-modifiers.sh18
-rwxr-xr-xt/t5500-fetch-pack.sh6
-rwxr-xr-xt/t5505-remote.sh30
-rwxr-xr-xt/t5510-fetch.sh8
-rwxr-xr-xt/t5512-ls-remote.sh2
-rwxr-xr-xt/t5516-fetch-push.sh5
-rwxr-xr-xt/t5526-fetch-submodules.sh38
-rwxr-xr-xt/t5541-http-push-smart.sh2
-rwxr-xr-xt/t5544-pack-objects-hook.sh10
-rwxr-xr-xt/t5550-http-fetch-dumb.sh5
-rwxr-xr-xt/t5601-clone.sh2
-rwxr-xr-xt/t5604-clone-reference.sh2
-rwxr-xr-xt/t5606-clone-options.sh8
-rwxr-xr-xt/t5701-git-serve.sh2
-rwxr-xr-xt/t5702-protocol-v2.sh83
-rwxr-xr-xt/t5703-upload-pack-ref-in-want.sh3
-rwxr-xr-xt/t6020-bundle-misc.sh30
-rwxr-xr-xt/t6030-bisect-porcelain.sh8
-rwxr-xr-xt/t6040-tracking-info.sh22
-rwxr-xr-xt/t6113-rev-list-bitmap-filters.sh1
-rwxr-xr-xt/t6115-rev-list-du.sh51
-rwxr-xr-xt/t6120-describe.sh2
-rwxr-xr-xt/t6134-pathspec-in-submodule.sh2
-rwxr-xr-xt/t6301-for-each-ref-errors.sh10
-rwxr-xr-xt/t6404-recursive-merge.sh5
-rwxr-xr-xt/t6423-merge-rename-directories.sh2
-rwxr-xr-xt/t6426-merge-skip-unneeded-updates.sh16
-rwxr-xr-xt/t6436-merge-overwrite.sh4
-rwxr-xr-xt/t6439-merge-co-error-msgs.sh12
-rwxr-xr-xt/t6500-gc.sh10
-rwxr-xr-xt/t6600-test-reach.sh68
-rwxr-xr-xt/t7001-mv.sh422
-rwxr-xr-xt/t7004-tag.sh33
-rwxr-xr-xt/t7006-pager.sh130
-rwxr-xr-xt/t7011-skip-worktree-reading.sh9
-rwxr-xr-xt/t7012-skip-worktree-writing.sh4
-rwxr-xr-xt/t7060-wtstatus.sh14
-rwxr-xr-xt/t7063-status-untracked-cache.sh2
-rwxr-xr-xt/t7102-reset.sh6
-rwxr-xr-xt/t7104-reset-hard.sh2
-rwxr-xr-xt/t7201-co.sh2
-rwxr-xr-xt/t7300-clean.sh6
-rwxr-xr-xt/t7400-submodule-basic.sh4
-rwxr-xr-xt/t7401-submodule-summary.sh12
-rwxr-xr-xt/t7406-submodule-update.sh16
-rwxr-xr-xt/t7407-submodule-foreach.sh10
-rwxr-xr-xt/t7500-commit-template-squash-signoff.sh4
-rwxr-xr-xt/t7501-commit-basic-functionality.sh2
-rwxr-xr-xt/t7502-commit-porcelain.sh6
-rwxr-xr-xt/t7505-prepare-commit-msg-hook.sh4
-rwxr-xr-xt/t7508-status.sh110
-rwxr-xr-xt/t7510-signed-commit.sh43
-rwxr-xr-xt/t7512-status-help.sh74
-rwxr-xr-xt/t7519-status-fsmonitor.sh4
-rwxr-xr-xt/t7521-ignored-mode.sh22
-rwxr-xr-xt/t7600-merge.sh4
-rwxr-xr-xt/t7602-merge-octopus-many.sh6
-rwxr-xr-xt/t7610-mergetool.sh18
-rwxr-xr-xt/t7800-difftool.sh70
-rwxr-xr-xt/t7810-grep.sh2
-rwxr-xr-xt/t7812-grep-icase-non-ascii.sh53
-rwxr-xr-xt/t7817-grep-sparse-checkout.sh174
-rwxr-xr-xt/t7900-maintenance.sh72
-rwxr-xr-xt/t9003-help-autocorrect.sh7
-rwxr-xr-xt/t9151-svn-mergeinfo.sh43
-rwxr-xr-xt/t9300-fast-import.sh7
-rwxr-xr-xt/t9500-gitweb-standalone-no-errors.sh2
-rwxr-xr-xt/t9501-gitweb-standalone-http-status.sh2
-rwxr-xr-xt/t9502-gitweb-standalone-parse-output.sh2
-rwxr-xr-xt/t9902-completion.sh1
-rw-r--r--t/test-lib-functions.sh142
-rw-r--r--t/test-lib.sh61
240 files changed, 4287 insertions, 1955 deletions
diff --git a/t/.gitattributes b/t/.gitattributes
index df05434d32..dafa17c3e6 100644
--- a/t/.gitattributes
+++ b/t/.gitattributes
@@ -1,13 +1,13 @@
t[0-9][0-9][0-9][0-9]/* -whitespace
/chainlint/*.expect eol=lf
-/diff-lib/* eol=lf
+/lib-diff/* eol=lf
/t0110/url-* binary
/t3206/* eol=lf
/t3900/*.txt eol=lf
/t3901/*.txt eol=lf
-/t4034/*/* eol=lf
/t4013/* eol=lf
/t4018/* eol=lf
+/t4034/*/* eol=lf
/t4051/* eol=lf
/t4100/* eol=lf
/t4101/* eol=lf
diff --git a/t/README b/t/README
index c730a70770..593d4a4e27 100644
--- a/t/README
+++ b/t/README
@@ -358,12 +358,6 @@ whether this mode is active, and e.g. skip some tests that are hard to
refactor to deal with it. The "SYMLINKS" prerequisite is currently
excluded as so much relies on it, but this might change in the future.
-GIT_TEST_GETTEXT_POISON=<boolean> turns all strings marked for
-translation into gibberish if true. Used for spotting those tests that
-need to be marked with a C_LOCALE_OUTPUT prerequisite when adding more
-strings for translation. See "Testing marked strings" in po/README for
-details.
-
GIT_TEST_SPLIT_INDEX=<boolean> forces split-index mode on the whole
test suite. Accept any boolean values that are accepted by git-config.
@@ -393,6 +387,9 @@ GIT_TEST_COMMIT_GRAPH=<boolean>, when true, forces the commit-graph to
be written after every 'git commit' command, and overrides the
'core.commitGraph' setting to true.
+GIT_TEST_COMMIT_GRAPH_NO_GDAT=<boolean>, when true, forces the
+commit-graph to be written without generation data chunk.
+
GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=<boolean>, when true, forces
commit-graph write to compute and write changed path Bloom filters for
every 'git commit-graph write', as if the `--changed-paths` option was
@@ -439,6 +436,9 @@ GIT_TEST_DEFAULT_HASH=<hash-algo> specifies which hash algorithm to
use in the test scripts. Recognized values for <hash-algo> are "sha1"
and "sha256".
+GIT_TEST_WRITE_REV_INDEX=<boolean>, when true enables the
+'pack.writeReverseIndex' setting.
+
Naming Tests
------------
@@ -917,13 +917,13 @@ library for your script to use.
Check whether a file has the length it is expected to.
- - test_path_is_file <path> [<diagnosis>]
- test_path_is_dir <path> [<diagnosis>]
- test_path_is_missing <path> [<diagnosis>]
+ - test_path_is_file <path>
+ test_path_is_dir <path>
+ test_path_is_missing <path>
Check if the named path is a file, if the named path is a
directory, or if the named path does not exist, respectively,
- and fail otherwise, showing the <diagnosis> text.
+ and fail otherwise.
- test_when_finished <script>
@@ -1104,18 +1104,6 @@ use these, and "test_set_prereq" for how to define your own.
Git was compiled with support for PCRE. Wrap any tests
that use git-grep --perl-regexp or git-grep -P in these.
- - LIBPCRE1
-
- Git was compiled with PCRE v1 support via
- USE_LIBPCRE1=YesPlease. Wrap any PCRE using tests that for some
- reason need v1 of the PCRE library instead of v2 in these.
-
- - LIBPCRE2
-
- Git was compiled with PCRE v2 support via
- USE_LIBPCRE2=YesPlease. Wrap any PCRE using tests that for some
- reason need v2 of the PCRE library instead of v1 in these.
-
- CASE_INSENSITIVE_FS
Test is run on a case insensitive file system.
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index ee5d2d4cf8..29ce89090d 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -483,12 +483,12 @@ test_expect_success 'setup -L :funcname with userdiff driver' '
echo "fortran-* diff=fortran" >.gitattributes &&
fortran_file=fortran-external-function &&
orig_file="$TEST_DIRECTORY/t4018/$fortran_file" &&
- cp $orig_file . &&
- git add $fortran_file &&
+ cp "$orig_file" . &&
+ git add "$fortran_file" &&
GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="A@test.git" \
git commit -m "add fortran file" &&
- sed -e "s/ChangeMe/IWasChanged/" <"$orig_file" >$fortran_file &&
- git add $fortran_file &&
+ sed -e "s/ChangeMe/IWasChanged/" <"$orig_file" >"$fortran_file" &&
+ git add "$fortran_file" &&
GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="B@test.git" \
git commit -m "change fortran file"
'
diff --git a/t/helper/test-pcre2-config.c b/t/helper/test-pcre2-config.c
new file mode 100644
index 0000000000..5258fdddba
--- /dev/null
+++ b/t/helper/test-pcre2-config.c
@@ -0,0 +1,12 @@
+#include "test-tool.h"
+#include "cache.h"
+#include "grep.h"
+
+int cmd__pcre2_config(int argc, const char **argv)
+{
+ if (argc == 2 && !strcmp(argv[1], "has-PCRE2_MATCH_INVALID_UTF")) {
+ int value = PCRE2_MATCH_INVALID_UTF;
+ return !value;
+ }
+ return 1;
+}
diff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c
index 5f585a1725..75927b2c81 100644
--- a/t/helper/test-read-graph.c
+++ b/t/helper/test-read-graph.c
@@ -33,6 +33,10 @@ int cmd__read_graph(int argc, const char **argv)
printf(" oid_lookup");
if (graph->chunk_commit_data)
printf(" commit_metadata");
+ if (graph->chunk_generation_data)
+ printf(" generation_data");
+ if (graph->chunk_generation_data_overflow)
+ printf(" generation_data_overflow");
if (graph->chunk_extra_edges)
printf(" extra_edges");
if (graph->chunk_bloom_indexes)
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index 759e69dc54..bba5f841c6 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -72,18 +72,6 @@ static int cmd_pack_refs(struct ref_store *refs, const char **argv)
return refs_pack_refs(refs, flags);
}
-static int cmd_peel_ref(struct ref_store *refs, const char **argv)
-{
- const char *refname = notnull(*argv++, "refname");
- struct object_id oid;
- int ret;
-
- ret = refs_peel_ref(refs, refname, &oid);
- if (!ret)
- puts(oid_to_hex(&oid));
- return ret;
-}
-
static int cmd_create_symref(struct ref_store *refs, const char **argv)
{
const char *refname = notnull(*argv++, "refname");
@@ -255,7 +243,6 @@ struct command {
static struct command commands[] = {
{ "pack-refs", cmd_pack_refs },
- { "peel-ref", cmd_peel_ref },
{ "create-symref", cmd_create_symref },
{ "delete-refs", cmd_delete_refs },
{ "rename-ref", cmd_rename_ref },
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 9d6d14d929..f97cd9f48a 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -46,6 +46,7 @@ static struct test_cmd cmds[] = {
{ "parse-options", cmd__parse_options },
{ "parse-pathspec-file", cmd__parse_pathspec_file },
{ "path-utils", cmd__path_utils },
+ { "pcre2-config", cmd__pcre2_config },
{ "pkt-line", cmd__pkt_line },
{ "prio-queue", cmd__prio_queue },
{ "proc-receive", cmd__proc_receive},
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index a6470ff62c..28072c0ad5 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -35,6 +35,7 @@ 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__pcre2_config(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__proc_receive(int argc, const char **argv);
diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c
index 823f33ceff..f93633f895 100644
--- a/t/helper/test-trace2.c
+++ b/t/helper/test-trace2.c
@@ -198,6 +198,14 @@ static int ut_006data(int argc, const char **argv)
return 0;
}
+static int ut_007bug(int argc, const char **argv)
+{
+ /*
+ * Exercise BUG() to ensure that the message is printed to trace2.
+ */
+ BUG("the bug message");
+}
+
/*
* Usage:
* test-tool trace2 <ut_name_1> <ut_usage_1>
@@ -214,6 +222,7 @@ static struct unit_test ut_table[] = {
{ ut_004child, "004child", "[<child_command_line>]" },
{ ut_005exec, "005exec", "<git_command_args>" },
{ ut_006data, "006data", "[<category> <key> <value>]+" },
+ { ut_007bug, "007bug", "" },
};
/* clang-format on */
diff --git a/t/lib-bitmap.sh b/t/lib-bitmap.sh
new file mode 100644
index 0000000000..fe3f98be24
--- /dev/null
+++ b/t/lib-bitmap.sh
@@ -0,0 +1,26 @@
+# 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/t/test-bundle-functions.sh b/t/lib-bundle.sh
index cf7ed818b2..cf7ed818b2 100644
--- a/t/test-bundle-functions.sh
+++ b/t/lib-bundle.sh
diff --git a/t/lib-credential.sh b/t/lib-credential.sh
index dea2cbef51..5ea8bc9f1d 100644
--- a/t/lib-credential.sh
+++ b/t/lib-credential.sh
@@ -20,7 +20,7 @@ check() {
false
fi &&
test_cmp expect-stdout stdout &&
- test_i18ncmp expect-stderr stderr
+ test_cmp expect-stderr stderr
}
read_chunk() {
diff --git a/t/diff-lib.sh b/t/lib-diff.sh
index 2de880f7a5..2de880f7a5 100644
--- a/t/diff-lib.sh
+++ b/t/lib-diff.sh
diff --git a/t/diff-lib/COPYING b/t/lib-diff/COPYING
index 6ff87c4664..6ff87c4664 100644
--- a/t/diff-lib/COPYING
+++ b/t/lib-diff/COPYING
diff --git a/t/diff-lib/README b/t/lib-diff/README
index 548142c327..548142c327 100644
--- a/t/diff-lib/README
+++ b/t/lib-diff/README
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index 2139b427ca..cc6bb2cdea 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -17,7 +17,7 @@ else
. "$GIT_BUILD_DIR"/git-sh-i18n
fi
-if test_have_prereq GETTEXT && test_have_prereq C_LOCALE_OUTPUT
+if test_have_prereq GETTEXT
then
# is_IS.UTF-8 on Solaris and FreeBSD, is_IS.utf8 on Debian
is_IS_locale=$(locale -a 2>/dev/null |
diff --git a/t/gitweb-lib.sh b/t/lib-gitweb.sh
index 1f32ca66ea..1f32ca66ea 100644
--- a/t/gitweb-lib.sh
+++ b/t/lib-gitweb.sh
diff --git a/t/lib-log-graph.sh b/t/lib-log-graph.sh
index 1184cceef2..bf952ef920 100644
--- a/t/lib-log-graph.sh
+++ b/t/lib-log-graph.sh
@@ -12,13 +12,13 @@ sanitize_log_output () {
lib_test_cmp_graph () {
git log --graph "$@" >output &&
sed 's/ *$//' >output.sanitized <output &&
- test_i18ncmp expect output.sanitized
+ test_cmp expect output.sanitized
}
lib_test_cmp_short_graph () {
git log --graph --pretty=short "$@" >output &&
sanitize_log_output >output.sanitized <output &&
- test_i18ncmp expect output.sanitized
+ test_cmp expect output.sanitized
}
lib_test_cmp_colored_graph () {
diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index b72c051f47..172d7459ff 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -29,7 +29,6 @@ set_fake_editor () {
*/COMMIT_EDITMSG)
test -z "$EXPECT_HEADER_COUNT" ||
test "$EXPECT_HEADER_COUNT" = "$(sed -n '1s/^# This is a combination of \(.*\) commits\./\1/p' < "$1")" ||
- test "# # GETTEXT POISON #" = "$(sed -n '1p' < "$1")" ||
exit
test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1"
test -z "$FAKE_COMMIT_AMEND" || echo "$FAKE_COMMIT_AMEND" >> "$1"
diff --git a/t/perf/.gitignore b/t/perf/.gitignore
index 982eb8e3a9..72f5d0d314 100644
--- a/t/perf/.gitignore
+++ b/t/perf/.gitignore
@@ -1,3 +1,4 @@
/build/
/test-results/
+/test-trace/
/trash directory*/
diff --git a/t/perf/Makefile b/t/perf/Makefile
index fcb0e8865e..2465770a78 100644
--- a/t/perf/Makefile
+++ b/t/perf/Makefile
@@ -7,10 +7,10 @@ perf: pre-clean
./run
pre-clean:
- rm -rf test-results
+ rm -rf test-results test-trace
clean:
- rm -rf build "trash directory".* test-results
+ rm -rf build "trash directory".* test-results test-trace
test-lint:
$(MAKE) -C .. test-lint
diff --git a/t/perf/p4205-log-pretty-formats.sh b/t/perf/p4205-log-pretty-formats.sh
index 7c26f4f337..609fecd65d 100755
--- a/t/perf/p4205-log-pretty-formats.sh
+++ b/t/perf/p4205-log-pretty-formats.sh
@@ -6,7 +6,7 @@ test_description='Tests the performance of various pretty format placeholders'
test_perf_default_repo
-for format in %H %h %T %t %P %p %h-%h-%h
+for format in %H %h %T %t %P %p %h-%h-%h %an-%ae-%s
do
test_perf "log with $format" "
git log --format=\"$format\" >/dev/null
diff --git a/t/perf/p5303-many-packs.sh b/t/perf/p5303-many-packs.sh
index f4c2ab0584..ce0c42cc9f 100755
--- a/t/perf/p5303-many-packs.sh
+++ b/t/perf/p5303-many-packs.sh
@@ -21,10 +21,14 @@ repack_into_n () {
mkdir staging &&
git rev-list --first-parent HEAD |
- sed -n '1~5p' |
- head -n "$1" |
- perl -e 'print reverse <>' \
- >pushes
+ perl -e '
+ my $n = shift;
+ while (<>) {
+ last unless @commits < $n;
+ push @commits, $_ if $. % 5 == 1;
+ }
+ print reverse @commits;
+ ' "$1" >pushes
# create base packfile
head -n 1 pushes |
diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh
index 1e20a184c7..b657564aed 100755
--- a/t/perf/p7519-fsmonitor.sh
+++ b/t/perf/p7519-fsmonitor.sh
@@ -32,6 +32,8 @@ test_description="Test core.fsmonitor"
#
# GIT_PERF_7519_DROP_CACHE: if set, the OS caches are dropped between tests
#
+# GIT_PERF_7519_TRACE: if set, enable trace logging during the test.
+# Trace logs will be grouped by fsmonitor provider.
test_perf_large_repo
test_checkout_worktree
@@ -70,6 +72,32 @@ then
fi
fi
+trace_start() {
+ if test -n "$GIT_PERF_7519_TRACE"
+ then
+ name="$1"
+ TEST_TRACE_DIR="$TEST_OUTPUT_DIRECTORY/test-trace/p7519/"
+ echo "Writing trace logging to $TEST_TRACE_DIR"
+
+ mkdir -p "$TEST_TRACE_DIR"
+
+ # Start Trace2 logging and any other GIT_TRACE_* logs that you
+ # want for this named test case.
+
+ GIT_TRACE2_PERF="$TEST_TRACE_DIR/$name.trace2perf"
+ export GIT_TRACE2_PERF
+
+ >"$GIT_TRACE2_PERF"
+ fi
+}
+
+trace_stop() {
+ if test -n "$GIT_PERF_7519_TRACE"
+ then
+ unset GIT_TRACE2_PERF
+ fi
+}
+
test_expect_success "one time repo setup" '
# set untrackedCache depending on the environment
if test -n "$GIT_PERF_7519_UNTRACKED_CACHE"
@@ -101,7 +129,7 @@ test_expect_success "one time repo setup" '
# If Watchman exists, watch the work tree and attempt a query.
if test_have_prereq WATCHMAN; then
watchman watch "$GIT_WORK_TREE" &&
- watchman watch-list | grep -q -F "$GIT_WORK_TREE"
+ watchman watch-list | grep -q -F "p7519-fsmonitor"
fi
'
@@ -169,8 +197,18 @@ test_fsmonitor_suite() {
git status -uall
'
+ # Update the mtimes on upto 100k files to make status think
+ # that they are dirty. For simplicity, omit any files with
+ # LFs (i.e. anything that ls-files thinks it needs to dquote).
+ # Then fully backslash-quote the paths to capture any
+ # whitespace so that they pass thru xargs properly.
+ #
test_perf_w_drop_caches "status (dirty) ($DESC)" '
- git ls-files | head -100000 | xargs -d "\n" touch -h &&
+ git ls-files | \
+ head -100000 | \
+ grep -v \" | \
+ sed '\''s/\(.\)/\\\1/g'\'' | \
+ xargs test-tool chmtime -300 &&
git status
'
@@ -203,6 +241,12 @@ test_fsmonitor_suite() {
'
}
+#
+# Run a full set of perf tests using each Hook-based fsmonitor provider,
+# such as Watchman.
+#
+
+trace_start fsmonitor-watchman
if test -n "$GIT_PERF_7519_FSMONITOR"; then
for INTEGRATION_PATH in $GIT_PERF_7519_FSMONITOR; do
test_expect_success "setup for fsmonitor $INTEGRATION_PATH" 'setup_for_fsmonitor'
@@ -213,14 +257,6 @@ else
test_fsmonitor_suite
fi
-test_expect_success "setup without fsmonitor" '
- unset INTEGRATION_SCRIPT &&
- git config --unset core.fsmonitor &&
- git update-index --no-fsmonitor
-'
-
-test_fsmonitor_suite
-
if test_have_prereq WATCHMAN
then
watchman watch-del "$GIT_WORK_TREE" >/dev/null 2>&1 &&
@@ -229,5 +265,20 @@ then
# preventing the removal of the trash directory
watchman shutdown-server >/dev/null 2>&1
fi
+trace_stop
+
+#
+# Run a full set of perf tests with the fsmonitor feature disabled.
+#
+
+trace_start fsmonitor-disabled
+test_expect_success "setup without fsmonitor" '
+ unset INTEGRATION_SCRIPT &&
+ git config --unset core.fsmonitor &&
+ git update-index --no-fsmonitor
+'
+
+test_fsmonitor_suite
+trace_stop
test_done
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index f4ba2e8c85..705d62cc27 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -135,32 +135,32 @@ check_sub_test_lib_test_err () {
)
}
-test_expect_success 'pretend we have a fully passing test suite' "
- run_sub_test_lib_test full-pass '3 passing tests' <<-\\EOF &&
+test_expect_success 'pretend we have a fully passing test suite' '
+ run_sub_test_lib_test full-pass "3 passing tests" <<-\EOF &&
for i in 1 2 3
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test full-pass <<-\\EOF
+ check_sub_test_lib_test full-pass <<-\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 'pretend we have a partially passing test suite' "
+test_expect_success 'pretend we have a partially passing test suite' '
run_sub_test_lib_test_err \
- partial-pass '2/3 tests passing' <<-\\EOF &&
- test_expect_success 'passing test #1' 'true'
- test_expect_success 'failing test #2' 'false'
- test_expect_success 'passing test #3' 'true'
+ partial-pass "2/3 tests passing" <<-\EOF &&
+ test_expect_success "passing test #1" "true"
+ test_expect_success "failing test #2" "false"
+ test_expect_success "passing test #3" "true"
test_done
EOF
- check_sub_test_lib_test partial-pass <<-\\EOF
+ check_sub_test_lib_test partial-pass <<-\EOF
> ok 1 - passing test #1
> not ok 2 - failing test #2
# false
@@ -168,44 +168,44 @@ test_expect_success 'pretend we have a partially passing test suite' "
> # failed 1 among 3 test(s)
> 1..3
EOF
-"
+'
-test_expect_success 'pretend we have a known breakage' "
- run_sub_test_lib_test failing-todo 'A failing TODO test' <<-\\EOF &&
- test_expect_success 'passing test' 'true'
- test_expect_failure 'pretend we have a known breakage' 'false'
+test_expect_success 'pretend we have a known breakage' '
+ run_sub_test_lib_test failing-todo "A failing TODO test" <<-\EOF &&
+ test_expect_success "passing test" "true"
+ test_expect_failure "pretend we have a known breakage" "false"
test_done
EOF
- check_sub_test_lib_test failing-todo <<-\\EOF
+ check_sub_test_lib_test failing-todo <<-\EOF
> ok 1 - passing test
> not ok 2 - pretend we have a known breakage # TODO known breakage
> # still have 1 known breakage(s)
> # passed all remaining 1 test(s)
> 1..2
EOF
-"
+'
-test_expect_success 'pretend we have fixed a known breakage' "
- run_sub_test_lib_test passing-todo 'A passing TODO test' <<-\\EOF &&
- test_expect_failure 'pretend we have fixed a known breakage' 'true'
+test_expect_success 'pretend we have fixed a known breakage' '
+ run_sub_test_lib_test passing-todo "A passing TODO test" <<-\EOF &&
+ test_expect_failure "pretend we have fixed a known breakage" "true"
test_done
EOF
- check_sub_test_lib_test passing-todo <<-\\EOF
+ check_sub_test_lib_test passing-todo <<-\EOF
> ok 1 - pretend we have fixed a known breakage # TODO known breakage vanished
> # 1 known breakage(s) vanished; please update test(s)
> 1..1
EOF
-"
+'
-test_expect_success 'pretend we have fixed one of two known breakages (run in sub test-lib)' "
+test_expect_success 'pretend we have fixed one of two known breakages (run in sub test-lib)' '
run_sub_test_lib_test partially-passing-todos \
- '2 TODO tests, one passing' <<-\\EOF &&
- test_expect_failure 'pretend we have a known breakage' 'false'
- test_expect_success 'pretend we have a passing test' 'true'
- test_expect_failure 'pretend we have fixed another known breakage' 'true'
+ "2 TODO tests, one passing" <<-\EOF &&
+ test_expect_failure "pretend we have a known breakage" "false"
+ test_expect_success "pretend we have a passing test" "true"
+ test_expect_failure "pretend we have fixed another known breakage" "true"
test_done
EOF
- check_sub_test_lib_test partially-passing-todos <<-\\EOF
+ check_sub_test_lib_test partially-passing-todos <<-\EOF
> not ok 1 - pretend we have a known breakage # TODO known breakage
> ok 2 - pretend we have a passing test
> ok 3 - pretend we have fixed another known breakage # TODO known breakage vanished
@@ -214,17 +214,17 @@ test_expect_success 'pretend we have fixed one of two known breakages (run in su
> # passed all remaining 1 test(s)
> 1..3
EOF
-"
+'
-test_expect_success 'pretend we have a pass, fail, and known breakage' "
+test_expect_success 'pretend we have a pass, fail, and known breakage' '
run_sub_test_lib_test_err \
- mixed-results1 'mixed results #1' <<-\\EOF &&
- test_expect_success 'passing test' 'true'
- test_expect_success 'failing test' 'false'
- test_expect_failure 'pretend we have a known breakage' 'false'
+ mixed-results1 "mixed results #1" <<-\EOF &&
+ test_expect_success "passing test" "true"
+ test_expect_success "failing test" "false"
+ test_expect_failure "pretend we have a known breakage" "false"
test_done
EOF
- check_sub_test_lib_test mixed-results1 <<-\\EOF
+ check_sub_test_lib_test mixed-results1 <<-\EOF
> ok 1 - passing test
> not ok 2 - failing test
> # false
@@ -233,24 +233,24 @@ test_expect_success 'pretend we have a pass, fail, and known breakage' "
> # failed 1 among remaining 2 test(s)
> 1..3
EOF
-"
+'
-test_expect_success 'pretend we have a mix of all possible results' "
+test_expect_success 'pretend we have a mix of all possible results' '
run_sub_test_lib_test_err \
- mixed-results2 'mixed results #2' <<-\\EOF &&
- test_expect_success 'passing test' 'true'
- test_expect_success 'passing test' 'true'
- test_expect_success 'passing test' 'true'
- test_expect_success 'passing test' 'true'
- test_expect_success 'failing test' 'false'
- test_expect_success 'failing test' 'false'
- test_expect_success 'failing test' 'false'
- test_expect_failure 'pretend we have a known breakage' 'false'
- test_expect_failure 'pretend we have a known breakage' 'false'
- test_expect_failure 'pretend we have fixed a known breakage' 'true'
+ mixed-results2 "mixed results #2" <<-\EOF &&
+ test_expect_success "passing test" "true"
+ test_expect_success "passing test" "true"
+ test_expect_success "passing test" "true"
+ test_expect_success "passing test" "true"
+ test_expect_success "failing test" "false"
+ test_expect_success "failing test" "false"
+ test_expect_success "failing test" "false"
+ test_expect_failure "pretend we have a known breakage" "false"
+ test_expect_failure "pretend we have a known breakage" "false"
+ test_expect_failure "pretend we have fixed a known breakage" "true"
test_done
EOF
- check_sub_test_lib_test mixed-results2 <<-\\EOF
+ check_sub_test_lib_test mixed-results2 <<-\EOF
> ok 1 - passing test
> ok 2 - passing test
> ok 3 - passing test
@@ -269,9 +269,9 @@ test_expect_success 'pretend we have a mix of all possible results' "
> # failed 3 among remaining 7 test(s)
> 1..10
EOF
-"
+'
-test_expect_success C_LOCALE_OUTPUT 'test --verbose' '
+test_expect_success 'test --verbose' '
run_sub_test_lib_test_err \
t1234-verbose "test verbose" --verbose <<-\EOF &&
test_expect_success "passing test" true
@@ -321,18 +321,18 @@ test_expect_success 'test --verbose-only' '
EOF
'
-test_expect_success 'GIT_SKIP_TESTS' "
+test_expect_success 'GIT_SKIP_TESTS' '
(
- GIT_SKIP_TESTS='git.2' && export GIT_SKIP_TESTS &&
+ GIT_SKIP_TESTS="git.2" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-basic \
- 'GIT_SKIP_TESTS' <<-\\EOF &&
+ "GIT_SKIP_TESTS" <<-\EOF &&
for i in 1 2 3
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test git-skip-tests-basic <<-\\EOF
+ check_sub_test_lib_test git-skip-tests-basic <<-\EOF
> ok 1 - passing test #1
> ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
> ok 3 - passing test #3
@@ -340,20 +340,20 @@ test_expect_success 'GIT_SKIP_TESTS' "
> 1..3
EOF
)
-"
+'
-test_expect_success 'GIT_SKIP_TESTS several tests' "
+test_expect_success 'GIT_SKIP_TESTS several tests' '
(
- GIT_SKIP_TESTS='git.2 git.5' && export GIT_SKIP_TESTS &&
+ GIT_SKIP_TESTS="git.2 git.5" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-several \
- 'GIT_SKIP_TESTS several tests' <<-\\EOF &&
+ "GIT_SKIP_TESTS several tests" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test git-skip-tests-several <<-\\EOF
+ check_sub_test_lib_test git-skip-tests-several <<-\EOF
> ok 1 - passing test #1
> ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
> ok 3 - passing test #3
@@ -364,20 +364,20 @@ test_expect_success 'GIT_SKIP_TESTS several tests' "
> 1..6
EOF
)
-"
+'
-test_expect_success 'GIT_SKIP_TESTS sh pattern' "
+test_expect_success 'GIT_SKIP_TESTS sh pattern' '
(
- GIT_SKIP_TESTS='git.[2-5]' && export GIT_SKIP_TESTS &&
+ GIT_SKIP_TESTS="git.[2-5]" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-sh-pattern \
- 'GIT_SKIP_TESTS sh pattern' <<-\\EOF &&
+ "GIT_SKIP_TESTS sh pattern" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test git-skip-tests-sh-pattern <<-\\EOF
+ check_sub_test_lib_test git-skip-tests-sh-pattern <<-\EOF
> ok 1 - passing test #1
> ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
> ok 3 # skip passing test #3 (GIT_SKIP_TESTS)
@@ -388,37 +388,37 @@ test_expect_success 'GIT_SKIP_TESTS sh pattern' "
> 1..6
EOF
)
-"
+'
-test_expect_success 'GIT_SKIP_TESTS entire suite' "
+test_expect_success 'GIT_SKIP_TESTS entire suite' '
(
- GIT_SKIP_TESTS='git' && export GIT_SKIP_TESTS &&
+ GIT_SKIP_TESTS="git" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-entire-suite \
- 'GIT_SKIP_TESTS entire suite' <<-\\EOF &&
+ "GIT_SKIP_TESTS entire suite" <<-\EOF &&
for i in 1 2 3
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test git-skip-tests-entire-suite <<-\\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' "
+test_expect_success 'GIT_SKIP_TESTS does not skip unmatched suite' '
(
- GIT_SKIP_TESTS='notgit' && export GIT_SKIP_TESTS &&
+ 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 &&
+ "GIT_SKIP_TESTS does not skip unmatched suite" <<-\EOF &&
for i in 1 2 3
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test git-skip-tests-unmatched-suite <<-\\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
@@ -426,18 +426,18 @@ test_expect_success 'GIT_SKIP_TESTS does not skip unmatched suite' "
> 1..3
EOF
)
-"
+'
-test_expect_success '--run basic' "
+test_expect_success '--run basic' '
run_sub_test_lib_test run-basic \
- '--run basic' --run='1,3,5' <<-\\EOF &&
+ "--run basic" --run="1,3,5" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-basic <<-\\EOF
+ check_sub_test_lib_test run-basic <<-\EOF
> ok 1 - passing test #1
> ok 2 # skip passing test #2 (--run)
> ok 3 - passing test #3
@@ -447,18 +447,18 @@ test_expect_success '--run basic' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run with a range' "
+test_expect_success '--run with a range' '
run_sub_test_lib_test run-range \
- '--run with a range' --run='1-3' <<-\\EOF &&
+ "--run with a range" --run="1-3" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-range <<-\\EOF
+ check_sub_test_lib_test run-range <<-\EOF
> ok 1 - passing test #1
> ok 2 - passing test #2
> ok 3 - passing test #3
@@ -468,18 +468,18 @@ test_expect_success '--run with a range' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run with two ranges' "
+test_expect_success '--run with two ranges' '
run_sub_test_lib_test run-two-ranges \
- '--run with two ranges' --run='1-2,5-6' <<-\\EOF &&
+ "--run with two ranges" --run="1-2,5-6" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-two-ranges <<-\\EOF
+ check_sub_test_lib_test run-two-ranges <<-\EOF
> ok 1 - passing test #1
> ok 2 - passing test #2
> ok 3 # skip passing test #3 (--run)
@@ -489,18 +489,18 @@ test_expect_success '--run with two ranges' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run with a left open range' "
+test_expect_success '--run with a left open range' '
run_sub_test_lib_test run-left-open-range \
- '--run with a left open range' --run='-3' <<-\\EOF &&
+ "--run with a left open range" --run="-3" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-left-open-range <<-\\EOF
+ check_sub_test_lib_test run-left-open-range <<-\EOF
> ok 1 - passing test #1
> ok 2 - passing test #2
> ok 3 - passing test #3
@@ -510,18 +510,18 @@ test_expect_success '--run with a left open range' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run with a right open range' "
+test_expect_success '--run with a right open range' '
run_sub_test_lib_test run-right-open-range \
- '--run with a right open range' --run='4-' <<-\\EOF &&
+ "--run with a right open range" --run="4-" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-right-open-range <<-\\EOF
+ check_sub_test_lib_test run-right-open-range <<-\EOF
> ok 1 # skip passing test #1 (--run)
> ok 2 # skip passing test #2 (--run)
> ok 3 # skip passing test #3 (--run)
@@ -531,18 +531,18 @@ test_expect_success '--run with a right open range' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run with basic negation' "
+test_expect_success '--run with basic negation' '
run_sub_test_lib_test run-basic-neg \
- '--run with basic negation' --run='"'!3'"' <<-\\EOF &&
+ "--run with basic negation" --run="!3" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-basic-neg <<-\\EOF
+ check_sub_test_lib_test run-basic-neg <<-\EOF
> ok 1 - passing test #1
> ok 2 - passing test #2
> ok 3 # skip passing test #3 (--run)
@@ -552,18 +552,18 @@ test_expect_success '--run with basic negation' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run with two negations' "
+test_expect_success '--run with two negations' '
run_sub_test_lib_test run-two-neg \
- '--run with two negations' --run='"'!3,!6'"' <<-\\EOF &&
+ "--run with two negations" --run="!3,!6" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-two-neg <<-\\EOF
+ check_sub_test_lib_test run-two-neg <<-\EOF
> ok 1 - passing test #1
> ok 2 - passing test #2
> ok 3 # skip passing test #3 (--run)
@@ -573,18 +573,18 @@ test_expect_success '--run with two negations' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run a range and negation' "
+test_expect_success '--run a range and negation' '
run_sub_test_lib_test run-range-and-neg \
- '--run a range and negation' --run='"'-4,!2'"' <<-\\EOF &&
+ "--run a range and negation" --run="-4,!2" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-range-and-neg <<-\\EOF
+ check_sub_test_lib_test run-range-and-neg <<-\EOF
> ok 1 - passing test #1
> ok 2 # skip passing test #2 (--run)
> ok 3 - passing test #3
@@ -594,18 +594,18 @@ test_expect_success '--run a range and negation' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run range negation' "
+test_expect_success '--run range negation' '
run_sub_test_lib_test run-range-neg \
- '--run range negation' --run='"'!1-3'"' <<-\\EOF &&
+ "--run range negation" --run="!1-3" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-range-neg <<-\\EOF
+ check_sub_test_lib_test run-range-neg <<-\EOF
> ok 1 # skip passing test #1 (--run)
> ok 2 # skip passing test #2 (--run)
> ok 3 # skip passing test #3 (--run)
@@ -615,19 +615,19 @@ test_expect_success '--run range negation' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run include, exclude and include' "
+test_expect_success '--run include, exclude and include' '
run_sub_test_lib_test run-inc-neg-inc \
- '--run include, exclude and include' \
- --run='"'1-5,!1-3,2'"' <<-\\EOF &&
+ "--run include, exclude and include" \
+ --run="1-5,!1-3,2" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-inc-neg-inc <<-\\EOF
+ check_sub_test_lib_test run-inc-neg-inc <<-\EOF
> ok 1 # skip passing test #1 (--run)
> ok 2 - passing test #2
> ok 3 # skip passing test #3 (--run)
@@ -637,19 +637,19 @@ test_expect_success '--run include, exclude and include' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run include, exclude and include, comma separated' "
+test_expect_success '--run include, exclude and include, comma separated' '
run_sub_test_lib_test run-inc-neg-inc-comma \
- '--run include, exclude and include, comma separated' \
- --run=1-5,\!1-3,2 <<-\\EOF &&
+ "--run include, exclude and include, comma separated" \
+ --run=1-5,!1-3,2 <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-inc-neg-inc-comma <<-\\EOF
+ check_sub_test_lib_test run-inc-neg-inc-comma <<-\EOF
> ok 1 # skip passing test #1 (--run)
> ok 2 - passing test #2
> ok 3 # skip passing test #3 (--run)
@@ -659,19 +659,19 @@ test_expect_success '--run include, exclude and include, comma separated' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run exclude and include' "
+test_expect_success '--run exclude and include' '
run_sub_test_lib_test run-neg-inc \
- '--run exclude and include' \
- --run='"'!3-,5'"' <<-\\EOF &&
+ "--run exclude and include" \
+ --run="!3-,5" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-neg-inc <<-\\EOF
+ check_sub_test_lib_test run-neg-inc <<-\EOF
> ok 1 - passing test #1
> ok 2 - passing test #2
> ok 3 # skip passing test #3 (--run)
@@ -681,19 +681,19 @@ test_expect_success '--run exclude and include' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run empty selectors' "
+test_expect_success '--run empty selectors' '
run_sub_test_lib_test run-empty-sel \
- '--run empty selectors' \
- --run='1,,3,,,5' <<-\\EOF &&
+ "--run empty selectors" \
+ --run="1,,3,,,5" <<-\EOF &&
for i in 1 2 3 4 5 6
do
- test_expect_success \"passing test #\$i\" 'true'
+ test_expect_success "passing test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-empty-sel <<-\\EOF
+ check_sub_test_lib_test run-empty-sel <<-\EOF
> ok 1 - passing test #1
> ok 2 # skip passing test #2 (--run)
> ok 3 - passing test #3
@@ -703,20 +703,20 @@ test_expect_success '--run empty selectors' "
> # passed all 6 test(s)
> 1..6
EOF
-"
+'
-test_expect_success '--run substring selector' "
+test_expect_success '--run substring selector' '
run_sub_test_lib_test run-substring-selector \
- '--run empty selectors' \
- --run='relevant' <<-\\EOF &&
- test_expect_success \"relevant test\" 'true'
+ "--run empty selectors" \
+ --run="relevant" <<-\EOF &&
+ test_expect_success "relevant test" "true"
for i in 1 2 3 4 5 6
do
- test_expect_success \"other test #\$i\" 'true'
+ test_expect_success "other test #$i" "true"
done
test_done
EOF
- check_sub_test_lib_test run-substring-selector <<-\\EOF
+ check_sub_test_lib_test run-substring-selector <<-\EOF
> ok 1 - relevant test
> ok 2 # skip other test #1 (--run)
> ok 3 # skip other test #2 (--run)
@@ -727,167 +727,165 @@ test_expect_success '--run substring selector' "
> # passed all 7 test(s)
> 1..7
EOF
-"
+'
-test_expect_success '--run keyword selection' "
+test_expect_success '--run keyword selection' '
run_sub_test_lib_test_err run-inv-range-start \
- '--run invalid range start' \
- --run='a-5' <<-\\EOF &&
- test_expect_success \"passing test #1\" 'true'
+ "--run invalid range start" \
+ --run="a-5" <<-\EOF &&
+ test_expect_success "passing test #1" "true"
test_done
EOF
check_sub_test_lib_test_err run-inv-range-start \
- <<-\\EOF_OUT 3<<-\\EOF_ERR
+ <<-\EOF_OUT 3<<-EOF_ERR
> FATAL: Unexpected exit with code 1
EOF_OUT
- > error: --run: invalid non-numeric in range start: 'a-5'
+ > error: --run: invalid non-numeric in range start: ${SQ}a-5${SQ}
EOF_ERR
-"
+'
-test_expect_success '--run invalid range end' "
+test_expect_success '--run invalid range end' '
run_sub_test_lib_test_err run-inv-range-end \
- '--run invalid range end' \
- --run='1-z' <<-\\EOF &&
- test_expect_success \"passing test #1\" 'true'
+ "--run invalid range end" \
+ --run="1-z" <<-\EOF &&
+ test_expect_success "passing test #1" "true"
test_done
EOF
check_sub_test_lib_test_err run-inv-range-end \
- <<-\\EOF_OUT 3<<-\\EOF_ERR
+ <<-\EOF_OUT 3<<-EOF_ERR
> FATAL: Unexpected exit with code 1
EOF_OUT
- > error: --run: invalid non-numeric in range end: '1-z'
+ > error: --run: invalid non-numeric in range end: ${SQ}1-z${SQ}
EOF_ERR
-"
-
-
-test_set_prereq HAVEIT
-haveit=no
-test_expect_success HAVEIT 'test runs if prerequisite is satisfied' '
- test_have_prereq HAVEIT &&
- haveit=yes
-'
-donthaveit=yes
-test_expect_success DONTHAVEIT 'unmet prerequisite causes test to be skipped' '
- donthaveit=no
-'
-if test -z "$GIT_TEST_FAIL_PREREQS_INTERNAL" -a $haveit$donthaveit != yesyes
-then
- say "bug in test framework: prerequisite tags do not work reliably"
- exit 1
-fi
-
-test_set_prereq HAVETHIS
-haveit=no
-test_expect_success HAVETHIS,HAVEIT 'test runs if prerequisites are satisfied' '
- test_have_prereq HAVEIT &&
- test_have_prereq HAVETHIS &&
- haveit=yes
-'
-donthaveit=yes
-test_expect_success HAVEIT,DONTHAVEIT 'unmet prerequisites causes test to be skipped' '
- donthaveit=no
-'
-donthaveiteither=yes
-test_expect_success DONTHAVEIT,HAVEIT 'unmet prerequisites causes test to be skipped' '
- donthaveiteither=no
-'
-if test -z "$GIT_TEST_FAIL_PREREQS_INTERNAL" -a $haveit$donthaveit$donthaveiteither != yesyesyes
-then
- say "bug in test framework: multiple prerequisite tags do not work reliably"
- exit 1
-fi
-
-test_lazy_prereq LAZY_TRUE true
-havetrue=no
-test_expect_success LAZY_TRUE 'test runs if lazy prereq is satisfied' '
- havetrue=yes
-'
-donthavetrue=yes
-test_expect_success !LAZY_TRUE 'missing lazy prereqs skip tests' '
- donthavetrue=no
-'
-
-if test -z "$GIT_TEST_FAIL_PREREQS_INTERNAL" -a "$havetrue$donthavetrue" != yesyes
-then
- say 'bug in test framework: lazy prerequisites do not work'
- exit 1
-fi
-
-test_lazy_prereq LAZY_FALSE false
-nothavefalse=no
-test_expect_success !LAZY_FALSE 'negative lazy prereqs checked' '
- nothavefalse=yes
-'
-havefalse=yes
-test_expect_success LAZY_FALSE 'missing negative lazy prereqs will skip' '
- havefalse=no
-'
-
-if test -z "$GIT_TEST_FAIL_PREREQS_INTERNAL" -a "$nothavefalse$havefalse" != yesyes
-then
- say 'bug in test framework: negative lazy prerequisites do not work'
- exit 1
-fi
-
-clean=no
-test_expect_success 'tests clean up after themselves' '
- test_when_finished clean=yes
'
-if test -z "$GIT_TEST_FAIL_PREREQS_INTERNAL" -a $clean != yes
-then
- say "bug in test framework: basic cleanup command does not work reliably"
- exit 1
-fi
+test_expect_success 'tests respect prerequisites' '
+ run_sub_test_lib_test prereqs "tests respect prereqs" <<-\EOF &&
-test_lazy_prereq NESTED_INNER '
- >inner &&
- rm -f outer
-'
-test_lazy_prereq NESTED_PREREQ '
- >outer &&
- test_have_prereq NESTED_INNER &&
- echo "can create new file in cwd" >file &&
- test -f outer &&
- test ! -f inner
+ test_set_prereq HAVEIT
+ test_expect_success HAVEIT "prereq is satisfied" "true"
+ test_expect_success "have_prereq works" "
+ test_have_prereq HAVEIT
+ "
+ test_expect_success DONTHAVEIT "prereq not satisfied" "false"
+
+ test_set_prereq HAVETHIS
+ test_expect_success HAVETHIS,HAVEIT "multiple prereqs" "true"
+ test_expect_success HAVEIT,DONTHAVEIT "mixed prereqs (yes,no)" "false"
+ test_expect_success DONTHAVEIT,HAVEIT "mixed prereqs (no,yes)" "false"
+
+ test_done
+ EOF
+
+ check_sub_test_lib_test prereqs <<-\EOF
+ ok 1 - prereq is satisfied
+ ok 2 - have_prereq works
+ ok 3 # skip prereq not satisfied (missing DONTHAVEIT)
+ ok 4 - multiple prereqs
+ ok 5 # skip mixed prereqs (yes,no) (missing DONTHAVEIT of HAVEIT,DONTHAVEIT)
+ ok 6 # skip mixed prereqs (no,yes) (missing DONTHAVEIT of DONTHAVEIT,HAVEIT)
+ # passed all 6 test(s)
+ 1..6
+ EOF
'
-test_expect_success NESTED_PREREQ 'evaluating nested lazy prereqs dont interfere with each other' '
- nestedworks=yes
+
+test_expect_success 'tests respect lazy prerequisites' '
+ run_sub_test_lib_test lazy-prereqs "respect lazy prereqs" <<-\EOF &&
+
+ test_lazy_prereq LAZY_TRUE true
+ test_expect_success LAZY_TRUE "lazy prereq is satisifed" "true"
+ test_expect_success !LAZY_TRUE "negative lazy prereq" "false"
+
+ test_lazy_prereq LAZY_FALSE false
+ test_expect_success LAZY_FALSE "lazy prereq not satisfied" "false"
+ test_expect_success !LAZY_FALSE "negative false prereq" "true"
+
+ test_done
+ EOF
+
+ check_sub_test_lib_test lazy-prereqs <<-\EOF
+ ok 1 - lazy prereq is satisifed
+ ok 2 # skip negative lazy prereq (missing !LAZY_TRUE)
+ ok 3 # skip lazy prereq not satisfied (missing LAZY_FALSE)
+ ok 4 - negative false prereq
+ # passed all 4 test(s)
+ 1..4
+ EOF
'
-if test -z "$GIT_TEST_FAIL_PREREQS_INTERNAL" && test "$nestedworks" != yes
-then
- say 'bug in test framework: nested lazy prerequisites do not work'
- exit 1
-fi
+test_expect_success 'nested lazy prerequisites' '
+ run_sub_test_lib_test nested-lazy "nested lazy prereqs" <<-\EOF &&
+
+ test_lazy_prereq NESTED_INNER "
+ >inner &&
+ rm -f outer
+ "
+ test_lazy_prereq NESTED_PREREQ "
+ >outer &&
+ test_have_prereq NESTED_INNER &&
+ echo can create new file in cwd >file &&
+ test_path_is_file outer &&
+ test_path_is_missing inner
+ "
+ test_expect_success NESTED_PREREQ "evaluate nested prereq" "true"
-test_expect_success 'lazy prereqs do not turn off tracing' "
+ test_done
+ EOF
+
+ check_sub_test_lib_test nested-lazy <<-\EOF
+ ok 1 - evaluate nested prereq
+ # passed all 1 test(s)
+ 1..1
+ EOF
+'
+
+test_expect_success 'lazy prereqs do not turn off tracing' '
run_sub_test_lib_test lazy-prereq-and-tracing \
- 'lazy prereqs and -x' -v -x <<-\\EOF &&
+ "lazy prereqs and -x" -v -x <<-\EOF &&
test_lazy_prereq LAZY true
- test_expect_success lazy 'test_have_prereq LAZY && echo trace'
+ test_expect_success lazy "test_have_prereq LAZY && echo trace"
+
+ test_done
+ EOF
+
+ grep "echo trace" lazy-prereq-and-tracing/err
+'
+test_expect_success 'tests clean up after themselves' '
+ run_sub_test_lib_test cleanup "test with cleanup" <<-\EOF &&
+ clean=no
+ test_expect_success "do cleanup" "
+ test_when_finished clean=yes
+ "
+ test_expect_success "cleanup happened" "
+ test $clean = yes
+ "
test_done
EOF
- grep 'echo trace' lazy-prereq-and-tracing/err
-"
+ check_sub_test_lib_test cleanup <<-\EOF
+ ok 1 - do cleanup
+ ok 2 - cleanup happened
+ # passed all 2 test(s)
+ 1..2
+ EOF
+'
-test_expect_success 'tests clean up even on failures' "
+test_expect_success 'tests clean up even on failures' '
run_sub_test_lib_test_err \
- failing-cleanup 'Failing tests with cleanup commands' <<-\\EOF &&
- test_expect_success 'tests clean up even after a failure' '
+ failing-cleanup "Failing tests with cleanup commands" <<-\EOF &&
+ test_expect_success "tests clean up even after a failure" "
touch clean-after-failure &&
test_when_finished rm clean-after-failure &&
(exit 1)
- '
- test_expect_success 'failure to clean up causes the test to fail' '
+ "
+ test_expect_success "failure to clean up causes the test to fail" "
test_when_finished \"(exit 2)\"
- '
+ "
test_done
EOF
- check_sub_test_lib_test failing-cleanup <<-\\EOF
+ check_sub_test_lib_test failing-cleanup <<-\EOF
> not ok 1 - tests clean up even after a failure
> # Z
> # touch clean-after-failure &&
@@ -896,30 +894,30 @@ test_expect_success 'tests clean up even on failures' "
> # Z
> not ok 2 - failure to clean up causes the test to fail
> # Z
- > # test_when_finished \"(exit 2)\"
+ > # test_when_finished "(exit 2)"
> # Z
> # failed 2 among 2 test(s)
> 1..2
EOF
-"
+'
-test_expect_success 'test_atexit is run' "
+test_expect_success 'test_atexit is run' '
run_sub_test_lib_test_err \
- atexit-cleanup 'Run atexit commands' -i <<-\\EOF &&
- test_expect_success 'tests clean up even after a failure' '
+ atexit-cleanup "Run atexit commands" -i <<-\EOF &&
+ test_expect_success "tests clean up even after a failure" "
> ../../clean-atexit &&
test_atexit rm ../../clean-atexit &&
> ../../also-clean-atexit &&
test_atexit rm ../../also-clean-atexit &&
> ../../dont-clean-atexit &&
(exit 1)
- '
+ "
test_done
EOF
test_path_is_file dont-clean-atexit &&
test_path_is_missing clean-atexit &&
test_path_is_missing also-clean-atexit
-"
+'
test_expect_success 'test_oid provides sane info by default' '
test_oid zero >actual &&
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index 75ee9a96b8..6b757d7169 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -11,7 +11,7 @@ check_relative() {
echo "$t -> $2" >expect
test_expect_${3:-success} "relative date ($2)" "
test-tool date relative $t >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
"
}
@@ -139,7 +139,7 @@ check_date_format_human() {
echo "$t -> $2" >expect
test_expect_success "human date $t" '
test-tool date human $t >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
}
diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
index 370a389e5c..f7abde62f6 100755
--- a/t/t0008-ignores.sh
+++ b/t/t0008-ignores.sh
@@ -34,7 +34,7 @@ expect_from_stdin () {
test_stderr () {
expected="$1"
expect_in stderr "$1" &&
- test_i18ncmp "$HOME/expected-stderr" "$HOME/stderr"
+ test_cmp "$HOME/expected-stderr" "$HOME/stderr"
}
broken_c_unquote () {
diff --git a/t/t0012-help.sh b/t/t0012-help.sh
index e8ef7300ec..5679e29c62 100755
--- a/t/t0012-help.sh
+++ b/t/t0012-help.sh
@@ -55,7 +55,7 @@ test_expect_success "--help does not work for guides" "
git: 'revisions' is not a git command. See 'git --help'.
EOF
test_must_fail git revisions --help 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
"
test_expect_success 'git help' '
diff --git a/t/t0017-env-helper.sh b/t/t0017-env-helper.sh
index c1ecf6aeac..4a159f99e4 100755
--- a/t/t0017-env-helper.sh
+++ b/t/t0017-env-helper.sh
@@ -86,14 +86,14 @@ test_expect_success 'env--helper reads config thanks to trace2' '
git config -f home/cycle include.path .gitconfig &&
test_must_fail \
- env HOME="$(pwd)/home" GIT_TEST_GETTEXT_POISON=false \
+ env HOME="$(pwd)/home" \
git config -l 2>err &&
grep "exceeded maximum include depth" err &&
test_must_fail \
- env HOME="$(pwd)/home" GIT_TEST_GETTEXT_POISON=true \
- git -C cycle env--helper --type=bool --default=0 --exit-code GIT_TEST_GETTEXT_POISON 2>err &&
- grep "# GETTEXT POISON #" err
+ env HOME="$(pwd)/home" GIT_TEST_ENV_HELPER=true \
+ git -C cycle env--helper --type=bool --default=0 --exit-code GIT_TEST_ENV_HELPER 2>err &&
+ grep "exceeded maximum include depth" err
'
test_done
diff --git a/t/t0018-advice.sh b/t/t0018-advice.sh
index e03554d2f3..39e5e4b34f 100755
--- a/t/t0018-advice.sh
+++ b/t/t0018-advice.sh
@@ -10,7 +10,7 @@ test_expect_success 'advice should be printed when config variable is unset' '
hint: Disable this message with "git config advice.nestedTag false"
EOF
test-tool advise "This is a piece of advice" 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'advice should be printed when config variable is set to true' '
@@ -20,7 +20,7 @@ test_expect_success 'advice should be printed when config variable is set to tru
EOF
test_config advice.nestedTag true &&
test-tool advise "This is a piece of advice" 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'advice should not be printed when config variable is set to false' '
diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
index 375cf94398..f25ae8b5e1 100755
--- a/t/t0020-crlf.sh
+++ b/t/t0020-crlf.sh
@@ -87,10 +87,8 @@ test_expect_success 'safecrlf: print warning only once' '
git commit -m "nowarn" &&
for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >doublewarn &&
git add doublewarn 2>err &&
- if test_have_prereq C_LOCALE_OUTPUT
- then
- test $(grep "CRLF will be replaced by LF" err | wc -l) = 1
- fi
+ grep "CRLF will be replaced by LF" err >err.warnings &&
+ test_line_count = 1 err.warnings
'
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index e4c4de5c74..e828ee964c 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -34,7 +34,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. https://lore.kernel.org/git/xmqqshv18i8i.fsf@gitster.mtv.corp.google.com/
test_cmp_count () {
expect=$1
actual=$2
@@ -49,7 +49,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. https://lore.kernel.org/git/xmqqshv18i8i.fsf@gitster.mtv.corp.google.com/
test_cmp_exclude_clean () {
expect=$1
actual=$2
diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
index 51f74a3ddf..d24d5acfbc 100755
--- a/t/t0027-auto-crlf.sh
+++ b/t/t0027-auto-crlf.sh
@@ -83,7 +83,7 @@ check_warning () {
*) echo >&2 "Illegal 1": "$1" ; return false ;;
esac
grep "will be replaced by" "$2" | sed -e "s/\(.*\) in [^ ]*$/\1/" | uniq >"$2".actual
- test_i18ncmp "$2".expect "$2".actual
+ test_cmp "$2".expect "$2".actual
}
commit_check_warn () {
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 14cafc138b..ad4746d899 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -61,7 +61,7 @@ EOF
test_expect_success 'test help' '
test_must_fail test-tool parse-options -h >output 2>output.err &&
test_must_be_empty output.err &&
- test_i18ncmp expect output
+ test_cmp expect output
'
mv expect expect.err
@@ -84,7 +84,7 @@ check_unknown_i18n() {
cat expect.err >>expect &&
test_must_fail test-tool parse-options $* >output 2>output.err &&
test_must_be_empty output &&
- test_i18ncmp expect output.err
+ test_cmp expect output.err
}
test_expect_success 'OPT_BOOL() #1' 'check boolean: 1 --yes'
@@ -250,7 +250,7 @@ EOF
test_expect_success 'detect possible typos' '
test_must_fail test-tool parse-options -boolean >output 2>output.err &&
test_must_be_empty output &&
- test_i18ncmp typo.err output.err
+ test_cmp typo.err output.err
'
cat >typo.err <<\EOF
@@ -260,7 +260,7 @@ EOF
test_expect_success 'detect possible typos' '
test_must_fail test-tool parse-options -ambiguous >output 2>output.err &&
test_must_be_empty output &&
- test_i18ncmp typo.err output.err
+ test_cmp typo.err output.err
'
test_expect_success 'keep some options as arguments' '
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index 5a633690bf..9bf66c9e68 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -10,40 +10,36 @@ cache-tree extension.
cmp_cache_tree () {
test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual &&
sed "s/$OID_REGEX/SHA/" <actual >filtered &&
- test_cmp "$1" filtered
+ test_cmp "$1" filtered &&
+ rm filtered
}
# We don't bother with actually checking the SHA1:
# test-tool dump-cache-tree already verifies that all existing data is
# correct.
-generate_expected_cache_tree_rec () {
- dir="$1${1:+/}" &&
- 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) &&
- subtree_count=$(echo "$subtrees"|awk -v c=0 '$1 != "" {++c} END {print c}') &&
- entries=$(wc -l <files) &&
- printf "SHA $dir (%d entries, %d subtrees)\n" "$entries" "$subtree_count" &&
- for subtree in $subtrees
- do
- cd "$subtree"
- generate_expected_cache_tree_rec "$dir$subtree" "$dir" || return 1
- cd ..
- done &&
- dir=$parent
-}
-
generate_expected_cache_tree () {
- (
- generate_expected_cache_tree_rec
- )
+ pathspec="$1" &&
+ dir="$2${2:+/}" &&
+ git ls-tree --name-only HEAD -- "$pathspec" >files &&
+ git ls-tree --name-only -d HEAD -- "$pathspec" >subtrees &&
+ printf "SHA %s (%d entries, %d subtrees)\n" "$dir" $(wc -l <files) $(wc -l <subtrees) &&
+ while read subtree
+ do
+ generate_expected_cache_tree "$pathspec/$subtree/" "$subtree" || return 1
+ done <subtrees
}
test_cache_tree () {
- generate_expected_cache_tree >expect &&
- cmp_cache_tree expect
+ generate_expected_cache_tree "." >expect &&
+ cmp_cache_tree expect &&
+ rm expect actual files subtrees &&
+ git status --porcelain -- ':!status' ':!expected.status' >status &&
+ if test -n "$1"
+ then
+ test_cmp "$1" status
+ else
+ test_must_be_empty status
+ fi
}
test_invalid_cache_tree () {
@@ -54,7 +50,7 @@ test_invalid_cache_tree () {
}
test_no_cache_tree () {
- : >expect &&
+ >expect &&
cmp_cache_tree expect
}
@@ -83,18 +79,6 @@ test_expect_success 'git-add in subdir invalidates cache-tree' '
test_invalid_cache_tree
'
-cat >before <<\EOF
-SHA (3 entries, 2 subtrees)
-SHA dir1/ (1 entries, 0 subtrees)
-SHA dir2/ (1 entries, 0 subtrees)
-EOF
-
-cat >expect <<\EOF
-invalid (2 subtrees)
-invalid dir1/ (0 subtrees)
-SHA dir2/ (1 entries, 0 subtrees)
-EOF
-
test_expect_success 'git-add in subdir does not invalidate sibling cache-tree' '
git tag no-children &&
test_when_finished "git reset --hard no-children; git read-tree HEAD" &&
@@ -102,9 +86,20 @@ test_expect_success 'git-add in subdir does not invalidate sibling cache-tree' '
test_commit dir1/a &&
test_commit dir2/b &&
echo "I changed this file" >dir1/a &&
+ test_when_finished "rm before" &&
+ cat >before <<-\EOF &&
+ SHA (3 entries, 2 subtrees)
+ SHA dir1/ (1 entries, 0 subtrees)
+ SHA dir2/ (1 entries, 0 subtrees)
+ EOF
cmp_cache_tree before &&
echo "I changed this file" >dir1/a &&
git add dir1/a &&
+ cat >expect <<-\EOF &&
+ invalid (2 subtrees)
+ invalid dir1/ (0 subtrees)
+ SHA dir2/ (1 entries, 0 subtrees)
+ EOF
cmp_cache_tree expect
'
@@ -133,6 +128,7 @@ test_expect_success 'second commit has cache-tree' '
'
test_expect_success PERL 'commit --interactive gives cache-tree on partial commit' '
+ test_when_finished "git reset --hard" &&
cat <<-\EOT >foo.c &&
int foo()
{
@@ -159,7 +155,10 @@ test_expect_success PERL 'commit --interactive gives cache-tree on partial commi
EOT
test_write_lines p 1 "" s n y q |
git commit --interactive -m foo &&
- test_cache_tree
+ cat <<-\EOF >expected.status &&
+ M foo.c
+ EOF
+ test_cache_tree expected.status
'
test_expect_success PERL 'commit -p with shrinking cache-tree' '
@@ -250,7 +249,10 @@ test_expect_success 'partial commit gives cache-tree' '
git add one.t &&
echo "some other change" >two.t &&
git commit two.t -m partial &&
- test_cache_tree
+ cat <<-\EOF >expected.status &&
+ M one.t
+ EOF
+ test_cache_tree expected.status
'
test_expect_success 'no phantom error when switching trees' '
diff --git a/t/t0201-gettext-fallbacks.sh b/t/t0201-gettext-fallbacks.sh
index 90da1c7ddc..6c74df0dc6 100755
--- a/t/t0201-gettext-fallbacks.sh
+++ b/t/t0201-gettext-fallbacks.sh
@@ -18,7 +18,7 @@ test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_TEST_FALLBACKS is set' '
test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
'
-test_expect_success C_LOCALE_OUTPUT 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is fallthrough' '
+test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is fallthrough' '
echo fallthrough >expect &&
echo $GIT_INTERNAL_GETTEXT_SH_SCHEME >actual &&
test_cmp expect actual
@@ -27,25 +27,25 @@ test_expect_success C_LOCALE_OUTPUT 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is
test_expect_success 'gettext: our gettext() fallback has pass-through semantics' '
printf "test" >expect &&
gettext "test" >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
printf "test more words" >expect &&
gettext "test more words" >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'eval_gettext: our eval_gettext() fallback has pass-through semantics' '
printf "test" >expect &&
eval_gettext "test" >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
printf "test more words" >expect &&
eval_gettext "test more words" >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables' '
printf "test YesPlease" >expect &&
GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease eval_gettext "test \$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces' '
@@ -53,7 +53,7 @@ test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate v
export cmdline &&
printf "When you have resolved this problem, run git am --resolved." >expect &&
eval_gettext "When you have resolved this problem, run \$cmdline --resolved." >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces and quotes' '
@@ -61,7 +61,7 @@ test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate v
export cmdline &&
printf "When you have resolved this problem, run \"git am --resolved\"." >expect &&
eval_gettext "When you have resolved this problem, run \"\$cmdline --resolved\"." >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_done
diff --git a/t/t0205-gettext-poison.sh b/t/t0205-gettext-poison.sh
deleted file mode 100755
index f9fa16ad83..0000000000
--- a/t/t0205-gettext-poison.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2010 Ævar Arnfjörð Bjarmason
-#
-
-test_description='Gettext Shell poison'
-
-GIT_TEST_GETTEXT_POISON=true
-export GIT_TEST_GETTEXT_POISON
-. ./lib-gettext.sh
-
-test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is poison' '
- test "$GIT_INTERNAL_GETTEXT_SH_SCHEME" = "poison"
-'
-
-test_expect_success 'gettext: our gettext() fallback has poison semantics' '
- printf "# GETTEXT POISON #" >expect &&
- gettext "test" >actual &&
- test_cmp expect actual &&
- printf "# GETTEXT POISON #" >expect &&
- gettext "test more words" >actual &&
- test_cmp expect actual
-'
-
-test_expect_success 'eval_gettext: our eval_gettext() fallback has poison semantics' '
- printf "# GETTEXT POISON #" >expect &&
- eval_gettext "test" >actual &&
- test_cmp expect actual &&
- printf "# GETTEXT POISON #" >expect &&
- eval_gettext "test more words" >actual &&
- test_cmp expect actual
-'
-
-test_expect_success "gettext: invalid GIT_TEST_GETTEXT_POISON value doesn't infinitely loop" "
- test_must_fail env GIT_TEST_GETTEXT_POISON=xyz git version 2>error &&
- grep \"fatal: bad numeric config value 'xyz' for 'GIT_TEST_GETTEXT_POISON': invalid unit\" error
-"
-
-test_done
diff --git a/t/t0210-trace2-normal.sh b/t/t0210-trace2-normal.sh
index ce7574edb1..0cf3a63b75 100755
--- a/t/t0210-trace2-normal.sh
+++ b/t/t0210-trace2-normal.sh
@@ -147,6 +147,25 @@ test_expect_success 'normal stream, error event' '
test_cmp expect actual
'
+# Verb 007bug
+#
+# Check that BUG writes to trace2
+
+test_expect_success 'BUG messages are written to trace2' '
+ test_when_finished "rm trace.normal actual expect" &&
+ test_must_fail env GIT_TRACE2="$(pwd)/trace.normal" test-tool trace2 007bug &&
+ perl "$TEST_DIRECTORY/t0210/scrub_normal.perl" <trace.normal >actual &&
+ cat >expect <<-EOF &&
+ version $V
+ start _EXE_ trace2 007bug
+ cmd_name trace2 (trace2)
+ error the bug message
+ exit elapsed:_TIME_ code:99
+ atexit elapsed:_TIME_ code:99
+ EOF
+ test_cmp expect actual
+'
+
sane_unset GIT_TRACE2_BRIEF
# Now test without environment variables and get all Trace2 settings
diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh
index a18f8a473b..3485c0534e 100755
--- a/t/t0300-credentials.sh
+++ b/t/t0300-credentials.sh
@@ -578,7 +578,7 @@ test_expect_success 'helpers can abort the process' '
quit: host=example.com
fatal: credential helper '\''quit'\'' told us to quit
EOF
- test_i18ncmp expect stderr
+ test_cmp expect stderr
'
test_expect_success 'empty helper spec resets helper list' '
@@ -606,7 +606,7 @@ test_expect_success 'url parser rejects embedded newlines' '
warning: url contains a newline in its path 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_cmp expect stderr
'
test_expect_success 'host-less URLs are parsed as empty host' '
@@ -633,7 +633,7 @@ test_expect_success 'credential system refuses to work with missing host' '
cat >expect <<-\EOF &&
fatal: refusing to work with credential missing host field
EOF
- test_i18ncmp expect stderr
+ test_cmp expect stderr
'
test_expect_success 'credential system refuses to work with missing protocol' '
@@ -643,7 +643,7 @@ test_expect_success 'credential system refuses to work with missing protocol' '
cat >expect <<-\EOF &&
fatal: refusing to work with credential missing protocol field
EOF
- test_i18ncmp expect stderr
+ test_cmp expect stderr
'
# usage: check_host_and_path <url> <expected-host> <expected-path>
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index 1ed1df351c..22058b503a 100755
--- a/t/t0500-progress-display.sh
+++ b/t/t0500-progress-display.sh
@@ -29,7 +29,7 @@ test_expect_success 'simple progress display' '
test-tool progress "Working hard" <in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'progress display with total' '
@@ -48,7 +48,7 @@ test_expect_success 'progress display with total' '
test-tool progress --total=3 "Working hard" <in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'progress display breaks long lines #1' '
@@ -72,7 +72,7 @@ EOF
<in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'progress display breaks long lines #2' '
@@ -100,7 +100,7 @@ EOF
<in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'progress display breaks long lines #3 - even the first is too long' '
@@ -126,7 +126,7 @@ EOF
<in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'progress display breaks long lines #4 - title line matches terminal width' '
@@ -150,7 +150,7 @@ EOF
<in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
# Progress counter goes backwards, this should not happen in practice.
@@ -172,7 +172,7 @@ test_expect_success 'progress shortens - crazy caller' '
test-tool progress --total=1000 "Working hard" <in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'progress display with throughput' '
@@ -201,7 +201,7 @@ test_expect_success 'progress display with throughput' '
test-tool progress "Working hard" <in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'progress display with throughput and total' '
@@ -226,7 +226,7 @@ test_expect_success 'progress display with throughput and total' '
test-tool progress --total=40 "Working hard" <in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'cover up after throughput shortens' '
@@ -255,7 +255,7 @@ test_expect_success 'cover up after throughput shortens' '
test-tool progress "Working hard" <in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'cover up after throughput shortens a lot' '
@@ -280,7 +280,7 @@ test_expect_success 'cover up after throughput shortens a lot' '
test-tool progress "Working hard" <in 2>stderr &&
show_cr <stderr >out &&
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'progress generates traces' '
@@ -303,8 +303,7 @@ test_expect_success 'progress generates traces' '
"Working hard" <in 2>stderr &&
# t0212/parse_events.perl intentionally omits regions and data.
- grep -e "region_enter" -e "\"category\":\"progress\"" trace.event &&
- grep -e "region_leave" -e "\"category\":\"progress\"" trace.event &&
+ test_region progress "Working hard" trace.event &&
grep "\"key\":\"total_objects\",\"value\":\"40\"" trace.event &&
grep "\"key\":\"total_bytes\",\"value\":\"409600\"" trace.event
'
diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index dfe9794a74..24092c09a9 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -253,7 +253,7 @@ warning: The following paths were already present and thus not updated despite s
After fixing the above paths, you may want to run `git sparse-checkout reapply`.
EOF
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'checkout without --ignore-skip-worktree-bits' '
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
new file mode 100755
index 0000000000..8cd3e5a8d2
--- /dev/null
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -0,0 +1,301 @@
+#!/bin/sh
+
+test_description='compare full workdir to sparse workdir'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ git init initial-repo &&
+ (
+ cd initial-repo &&
+ echo a >a &&
+ echo "after deep" >e &&
+ echo "after folder1" >g &&
+ echo "after x" >z &&
+ mkdir folder1 folder2 deep x &&
+ mkdir deep/deeper1 deep/deeper2 &&
+ mkdir deep/deeper1/deepest &&
+ echo "after deeper1" >deep/e &&
+ echo "after deepest" >deep/deeper1/e &&
+ cp a folder1 &&
+ cp a folder2 &&
+ cp a x &&
+ cp a deep &&
+ cp a deep/deeper1 &&
+ cp a deep/deeper2 &&
+ cp a deep/deeper1/deepest &&
+ cp -r deep/deeper1/deepest deep/deeper2 &&
+ git add . &&
+ git commit -m "initial commit" &&
+ git checkout -b base &&
+ for dir in folder1 folder2 deep
+ do
+ git checkout -b update-$dir &&
+ echo "updated $dir" >$dir/a &&
+ git commit -a -m "update $dir" || return 1
+ done &&
+
+ git checkout -b rename-base base &&
+ echo >folder1/larger-content <<-\EOF &&
+ matching
+ lines
+ help
+ inexact
+ renames
+ EOF
+ cp folder1/larger-content folder2/ &&
+ cp folder1/larger-content deep/deeper1/ &&
+ git add . &&
+ git commit -m "add interesting rename content" &&
+
+ git checkout -b rename-out-to-out rename-base &&
+ mv folder1/a folder2/b &&
+ mv folder1/larger-content folder2/edited-content &&
+ echo >>folder2/edited-content &&
+ git add . &&
+ git commit -m "rename folder1/... to folder2/..." &&
+
+ git checkout -b rename-out-to-in rename-base &&
+ mv folder1/a deep/deeper1/b &&
+ mv folder1/larger-content deep/deeper1/edited-content &&
+ echo >>deep/deeper1/edited-content &&
+ git add . &&
+ git commit -m "rename folder1/... to deep/deeper1/..." &&
+
+ git checkout -b rename-in-to-out rename-base &&
+ mv deep/deeper1/a folder1/b &&
+ mv deep/deeper1/larger-content folder1/edited-content &&
+ echo >>folder1/edited-content &&
+ git add . &&
+ git commit -m "rename deep/deeper1/... to folder1/..." &&
+
+ git checkout -b deepest base &&
+ echo "updated deepest" >deep/deeper1/deepest/a &&
+ git commit -a -m "update deepest" &&
+
+ git checkout -f base &&
+ git reset --hard
+ )
+'
+
+init_repos () {
+ rm -rf full-checkout sparse-checkout sparse-index &&
+
+ # create repos in initial state
+ cp -r initial-repo full-checkout &&
+ git -C full-checkout reset --hard &&
+
+ cp -r initial-repo sparse-checkout &&
+ git -C sparse-checkout reset --hard &&
+ git -C sparse-checkout sparse-checkout init --cone &&
+
+ # initialize sparse-checkout definitions
+ git -C sparse-checkout sparse-checkout set deep
+}
+
+run_on_sparse () {
+ (
+ cd sparse-checkout &&
+ $* >../sparse-checkout-out 2>../sparse-checkout-err
+ )
+}
+
+run_on_all () {
+ (
+ cd full-checkout &&
+ $* >../full-checkout-out 2>../full-checkout-err
+ ) &&
+ run_on_sparse $*
+}
+
+test_all_match () {
+ run_on_all $* &&
+ test_cmp full-checkout-out sparse-checkout-out &&
+ test_cmp full-checkout-err sparse-checkout-err
+}
+
+test_expect_success 'status with options' '
+ init_repos &&
+ test_all_match git status --porcelain=v2 &&
+ test_all_match git status --porcelain=v2 -z -u &&
+ test_all_match git status --porcelain=v2 -uno &&
+ run_on_all "touch README.md" &&
+ test_all_match git status --porcelain=v2 &&
+ test_all_match git status --porcelain=v2 -z -u &&
+ test_all_match git status --porcelain=v2 -uno &&
+ test_all_match git add README.md &&
+ test_all_match git status --porcelain=v2 &&
+ test_all_match git status --porcelain=v2 -z -u &&
+ test_all_match git status --porcelain=v2 -uno
+'
+
+test_expect_success 'add, commit, checkout' '
+ init_repos &&
+
+ write_script edit-contents <<-\EOF &&
+ echo text >>$1
+ EOF
+ run_on_all "../edit-contents README.md" &&
+
+ test_all_match git add README.md &&
+ test_all_match git status --porcelain=v2 &&
+ test_all_match git commit -m "Add README.md" &&
+
+ test_all_match git checkout HEAD~1 &&
+ test_all_match git checkout - &&
+
+ run_on_all "../edit-contents README.md" &&
+
+ test_all_match git add -A &&
+ test_all_match git status --porcelain=v2 &&
+ test_all_match git commit -m "Extend README.md" &&
+
+ test_all_match git checkout HEAD~1 &&
+ test_all_match git checkout - &&
+
+ run_on_all "../edit-contents deep/newfile" &&
+
+ test_all_match git status --porcelain=v2 -uno &&
+ test_all_match git status --porcelain=v2 &&
+ test_all_match git add . &&
+ test_all_match git status --porcelain=v2 &&
+ test_all_match git commit -m "add deep/newfile" &&
+
+ test_all_match git checkout HEAD~1 &&
+ test_all_match git checkout -
+'
+
+test_expect_success 'checkout and reset --hard' '
+ init_repos &&
+
+ test_all_match git checkout update-folder1 &&
+ test_all_match git status --porcelain=v2 &&
+
+ test_all_match git checkout update-deep &&
+ test_all_match git status --porcelain=v2 &&
+
+ test_all_match git checkout -b reset-test &&
+ test_all_match git reset --hard deepest &&
+ test_all_match git reset --hard update-folder1 &&
+ test_all_match git reset --hard update-folder2
+'
+
+test_expect_success 'diff --staged' '
+ init_repos &&
+
+ write_script edit-contents <<-\EOF &&
+ echo text >>README.md
+ EOF
+ run_on_all "../edit-contents" &&
+
+ test_all_match git diff &&
+ test_all_match git diff --staged &&
+ test_all_match git add README.md &&
+ test_all_match git diff &&
+ test_all_match git diff --staged
+'
+
+test_expect_success 'diff with renames' '
+ init_repos &&
+
+ for branch in rename-out-to-out rename-out-to-in rename-in-to-out
+ do
+ test_all_match git checkout rename-base &&
+ test_all_match git checkout $branch -- .&&
+ test_all_match git diff --staged --no-renames &&
+ test_all_match git diff --staged --find-renames || return 1
+ done
+'
+
+test_expect_success 'log with pathspec outside sparse definition' '
+ init_repos &&
+
+ test_all_match git log -- a &&
+ test_all_match git log -- folder1/a &&
+ test_all_match git log -- folder2/a &&
+ test_all_match git log -- deep/a &&
+ test_all_match git log -- deep/deeper1/a &&
+ test_all_match git log -- deep/deeper1/deepest/a &&
+
+ test_all_match git checkout update-folder1 &&
+ test_all_match git log -- folder1/a
+'
+
+test_expect_success 'blame with pathspec inside sparse definition' '
+ init_repos &&
+
+ test_all_match git blame a &&
+ test_all_match git blame deep/a &&
+ test_all_match git blame deep/deeper1/a &&
+ test_all_match git blame deep/deeper1/deepest/a
+'
+
+# TODO: blame currently does not support blaming files outside of the
+# sparse definition. It complains that the file doesn't exist locally.
+test_expect_failure 'blame with pathspec outside sparse definition' '
+ init_repos &&
+
+ test_all_match git blame folder1/a &&
+ test_all_match git blame folder2/a &&
+ test_all_match git blame deep/deeper2/a &&
+ test_all_match git blame deep/deeper2/deepest/a
+'
+
+# TODO: reset currently does not behave as expected when in a
+# sparse-checkout.
+test_expect_failure 'checkout and reset (mixed)' '
+ init_repos &&
+
+ test_all_match git checkout -b reset-test update-deep &&
+ test_all_match git reset deepest &&
+ test_all_match git reset update-folder1 &&
+ test_all_match git reset update-folder2
+'
+
+test_expect_success 'merge' '
+ init_repos &&
+
+ test_all_match git checkout -b merge update-deep &&
+ test_all_match git merge -m "folder1" update-folder1 &&
+ test_all_match git rev-parse HEAD^{tree} &&
+ test_all_match git merge -m "folder2" update-folder2 &&
+ test_all_match git rev-parse HEAD^{tree}
+'
+
+test_expect_success 'merge with outside renames' '
+ init_repos &&
+
+ for type in out-to-out out-to-in in-to-out
+ do
+ test_all_match git reset --hard &&
+ test_all_match git checkout -f -b merge-$type update-deep &&
+ test_all_match git merge -m "$type" rename-$type &&
+ test_all_match git rev-parse HEAD^{tree} || return 1
+ done
+'
+
+test_expect_success 'clean' '
+ init_repos &&
+
+ echo bogus >>.gitignore &&
+ run_on_all cp ../.gitignore . &&
+ test_all_match git add .gitignore &&
+ test_all_match git commit -m ignore-bogus-files &&
+
+ run_on_sparse mkdir folder1 &&
+ run_on_all touch folder1/bogus &&
+
+ test_all_match git status --porcelain=v2 &&
+ test_all_match git clean -f &&
+ test_all_match git status --porcelain=v2 &&
+
+ test_all_match git clean -xf &&
+ test_all_match git status --porcelain=v2 &&
+
+ test_all_match git clean -xdf &&
+ test_all_match git status --porcelain=v2 &&
+
+ test_path_is_dir sparse-checkout/folder1
+'
+
+test_done
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 936d72041b..e0dd5d65ce 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -675,6 +675,13 @@ test_expect_success 'invalid unit' '
test_i18ngrep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
'
+test_expect_success 'invalid unit boolean' '
+ git config commit.gpgsign "1true" &&
+ test_cmp_config 1true commit.gpgsign &&
+ test_must_fail git config --bool --get commit.gpgsign 2>actual &&
+ test_i18ngrep "bad boolean config value .1true. for .commit.gpgsign." actual
+'
+
test_expect_success 'line number is reported correctly' '
printf "[bool]\n\tvar\n" >invalid &&
test_must_fail git config -f invalid --path bool.var 2>actual &&
diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh
index 938ca17d78..ccbb116c01 100755
--- a/t/t1305-config-include.sh
+++ b/t/t1305-config-include.sh
@@ -352,9 +352,7 @@ test_expect_success 'include cycles are detected' '
git init --bare cycle &&
git -C cycle config include.path cycle &&
git config -f cycle/cycle include.path config &&
- test_must_fail \
- env GIT_TEST_GETTEXT_POISON=false \
- git -C cycle config --get-all test.value 2>stderr &&
+ test_must_fail git -C cycle config --get-all test.value 2>stderr &&
grep "exceeded maximum include depth" stderr
'
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index 3a527e3a84..88b119a0a3 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -208,14 +208,14 @@ test_expect_success 'proper error on error in default config files' '
echo "[" >>.git/config &&
echo "fatal: bad config line 34 in file .git/config" >expect &&
test_expect_code 128 test-tool config get_value foo.bar 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'proper error on error in custom config files' '
echo "[" >>syntax-error &&
echo "fatal: bad config line 1 in file syntax-error" >expect &&
test_expect_code 128 test-tool config configset_get_value foo.bar syntax-error 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'check line errors for malformed values' '
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 359d8731c8..e31f65f381 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -374,7 +374,7 @@ test_expect_success 'Query "main@{May 25 2005}" (before history)' '
echo "$C" >expect &&
test_cmp expect o &&
echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
- test_i18ncmp expect e
+ test_cmp expect e
'
test_expect_success 'Query main@{2005-05-25} (before history)' '
test_when_finished "rm -f o e" &&
@@ -382,7 +382,7 @@ test_expect_success 'Query main@{2005-05-25} (before history)' '
echo "$C" >expect &&
test_cmp expect o &&
echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
- test_i18ncmp expect e
+ test_cmp expect e
'
test_expect_success 'Query "main@{May 26 2005 23:31:59}" (1 second before history)' '
test_when_finished "rm -f o e" &&
@@ -390,7 +390,7 @@ test_expect_success 'Query "main@{May 26 2005 23:31:59}" (1 second before histor
echo "$C" >expect &&
test_cmp expect o &&
echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
- test_i18ncmp expect e
+ test_cmp expect e
'
test_expect_success 'Query "main@{May 26 2005 23:32:00}" (exactly history start)' '
test_when_finished "rm -f o e" &&
diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh
index 2d142e5535..8b51c4efc1 100755
--- a/t/t1404-update-ref-errors.sh
+++ b/t/t1404-update-ref-errors.sh
@@ -101,7 +101,7 @@ df_test() {
printf "%s\n" "delete $delname" "create $addname $D"
fi >commands &&
test_must_fail git update-ref --stdin <commands 2>output.err &&
- test_i18ncmp expected-err output.err &&
+ test_cmp expected-err output.err &&
printf "%s\n" "$C $delref" >expected-refs &&
git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
test_cmp expected-refs actual-refs
diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh
index 602e21957b..a237d9880e 100755
--- a/t/t1405-main-ref-store.sh
+++ b/t/t1405-main-ref-store.sh
@@ -17,13 +17,6 @@ test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '
N=`find .git/refs -type f | wc -l`
'
-test_expect_success 'peel_ref(new-tag)' '
- git rev-parse HEAD >expected &&
- git tag -a -m new-tag new-tag HEAD &&
- $RUN peel-ref refs/tags/new-tag >actual &&
- test_cmp expected actual
-'
-
test_expect_success 'create_symref(FOO, refs/heads/main)' '
$RUN create-symref FOO refs/heads/main nothing &&
echo refs/heads/main >expected &&
@@ -32,6 +25,7 @@ test_expect_success 'create_symref(FOO, refs/heads/main)' '
'
test_expect_success 'delete_refs(FOO, refs/tags/new-tag)' '
+ git tag -a -m new-tag new-tag HEAD &&
git rev-parse FOO -- &&
git rev-parse refs/tags/new-tag -- &&
m=$(git rev-parse main) &&
diff --git a/t/t1406-submodule-ref-store.sh b/t/t1406-submodule-ref-store.sh
index a68c8f11a2..0a87058971 100755
--- a/t/t1406-submodule-ref-store.sh
+++ b/t/t1406-submodule-ref-store.sh
@@ -14,7 +14,8 @@ test_expect_success 'setup' '
(
cd sub &&
test_commit first &&
- git checkout -b new-main
+ git checkout -b new-main &&
+ git tag -a -m new-tag new-tag HEAD
)
'
@@ -22,13 +23,6 @@ test_expect_success 'pack_refs() not allowed' '
test_must_fail $RUN pack-refs 3
'
-test_expect_success 'peel_ref(new-tag)' '
- git -C sub rev-parse HEAD >expected &&
- git -C sub tag -a -m new-tag new-tag HEAD &&
- $RUN peel-ref refs/tags/new-tag >actual &&
- test_cmp expected actual
-'
-
test_expect_success 'create_symref() not allowed' '
test_must_fail $RUN create-symref FOO refs/heads/main nothing
'
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index ecccaa0634..27b9080251 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -158,6 +158,32 @@ test_expect_success 'reflog expire' '
check_fsck "dangling commit $K"
'
+test_expect_success '--stale-fix handles missing objects generously' '
+ git -c core.logAllRefUpdates=false fast-import --date-format=now <<-EOS &&
+ commit refs/heads/stale-fix
+ mark :1
+ committer Author <a@uth.or> now
+ data <<EOF
+ start stale fix
+ EOF
+ M 100644 inline file
+ data <<EOF
+ contents
+ EOF
+ commit refs/heads/stale-fix
+ committer Author <a@uth.or> now
+ data <<EOF
+ stale fix branch tip
+ EOF
+ from :1
+ EOS
+
+ parent_oid=$(git rev-parse stale-fix^) &&
+ test_when_finished "recover $parent_oid" &&
+ corrupt $parent_oid &&
+ git reflog expire --stale-fix
+'
+
test_expect_success 'prune and fsck' '
git prune &&
diff --git a/t/t1430-bad-ref-name.sh b/t/t1430-bad-ref-name.sh
index 354902e514..b1839e0877 100755
--- a/t/t1430-bad-ref-name.sh
+++ b/t/t1430-bad-ref-name.sh
@@ -125,7 +125,7 @@ test_expect_success 'push cannot create a badly named ref' '
! grep -e "broken\.\.\.ref" output
'
-test_expect_failure C_LOCALE_OUTPUT 'push --mirror can delete badly named ref' '
+test_expect_failure 'push --mirror can delete badly named ref' '
top=$(pwd) &&
git init src &&
git init dest &&
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index a30fc5f74a..5071ac63a5 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -40,17 +40,13 @@ test_expect_success 'HEAD is part of refs, valid objects appear valid' '
# specific corruption you test afterwards, lest a later test trip over
# it.
-test_expect_success 'setup: helpers for corruption tests' '
- sha1_file() {
- remainder=${1#??} &&
- firsttwo=${1%$remainder} &&
- echo ".git/objects/$firsttwo/$remainder"
- } &&
+sha1_file () {
+ git rev-parse --git-path objects/$(test_oid_to_path "$1")
+}
- remove_object() {
- rm "$(sha1_file "$1")"
- }
-'
+remove_object () {
+ rm "$(sha1_file "$1")"
+}
test_expect_success 'object with bad sha1' '
sha=$(echo blob | git hash-object -w --stdin) &&
@@ -380,7 +376,7 @@ test_expect_success 'tag with incorrect tag name & missing tagger' '
warning in tag $tag: badTagName: invalid '\''tag'\'' name: wrong name format
warning in tag $tag: missingTaggerEntry: invalid format - expected '\''tagger'\'' line
EOF
- test_i18ncmp expect out
+ test_cmp expect out
'
test_expect_success 'tag with bad tagger' '
@@ -662,13 +658,15 @@ test_expect_success 'fsck --name-objects' '
git init name-objects &&
(
cd name-objects &&
+ git config core.logAllRefUpdates false &&
test_commit julius caesar.t &&
- test_commit augustus &&
- test_commit caesar &&
+ test_commit augustus44 &&
+ test_commit caesar &&
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
+ git tag -d julius &&
+ test_must_fail git fsck --name-objects >out &&
+ test_i18ngrep "$tree (refs/tags/augustus44\\^:" out
)
'
@@ -806,7 +804,7 @@ test_expect_success 'fsck notices dangling objects' '
git fsck >actual &&
# the output order is non-deterministic, as it comes from a hash
sort <actual >actual.sorted &&
- test_i18ncmp expect actual.sorted
+ test_cmp expect actual.sorted
)
'
@@ -816,7 +814,7 @@ test_expect_success 'fsck --connectivity-only notices dangling objects' '
git fsck --connectivity-only >actual &&
# the output order is non-deterministic, as it comes from a hash
sort <actual >actual.sorted &&
- test_i18ncmp expect actual.sorted
+ test_cmp expect actual.sorted
)
'
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index abdda360d5..deae916707 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -243,4 +243,19 @@ test_expect_success 'showing the superproject correctly' '
test_cmp expect out
'
+# at least one external project depends on this behavior:
+test_expect_success 'rev-parse --since= unsqueezed ordering' '
+ x1=--since=1970-01-01T00:00:01Z &&
+ x2=--since=1970-01-01T00:00:02Z &&
+ x3=--since=1970-01-01T00:00:03Z &&
+ git rev-parse $x1 $x1 $x3 $x2 >actual &&
+ cat >expect <<-EOF &&
+ --max-age=1
+ --max-age=1
+ --max-age=3
+ --max-age=2
+ EOF
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index a859abedf5..b29563fc99 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -95,7 +95,7 @@ test_expect_success 'test --parseopt help output' '
|EOF
END_EXPECT
test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'test --parseopt help output no switches' '
@@ -108,7 +108,7 @@ test_expect_success 'test --parseopt help output no switches' '
|EOF
END_EXPECT
test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec_no_switches &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'test --parseopt help output hidden switches' '
@@ -121,7 +121,7 @@ test_expect_success 'test --parseopt help output hidden switches' '
|EOF
END_EXPECT
test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec_only_hidden_switches &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'test --parseopt help-all output hidden switches' '
@@ -136,7 +136,7 @@ test_expect_success 'test --parseopt help-all output hidden switches' '
|EOF
END_EXPECT
test_expect_code 129 git rev-parse --parseopt -- --help-all > output < optionspec_only_hidden_switches &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'test --parseopt invalid switch help output' '
@@ -176,7 +176,7 @@ test_expect_success 'test --parseopt invalid switch help output' '
|
END_EXPECT
test_expect_code 129 git rev-parse --parseopt -- --does-not-exist 1>/dev/null 2>output < optionspec &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'setup expect.1' "
diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh
index f6e6f23f7e..65a154a8a2 100755
--- a/t/t1506-rev-parse-diagnosis.sh
+++ b/t/t1506-rev-parse-diagnosis.sh
@@ -15,7 +15,7 @@ test_did_you_mean ()
fatal: path '$2$3' $4, but not ${5:-$SQ$3$SQ}
hint: Did you mean '$1:$2$3'${2:+ aka $SQ$1:./$3$SQ}?
EOF
- test_i18ncmp expected error
+ test_cmp expected error
}
HASH_file=
diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh
index 73b4f34c6e..c34714ffe3 100755
--- a/t/t1507-rev-parse-upstream.sh
+++ b/t/t1507-rev-parse-upstream.sh
@@ -172,7 +172,7 @@ test_expect_success 'branch@{u} error message when no upstream' '
fatal: no upstream configured for branch ${SQ}non-tracking${SQ}
EOF
error_message non-tracking@{u} &&
- test_i18ncmp expect error
+ test_cmp expect error
'
test_expect_success '@{u} error message when no upstream' '
@@ -180,7 +180,7 @@ test_expect_success '@{u} error message when no upstream' '
fatal: no upstream configured for branch ${SQ}main${SQ}
EOF
test_must_fail git rev-parse --verify @{u} 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'branch@{u} error message with misspelt branch' '
@@ -188,7 +188,7 @@ test_expect_success 'branch@{u} error message with misspelt branch' '
fatal: no such branch: ${SQ}no-such-branch${SQ}
EOF
error_message no-such-branch@{u} &&
- test_i18ncmp expect error
+ test_cmp expect error
'
test_expect_success '@{u} error message when not on a branch' '
@@ -197,7 +197,7 @@ test_expect_success '@{u} error message when not on a branch' '
EOF
git checkout HEAD^0 &&
test_must_fail git rev-parse --verify @{u} 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'branch@{u} error message if upstream branch not fetched' '
@@ -205,7 +205,7 @@ test_expect_success 'branch@{u} error message if upstream branch not fetched' '
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
+ test_cmp expect error
'
test_expect_success 'pull works when tracking a local branch' '
diff --git a/t/t1509-root-work-tree.sh b/t/t1509-root-work-tree.sh
index fd2f7abf1c..553a3f601b 100755
--- a/t/t1509-root-work-tree.sh
+++ b/t/t1509-root-work-tree.sh
@@ -221,7 +221,7 @@ test_expect_success 'setup' '
rm -rf /.git &&
echo "Initialized empty Git repository in /.git/" > expected &&
git init > result &&
- test_i18ncmp expected result
+ test_cmp expected result
'
test_vars 'auto gitdir, root' ".git" "/" ""
@@ -246,7 +246,7 @@ test_expect_success 'setup' '
cd / &&
echo "Initialized empty Git repository in /" > expected &&
git init --bare > result &&
- test_i18ncmp expected result
+ test_cmp expected result
'
test_vars 'auto gitdir, root' "." "" ""
diff --git a/t/t1512-rev-parse-disambiguation.sh b/t/t1512-rev-parse-disambiguation.sh
index 242abbfa0b..7891a6becf 100755
--- a/t/t1512-rev-parse-disambiguation.sh
+++ b/t/t1512-rev-parse-disambiguation.sh
@@ -314,39 +314,39 @@ test_expect_success 'ambiguous short sha1 ref' '
grep "refname.*${REF}.*ambiguous" err
'
-test_expect_success C_LOCALE_OUTPUT 'ambiguity errors are not repeated (raw)' '
+test_expect_success 'ambiguity errors are not repeated (raw)' '
test_must_fail git rev-parse 00000 2>stderr &&
grep "is ambiguous" stderr >errors &&
test_line_count = 1 errors
'
-test_expect_success C_LOCALE_OUTPUT 'ambiguity errors are not repeated (treeish)' '
+test_expect_success 'ambiguity errors are not repeated (treeish)' '
test_must_fail git rev-parse 00000:foo 2>stderr &&
grep "is ambiguous" stderr >errors &&
test_line_count = 1 errors
'
-test_expect_success C_LOCALE_OUTPUT 'ambiguity errors are not repeated (peel)' '
+test_expect_success 'ambiguity errors are not repeated (peel)' '
test_must_fail git rev-parse 00000^{commit} 2>stderr &&
grep "is ambiguous" stderr >errors &&
test_line_count = 1 errors
'
-test_expect_success C_LOCALE_OUTPUT 'ambiguity hints' '
+test_expect_success 'ambiguity hints' '
test_must_fail git rev-parse 000000000 2>stderr &&
grep ^hint: stderr >hints &&
# 16 candidates, plus one intro line
test_line_count = 17 hints
'
-test_expect_success C_LOCALE_OUTPUT 'ambiguity hints respect type' '
+test_expect_success 'ambiguity hints respect type' '
test_must_fail git rev-parse 000000000^{commit} 2>stderr &&
grep ^hint: stderr >hints &&
# 5 commits, 1 tag (which is a committish), plus intro line
test_line_count = 7 hints
'
-test_expect_success C_LOCALE_OUTPUT 'failed type-selector still shows hint' '
+test_expect_success 'failed type-selector still shows hint' '
# these two blobs share the same prefix "ee3d", but neither
# will pass for a commit
echo 851 | git hash-object --stdin -w &&
@@ -370,7 +370,7 @@ test_expect_success 'core.disambiguate does not override context' '
git -c core.disambiguate=committish rev-parse $sha1^{tree}
'
-test_expect_success C_LOCALE_OUTPUT 'ambiguous commits are printed by type first, then hash order' '
+test_expect_success 'ambiguous commits are printed by type first, then hash order' '
test_must_fail git rev-parse 0000 2>stderr &&
grep ^hint: stderr >hints &&
grep 0000 hints >objects &&
diff --git a/t/t1600-index.sh b/t/t1600-index.sh
index b7c31aa86a..c9b9e718b8 100755
--- a/t/t1600-index.sh
+++ b/t/t1600-index.sh
@@ -18,7 +18,7 @@ test_expect_success 'bogus GIT_INDEX_VERSION issues warning' '
warning: GIT_INDEX_VERSION set, but the value is invalid.
Using version Z
EOF
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
)
'
@@ -32,7 +32,7 @@ test_expect_success 'out of bounds GIT_INDEX_VERSION issues warning' '
warning: GIT_INDEX_VERSION set, but the value is invalid.
Using version Z
EOF
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
)
'
@@ -55,7 +55,7 @@ test_expect_success 'out of bounds index.version issues warning' '
warning: index.version set, but the value is invalid.
Using version Z
EOF
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
)
'
diff --git a/t/t2006-checkout-index-basic.sh b/t/t2006-checkout-index-basic.sh
index 8e181dbf01..7ff3edab05 100755
--- a/t/t2006-checkout-index-basic.sh
+++ b/t/t2006-checkout-index-basic.sh
@@ -32,4 +32,27 @@ test_expect_success 'checkout-index reports errors (stdin)' '
test_i18ngrep not.in.the.cache stderr
'
+test_expect_success 'checkout-index --temp correctly reports error on missing blobs' '
+ test_when_finished git reset --hard &&
+ missing_blob=$(echo "no such blob here" | git hash-object --stdin) &&
+ cat >objs <<-EOF &&
+ 100644 $missing_blob file
+ 120000 $missing_blob symlink
+ EOF
+ git update-index --index-info <objs &&
+
+ test_must_fail git checkout-index --temp symlink file 2>stderr &&
+ test_i18ngrep "unable to read sha1 file of file ($missing_blob)" stderr &&
+ test_i18ngrep "unable to read sha1 file of symlink ($missing_blob)" stderr
+'
+
+test_expect_success 'checkout-index --temp correctly reports error for submodules' '
+ git init sub &&
+ test_commit -C sub file &&
+ git submodule add ./sub &&
+ git commit -m sub &&
+ test_must_fail git checkout-index --temp sub 2>stderr &&
+ test_i18ngrep "cannot create temporary submodule sub" stderr
+'
+
test_done
diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh
index 5f761bc616..93be1c0eae 100755
--- a/t/t2018-checkout-branch.sh
+++ b/t/t2018-checkout-branch.sh
@@ -150,7 +150,7 @@ test_expect_success 'checkout -b to @{-1} fails with the right branch name' '
git checkout branch2 &&
echo >expect "fatal: A branch named '\''branch1'\'' already exists." &&
test_must_fail git checkout -b @{-1} 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'checkout -B to an existing branch resets branch to HEAD' '
diff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh
index b432b6427b..bc46713a43 100755
--- a/t/t2020-checkout-detach.sh
+++ b/t/t2020-checkout-detach.sh
@@ -163,7 +163,7 @@ test_expect_success 'tracking count is accurate after orphan check' '
git config branch.child.merge refs/heads/main &&
git checkout child^ &&
git checkout child >stdout &&
- test_i18ncmp expect stdout
+ test_cmp expect stdout
'
test_expect_success 'no advice given for explicit detached head state' '
@@ -237,15 +237,15 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as
sane_unset GIT_PRINT_SHA1_ELLIPSIS &&
git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
check_detached &&
- test_i18ncmp 1st_detach actual &&
+ test_cmp 1st_detach actual &&
GIT_PRINT_SHA1_ELLIPSIS="no" git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
check_detached &&
- test_i18ncmp 2nd_detach actual &&
+ test_cmp 2nd_detach actual &&
GIT_PRINT_SHA1_ELLIPSIS= git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
check_detached &&
- test_i18ncmp 3rd_detach actual &&
+ test_cmp 3rd_detach actual &&
sane_unset GIT_PRINT_SHA1_ELLIPSIS &&
@@ -256,17 +256,17 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as
# Make no mention of the env var at all
git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
check_detached &&
- test_i18ncmp 1st_detach actual &&
+ test_cmp 1st_detach actual &&
GIT_PRINT_SHA1_ELLIPSIS='nope' &&
git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
check_detached &&
- test_i18ncmp 2nd_detach actual &&
+ test_cmp 2nd_detach actual &&
GIT_PRINT_SHA1_ELLIPSIS=nein &&
git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
check_detached &&
- test_i18ncmp 3rd_detach actual &&
+ test_cmp 3rd_detach actual &&
true
"
@@ -319,15 +319,15 @@ test_expect_success 'describe_detached_head does print SHA-1 ellipsis when asked
GIT_PRINT_SHA1_ELLIPSIS=yes git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
check_detached &&
- test_i18ncmp 1st_detach actual &&
+ test_cmp 1st_detach actual &&
GIT_PRINT_SHA1_ELLIPSIS=Yes git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
check_detached &&
- test_i18ncmp 2nd_detach actual &&
+ test_cmp 2nd_detach actual &&
GIT_PRINT_SHA1_ELLIPSIS=YES git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
check_detached &&
- test_i18ncmp 3rd_detach actual &&
+ test_cmp 3rd_detach actual &&
true
"
diff --git a/t/t2104-update-index-skip-worktree.sh b/t/t2104-update-index-skip-worktree.sh
index 7e2e7dd4ae..30666fc70d 100755
--- a/t/t2104-update-index-skip-worktree.sh
+++ b/t/t2104-update-index-skip-worktree.sh
@@ -9,6 +9,11 @@ test_description='skip-worktree bit test'
sane_unset GIT_TEST_SPLIT_INDEX
+test_set_index_version () {
+ GIT_INDEX_VERSION="$1"
+ export GIT_INDEX_VERSION
+}
+
test_set_index_version 3
cat >expect.full <<EOF
diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
index 7cb7a70382..45ca35d60a 100755
--- a/t/t2200-add-update.sh
+++ b/t/t2200-add-update.sh
@@ -135,7 +135,7 @@ test_expect_success 'add -n -u should not add but just report' '
after=$(git ls-files -s check top) &&
test "$before" = "$after" &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
diff --git a/t/t2401-worktree-prune.sh b/t/t2401-worktree-prune.sh
index aff877590d..a615d3b483 100755
--- a/t/t2401-worktree-prune.sh
+++ b/t/t2401-worktree-prune.sh
@@ -23,7 +23,7 @@ test_expect_success 'prune files inside $GIT_DIR/worktrees' '
cat >expect <<EOF &&
Removing worktrees/abc: not a valid directory
EOF
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
! test -f .git/worktrees/abc &&
! test -d .git/worktrees
'
@@ -35,7 +35,7 @@ test_expect_success 'prune directories without gitdir' '
Removing worktrees/def: gitdir file does not exist
EOF
git worktree prune --verbose >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
! test -d .git/worktrees/def &&
! test -d .git/worktrees
'
diff --git a/t/t2402-worktree-list.sh b/t/t2402-worktree-list.sh
index 821a20f3d6..fedcefe8de 100755
--- a/t/t2402-worktree-list.sh
+++ b/t/t2402-worktree-list.sh
@@ -69,11 +69,107 @@ test_expect_success '"list" all worktrees with locked annotation' '
git worktree add --detach locked main &&
git worktree add --detach unlocked main &&
git worktree lock locked &&
+ test_when_finished "git worktree unlock locked" &&
git worktree list >out &&
grep "/locked *[0-9a-f].* locked$" out &&
! grep "/unlocked *[0-9a-f].* locked$" out
'
+test_expect_success '"list" all worktrees --porcelain with locked' '
+ test_when_finished "rm -rf locked1 locked2 unlocked out actual expect && git worktree prune" &&
+ echo "locked" >expect &&
+ echo "locked with reason" >>expect &&
+ git worktree add --detach locked1 &&
+ git worktree add --detach locked2 &&
+ # unlocked worktree should not be annotated with "locked"
+ git worktree add --detach unlocked &&
+ git worktree lock locked1 &&
+ test_when_finished "git worktree unlock locked1" &&
+ git worktree lock locked2 --reason "with reason" &&
+ test_when_finished "git worktree unlock locked2" &&
+ git worktree list --porcelain >out &&
+ grep "^locked" out >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '"list" all worktrees --porcelain with locked reason newline escaped' '
+ test_when_finished "rm -rf locked_lf locked_crlf out actual expect && git worktree prune" &&
+ printf "locked \"locked\\\\r\\\\nreason\"\n" >expect &&
+ printf "locked \"locked\\\\nreason\"\n" >>expect &&
+ git worktree add --detach locked_lf &&
+ git worktree add --detach locked_crlf &&
+ git worktree lock locked_lf --reason "$(printf "locked\nreason")" &&
+ test_when_finished "git worktree unlock locked_lf" &&
+ git worktree lock locked_crlf --reason "$(printf "locked\r\nreason")" &&
+ test_when_finished "git worktree unlock locked_crlf" &&
+ git worktree list --porcelain >out &&
+ grep "^locked" out >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '"list" all worktrees with prunable annotation' '
+ test_when_finished "rm -rf prunable unprunable out && git worktree prune" &&
+ git worktree add --detach prunable &&
+ git worktree add --detach unprunable &&
+ rm -rf prunable &&
+ git worktree list >out &&
+ grep "/prunable *[0-9a-f].* prunable$" out &&
+ ! grep "/unprunable *[0-9a-f].* prunable$"
+'
+
+test_expect_success '"list" all worktrees --porcelain with prunable' '
+ test_when_finished "rm -rf prunable out && git worktree prune" &&
+ git worktree add --detach prunable &&
+ rm -rf prunable &&
+ git worktree list --porcelain >out &&
+ sed -n "/^worktree .*\/prunable$/,/^$/p" <out >only_prunable &&
+ test_i18ngrep "^prunable gitdir file points to non-existent location$" only_prunable
+'
+
+test_expect_success '"list" all worktrees with prunable consistent with "prune"' '
+ test_when_finished "rm -rf prunable unprunable out && git worktree prune" &&
+ git worktree add --detach prunable &&
+ git worktree add --detach unprunable &&
+ rm -rf prunable &&
+ git worktree list >out &&
+ grep "/prunable *[0-9a-f].* prunable$" out &&
+ ! grep "/unprunable *[0-9a-f].* unprunable$" out &&
+ git worktree prune --verbose >out &&
+ test_i18ngrep "^Removing worktrees/prunable" out &&
+ test_i18ngrep ! "^Removing worktrees/unprunable" out
+'
+
+test_expect_success '"list" --verbose and --porcelain mutually exclusive' '
+ test_must_fail git worktree list --verbose --porcelain
+'
+
+test_expect_success '"list" all worktrees --verbose with locked' '
+ test_when_finished "rm -rf locked1 locked2 out actual expect && git worktree prune" &&
+ git worktree add locked1 --detach &&
+ git worktree add locked2 --detach &&
+ git worktree lock locked1 &&
+ test_when_finished "git worktree unlock locked1" &&
+ git worktree lock locked2 --reason "with reason" &&
+ test_when_finished "git worktree unlock locked2" &&
+ echo "$(git -C locked2 rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >expect &&
+ printf "\tlocked: with reason\n" >>expect &&
+ git worktree list --verbose >out &&
+ grep "/locked1 *[0-9a-f].* locked$" out &&
+ sed -n "s/ */ /g;/\/locked2 *[0-9a-f].*$/,/locked: .*$/p" <out >actual &&
+ test_cmp actual expect
+'
+
+test_expect_success '"list" all worktrees --verbose with prunable' '
+ test_when_finished "rm -rf prunable out actual expect && git worktree prune" &&
+ git worktree add prunable --detach &&
+ echo "$(git -C prunable rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >expect &&
+ printf "\tprunable: gitdir file points to non-existent location\n" >>expect &&
+ rm -rf prunable &&
+ git worktree list --verbose >out &&
+ sed -n "s/ */ /g;/\/prunable *[0-9a-f].*$/,/prunable: .*$/p" <out >actual &&
+ test_cmp actual expect
+'
+
test_expect_success 'bare repo setup' '
git init --bare bare1 &&
echo "data" >file1 &&
diff --git a/t/t3005-ls-files-relative.sh b/t/t3005-ls-files-relative.sh
index 2ec69a8a26..727e9ae1a4 100755
--- a/t/t3005-ls-files-relative.sh
+++ b/t/t3005-ls-files-relative.sh
@@ -46,7 +46,7 @@ test_expect_success 'ls-files -c' '
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 &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
)
'
@@ -61,7 +61,7 @@ test_expect_success 'ls-files -o' '
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 &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
)
'
diff --git a/t/t3012-ls-files-dedup.sh b/t/t3012-ls-files-dedup.sh
new file mode 100755
index 0000000000..2682b1f43a
--- /dev/null
+++ b/t/t3012-ls-files-dedup.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+test_description='git ls-files --deduplicate test'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ >a.txt &&
+ >b.txt &&
+ >delete.txt &&
+ git add a.txt b.txt delete.txt &&
+ git commit -m base &&
+ echo a >a.txt &&
+ echo b >b.txt &&
+ echo delete >delete.txt &&
+ git add a.txt b.txt delete.txt &&
+ git commit -m tip &&
+ git tag tip &&
+ git reset --hard HEAD^ &&
+ echo change >a.txt &&
+ git commit -a -m side &&
+ git tag side
+'
+
+test_expect_success 'git ls-files --deduplicate to show unique unmerged path' '
+ test_must_fail git merge tip &&
+ git ls-files --deduplicate >actual &&
+ cat >expect <<-\EOF &&
+ a.txt
+ b.txt
+ delete.txt
+ EOF
+ test_cmp expect actual &&
+ git merge --abort
+'
+
+test_expect_success 'git ls-files -d -m --deduplicate with different display options' '
+ git reset --hard side &&
+ test_must_fail git merge tip &&
+ rm delete.txt &&
+ git ls-files -d -m --deduplicate >actual &&
+ cat >expect <<-\EOF &&
+ a.txt
+ delete.txt
+ EOF
+ test_cmp expect actual &&
+ git ls-files -d -m -t --deduplicate >actual &&
+ cat >expect <<-\EOF &&
+ C a.txt
+ C a.txt
+ C a.txt
+ R delete.txt
+ C delete.txt
+ EOF
+ test_cmp expect actual &&
+ git ls-files -d -m -c --deduplicate >actual &&
+ cat >expect <<-\EOF &&
+ a.txt
+ b.txt
+ delete.txt
+ EOF
+ test_cmp expect actual &&
+ git merge --abort
+'
+
+test_done
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 00761e4080..cc4b10236e 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -695,7 +695,7 @@ test_expect_success 'deleting a symref' '
git branch -d symref >actual &&
test_path_is_file .git/refs/heads/target &&
test_path_is_missing .git/refs/heads/symref &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'deleting a dangling symref' '
@@ -704,7 +704,7 @@ test_expect_success 'deleting a dangling symref' '
echo "Deleted branch dangling-symref (was nowhere)." >expect &&
git branch -d dangling-symref >actual &&
test_path_is_missing .git/refs/heads/dangling-symref &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'deleting a self-referential symref' '
@@ -713,7 +713,7 @@ test_expect_success 'deleting a self-referential symref' '
echo "Deleted branch self-reference (was refs/heads/self-reference)." >expect &&
git branch -d self-reference >actual &&
test_path_is_missing .git/refs/heads/self-reference &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'renaming a symref is not allowed' '
@@ -808,7 +808,7 @@ test_expect_success 'test deleting branch without config' '
sha1=$(git rev-parse my7 | cut -c 1-7) &&
echo "Deleted branch my7 (was $sha1)." >expect &&
git branch -d my7 >actual 2>&1 &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'deleting currently checked out branch fails' '
@@ -843,7 +843,7 @@ test_expect_success 'branch from tag w/--track causes failure' '
test_expect_success '--set-upstream-to fails on multiple branches' '
echo "fatal: too many arguments to set new upstream" >expect &&
test_must_fail git branch --set-upstream-to main a b c 2>err &&
- test_i18ncmp expect err
+ test_cmp expect err
'
test_expect_success '--set-upstream-to fails on detached HEAD' '
@@ -851,13 +851,13 @@ test_expect_success '--set-upstream-to fails on detached HEAD' '
test_when_finished git checkout - &&
echo "fatal: could not set upstream of HEAD to main when it does not point to any branch." >expect &&
test_must_fail git branch --set-upstream-to main 2>err &&
- test_i18ncmp expect err
+ test_cmp expect err
'
test_expect_success '--set-upstream-to fails on a missing dst branch' '
echo "fatal: branch '"'"'does-not-exist'"'"' does not exist" >expect &&
test_must_fail git branch --set-upstream-to main does-not-exist 2>err &&
- test_i18ncmp expect err
+ test_cmp expect err
'
test_expect_success '--set-upstream-to fails on a missing src branch' '
@@ -868,7 +868,7 @@ test_expect_success '--set-upstream-to fails on a missing src branch' '
test_expect_success '--set-upstream-to fails on a non-ref' '
echo "fatal: Cannot setup tracking information; starting point '"'"'HEAD^{}'"'"' is not a branch." >expect &&
test_must_fail git branch --set-upstream-to HEAD^{} 2>err &&
- test_i18ncmp expect err
+ test_cmp expect err
'
test_expect_success '--set-upstream-to fails on locked config' '
@@ -899,7 +899,7 @@ test_expect_success 'use --set-upstream-to modify a particular branch' '
test_expect_success '--unset-upstream should fail if given a non-existent branch' '
echo "fatal: Branch '"'"'i-dont-exist'"'"' has no upstream information" >expect &&
test_must_fail git branch --unset-upstream i-dont-exist 2>err &&
- test_i18ncmp expect err
+ test_cmp expect err
'
test_expect_success '--unset-upstream should fail if config is locked' '
@@ -921,13 +921,13 @@ test_expect_success 'test --unset-upstream on HEAD' '
# fail for a branch without upstream set
echo "fatal: Branch '"'"'main'"'"' has no upstream information" >expect &&
test_must_fail git branch --unset-upstream 2>err &&
- test_i18ncmp expect err
+ test_cmp expect err
'
test_expect_success '--unset-upstream should fail on multiple branches' '
echo "fatal: too many arguments to unset upstream" >expect &&
test_must_fail git branch --unset-upstream a b c 2>err &&
- test_i18ncmp expect err
+ test_cmp expect err
'
test_expect_success '--unset-upstream should fail on detached HEAD' '
@@ -935,7 +935,7 @@ test_expect_success '--unset-upstream should fail on detached HEAD' '
test_when_finished git checkout - &&
echo "fatal: could not unset upstream of HEAD when it does not point to any branch." >expect &&
test_must_fail git branch --unset-upstream 2>err &&
- test_i18ncmp expect err
+ test_cmp expect err
'
test_expect_success 'test --unset-upstream on a particular branch' '
@@ -957,7 +957,7 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups
EOF
test_expect_code 1 git config branch.my13.remote &&
test_expect_code 1 git config branch.my13.merge &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
# Keep this test last, as it changes the current branch
diff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh
index 578b5f4825..349a810cee 100755
--- a/t/t3201-branch-contains.sh
+++ b/t/t3201-branch-contains.sh
@@ -264,7 +264,7 @@ test_expect_success 'branch --merged with --verbose' '
* topic $(git rev-parse --short topic ) [ahead 1] foo
zzz $(git rev-parse --short zzz ) second on main
EOF
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_done
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index b6fcd017af..5325b9f67a 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -160,7 +160,7 @@ test_expect_success 'git branch shows detached HEAD properly' '
EOF
git checkout HEAD^0 &&
git branch >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'git branch shows detached HEAD properly after checkout --detach' '
@@ -173,7 +173,7 @@ test_expect_success 'git branch shows detached HEAD properly after checkout --de
EOF
git checkout --detach &&
git branch >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'git branch shows detached HEAD properly after moving' '
@@ -185,7 +185,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving' '
EOF
git reset --hard HEAD^1 &&
git branch >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'git branch shows detached HEAD properly from tag' '
@@ -198,7 +198,7 @@ EOF
git tag fromtag main &&
git checkout fromtag &&
git branch >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'git branch shows detached HEAD properly after moving from tag' '
@@ -210,7 +210,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving from t
EOF
git reset --hard HEAD^1 &&
git branch >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'git branch `--sort=[-]objectsize` option' '
@@ -221,7 +221,7 @@ test_expect_success 'git branch `--sort=[-]objectsize` option' '
main
EOF
git branch --sort=objectsize >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
cat >expect <<-\EOF &&
* (HEAD detached from fromtag)
@@ -230,7 +230,7 @@ test_expect_success 'git branch `--sort=[-]objectsize` option' '
branch-two
EOF
git branch --sort=-objectsize >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'git branch `--sort=[-]type` option' '
@@ -241,7 +241,7 @@ test_expect_success 'git branch `--sort=[-]type` option' '
main
EOF
git branch --sort=type >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
cat >expect <<-\EOF &&
* (HEAD detached from fromtag)
@@ -250,7 +250,7 @@ test_expect_success 'git branch `--sort=[-]type` option' '
main
EOF
git branch --sort=-type >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'git branch `--sort=[-]version:refname` option' '
@@ -261,7 +261,7 @@ test_expect_success 'git branch `--sort=[-]version:refname` option' '
main
EOF
git branch --sort=version:refname >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
cat >expect <<-\EOF &&
* (HEAD detached from fromtag)
@@ -270,7 +270,7 @@ test_expect_success 'git branch `--sort=[-]version:refname` option' '
branch-one
EOF
git branch --sort=-version:refname >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'git branch --points-at option' '
@@ -337,7 +337,7 @@ test_expect_success 'git branch --format option' '
Refname is refs/heads/ref-to-remote
EOF
git branch --format="Refname is %(refname)" >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'worktree colors correct' '
@@ -355,7 +355,7 @@ test_expect_success 'worktree colors correct' '
rm -r worktree_dir &&
git worktree prune &&
test_decode_color <actual.raw >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success "set up color tests" '
@@ -398,7 +398,7 @@ test_expect_success 'verbose output lists worktree path' '
git branch -vv >actual &&
rm -r worktree_dir &&
git worktree prune &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_done
diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
index ce24b5d735..1b26c4c2ef 100755
--- a/t/t3206-range-diff.sh
+++ b/t/t3206-range-diff.sh
@@ -153,6 +153,19 @@ test_expect_success 'simple A B C (unmodified)' '
test_cmp expect actual
'
+test_expect_success 'A^! and A^-<n> (unmodified)' '
+ git range-diff --no-color topic^! unmodified^-1 >actual &&
+ cat >expect <<-EOF &&
+ 1: $(test_oid t4) = 1: $(test_oid u4) s/12/B/
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'A^{/..} is not mistaken for a range' '
+ test_must_fail git range-diff topic^.. topic^{/..} 2>error &&
+ test_i18ngrep "not a commit range" error
+'
+
test_expect_success 'trivial reordering' '
git range-diff --no-color main topic reordered >actual &&
cat >expect <<-EOF &&
@@ -720,4 +733,19 @@ test_expect_success 'format-patch --range-diff with multiple notes' '
test_cmp expect actual
'
+test_expect_success '--left-only/--right-only' '
+ git switch --orphan left-right &&
+ test_commit first &&
+ test_commit unmatched &&
+ test_commit common &&
+ git switch -C left-right first &&
+ git cherry-pick common &&
+
+ git range-diff -s --left-only ...common >actual &&
+ head_oid=$(git rev-parse --short HEAD) &&
+ common_oid=$(git rev-parse --short common) &&
+ echo "1: $head_oid = 2: $common_oid common" >expect &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh
index 04de03cad0..f5bf16abcd 100755
--- a/t/t3300-funny-names.sh
+++ b/t/t3300-funny-names.sh
@@ -181,7 +181,7 @@ test_expect_success 'diffstat for rename quotes funny filename' '
git diff-index -M -p $t0 >diff &&
git apply --stat <diff >diffstat &&
sed -e "s/|.*//" -e "s/ *\$//" <diffstat >current &&
- test_i18ncmp expected current
+ test_cmp expected current
'
test_expect_success 'numstat for rename quotes funny filename' '
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index 4af881f0ba..d742be8840 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -1293,11 +1293,11 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' '
grep "replacement note 3" actual
'
-test_expect_success 'git notes copy diagnoses too many or too few parameters' '
+test_expect_success 'git notes copy diagnoses too many or too few arguments' '
test_must_fail git notes copy 2>error &&
- test_i18ngrep "too few parameters" error &&
+ test_i18ngrep "too few arguments" error &&
test_must_fail git notes copy one two three 2>error &&
- test_i18ngrep "too many parameters" error
+ test_i18ngrep "too many arguments" error
'
test_expect_success 'git notes get-ref expands refs/heads/main to refs/notes/refs/heads/main' '
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 5e88a10f8d..587b408063 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -113,7 +113,7 @@ test_expect_success 'rebase off of the previous branch using "-"' '
test_cmp expect.forkpoint actual.forkpoint &&
# the next one is dubious---we may want to say "-",
# instead of @{-1}, in the message
- test_i18ncmp expect.messages actual.messages
+ test_cmp expect.messages actual.messages
'
test_expect_success 'rebase a single mode change' '
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 1e738df81d..66bcbbf952 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -86,7 +86,7 @@ test_expect_success 'rebase -i with empty todo list' '
git rebase -i HEAD^ >output 2>&1
) &&
tail -n 1 output >actual && # Ignore output about changing todo list
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'rebase -i with the exec command' '
@@ -101,7 +101,8 @@ test_expect_success 'rebase -i with the exec command' '
) &&
test_path_is_file touch-one &&
test_path_is_file touch-two &&
- test_path_is_missing touch-three " (should have stopped before)" &&
+ # Missing because we should have stopped by now.
+ test_path_is_missing touch-three &&
test_cmp_rev C HEAD &&
git rebase --continue &&
test_path_is_file touch-three &&
@@ -158,9 +159,9 @@ test_expect_success 'rebase -x with empty command fails' '
test_when_finished "git rebase --abort ||:" &&
test_must_fail env git rebase -x "" @ 2>actual &&
test_write_lines "error: empty exec command" >expected &&
- test_i18ncmp expected actual &&
+ test_cmp expected actual &&
test_must_fail env git rebase -x " " @ 2>actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'rebase -x with newline in command fails' '
@@ -168,7 +169,7 @@ test_expect_success 'rebase -x with newline in command fails' '
test_must_fail env git rebase -x "a${LF}b" @ 2>actual &&
test_write_lines "error: exec commands cannot contain newlines" \
>expected &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'rebase -i with exec of inexistent command' '
@@ -450,7 +451,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '
grep "^ file1 | 2 +-$" output
'
-test_expect_success C_LOCALE_OUTPUT 'multi-squash only fires up editor once' '
+test_expect_success 'multi-squash only fires up editor once' '
base=$(git rev-parse HEAD~4) &&
(
set_fake_editor &&
@@ -463,7 +464,7 @@ test_expect_success C_LOCALE_OUTPUT 'multi-squash only fires up editor once' '
test 1 = $(git show | grep ONCE | wc -l)
'
-test_expect_success C_LOCALE_OUTPUT 'multi-fixup does not fire up editor' '
+test_expect_success 'multi-fixup does not fire up editor' '
git checkout -b multi-fixup E &&
base=$(git rev-parse HEAD~4) &&
(
@@ -514,7 +515,7 @@ test_expect_success 'commit message retained after conflict' '
git branch -D conflict-squash
'
-test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messages' '
+test_expect_success 'squash and fixup generate correct log messages' '
cat >expect-squash-fixup <<-\EOF &&
B
@@ -541,7 +542,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messa
git branch -D squash-fixup
'
-test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' '
+test_expect_success 'squash ignores comments' '
git checkout -b skip-comments E &&
base=$(git rev-parse HEAD~4) &&
(
@@ -557,7 +558,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' '
git branch -D skip-comments
'
-test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' '
+test_expect_success 'squash ignores blank lines' '
git checkout -b skip-blank-lines E &&
base=$(git rev-parse HEAD~4) &&
(
@@ -995,7 +996,7 @@ test_expect_success 'rebase -ix with several instances of --exec' '
test_cmp expected actual
'
-test_expect_success C_LOCALE_OUTPUT 'rebase -ix with --autosquash' '
+test_expect_success 'rebase -ix with --autosquash' '
git reset --hard execute &&
git checkout -b autosquash &&
echo second >second.txt &&
@@ -1136,7 +1137,7 @@ test_expect_success 'rebase -i --root reword root when root has untracked file c
test "$(git rev-list --count HEAD)" = 2
'
-test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-interactive rebase' '
+test_expect_success 'rebase --edit-todo does not work on non-interactive rebase' '
git checkout reword-original-root-branch &&
git reset --hard &&
git checkout conflict-branch &&
@@ -1465,7 +1466,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
FAKE_LINES="1 2 3 4" git rebase -i --root 2>actual.2
) &&
head -n4 actual.2 >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
test D = $(git cat-file commit HEAD | sed -ne \$p)
'
@@ -1489,7 +1490,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '
set_fake_editor &&
test_must_fail env FAKE_LINES="1 2 4" \
git rebase -i --root 2>actual &&
- test_i18ncmp expect actual &&
+ test_cmp 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
@@ -1535,11 +1536,11 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = wa
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 &&
+ test_cmp 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 &&
+ test_cmp expect.3 actual &&
git rebase --continue 2>actual
) &&
test D = $(git cat-file commit HEAD | sed -ne \$p) &&
@@ -1575,16 +1576,16 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = er
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_cmp expect actual &&
test_must_fail git rebase --continue 2>actual &&
- test_i18ncmp expect.2 actual &&
+ test_cmp 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_cmp expect.3 actual &&
test_must_fail git rebase --continue 2>actual &&
- test_i18ncmp expect.3 actual &&
+ test_cmp 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
diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh
index c02729d5ea..77a313f62e 100755
--- a/t/t3406-rebase-message.sh
+++ b/t/t3406-rebase-message.sh
@@ -67,13 +67,6 @@ test_expect_success 'rebase -n overrides config rebase.stat config' '
! grep "^ fileX | *1 +$" diffstat.txt
'
-# Output to stderr:
-#
-# "Does not point to a valid commit: invalid-ref"
-#
-# NEEDSWORK: This "grep" is fine in real non-C locales, but
-# GIT_TEST_GETTEXT_POISON poisons the refname along with the enclosing
-# error message.
test_expect_success 'rebase --onto outputs the invalid ref' '
test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err &&
test_i18ngrep "invalid-ref" err
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index e7087befd4..908016c2f8 100755
--- a/t/t3415-rebase-autosquash.sh
+++ b/t/t3415-rebase-autosquash.sh
@@ -306,23 +306,23 @@ test_auto_fixup_fixup () {
fi
}
-test_expect_success C_LOCALE_OUTPUT 'fixup! fixup!' '
+test_expect_success 'fixup! fixup!' '
test_auto_fixup_fixup fixup fixup
'
-test_expect_success C_LOCALE_OUTPUT 'fixup! squash!' '
+test_expect_success 'fixup! squash!' '
test_auto_fixup_fixup fixup squash
'
-test_expect_success C_LOCALE_OUTPUT 'squash! squash!' '
+test_expect_success 'squash! squash!' '
test_auto_fixup_fixup squash squash
'
-test_expect_success C_LOCALE_OUTPUT 'squash! fixup!' '
+test_expect_success 'squash! fixup!' '
test_auto_fixup_fixup squash fixup
'
-test_expect_success C_LOCALE_OUTPUT 'autosquash with custom inst format' '
+test_expect_success 'autosquash with custom inst format' '
git reset --hard base &&
git config --add rebase.instructionFormat "[%an @ %ar] %s" &&
echo 2 >file1 &&
@@ -443,4 +443,12 @@ test_expect_success 'fixup a fixup' '
test XZWY = $(git show | tr -cd W-Z)
'
+test_expect_success 'fixup does not clean up commit message' '
+ oneline="#818" &&
+ git commit --allow-empty -m "$oneline" &&
+ git commit --fixup HEAD --allow-empty &&
+ git -c commit.cleanup=strip rebase -ki --autosquash HEAD~2 &&
+ test "$oneline" = "$(git show -s --format=%s)"
+'
+
test_done
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 4caa014c71..43fcb68f27 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -110,7 +110,7 @@ testrebase () {
fi &&
create_expected_success_$suffix &&
sed "$remove_progress_re" <actual >actual2 &&
- test_i18ncmp expected actual2
+ test_cmp expected actual2
'
test_expect_success "rebase$type: dirty index, non-conflicting rebase" '
@@ -231,7 +231,7 @@ testrebase () {
fi &&
create_expected_failure_$suffix &&
sed "$remove_progress_re" <actual >actual2 &&
- test_i18ncmp expected actual2
+ test_cmp expected actual2
'
}
diff --git a/t/t3431-rebase-fork-point.sh b/t/t3431-rebase-fork-point.sh
index 2dab893c75..4c98d99e7e 100755
--- a/t/t3431-rebase-fork-point.sh
+++ b/t/t3431-rebase-fork-point.sh
@@ -29,19 +29,23 @@ test_expect_success setup '
test_commit G
'
+do_test_rebase () {
+ expected="$1" &&
+ shift &&
+ git checkout main &&
+ 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 () {
expected="$1" &&
shift &&
- test_expect_success "git rebase $*" "
- git checkout main &&
- 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_expect_success "git rebase $*" "do_test_rebase '$expected' $*"
}
test_rebase 'G F E D B A'
@@ -77,4 +81,35 @@ test_expect_success 'git rebase --fork-point with ambigous refname' '
test_must_fail git rebase --fork-point --onto D one
'
+test_expect_success '--fork-point and --root both given' '
+ test_must_fail git rebase --fork-point --root 2>err &&
+ test_i18ngrep "cannot combine" err
+'
+
+test_expect_success 'rebase.forkPoint set to false' '
+ test_config rebase.forkPoint false &&
+ do_test_rebase "G F C E D B A"
+'
+
+test_expect_success 'rebase.forkPoint set to false and then to true' '
+ test_config_global rebase.forkPoint false &&
+ test_config rebase.forkPoint true &&
+ do_test_rebase "G F E D B A"
+'
+
+test_expect_success 'rebase.forkPoint set to false and command line says --fork-point' '
+ test_config rebase.forkPoint false &&
+ do_test_rebase "G F E D B A" --fork-point
+'
+
+test_expect_success 'rebase.forkPoint set to true and command line says --no-fork-point' '
+ test_config rebase.forkPoint true &&
+ do_test_rebase "G F C E D B A" --no-fork-point
+'
+
+test_expect_success 'rebase.forkPoint set to true and --root given' '
+ test_config rebase.forkPoint true &&
+ git rebase --root
+'
+
test_done
diff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh
index 9198535874..4581ae98b8 100755
--- a/t/t3504-cherry-pick-rerere.sh
+++ b/t/t3504-cherry-pick-rerere.sh
@@ -74,10 +74,10 @@ test_expect_success 'cherry-pick --continue rejects --rerere-autoupdate' '
git diff-files --quiet &&
test_must_fail git cherry-pick --continue --rerere-autoupdate >actual 2>&1 &&
echo "fatal: cherry-pick: --rerere-autoupdate cannot be used with --continue" >expect &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
test_must_fail git cherry-pick --continue --no-rerere-autoupdate >actual 2>&1 &&
echo "fatal: cherry-pick: --no-rerere-autoupdate cannot be used with --continue" >expect &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
git cherry-pick --abort
'
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index 5f4564c830..014001b8f3 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -59,7 +59,7 @@ test_expect_success 'advice from failed cherry-pick' "
EOF
test_must_fail git cherry-pick picked 2>actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
"
test_expect_success 'advice from failed cherry-pick --no-commit' "
@@ -73,7 +73,7 @@ test_expect_success 'advice from failed cherry-pick --no-commit' "
EOF
test_must_fail git cherry-pick --no-commit picked 2>actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
"
test_expect_success 'failed cherry-pick sets CHERRY_PICK_HEAD' '
@@ -256,7 +256,7 @@ test_expect_success \
test_must_fail git cherry-pick picked &&
- test_i18ncmp expected .git/MERGE_MSG
+ test_cmp expected .git/MERGE_MSG
'
test_expect_success \
@@ -276,7 +276,7 @@ test_expect_success \
test_must_fail git cherry-pick --cleanup=scissors picked &&
- test_i18ncmp expected .git/MERGE_MSG
+ test_cmp expected .git/MERGE_MSG
'
test_expect_success 'failed cherry-pick describes conflict in work tree' '
@@ -465,7 +465,7 @@ test_expect_success \
test_must_fail git revert picked &&
sed "s/$OID_REGEX/OBJID/" .git/MERGE_MSG >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success \
@@ -488,7 +488,7 @@ test_expect_success \
test_must_fail git revert --cleanup=scissors picked &&
sed "s/$OID_REGEX/OBJID/" .git/MERGE_MSG >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'failed cherry-pick does not forget -s' '
diff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh
index ec7a2c9fcf..e8375d1c97 100755
--- a/t/t3508-cherry-pick-many-commits.sh
+++ b/t/t3508-cherry-pick-many-commits.sh
@@ -86,7 +86,7 @@ test_expect_success 'output to keep user entertained during multi-pick' '
git cherry-pick first..fourth >actual &&
sed -e "s/$_x05[0-9a-f][0-9a-f]/OBJID/" <actual >actual.fuzzy &&
test_line_count -ge 3 actual.fuzzy &&
- test_i18ncmp expected actual.fuzzy
+ test_cmp expected actual.fuzzy
'
test_expect_success 'cherry-pick --strategy resolve first..fourth works' '
@@ -123,7 +123,7 @@ test_expect_success 'output during multi-pick indicates merge strategy' '
test_tick &&
git cherry-pick --strategy resolve first..fourth >actual &&
sed -e "s/$_x05[0-9a-f][0-9a-f]/OBJID/" <actual >actual.fuzzy &&
- test_i18ncmp expected actual.fuzzy
+ test_cmp expected actual.fuzzy
'
test_expect_success 'cherry-pick --ff first..fourth works' '
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index 5b94fdaa67..b76cb6de91 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -170,7 +170,7 @@ test_expect_success 'check advice when we move HEAD by committing' '
git commit -a &&
test_path_is_missing .git/CHERRY_PICK_HEAD &&
test_must_fail git cherry-pick --skip 2>advice &&
- test_i18ncmp expect advice
+ test_cmp expect advice
'
test_expect_success 'selectively advise --skip while launching another sequence' '
@@ -182,7 +182,7 @@ test_expect_success 'selectively advise --skip while launching another sequence'
EOF
test_must_fail git cherry-pick picked..yetanotherpick &&
test_must_fail git cherry-pick picked..yetanotherpick 2>advice &&
- test_i18ncmp expect advice &&
+ test_cmp expect advice &&
cat >expect <<-EOF &&
error: cherry-pick is already in progress
hint: try "git cherry-pick (--continue | --abort | --quit)"
@@ -190,7 +190,7 @@ test_expect_success 'selectively advise --skip while launching another sequence'
EOF
git reset --merge &&
test_must_fail git cherry-pick picked..yetanotherpick 2>advice &&
- test_i18ncmp expect advice
+ test_cmp expect advice
'
test_expect_success 'allow skipping commit but not abort for a new history' '
@@ -204,7 +204,7 @@ test_expect_success 'allow skipping commit but not abort for a new history' '
test_must_fail git cherry-pick anotherpick &&
test_must_fail git cherry-pick --abort 2>advice &&
git cherry-pick --skip &&
- test_i18ncmp expect advice
+ test_cmp expect advice
'
test_expect_success 'allow skipping stopped cherry-pick because of untracked file modifications' '
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index dff1228669..bb9ef35dac 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -243,7 +243,7 @@ test_expect_success 'refresh index before checking if it is up-to-date' '
test_path_is_missing frotz/nitfol
'
-test_expect_success 'choking "git rm" should not let it die with cruft' '
+choke_git_rm_setup() {
git reset -q --hard &&
test_when_finished "rm -f .git/index.lock && git reset -q --hard" &&
i=0 &&
@@ -252,12 +252,24 @@ test_expect_success 'choking "git rm" should not let it die with cruft' '
do
echo "100644 $hash 0 some-file-$i"
i=$(( $i + 1 ))
- done | git update-index --index-info &&
+ done | git update-index --index-info
+}
+
+test_expect_success 'choking "git rm" should not let it die with cruft (induce SIGPIPE)' '
+ choke_git_rm_setup &&
# git command is intentionally placed upstream of pipe to induce SIGPIPE
git rm -n "some-file-*" | : &&
test_path_is_missing .git/index.lock
'
+
+test_expect_success !MINGW 'choking "git rm" should not let it die with cruft (induce and check SIGPIPE)' '
+ choke_git_rm_setup &&
+ OUT=$( ((trap "" PIPE; git rm -n "some-file-*"; echo $? 1>&3) | :) 3>&1 ) &&
+ test_match_signal 13 "$OUT" &&
+ test_path_is_missing .git/index.lock
+'
+
test_expect_success 'Resolving by removal is not a warning-worthy event' '
git reset -q --hard &&
test_when_finished "rm -f .git/index.lock msg && git reset -q --hard" &&
@@ -442,7 +454,7 @@ test_expect_success 'rm issues a warning when section is not found in .gitmodule
git add .gitmodules &&
echo "warning: Could not find section in .gitmodules where path=submod" >expect.err &&
git rm submod >actual 2>actual.err &&
- test_i18ncmp expect.err actual.err &&
+ test_cmp expect.err actual.err &&
test_path_is_missing submod &&
test_path_is_missing submod/.git &&
git status -s -uno >actual &&
@@ -812,7 +824,7 @@ test_expect_success 'rm files with different staged content' '
echo content1 >foo.txt &&
echo content1 >bar.txt &&
test_must_fail git rm foo.txt bar.txt 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'rm files with different staged content without hints' '
@@ -825,7 +837,7 @@ test_expect_success 'rm files with different staged content without hints' '
echo content2 >foo.txt &&
echo content2 >bar.txt &&
test_must_fail git -c advice.rmhints=false rm foo.txt bar.txt 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'rm file with local modification' '
@@ -837,7 +849,7 @@ test_expect_success 'rm file with local modification' '
git commit -m "testing rm 3" &&
echo content3 >foo.txt &&
test_must_fail git rm foo.txt 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'rm file with local modification without hints' '
@@ -847,7 +859,7 @@ test_expect_success 'rm file with local modification without hints' '
EOF
echo content4 >bar.txt &&
test_must_fail git -c advice.rmhints=false rm bar.txt 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'rm file with changes in the index' '
@@ -860,7 +872,7 @@ test_expect_success 'rm file with changes in the index' '
echo content5 >foo.txt &&
git add foo.txt &&
test_must_fail git rm foo.txt 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'rm file with changes in the index without hints' '
@@ -869,7 +881,7 @@ test_expect_success 'rm file with changes in the index without hints' '
foo.txt
EOF
test_must_fail git -c advice.rmhints=false rm foo.txt 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'rm files with two different errors' '
@@ -888,7 +900,7 @@ test_expect_success 'rm files with two different errors' '
echo content6 >bar1.txt &&
git add bar1.txt &&
test_must_fail git rm bar1.txt foo1.txt 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'rm empty string should fail' '
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index b7d4ba608c..b3b122ff97 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -304,7 +304,7 @@ test_expect_success 'error on a repository with no commits' '
error: '"'empty/'"' does not have a commit checked out
fatal: adding files failed
EOF
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'git add --dry-run of existing changed file' "
@@ -320,7 +320,7 @@ test_expect_success 'git add --dry-run of non-existing file' "
test_expect_success 'git add --dry-run of an existing file output' "
echo \"fatal: pathspec 'ignored-file' did not match any files\" >expect &&
- test_i18ncmp expect actual
+ test_cmp expect actual
"
cat >expect.err <<\EOF
@@ -339,8 +339,8 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
'
test_expect_success 'git add --dry-run --ignore-missing of non-existing file output' '
- test_i18ncmp expect.out actual.out &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.out actual.out &&
+ test_cmp expect.err actual.err
'
test_expect_success 'git add empty string should fail' '
@@ -386,6 +386,36 @@ test_expect_success POSIXPERM 'git add --chmod=[+-]x does not change the working
! test -x foo4
'
+test_expect_success 'git add --chmod fails with non regular files (but updates the other paths)' '
+ git reset --hard &&
+ test_ln_s_add foo foo3 &&
+ touch foo4 &&
+ test_must_fail git add --chmod=+x foo3 foo4 2>stderr &&
+ test_i18ngrep "cannot chmod +x .foo3." stderr &&
+ test_mode_in_index 120000 foo3 &&
+ test_mode_in_index 100755 foo4
+'
+
+test_expect_success 'git add --chmod honors --dry-run' '
+ git reset --hard &&
+ echo foo >foo4 &&
+ git add foo4 &&
+ git add --chmod=+x --dry-run foo4 &&
+ test_mode_in_index 100644 foo4
+'
+
+test_expect_success 'git add --chmod --dry-run reports error for non regular files' '
+ git reset --hard &&
+ test_ln_s_add foo foo4 &&
+ test_must_fail git add --chmod=+x --dry-run foo4 2>stderr &&
+ test_i18ngrep "cannot chmod +x .foo4." stderr
+'
+
+test_expect_success 'git add --chmod --dry-run reports error for unmatched pathspec' '
+ test_must_fail git add --chmod=+x --dry-run nonexistent 2>stderr &&
+ test_i18ngrep "pathspec .nonexistent. did not match any files" stderr
+'
+
test_expect_success 'no file status change if no pathspec is given' '
>foo5 &&
>foo6 &&
@@ -409,11 +439,17 @@ test_expect_success 'no file status change if no pathspec is given in subdir' '
'
test_expect_success 'all statuses changed in folder if . is given' '
- rm -fr empty &&
- git add --chmod=+x . &&
- test $(git ls-files --stage | grep ^100644 | wc -l) -eq 0 &&
- git add --chmod=-x . &&
- test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0
+ git init repo &&
+ (
+ cd repo &&
+ mkdir -p sub/dir &&
+ touch x y z sub/a sub/dir/b &&
+ git add -A &&
+ git add --chmod=+x . &&
+ test $(git ls-files --stage | grep ^100644 | wc -l) -eq 0 &&
+ git add --chmod=-x . &&
+ test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0
+ )
'
test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' '
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index b2f90997db..207714655f 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -370,7 +370,7 @@ test_expect_success 'setup expected' '
'
# Test splitting the first patch, then adding both
-test_expect_success C_LOCALE_OUTPUT 'add first line works' '
+test_expect_success '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 |
@@ -974,7 +974,7 @@ test_expect_success 'show help from add--helper' '
EOF
test_write_lines h | force_color git add -i >actual.colored &&
test_decode_color <actual.colored >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_done
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index 86bfeb271e..60a666da59 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -13,13 +13,11 @@ test_description='git mktag: tag object verify test'
check_verify_failure () {
test_expect_success "$1" "
- test_must_fail env GIT_TEST_GETTEXT_POISON=false \
- git mktag <tag.sig 2>message &&
+ test_must_fail git mktag <tag.sig 2>message &&
grep '$2' message &&
if test '$3' != '--no-strict'
then
- test_must_fail env GIT_TEST_GETTEXT_POISON=false \
- git mktag --no-strict <tag.sig 2>message.no-strict &&
+ test_must_fail git mktag --no-strict <tag.sig 2>message.no-strict &&xb
grep '$2' message.no-strict
fi
"
@@ -443,11 +441,9 @@ test_expect_success 'invalid header entry config & fsck' '
git -c fsck.extraHeaderEntry=ignore mktag --no-strict <tag.sig &&
git fsck &&
- env GIT_TEST_GETTEXT_POISON=false \
- git -c fsck.extraHeaderEntry=warn fsck 2>err &&
+ git -c fsck.extraHeaderEntry=warn fsck 2>err &&
grep "warning .*extraHeaderEntry:" err &&
- test_must_fail env GIT_TEST_GETTEXT_POISON=false \
- git -c fsck.extraHeaderEntry=error 2>err fsck &&
+ test_must_fail git -c fsck.extraHeaderEntry=error 2>err fsck &&
grep "error .* extraHeaderEntry:" err
'
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 84b039e573..5f282ecf61 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -564,7 +564,7 @@ test_expect_success 'stash show format defaults to --stat' '
1 file changed, 1 insertion(+)
EOF
git stash show ${STASH_ID} >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'stash show - stashes on stack, stash-like argument' '
@@ -792,7 +792,7 @@ test_expect_success 'apply: show same status as git status (relative to ./)' '
git stash apply
) |
sed -e 1d >actual && # drop "Saved..."
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat >expect <<EOF
@@ -1114,7 +1114,7 @@ test_expect_success 'stash push -p with pathspec shows no changes only once' '
git stash push -p foo >actual &&
echo "No local changes to save" >expect &&
git reset --hard HEAD~ &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'push <pathspec>: show no changes when there are none' '
@@ -1124,7 +1124,7 @@ test_expect_success 'push <pathspec>: show no changes when there are none' '
git stash push foo >actual &&
echo "No local changes to save" >expect &&
git reset --hard HEAD~ &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'push: <pathspec> not in the repository errors out' '
diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh
index f075c7f1f3..598b17f6d4 100755
--- a/t/t3905-stash-include-untracked.sh
+++ b/t/t3905-stash-include-untracked.sh
@@ -8,16 +8,16 @@ test_description='Test git stash --include-untracked'
. ./test-lib.sh
test_expect_success 'stash save --include-untracked some dirty working directory' '
- echo 1 > file &&
+ echo 1 >file &&
git add file &&
test_tick &&
git commit -m initial &&
- echo 2 > file &&
+ echo 2 >file &&
git add file &&
- echo 3 > file &&
+ echo 3 >file &&
test_tick &&
- echo 1 > file2 &&
- echo 1 > HEAD &&
+ echo 1 >file2 &&
+ echo 1 >HEAD &&
mkdir untracked &&
echo untracked >untracked/untracked &&
git stash --include-untracked &&
@@ -25,48 +25,50 @@ test_expect_success 'stash save --include-untracked some dirty working directory
git diff-index --cached --quiet HEAD
'
-cat > expect <<EOF
-?? actual
-?? expect
-EOF
-
test_expect_success 'stash save --include-untracked cleaned the untracked files' '
+ cat >expect <<-EOF &&
+ ?? actual
+ ?? expect
+ EOF
+
git status --porcelain >actual &&
test_cmp expect actual
'
-tracked=$(git rev-parse --short $(echo 1 | git hash-object --stdin))
-untracked=$(git rev-parse --short $(echo untracked | git hash-object --stdin))
-cat > expect.diff <<EOF
-diff --git a/HEAD b/HEAD
-new file mode 100644
-index 0000000..$tracked
---- /dev/null
-+++ b/HEAD
-@@ -0,0 +1 @@
-+1
-diff --git a/file2 b/file2
-new file mode 100644
-index 0000000..$tracked
---- /dev/null
-+++ b/file2
-@@ -0,0 +1 @@
-+1
-diff --git a/untracked/untracked b/untracked/untracked
-new file mode 100644
-index 0000000..$untracked
---- /dev/null
-+++ b/untracked/untracked
-@@ -0,0 +1 @@
-+untracked
-EOF
-cat > expect.lstree <<EOF
-HEAD
-file2
-untracked
-EOF
-
test_expect_success 'stash save --include-untracked stashed the untracked files' '
+ one_blob=$(echo 1 | git hash-object --stdin) &&
+ tracked=$(git rev-parse --short "$one_blob") &&
+ untracked_blob=$(echo untracked | git hash-object --stdin) &&
+ untracked=$(git rev-parse --short "$untracked_blob") &&
+ cat >expect.diff <<-EOF &&
+ diff --git a/HEAD b/HEAD
+ new file mode 100644
+ index 0000000..$tracked
+ --- /dev/null
+ +++ b/HEAD
+ @@ -0,0 +1 @@
+ +1
+ diff --git a/file2 b/file2
+ new file mode 100644
+ index 0000000..$tracked
+ --- /dev/null
+ +++ b/file2
+ @@ -0,0 +1 @@
+ +1
+ diff --git a/untracked/untracked b/untracked/untracked
+ new file mode 100644
+ index 0000000..$untracked
+ --- /dev/null
+ +++ b/untracked/untracked
+ @@ -0,0 +1 @@
+ +untracked
+ EOF
+ cat >expect.lstree <<-EOF &&
+ HEAD
+ file2
+ untracked
+ EOF
+
test_path_is_missing file2 &&
test_path_is_missing untracked &&
test_path_is_missing HEAD &&
@@ -83,57 +85,64 @@ test_expect_success 'stash save --patch --all fails' '
test_must_fail git stash --patch --all
'
-git clean --force --quiet
+test_expect_success 'clean up untracked/untracked file to prepare for next tests' '
+ git clean --force --quiet
-cat > expect <<EOF
- M file
-?? HEAD
-?? actual
-?? expect
-?? file2
-?? untracked/
-EOF
+'
test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '
+ cat >expect <<-EOF &&
+ M file
+ ?? HEAD
+ ?? actual
+ ?? expect
+ ?? file2
+ ?? untracked/
+ EOF
+
git stash pop &&
git status --porcelain >actual &&
test_cmp expect actual &&
- test "1" = "$(cat file2)" &&
- test untracked = "$(cat untracked/untracked)"
+ echo 1 >expect_file2 &&
+ test_cmp expect_file2 file2 &&
+ echo untracked >untracked_expect &&
+ test_cmp untracked_expect untracked/untracked
'
-git clean --force --quiet -d
+test_expect_success 'clean up untracked/ directory to prepare for next tests' '
+ git clean --force --quiet -d
+'
test_expect_success 'stash save -u dirty index' '
- echo 4 > file3 &&
+ echo 4 >file3 &&
git add file3 &&
test_tick &&
git stash -u
'
-blob=$(git rev-parse --short $(echo 4 | git hash-object --stdin))
-cat > expect <<EOF
-diff --git a/file3 b/file3
-new file mode 100644
-index 0000000..$blob
---- /dev/null
-+++ b/file3
-@@ -0,0 +1 @@
-+4
-EOF
-
test_expect_success 'stash save --include-untracked dirty index got stashed' '
+ four_blob=$(echo 4 | git hash-object --stdin) &&
+ blob=$(git rev-parse --short "$four_blob") &&
+ cat >expect <<-EOF &&
+ diff --git a/file3 b/file3
+ new file mode 100644
+ index 0000000..$blob
+ --- /dev/null
+ +++ b/file3
+ @@ -0,0 +1 @@
+ +4
+ EOF
+
git stash pop --index &&
+ test_when_finished "git reset" &&
git diff --cached >actual &&
test_cmp expect actual
'
-git reset > /dev/null
-
# Must direct output somewhere where it won't be considered an untracked file
test_expect_success 'stash save --include-untracked -q is quiet' '
- echo 1 > file5 &&
- git stash save --include-untracked --quiet > .git/stash-output.out 2>&1 &&
+ echo 1 >file5 &&
+ git stash save --include-untracked --quiet >.git/stash-output.out 2>&1 &&
test_line_count = 0 .git/stash-output.out &&
rm -f .git/stash-output.out
'
@@ -141,35 +150,34 @@ test_expect_success 'stash save --include-untracked -q is quiet' '
test_expect_success 'stash save --include-untracked removed files' '
rm -f file &&
git stash save --include-untracked &&
- echo 1 > expect &&
+ echo 1 >expect &&
+ test_when_finished "rm -f expect" &&
test_cmp expect file
'
-rm -f expect
-
test_expect_success 'stash save --include-untracked removed files got stashed' '
git stash pop &&
test_path_is_missing file
'
-cat > .gitignore <<EOF
-.gitignore
-ignored
-ignored.d/
-EOF
-
test_expect_success 'stash save --include-untracked respects .gitignore' '
- echo ignored > ignored &&
+ cat >.gitignore <<-EOF &&
+ .gitignore
+ ignored
+ ignored.d/
+ EOF
+
+ echo ignored >ignored &&
mkdir ignored.d &&
echo ignored >ignored.d/untracked &&
git stash -u &&
- test -s ignored &&
- test -s ignored.d/untracked &&
- test -s .gitignore
+ test_file_not_empty ignored &&
+ test_file_not_empty ignored.d/untracked &&
+ test_file_not_empty .gitignore
'
test_expect_success 'stash save -u can stash with only untracked files different' '
- echo 4 > file4 &&
+ echo 4 >file4 &&
git stash -u &&
test_path_is_missing file4
'
@@ -183,9 +191,9 @@ test_expect_success 'stash save --all does not respect .gitignore' '
test_expect_success 'stash save --all is stash poppable' '
git stash pop &&
- test -s ignored &&
- test -s ignored.d/untracked &&
- test -s .gitignore
+ test_file_not_empty ignored &&
+ test_file_not_empty ignored.d/untracked &&
+ test_file_not_empty .gitignore
'
test_expect_success 'stash push --include-untracked with pathspec' '
@@ -214,17 +222,17 @@ test_expect_success 'stash push with $IFS character' '
test_path_is_file bar
'
-cat > .gitignore <<EOF
-ignored
-ignored.d/*
-EOF
-
test_expect_success 'stash previously ignored file' '
+ cat >.gitignore <<-EOF &&
+ ignored
+ ignored.d/*
+ EOF
+
git reset HEAD &&
git add .gitignore &&
git commit -m "Add .gitignore" &&
>ignored.d/foo &&
- echo "!ignored.d/foo" >> .gitignore &&
+ echo "!ignored.d/foo" >>.gitignore &&
git stash save --include-untracked &&
test_path_is_missing ignored.d/foo &&
git stash pop &&
@@ -280,7 +288,7 @@ test_expect_success 'stash -u -- <ignored> leaves ignored file alone' '
test_expect_success 'stash -u -- <non-existent> shows no changes when there are none' '
git stash push -u -- non-existent >actual &&
echo "No local changes to save" >expect &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'stash -u with globs' '
diff --git a/t/t3910-mac-os-precompose.sh b/t/t3910-mac-os-precompose.sh
index a0b9208ce8..898267a6bd 100755
--- a/t/t3910-mac-os-precompose.sh
+++ b/t/t3910-mac-os-precompose.sh
@@ -194,6 +194,22 @@ test_expect_failure 'handle existing decomposed filenames' '
test_must_be_empty untracked
'
+test_expect_success "unicode decomposed: git restore -p . " '
+ DIRNAMEPWD=dir.Odiarnfc &&
+ DIRNAMEINREPO=dir.$Adiarnfc &&
+ export DIRNAMEPWD DIRNAMEINREPO &&
+ git init "$DIRNAMEPWD" &&
+ (
+ cd "$DIRNAMEPWD" &&
+ mkdir "$DIRNAMEINREPO" &&
+ cd "$DIRNAMEINREPO" &&
+ echo "Initial" >file &&
+ git add file &&
+ echo "More stuff" >>file &&
+ echo y | git restore -p .
+ )
+'
+
# Test if the global core.precomposeunicode stops autosensing
# Must be the last test case
test_expect_success "respect git config --global core.precomposeunicode" '
diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh
index e5116a76a1..cce334981e 100755
--- a/t/t4000-diff-format.sh
+++ b/t/t4000-diff-format.sh
@@ -7,7 +7,7 @@ test_description='Test built-in diff output engine.
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
echo >path0 'Line 1
Line 2
diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
index c16486a9d4..68f2ebca58 100755
--- a/t/t4001-diff-rename.sh
+++ b/t/t4001-diff-rename.sh
@@ -7,7 +7,7 @@ test_description='Test rename detection in diff engine.
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
test_expect_success 'setup' '
cat >path0 <<-\EOF &&
@@ -262,4 +262,28 @@ test_expect_success 'diff-tree -l0 defaults to a big rename limit, not zero' '
grep "myotherfile.*myfile" actual
'
+test_expect_success 'basename similarity vs best similarity' '
+ mkdir subdir &&
+ test_write_lines line1 line2 line3 line4 line5 \
+ line6 line7 line8 line9 line10 >subdir/file.txt &&
+ git add subdir/file.txt &&
+ git commit -m "base txt" &&
+
+ git rm subdir/file.txt &&
+ test_write_lines line1 line2 line3 line4 line5 \
+ line6 line7 line8 >file.txt &&
+ test_write_lines line1 line2 line3 line4 line5 \
+ line6 line7 line8 line9 >file.md &&
+ git add file.txt file.md &&
+ git commit -a -m "rename" &&
+ git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
+ # subdir/file.txt is 88% similar to file.md, 78% similar to file.txt,
+ # but since same basenames are checked first...
+ cat >expected <<-\EOF &&
+ A file.md
+ R078 subdir/file.txt file.txt
+ EOF
+ test_cmp expected actual
+'
+
test_done
diff --git a/t/t4003-diff-rename-1.sh b/t/t4003-diff-rename-1.sh
index df2accb655..db07ff3eb1 100755
--- a/t/t4003-diff-rename-1.sh
+++ b/t/t4003-diff-rename-1.sh
@@ -7,11 +7,11 @@ test_description='More rename detection
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
test_expect_success \
'prepare reference tree' \
- 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+ 'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
echo frotz >rezrov &&
git update-index --add COPYING rezrov &&
tree=$(git write-tree) &&
@@ -99,7 +99,7 @@ test_expect_success \
test_expect_success \
'prepare work tree once again' \
- 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+ 'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
git update-index --add --remove COPYING COPYING.1'
# tree has COPYING and rezrov. work tree has COPYING and COPYING.1,
diff --git a/t/t4004-diff-rename-symlink.sh b/t/t4004-diff-rename-symlink.sh
index 6e562c80d1..3d495e37bb 100755
--- a/t/t4004-diff-rename-symlink.sh
+++ b/t/t4004-diff-rename-symlink.sh
@@ -10,7 +10,7 @@ copy of symbolic links, but should not produce rename/copy followed
by an edit for them.
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
test_expect_success SYMLINKS \
'prepare reference tree' \
diff --git a/t/t4005-diff-rename-2.sh b/t/t4005-diff-rename-2.sh
index d18a80493c..8647906132 100755
--- a/t/t4005-diff-rename-2.sh
+++ b/t/t4005-diff-rename-2.sh
@@ -6,10 +6,10 @@
test_description='Same rename detection as t4003 but testing diff-raw.'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
test_expect_success 'setup reference tree' '
- cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+ cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
echo frotz >rezrov &&
git update-index --add COPYING rezrov &&
tree=$(git write-tree) &&
@@ -64,7 +64,7 @@ test_expect_success 'validate output from rename/copy detection (#2)' '
# nows how to say Copy.
test_expect_success 'validate output from rename/copy detection (#3)' '
- cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+ cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
git update-index --add --remove COPYING COPYING.1 &&
cat <<-EOF >expected &&
diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh
index 03489aff14..275ce5fa15 100755
--- a/t/t4006-diff-mode.sh
+++ b/t/t4006-diff-mode.sh
@@ -39,13 +39,13 @@ test_expect_success '--stat output after text chmod' '
1 file changed, 0 insertions(+), 0 deletions(-)
EOF
git diff HEAD --stat >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success '--shortstat output after text chmod' '
tail -n 1 <expect >expect.short &&
git diff HEAD --shortstat >actual &&
- test_i18ncmp expect.short actual
+ test_cmp expect.short actual
'
test_expect_success '--stat output after binary chmod' '
@@ -56,13 +56,13 @@ test_expect_success '--stat output after binary chmod' '
2 files changed, 0 insertions(+), 0 deletions(-)
EOF
git diff HEAD --stat >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success '--shortstat output after binary chmod' '
tail -n 1 <expect >expect.short &&
git diff HEAD --shortstat >actual &&
- test_i18ncmp expect.short actual
+ test_cmp expect.short actual
'
test_done
diff --git a/t/t4007-rename-3.sh b/t/t4007-rename-3.sh
index b187b7f6c6..cbb9c62f53 100755
--- a/t/t4007-rename-3.sh
+++ b/t/t4007-rename-3.sh
@@ -7,17 +7,17 @@ test_description='Rename interaction with pathspec.
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
test_expect_success 'prepare reference tree' '
mkdir path0 path1 &&
- cp "$TEST_DIRECTORY"/diff-lib/COPYING path0/COPYING &&
+ cp "$TEST_DIRECTORY"/lib-diff/COPYING path0/COPYING &&
git update-index --add path0/COPYING &&
tree=$(git write-tree) &&
echo $tree
'
-blob=$(git hash-object "$TEST_DIRECTORY/diff-lib/COPYING")
+blob=$(git hash-object "$TEST_DIRECTORY/lib-diff/COPYING")
test_expect_success 'prepare work tree' '
cp path0/COPYING path1/COPYING &&
git update-index --add --remove path0/COPYING path1/COPYING
diff --git a/t/t4008-diff-break-rewrite.sh b/t/t4008-diff-break-rewrite.sh
index b1ccd4102e..2299f27511 100755
--- a/t/t4008-diff-break-rewrite.sh
+++ b/t/t4008-diff-break-rewrite.sh
@@ -22,11 +22,11 @@ With -B, this should be detected as two complete rewrites.
Further, with -B and -M together, these should turn into two renames.
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
test_expect_success setup '
- cat "$TEST_DIRECTORY"/diff-lib/README >file0 &&
- cat "$TEST_DIRECTORY"/diff-lib/COPYING >file1 &&
+ cat "$TEST_DIRECTORY"/lib-diff/README >file0 &&
+ cat "$TEST_DIRECTORY"/lib-diff/COPYING >file1 &&
blob0_id=$(git hash-object file0) &&
blob1_id=$(git hash-object file1) &&
git update-index --add file0 file1 &&
diff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh
index b63bdf031f..b1da807f16 100755
--- a/t/t4009-diff-rename-4.sh
+++ b/t/t4009-diff-rename-4.sh
@@ -7,11 +7,11 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
test_expect_success \
'prepare reference tree' \
- 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+ 'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
echo frotz >rezrov &&
git update-index --add COPYING rezrov &&
orig=$(git hash-object COPYING) &&
@@ -81,7 +81,7 @@ test_expect_success \
test_expect_success \
'prepare work tree once again' \
- 'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
+ 'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
git update-index --add --remove COPYING COPYING.1'
git diff-index -z -C --find-copies-harder $tree >current
diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh
index 65cc703c65..1bbced79ec 100755
--- a/t/t4010-diff-pathspec.sh
+++ b/t/t4010-diff-pathspec.sh
@@ -10,7 +10,7 @@ Prepare:
path1/file1
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
test_expect_success \
setup \
diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
index 717034bb50..5a25c259fe 100755
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
@@ -7,7 +7,7 @@ test_description='Test diff of symlinks.
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
# Print the short OID of a symlink with the given name.
symlink_oid () {
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh
index 6579c81216..33ff588ebc 100755
--- a/t/t4012-diff-binary.sh
+++ b/t/t4012-diff-binary.sh
@@ -34,19 +34,19 @@ EOF
test_expect_success 'apply --stat output for binary file change' '
git diff >diff &&
git apply --stat --summary <diff >current &&
- test_i18ncmp expected current
+ test_cmp expected current
'
test_expect_success 'diff --shortstat output for binary file change' '
tail -n 1 expected >expect &&
git diff --shortstat >current &&
- test_i18ncmp expect current
+ test_cmp expect current
'
test_expect_success 'diff --shortstat output for binary file change only' '
echo " 1 file changed, 0 insertions(+), 0 deletions(-)" >expected &&
git diff --shortstat -- b >current &&
- test_i18ncmp expected current
+ test_cmp expected current
'
test_expect_success 'apply --numstat notices binary file change' '
@@ -63,7 +63,7 @@ test_expect_success 'apply --numstat understands diff --binary format' '
# apply needs to be able to skip the binary material correctly
# in order to report the line number of a corrupt patch.
-test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
+test_expect_success 'apply detecting corrupt patch correctly' '
git diff >output &&
sed -e "s/-CIT/xCIT/" <output >broken &&
test_must_fail git apply --stat --summary broken 2>detected &&
@@ -73,7 +73,7 @@ test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
test "$detected" = xCIT
'
-test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
+test_expect_success 'apply detecting corrupt patch correctly' '
git diff --binary | sed -e "s/-CIT/xCIT/" >broken &&
test_must_fail git apply --stat --summary broken 2>detected &&
detected=$(cat detected) &&
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 45f68ebcdb..6cca8b84a6 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -9,7 +9,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
test_expect_success setup '
@@ -178,6 +178,7 @@ process_diffs () {
V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
while read magic cmd
do
+ status=success
case "$magic" in
'' | '#'*)
continue ;;
@@ -186,6 +187,10 @@ do
label="$magic-$cmd"
case "$magic" in
noellipses) ;;
+ failure)
+ status=failure
+ magic=
+ label="$cmd" ;;
*)
BUG "unknown magic $magic" ;;
esac ;;
@@ -198,7 +203,7 @@ do
expect="$TEST_DIRECTORY/t4013/diff.$test"
actual="$pfx-diff.$test"
- test_expect_success "git $cmd # magic is ${magic:-(not used)}" '
+ test_expect_$status "git $cmd # magic is ${magic:-(not used)}" '
{
echo "$ git $cmd"
case "$magic" in
@@ -217,7 +222,7 @@ do
process_diffs "$expect" >expect &&
case $cmd in
*format-patch* | *-stat*)
- test_i18ncmp expect actual;;
+ test_cmp expect actual;;
*)
test_cmp expect actual;;
esac &&
@@ -326,8 +331,12 @@ log --no-diff-merges -p --first-parent master
log --diff-merges=off -p --first-parent master
log --first-parent --diff-merges=off -p master
log -p --first-parent master
+log -p --diff-merges=first-parent master
+log --diff-merges=first-parent master
log -m -p --first-parent master
log -m -p master
+log --cc -m -p master
+log -c -m -p master
log -SF master
log -S F master
log -SF -p master
diff --git a/t/t4013/diff.log_--cc_-m_-p_master b/t/t4013/diff.log_--cc_-m_-p_master
new file mode 100644
index 0000000000..7c217cf348
--- /dev/null
+++ b/t/t4013/diff.log_--cc_-m_-p_master
@@ -0,0 +1,200 @@
+$ git log --cc -m -p master
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)
+Merge: 9a6d494 c7a2ab9
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:04:00 2006 +0000
+
+ Merge branch 'side'
+
+diff --git a/dir/sub b/dir/sub
+index cead32e..992913c 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -4,3 +4,5 @@ C
+ D
+ E
+ F
++1
++2
+diff --git a/file0 b/file0
+index b414108..10a8a9f 100644
+--- a/file0
++++ b/file0
+@@ -4,3 +4,6 @@
+ 4
+ 5
+ 6
++A
++B
++C
+
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)
+Merge: 9a6d494 c7a2ab9
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:04:00 2006 +0000
+
+ Merge branch 'side'
+
+diff --git a/dir/sub b/dir/sub
+index 7289e35..992913c 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,4 +1,8 @@
+ A
+ B
++C
++D
++E
++F
+ 1
+ 2
+diff --git a/file0 b/file0
+index f4615da..10a8a9f 100644
+--- a/file0
++++ b/file0
+@@ -1,6 +1,9 @@
+ 1
+ 2
+ 3
++4
++5
++6
+ A
+ B
+ C
+diff --git a/file1 b/file1
+new file mode 100644
+index 0000000..b1e6722
+--- /dev/null
++++ b/file1
+@@ -0,0 +1,3 @@
++A
++B
++C
+diff --git a/file2 b/file2
+deleted file mode 100644
+index 01e79c3..0000000
+--- a/file2
++++ /dev/null
+@@ -1,3 +0,0 @@
+-1
+-2
+-3
+diff --git a/file3 b/file3
+deleted file mode 100644
+index 7289e35..0000000
+--- a/file3
++++ /dev/null
+@@ -1,4 +0,0 @@
+-A
+-B
+-1
+-2
+
+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:03:00 2006 +0000
+
+ Side
+
+diff --git a/dir/sub b/dir/sub
+index 35d242b..7289e35 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,2 +1,4 @@
+ A
+ B
++1
++2
+diff --git a/file0 b/file0
+index 01e79c3..f4615da 100644
+--- a/file0
++++ b/file0
+@@ -1,3 +1,6 @@
+ 1
+ 2
+ 3
++A
++B
++C
+diff --git a/file3 b/file3
+new file mode 100644
+index 0000000..7289e35
+--- /dev/null
++++ b/file3
+@@ -0,0 +1,4 @@
++A
++B
++1
++2
+
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:02:00 2006 +0000
+
+ Third
+
+diff --git a/dir/sub b/dir/sub
+index 8422d40..cead32e 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -2,3 +2,5 @@ A
+ B
+ C
+ D
++E
++F
+diff --git a/file1 b/file1
+new file mode 100644
+index 0000000..b1e6722
+--- /dev/null
++++ b/file1
+@@ -0,0 +1,3 @@
++A
++B
++C
+
+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:01:00 2006 +0000
+
+ Second
+
+ This is the second commit.
+
+diff --git a/dir/sub b/dir/sub
+index 35d242b..8422d40 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,2 +1,4 @@
+ A
+ B
++C
++D
+diff --git a/file0 b/file0
+index 01e79c3..b414108 100644
+--- a/file0
++++ b/file0
+@@ -1,3 +1,6 @@
+ 1
+ 2
+ 3
++4
++5
++6
+diff --git a/file2 b/file2
+deleted file mode 100644
+index 01e79c3..0000000
+--- a/file2
++++ /dev/null
+@@ -1,3 +0,0 @@
+-1
+-2
+-3
+
+commit 444ac553ac7612cc88969031b02b3767fb8a353a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:00:00 2006 +0000
+
+ Initial
+$
diff --git a/t/t4013/diff.log_--diff-merges=first-parent_master b/t/t4013/diff.log_--diff-merges=first-parent_master
new file mode 100644
index 0000000000..fa63a557dd
--- /dev/null
+++ b/t/t4013/diff.log_--diff-merges=first-parent_master
@@ -0,0 +1,56 @@
+$ git log --diff-merges=first-parent master
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
+Merge: 9a6d494 c7a2ab9
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:04:00 2006 +0000
+
+ Merge branch 'side'
+
+diff --git a/dir/sub b/dir/sub
+index cead32e..992913c 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -4,3 +4,5 @@ C
+ D
+ E
+ F
++1
++2
+diff --git a/file0 b/file0
+index b414108..10a8a9f 100644
+--- a/file0
++++ b/file0
+@@ -4,3 +4,6 @@
+ 4
+ 5
+ 6
++A
++B
++C
+
+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:03:00 2006 +0000
+
+ Side
+
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:02:00 2006 +0000
+
+ Third
+
+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:01:00 2006 +0000
+
+ Second
+
+ This is the second commit.
+
+commit 444ac553ac7612cc88969031b02b3767fb8a353a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:00:00 2006 +0000
+
+ Initial
+$
diff --git a/t/t4013/diff.log_-c_-m_-p_master b/t/t4013/diff.log_-c_-m_-p_master
new file mode 100644
index 0000000000..b660f3d5f2
--- /dev/null
+++ b/t/t4013/diff.log_-c_-m_-p_master
@@ -0,0 +1,200 @@
+$ git log -c -m -p master
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)
+Merge: 9a6d494 c7a2ab9
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:04:00 2006 +0000
+
+ Merge branch 'side'
+
+diff --git a/dir/sub b/dir/sub
+index cead32e..992913c 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -4,3 +4,5 @@ C
+ D
+ E
+ F
++1
++2
+diff --git a/file0 b/file0
+index b414108..10a8a9f 100644
+--- a/file0
++++ b/file0
+@@ -4,3 +4,6 @@
+ 4
+ 5
+ 6
++A
++B
++C
+
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)
+Merge: 9a6d494 c7a2ab9
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:04:00 2006 +0000
+
+ Merge branch 'side'
+
+diff --git a/dir/sub b/dir/sub
+index 7289e35..992913c 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,4 +1,8 @@
+ A
+ B
++C
++D
++E
++F
+ 1
+ 2
+diff --git a/file0 b/file0
+index f4615da..10a8a9f 100644
+--- a/file0
++++ b/file0
+@@ -1,6 +1,9 @@
+ 1
+ 2
+ 3
++4
++5
++6
+ A
+ B
+ C
+diff --git a/file1 b/file1
+new file mode 100644
+index 0000000..b1e6722
+--- /dev/null
++++ b/file1
+@@ -0,0 +1,3 @@
++A
++B
++C
+diff --git a/file2 b/file2
+deleted file mode 100644
+index 01e79c3..0000000
+--- a/file2
++++ /dev/null
+@@ -1,3 +0,0 @@
+-1
+-2
+-3
+diff --git a/file3 b/file3
+deleted file mode 100644
+index 7289e35..0000000
+--- a/file3
++++ /dev/null
+@@ -1,4 +0,0 @@
+-A
+-B
+-1
+-2
+
+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:03:00 2006 +0000
+
+ Side
+
+diff --git a/dir/sub b/dir/sub
+index 35d242b..7289e35 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,2 +1,4 @@
+ A
+ B
++1
++2
+diff --git a/file0 b/file0
+index 01e79c3..f4615da 100644
+--- a/file0
++++ b/file0
+@@ -1,3 +1,6 @@
+ 1
+ 2
+ 3
++A
++B
++C
+diff --git a/file3 b/file3
+new file mode 100644
+index 0000000..7289e35
+--- /dev/null
++++ b/file3
+@@ -0,0 +1,4 @@
++A
++B
++1
++2
+
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:02:00 2006 +0000
+
+ Third
+
+diff --git a/dir/sub b/dir/sub
+index 8422d40..cead32e 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -2,3 +2,5 @@ A
+ B
+ C
+ D
++E
++F
+diff --git a/file1 b/file1
+new file mode 100644
+index 0000000..b1e6722
+--- /dev/null
++++ b/file1
+@@ -0,0 +1,3 @@
++A
++B
++C
+
+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:01:00 2006 +0000
+
+ Second
+
+ This is the second commit.
+
+diff --git a/dir/sub b/dir/sub
+index 35d242b..8422d40 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,2 +1,4 @@
+ A
+ B
++C
++D
+diff --git a/file0 b/file0
+index 01e79c3..b414108 100644
+--- a/file0
++++ b/file0
+@@ -1,3 +1,6 @@
+ 1
+ 2
+ 3
++4
++5
++6
+diff --git a/file2 b/file2
+deleted file mode 100644
+index 01e79c3..0000000
+--- a/file2
++++ /dev/null
+@@ -1,3 +0,0 @@
+-1
+-2
+-3
+
+commit 444ac553ac7612cc88969031b02b3767fb8a353a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:00:00 2006 +0000
+
+ Initial
+$
diff --git a/t/t4013/diff.log_-p_--diff-merges=first-parent_master b/t/t4013/diff.log_-p_--diff-merges=first-parent_master
new file mode 100644
index 0000000000..9538a27511
--- /dev/null
+++ b/t/t4013/diff.log_-p_--diff-merges=first-parent_master
@@ -0,0 +1,137 @@
+$ git log -p --diff-merges=first-parent master
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
+Merge: 9a6d494 c7a2ab9
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:04:00 2006 +0000
+
+ Merge branch 'side'
+
+diff --git a/dir/sub b/dir/sub
+index cead32e..992913c 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -4,3 +4,5 @@ C
+ D
+ E
+ F
++1
++2
+diff --git a/file0 b/file0
+index b414108..10a8a9f 100644
+--- a/file0
++++ b/file0
+@@ -4,3 +4,6 @@
+ 4
+ 5
+ 6
++A
++B
++C
+
+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:03:00 2006 +0000
+
+ Side
+
+diff --git a/dir/sub b/dir/sub
+index 35d242b..7289e35 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,2 +1,4 @@
+ A
+ B
++1
++2
+diff --git a/file0 b/file0
+index 01e79c3..f4615da 100644
+--- a/file0
++++ b/file0
+@@ -1,3 +1,6 @@
+ 1
+ 2
+ 3
++A
++B
++C
+diff --git a/file3 b/file3
+new file mode 100644
+index 0000000..7289e35
+--- /dev/null
++++ b/file3
+@@ -0,0 +1,4 @@
++A
++B
++1
++2
+
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:02:00 2006 +0000
+
+ Third
+
+diff --git a/dir/sub b/dir/sub
+index 8422d40..cead32e 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -2,3 +2,5 @@ A
+ B
+ C
+ D
++E
++F
+diff --git a/file1 b/file1
+new file mode 100644
+index 0000000..b1e6722
+--- /dev/null
++++ b/file1
+@@ -0,0 +1,3 @@
++A
++B
++C
+
+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:01:00 2006 +0000
+
+ Second
+
+ This is the second commit.
+
+diff --git a/dir/sub b/dir/sub
+index 35d242b..8422d40 100644
+--- a/dir/sub
++++ b/dir/sub
+@@ -1,2 +1,4 @@
+ A
+ B
++C
++D
+diff --git a/file0 b/file0
+index 01e79c3..b414108 100644
+--- a/file0
++++ b/file0
+@@ -1,3 +1,6 @@
+ 1
+ 2
+ 3
++4
++5
++6
+diff --git a/file2 b/file2
+deleted file mode 100644
+index 01e79c3..0000000
+--- a/file2
++++ /dev/null
+@@ -1,3 +0,0 @@
+-1
+-2
+-3
+
+commit 444ac553ac7612cc88969031b02b3767fb8a353a
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:00:00 2006 +0000
+
+ Initial
+$
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 66630c8413..cdd3154e70 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -888,11 +888,11 @@ 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_i18ncmp expect.name-only output &&
+ test_cmp expect.name-only output &&
test_must_fail git format-patch --name-status 2>output &&
- test_i18ncmp expect.name-status output &&
+ test_cmp expect.name-status output &&
test_must_fail git format-patch --check 2>output &&
- test_i18ncmp expect.check output
+ test_cmp expect.check output
'
test_expect_success 'format-patch --numstat should produce a patch' '
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 8c574221b2..2c13b62d3c 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -7,7 +7,7 @@ test_description='Test special whitespace in diff engine.
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
test_expect_success "Ray Lehtiniemi's example" '
cat <<-\EOF >x &&
diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh
index 9c48e5c2c9..876271d682 100755
--- a/t/t4016-diff-quote.sh
+++ b/t/t4016-diff-quote.sh
@@ -82,7 +82,7 @@ test_expect_success 'git diff --stat -M HEAD' '
7 files changed, 0 insertions(+), 0 deletions(-)
EOF
git diff --stat -M HEAD >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_done
diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh
index 894a11b224..94ef77e1df 100755
--- a/t/t4027-diff-submodule.sh
+++ b/t/t4027-diff-submodule.sh
@@ -3,7 +3,7 @@
test_description='difference in submodules'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
test_expect_success setup '
test_tick &&
diff --git a/t/t4030-diff-textconv.sh b/t/t4030-diff-textconv.sh
index 4cb9f0e523..c906320b60 100755
--- a/t/t4030-diff-textconv.sh
+++ b/t/t4030-diff-textconv.sh
@@ -139,7 +139,7 @@ EOF
test_expect_success 'diffstat does not run textconv' '
echo file diff=fail >.gitattributes &&
git diff --stat HEAD^ HEAD >actual &&
- test_i18ncmp expect.stat actual &&
+ test_cmp expect.stat actual &&
head -n1 <expect.stat >expect.line1 &&
head -n1 <actual >actual.line1 &&
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index 0c8fb39ced..56f1e62a97 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -3,7 +3,7 @@
test_description='word diff colors'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
cat >pre.simple <<-\EOF
h(4)
diff --git a/t/t4038-diff-combined.sh b/t/t4038-diff-combined.sh
index 09ad491a59..aeac203c42 100755
--- a/t/t4038-diff-combined.sh
+++ b/t/t4038-diff-combined.sh
@@ -6,7 +6,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
setup_helper () {
one=$1 branch=$2 side=$3 &&
diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
index 7be1de736d..61ba5f707f 100755
--- a/t/t4045-diff-relative.sh
+++ b/t/t4045-diff-relative.sh
@@ -61,7 +61,7 @@ check_stat () {
EOF
test_expect_success "--stat $*" "
git -C '$dir' diff --stat $* HEAD^ >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
"
}
diff --git a/t/t4049-diff-stat-count.sh b/t/t4049-diff-stat-count.sh
index a34121740a..53061b104e 100755
--- a/t/t4049-diff-stat-count.sh
+++ b/t/t4049-diff-stat-count.sh
@@ -25,7 +25,7 @@ test_expect_success 'mode-only change show as a 0-line change' '
4 files changed, 2 insertions(+)
EOF
git diff --stat --stat-count=2 HEAD >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'binary changes do not count in lines' '
@@ -40,7 +40,7 @@ test_expect_success 'binary changes do not count in lines' '
3 files changed, 2 insertions(+)
EOF
git diff --stat --stat-count=2 >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'exclude unmerged entries from total file count' '
@@ -62,7 +62,7 @@ test_expect_success 'exclude unmerged entries from total file count' '
3 files changed, 3 insertions(+)
EOF
git diff --stat --stat-count=2 >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_done
diff --git a/t/t4056-diff-order.sh b/t/t4056-diff-order.sh
index 63ea7144bb..aec1d9d1b4 100755
--- a/t/t4056-diff-order.sh
+++ b/t/t4056-diff-order.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='diff order'
+test_description='diff order & rotate'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
@@ -127,4 +127,74 @@ do
'
done
+### rotate and skip
+
+test_expect_success 'rotate and skip setup' '
+ >sample1.t &&
+ >sample2.t &&
+ >sample3.t &&
+ >sample4.t &&
+ git add sample[1234].t &&
+ git commit -m "added" sample[1234].t &&
+ echo modified >>sample1.t &&
+ echo modified >>sample2.t &&
+ echo modified >>sample4.t &&
+ git commit -m "updated" sample[1234].t
+'
+
+test_expect_success 'diff --rotate-to' '
+ git diff --rotate-to=sample2.t --name-only HEAD^ >actual &&
+ test_write_lines sample2.t sample4.t sample1.t >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'diff --skip-to' '
+ git diff --skip-to=sample2.t --name-only HEAD^ >actual &&
+ test_write_lines sample2.t sample4.t >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'diff --rotate/skip-to error condition' '
+ test_must_fail git diff --rotate-to=sample3.t HEAD^ &&
+ test_must_fail git diff --skip-to=sample3.t HEAD^
+'
+
+test_expect_success 'log --rotate-to' '
+ git log --rotate-to=sample3.t --raw HEAD~2.. >raw &&
+ # just distill the commit header and paths
+ sed -n -e "s/^commit.*/commit/p" \
+ -e "/^:/s/^.* //p" raw >actual &&
+
+ cat >expect <<-\EOF &&
+ commit
+ sample4.t
+ sample1.t
+ sample2.t
+ commit
+ sample3.t
+ sample4.t
+ sample1.t
+ sample2.t
+ EOF
+
+ test_cmp expect actual
+'
+
+test_expect_success 'log --skip-to' '
+ git log --skip-to=sample3.t --raw HEAD~2.. >raw &&
+ # just distill the commit header and paths
+ sed -n -e "s/^commit.*/commit/p" \
+ -e "/^:/s/^.* //p" raw >actual &&
+
+ cat >expect <<-\EOF &&
+ commit
+ sample4.t
+ commit
+ sample3.t
+ sample4.t
+ EOF
+
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t4061-diff-indent.sh b/t/t4061-diff-indent.sh
index bcf7493740..7750b87ca1 100755
--- a/t/t4061-diff-indent.sh
+++ b/t/t4061-diff-indent.sh
@@ -7,7 +7,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
# Compare two diff outputs. Ignore "index" lines, because we don't
# care about SHA-1s or file modes.
diff --git a/t/t4100-apply-stat.sh b/t/t4100-apply-stat.sh
index 744b8e51be..9b433de836 100755
--- a/t/t4100-apply-stat.sh
+++ b/t/t4100-apply-stat.sh
@@ -17,13 +17,13 @@ do
test_expect_success "$title" '
git apply --stat --summary \
<"$TEST_DIRECTORY/t4100/t-apply-$num.patch" >current &&
- test_i18ncmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
+ test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
'
test_expect_success "$title with recount" '
sed -e "$UNC" <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" |
git apply --recount --stat --summary >current &&
- test_i18ncmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
+ test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
'
done <<\EOF
rename
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 99987515dc..2aaaa0d7de 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -906,7 +906,7 @@ test_expect_success 'am empty-file does not infloop' '
test_tick &&
test_must_fail git am empty-file 2>actual &&
echo Patch format detection failed. >expected &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'am --message-id really adds the message id' '
diff --git a/t/t4153-am-resume-override-opts.sh b/t/t4153-am-resume-override-opts.sh
index 8ea22d1bcb..b7c3861407 100755
--- a/t/t4153-am-resume-override-opts.sh
+++ b/t/t4153-am-resume-override-opts.sh
@@ -61,7 +61,7 @@ test_expect_success '--no-quiet overrides --quiet' '
# Applying side2 will be quiet.
git am --no-quiet --continue >out &&
echo "Applying: side1" >expected &&
- test_i18ncmp expected out
+ test_cmp expected out
'
test_expect_success '--signoff overrides --no-signoff' '
diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 621f9962d5..93caf9a46d 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -889,4 +889,47 @@ test_expect_success 'empty syntax: setup' '
test_cmp expect actual
'
+test_expect_success 'set up mailmap location tests' '
+ git init --bare loc-bare &&
+ git --git-dir=loc-bare --work-tree=. commit \
+ --allow-empty -m foo --author="Orig <orig@example.com>" &&
+ echo "New <new@example.com> <orig@example.com>" >loc-bare/.mailmap
+'
+
+test_expect_success 'bare repo with --work-tree finds mailmap at top-level' '
+ git -C loc-bare --work-tree=. log -1 --format=%aE >actual &&
+ echo new@example.com >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'bare repo does not look in current directory' '
+ git -C loc-bare log -1 --format=%aE >actual &&
+ echo orig@example.com >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'non-git shortlog respects mailmap in current dir' '
+ git --git-dir=loc-bare log -1 >input &&
+ nongit cp "$TRASH_DIRECTORY/loc-bare/.mailmap" . &&
+ nongit git shortlog -s <input >actual &&
+ echo " 1 New" >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'shortlog on stdin respects mailmap from repo' '
+ cp loc-bare/.mailmap . &&
+ git shortlog -s <input >actual &&
+ echo " 1 New" >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'find top-level mailmap from subdir' '
+ git clone loc-bare loc-wt &&
+ cp loc-bare/.mailmap loc-wt &&
+ mkdir loc-wt/subdir &&
+ git -C loc-wt/subdir log -1 --format=%aE >actual &&
+ echo new@example.com >expect &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 749bc1431a..85432b80ff 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -123,10 +123,10 @@ test_expect_success 'NUL separation with --stat' '
stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
git log -z --stat --pretty="format:%s" >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
-test_expect_failure C_LOCALE_OUTPUT 'NUL termination with --stat' '
+test_expect_failure 'NUL termination with --stat' '
stat0_part=$(git diff --stat HEAD^ HEAD) &&
stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n0" >expected &&
diff --git a/t/t4206-log-follow-harder-copies.sh b/t/t4206-log-follow-harder-copies.sh
index ad29e65fcb..4871a5dc92 100755
--- a/t/t4206-log-follow-harder-copies.sh
+++ b/t/t4206-log-follow-harder-copies.sh
@@ -7,7 +7,7 @@ test_description='Test --follow should always find copies hard in git log.
'
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
echo >path0 'Line 1
Line 2
diff --git a/t/t4208-log-magic-pathspec.sh b/t/t4208-log-magic-pathspec.sh
index 5e10136e9a..7f0c1dcc0f 100755
--- a/t/t4208-log-magic-pathspec.sh
+++ b/t/t4208-log-magic-pathspec.sh
@@ -31,13 +31,8 @@ test_expect_success '"git log :/a -- " should not be ambiguous' '
test_expect_success '"git log :/detached -- " should find a commit only in HEAD' '
test_when_finished "git checkout main" &&
git checkout --detach &&
- # Must manually call `test_tick` instead of using `test_commit`,
- # because the latter additionally creates a tag, which would make
- # the commit reachable not only via HEAD.
- test_tick &&
- git commit --allow-empty -m detached &&
- test_tick &&
- git commit --allow-empty -m something-else &&
+ test_commit --no-tag detached &&
+ test_commit --no-tag something-else &&
git log :/detached --
'
diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh
index 0f16c4b9d5..50f206db55 100755
--- a/t/t4216-log-bloom.sh
+++ b/t/t4216-log-bloom.sh
@@ -43,11 +43,11 @@ test_expect_success 'setup test - repo, commits, commit graph, log outputs' '
'
graph_read_expect () {
- NUM_CHUNKS=5
+ NUM_CHUNKS=6
cat >expect <<- EOF
header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0
num_commits: $1
- chunks: oid_fanout oid_lookup commit_metadata bloom_indexes bloom_data
+ chunks: oid_fanout oid_lookup commit_metadata generation_data bloom_indexes bloom_data
EOF
test-tool read-graph >actual &&
test_cmp expect actual
diff --git a/t/t4254-am-corrupt.sh b/t/t4254-am-corrupt.sh
index daf01c309d..54be7da161 100755
--- a/t/t4254-am-corrupt.sh
+++ b/t/t4254-am-corrupt.sh
@@ -60,7 +60,7 @@ test_expect_success 'try to apply corrupted patch' '
test_must_fail git -c advice.amWorkDir=false am bad-patch.diff 2>actual &&
echo "error: git diff header lacks filename information (line 4)" >expected &&
test_path_is_file f &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success "NUL in commit message's body" '
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 3ebb0d3b65..7204799a0b 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -431,15 +431,33 @@ test_expect_success TAR_HUGE,LONG_IS_64BIT 'system tar can read our huge size' '
test_cmp expect actual
'
-test_expect_success TIME_IS_64BIT 'set up repository with far-future commit' '
+test_expect_success TIME_IS_64BIT 'set up repository with far-future (2^34 - 1) commit' '
+ rm -f .git/index &&
+ echo foo >file &&
+ git add file &&
+ GIT_COMMITTER_DATE="@17179869183 +0000" \
+ git commit -m "tempori parendum"
+'
+
+test_expect_success TIME_IS_64BIT 'generate tar with far-future mtime' '
+ git archive HEAD >future.tar
+'
+
+test_expect_success TAR_HUGE,TIME_IS_64BIT,TIME_T_IS_64BIT 'system tar can read our future mtime' '
+ echo 2514 >expect &&
+ tar_info future.tar | cut -d" " -f2 >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success TIME_IS_64BIT 'set up repository with far-far-future (2^36 + 1) commit' '
rm -f .git/index &&
echo content >file &&
git add file &&
- GIT_COMMITTER_DATE="@68719476737 +0000" \
+ GIT_TEST_COMMIT_GRAPH=0 GIT_COMMITTER_DATE="@68719476737 +0000" \
git commit -m "tempori parendum"
'
-test_expect_success TIME_IS_64BIT 'generate tar with future mtime' '
+test_expect_success TIME_IS_64BIT 'generate tar with far-far-future mtime' '
git archive HEAD >future.tar
'
diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh
index 3e7b23cb32..2d32d0ed12 100755
--- a/t/t5004-archive-corner-cases.sh
+++ b/t/t5004-archive-corner-cases.sh
@@ -153,7 +153,8 @@ test_expect_success ZIPINFO 'zip archive with many entries' '
# check the number of entries in the ZIP file directory
expr 65536 + 256 >expect &&
- "$ZIPINFO" many.zip | head -2 | sed -n "2s/.* //p" >actual &&
+ "$ZIPINFO" -h many.zip >zipinfo &&
+ sed -n "2s/.* //p" <zipinfo >actual &&
test_cmp expect actual
'
diff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh
index db4e15fd59..cb67bac1c4 100755
--- a/t/t5150-request-pull.sh
+++ b/t/t5150-request-pull.sh
@@ -223,14 +223,14 @@ test_expect_success 'pull request format' '
git request-pull initial "$downstream_url" tags/full >../request
) &&
<request sed -nf fuzz.sed >request.fuzzy &&
- test_i18ncmp expect request.fuzzy &&
+ test_cmp expect request.fuzzy &&
(
cd local &&
git request-pull initial "$downstream_url" tags/full:refs/tags/full
) >request &&
sed -nf fuzz.sed <request >request.fuzzy &&
- test_i18ncmp expect request.fuzzy &&
+ test_cmp expect request.fuzzy &&
(
cd local &&
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 392201cabd..d586fdc7a9 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -427,7 +427,7 @@ test_expect_success 'index-pack --strict <pack> works in non-repo' '
test_path_is_file foo.idx
'
-test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'index-pack --threads=N or pack.threads=N warns when no pthreads' '
+test_expect_success !PTHREADS 'index-pack --threads=N or pack.threads=N warns when no pthreads' '
test_must_fail git index-pack --threads=2 2>err &&
grep ^warning: err >warnings &&
test_line_count = 1 warnings &&
@@ -445,7 +445,7 @@ test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'index-pack --threads=N or pack.th
grep -F "no threads support, ignoring pack.threads" err
'
-test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'pack-objects --threads=N or pack.threads=N warns when no pthreads' '
+test_expect_success !PTHREADS 'pack-objects --threads=N or pack.threads=N warns when no pthreads' '
git pack-objects --threads=2 --stdout --all </dev/null >/dev/null 2>err &&
grep ^warning: err >warnings &&
test_line_count = 1 warnings &&
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index 5ba7603109..40b9f63244 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -5,6 +5,8 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-bundle.sh
+. "$TEST_DIRECTORY"/lib-bitmap.sh
objpath () {
echo ".git/objects/$(echo "$1" | sed -e 's|\(..\)|\1/|')"
diff --git a/t/t5316-pack-delta-depth.sh b/t/t5316-pack-delta-depth.sh
index 0f06c40eb1..a8c1bc0f66 100755
--- a/t/t5316-pack-delta-depth.sh
+++ b/t/t5316-pack-delta-depth.sh
@@ -84,14 +84,14 @@ test_expect_success 'packing produces a long delta' '
pack=$(git pack-objects --all --window=0 </dev/null pack) &&
echo 9 >expect &&
max_chain pack-$pack.pack >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success '--depth limits depth' '
pack=$(git pack-objects --all --depth=5 </dev/null pack) &&
echo 5 >expect &&
max_chain pack-$pack.pack >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_done
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 2ed0c1544d..edeb6d6d31 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -76,7 +76,7 @@ graph_git_behavior 'no graph' full commits/3 commits/1
graph_read_expect() {
OPTIONAL=""
NUM_CHUNKS=3
- if test ! -z $2
+ if test ! -z "$2"
then
OPTIONAL=" $2"
NUM_CHUNKS=$((3 + $(echo "$2" | wc -w)))
@@ -103,14 +103,14 @@ test_expect_success 'exit with correct error on bad input to --stdin-commits' '
# valid commit and tree OID
git rev-parse HEAD HEAD^{tree} >in &&
git commit-graph write --stdin-commits <in &&
- graph_read_expect 3
+ graph_read_expect 3 generation_data
'
test_expect_success 'write graph' '
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "3"
+ graph_read_expect "3" generation_data
'
test_expect_success POSIXPERM 'write graph has correct permissions' '
@@ -219,7 +219,7 @@ test_expect_success 'write graph with merges' '
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "10" "extra_edges"
+ graph_read_expect "10" "generation_data extra_edges"
'
graph_git_behavior 'merge 1 vs 2' full merge/1 merge/2
@@ -254,7 +254,7 @@ test_expect_success 'write graph with new commit' '
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "11" "extra_edges"
+ graph_read_expect "11" "generation_data extra_edges"
'
graph_git_behavior 'full graph, commit 8 vs merge 1' full commits/8 merge/1
@@ -264,7 +264,7 @@ test_expect_success 'write graph with nothing new' '
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "11" "extra_edges"
+ graph_read_expect "11" "generation_data extra_edges"
'
graph_git_behavior 'cleared graph, commit 8 vs merge 1' full commits/8 merge/1
@@ -274,7 +274,7 @@ test_expect_success 'build graph from latest pack with closure' '
cd "$TRASH_DIRECTORY/full" &&
cat new-idx | git commit-graph write --stdin-packs &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "9" "extra_edges"
+ graph_read_expect "9" "generation_data extra_edges"
'
graph_git_behavior 'graph from pack, commit 8 vs merge 1' full commits/8 merge/1
@@ -287,7 +287,7 @@ test_expect_success 'build graph from commits with closure' '
git rev-parse merge/1 >>commits-in &&
cat commits-in | git commit-graph write --stdin-commits &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "6"
+ graph_read_expect "6" "generation_data"
'
graph_git_behavior 'graph from commits, commit 8 vs merge 1' full commits/8 merge/1
@@ -297,7 +297,7 @@ test_expect_success 'build graph from commits with append' '
cd "$TRASH_DIRECTORY/full" &&
git rev-parse merge/3 | git commit-graph write --stdin-commits --append &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "10" "extra_edges"
+ graph_read_expect "10" "generation_data extra_edges"
'
graph_git_behavior 'append graph, commit 8 vs merge 1' full commits/8 merge/1
@@ -307,7 +307,7 @@ test_expect_success 'build graph using --reachable' '
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write --reachable &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "11" "extra_edges"
+ graph_read_expect "11" "generation_data extra_edges"
'
graph_git_behavior 'append graph, commit 8 vs merge 1' full commits/8 merge/1
@@ -328,7 +328,7 @@ test_expect_success 'write graph in bare repo' '
cd "$TRASH_DIRECTORY/bare" &&
git commit-graph write &&
test_path_is_file $baredir/info/commit-graph &&
- graph_read_expect "11" "extra_edges"
+ graph_read_expect "11" "generation_data extra_edges"
'
graph_git_behavior 'bare repo with graph, commit 8 vs merge 1' bare commits/8 merge/1
@@ -446,6 +446,27 @@ test_expect_success 'warn on improper hash version' '
)
'
+test_expect_success 'lower layers have overflow chunk' '
+ cd "$TRASH_DIRECTORY/full" &&
+ UNIX_EPOCH_ZERO="@0 +0000" &&
+ FUTURE_DATE="@2147483646 +0000" &&
+ rm -f .git/objects/info/commit-graph &&
+ test_commit --date "$FUTURE_DATE" future-1 &&
+ test_commit --date "$UNIX_EPOCH_ZERO" old-1 &&
+ git commit-graph write --reachable &&
+ test_commit --date "$FUTURE_DATE" future-2 &&
+ test_commit --date "$UNIX_EPOCH_ZERO" old-2 &&
+ git commit-graph write --reachable --split=no-merge &&
+ test_commit extra &&
+ git commit-graph write --reachable --split=no-merge &&
+ git commit-graph write --reachable &&
+ graph_read_expect 16 "generation_data generation_data_overflow extra_edges" &&
+ mv .git/objects/info/commit-graph commit-graph-upgraded &&
+ git commit-graph write --reachable &&
+ graph_read_expect 16 "generation_data generation_data_overflow extra_edges" &&
+ test_cmp .git/objects/info/commit-graph commit-graph-upgraded
+'
+
# the verify tests below expect the commit-graph to contain
# exactly the commits reachable from the commits/8 branch.
# If the file changes the set of commits in the list, then the
@@ -454,8 +475,9 @@ test_expect_success 'warn on improper hash version' '
test_expect_success 'git commit-graph verify' '
cd "$TRASH_DIRECTORY/full" &&
- git rev-parse commits/8 | git commit-graph write --stdin-commits &&
- git commit-graph verify >output
+ git rev-parse commits/8 | GIT_TEST_COMMIT_GRAPH_NO_GDAT=1 git commit-graph write --stdin-commits &&
+ git commit-graph verify >output &&
+ graph_read_expect 9 extra_edges
'
NUM_COMMITS=9
@@ -529,7 +551,7 @@ corrupt_graph_and_verify() {
zero_pos=${4:-${orig_size}} &&
printf "$data" | dd of="$objdir/info/commit-graph" bs=1 seek="$pos" conv=notrunc &&
dd of="$objdir/info/commit-graph" bs=1 seek="$zero_pos" if=/dev/null &&
- generate_zero_bytes $(($orig_size - $zero_pos)) >>"$objdir/info/commit-graph" &&
+ test-tool genzeros $(($orig_size - $zero_pos)) >>"$objdir/info/commit-graph" &&
corrupt_graph_verify "$grepstr"
}
@@ -563,7 +585,7 @@ test_expect_success 'detect bad hash version' '
test_expect_success 'detect low chunk count' '
corrupt_graph_and_verify $GRAPH_BYTE_CHUNK_COUNT "\01" \
- "missing the .* chunk"
+ "final chunk has non-zero id"
'
test_expect_success 'detect missing OID fanout chunk' '
@@ -741,4 +763,56 @@ test_expect_success 'corrupt commit-graph write (missing tree)' '
)
'
+# We test the overflow-related code with the following repo history:
+#
+# 4:F - 5:N - 6:U
+# / \
+# 1:U - 2:N - 3:U M:N
+# \ /
+# 7:N - 8:F - 9:N
+#
+# Here the commits denoted by U have committer date of zero seconds
+# since Unix epoch, the commits denoted by N have committer date
+# starting from 1112354055 seconds since Unix epoch (default committer
+# date for the test suite), and the commits denoted by F have committer
+# date of (2 ^ 31 - 2) seconds since Unix epoch.
+#
+# The largest offset observed is 2 ^ 31, just large enough to overflow.
+#
+
+test_expect_success 'set up and verify repo with generation data overflow chunk' '
+ objdir=".git/objects" &&
+ UNIX_EPOCH_ZERO="@0 +0000" &&
+ FUTURE_DATE="@2147483646 +0000" &&
+ test_oid_cache <<-EOF &&
+ oid_version sha1:1
+ oid_version sha256:2
+ EOF
+ cd "$TRASH_DIRECTORY" &&
+ mkdir repo &&
+ cd repo &&
+ git init &&
+ test_commit --date "$UNIX_EPOCH_ZERO" 1 &&
+ test_commit 2 &&
+ test_commit --date "$UNIX_EPOCH_ZERO" 3 &&
+ git commit-graph write --reachable &&
+ graph_read_expect 3 generation_data &&
+ test_commit --date "$FUTURE_DATE" 4 &&
+ test_commit 5 &&
+ test_commit --date "$UNIX_EPOCH_ZERO" 6 &&
+ git branch left &&
+ git reset --hard 3 &&
+ test_commit 7 &&
+ test_commit --date "$FUTURE_DATE" 8 &&
+ test_commit 9 &&
+ git branch right &&
+ git reset --hard 3 &&
+ test_merge M left right &&
+ git commit-graph write --reachable &&
+ graph_read_expect 10 "generation_data generation_data_overflow" &&
+ git commit-graph verify
+'
+
+graph_git_behavior 'generation data overflow chunk repo' repo left right
+
test_done
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 297de502a9..b4afab1dfc 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -314,12 +314,12 @@ test_expect_success 'verify bad OID version' '
test_expect_success 'verify truncated chunk count' '
corrupt_midx_and_verify $MIDX_BYTE_CHUNK_COUNT "\01" $objdir \
- "missing required"
+ "final chunk has non-zero id"
'
test_expect_success 'verify extended chunk count' '
corrupt_midx_and_verify $MIDX_BYTE_CHUNK_COUNT "\07" $objdir \
- "terminating multi-pack-index chunk id appears earlier than expected"
+ "terminating chunk id appears earlier than expected"
'
test_expect_success 'verify missing required chunk' '
@@ -329,7 +329,7 @@ test_expect_success 'verify missing required chunk' '
test_expect_success 'verify invalid chunk offset' '
corrupt_midx_and_verify $MIDX_BYTE_CHUNK_OFFSET "\01" $objdir \
- "invalid chunk offset (too large)"
+ "improper chunk offset(s)"
'
test_expect_success 'verify packnames out of order' '
@@ -710,8 +710,9 @@ test_expect_success 'expire respects .keep files' '
PACKA=$(ls .git/objects/pack/a-pack*\.pack | sed s/\.pack\$//) &&
touch $PACKA.keep &&
git multi-pack-index expire &&
- ls -S .git/objects/pack/a-pack* | grep $PACKA >a-pack-files &&
- test_line_count = 3 a-pack-files &&
+ test_path_is_file $PACKA.idx &&
+ test_path_is_file $PACKA.keep &&
+ test_path_is_file $PACKA.pack &&
test-tool read-midx .git/objects | grep idx >midx-list &&
test_line_count = 2 midx-list
)
diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh
index 4d3842b83b..8e90f3423b 100755
--- a/t/t5324-split-commit-graph.sh
+++ b/t/t5324-split-commit-graph.sh
@@ -13,11 +13,11 @@ test_expect_success 'setup repo' '
infodir=".git/objects/info" &&
graphdir="$infodir/commit-graphs" &&
test_oid_cache <<-EOM
- shallow sha1:1760
- shallow sha256:2064
+ shallow sha1:2132
+ shallow sha256:2436
- base sha1:1376
- base sha256:1496
+ base sha1:1408
+ base sha256:1528
oid_version sha1:1
oid_version sha256:2
@@ -31,9 +31,9 @@ graph_read_expect() {
NUM_BASE=$2
fi
cat >expect <<- EOF
- header: 43475048 1 $(test_oid oid_version) 3 $NUM_BASE
+ header: 43475048 1 $(test_oid oid_version) 4 $NUM_BASE
num_commits: $1
- chunks: oid_fanout oid_lookup commit_metadata
+ chunks: oid_fanout oid_lookup commit_metadata generation_data
EOF
test-tool read-graph >output &&
test_cmp expect output
@@ -453,4 +453,185 @@ test_expect_success 'prevent regression for duplicate commits across layers' '
git -C dup commit-graph verify
'
+NUM_FIRST_LAYER_COMMITS=64
+NUM_SECOND_LAYER_COMMITS=16
+NUM_THIRD_LAYER_COMMITS=7
+NUM_FOURTH_LAYER_COMMITS=8
+NUM_FIFTH_LAYER_COMMITS=16
+SECOND_LAYER_SEQUENCE_START=$(($NUM_FIRST_LAYER_COMMITS + 1))
+SECOND_LAYER_SEQUENCE_END=$(($SECOND_LAYER_SEQUENCE_START + $NUM_SECOND_LAYER_COMMITS - 1))
+THIRD_LAYER_SEQUENCE_START=$(($SECOND_LAYER_SEQUENCE_END + 1))
+THIRD_LAYER_SEQUENCE_END=$(($THIRD_LAYER_SEQUENCE_START + $NUM_THIRD_LAYER_COMMITS - 1))
+FOURTH_LAYER_SEQUENCE_START=$(($THIRD_LAYER_SEQUENCE_END + 1))
+FOURTH_LAYER_SEQUENCE_END=$(($FOURTH_LAYER_SEQUENCE_START + $NUM_FOURTH_LAYER_COMMITS - 1))
+FIFTH_LAYER_SEQUENCE_START=$(($FOURTH_LAYER_SEQUENCE_END + 1))
+FIFTH_LAYER_SEQUENCE_END=$(($FIFTH_LAYER_SEQUENCE_START + $NUM_FIFTH_LAYER_COMMITS - 1))
+
+# Current split graph chain:
+#
+# 16 commits (No GDAT)
+# ------------------------
+# 64 commits (GDAT)
+#
+test_expect_success 'setup repo for mixed generation commit-graph-chain' '
+ graphdir=".git/objects/info/commit-graphs" &&
+ test_oid_cache <<-EOF &&
+ oid_version sha1:1
+ oid_version sha256:2
+ EOF
+ git init mixed &&
+ (
+ cd mixed &&
+ git config core.commitGraph true &&
+ git config gc.writeCommitGraph false &&
+ for i in $(test_seq $NUM_FIRST_LAYER_COMMITS)
+ do
+ test_commit $i &&
+ git branch commits/$i || return 1
+ done &&
+ git commit-graph write --reachable --split &&
+ graph_read_expect $NUM_FIRST_LAYER_COMMITS &&
+ test_line_count = 1 $graphdir/commit-graph-chain &&
+ for i in $(test_seq $SECOND_LAYER_SEQUENCE_START $SECOND_LAYER_SEQUENCE_END)
+ do
+ test_commit $i &&
+ git branch commits/$i || return 1
+ done &&
+ GIT_TEST_COMMIT_GRAPH_NO_GDAT=1 git commit-graph write --reachable --split=no-merge &&
+ test_line_count = 2 $graphdir/commit-graph-chain &&
+ test-tool read-graph >output &&
+ cat >expect <<-EOF &&
+ header: 43475048 1 $(test_oid oid_version) 4 1
+ num_commits: $NUM_SECOND_LAYER_COMMITS
+ chunks: oid_fanout oid_lookup commit_metadata
+ EOF
+ test_cmp expect output &&
+ git commit-graph verify &&
+ cat $graphdir/commit-graph-chain
+ )
+'
+
+# The new layer will be added without generation data chunk as it was not
+# present on the layer underneath it.
+#
+# 7 commits (No GDAT)
+# ------------------------
+# 16 commits (No GDAT)
+# ------------------------
+# 64 commits (GDAT)
+#
+test_expect_success 'do not write generation data chunk if not present on existing tip' '
+ git clone mixed mixed-no-gdat &&
+ (
+ cd mixed-no-gdat &&
+ for i in $(test_seq $THIRD_LAYER_SEQUENCE_START $THIRD_LAYER_SEQUENCE_END)
+ do
+ test_commit $i &&
+ git branch commits/$i || return 1
+ done &&
+ git commit-graph write --reachable --split=no-merge &&
+ test_line_count = 3 $graphdir/commit-graph-chain &&
+ test-tool read-graph >output &&
+ cat >expect <<-EOF &&
+ header: 43475048 1 $(test_oid oid_version) 4 2
+ num_commits: $NUM_THIRD_LAYER_COMMITS
+ chunks: oid_fanout oid_lookup commit_metadata
+ EOF
+ test_cmp expect output &&
+ git commit-graph verify
+ )
+'
+
+# Number of commits in each layer of the split-commit graph before merge:
+#
+# 8 commits (No GDAT)
+# ------------------------
+# 7 commits (No GDAT)
+# ------------------------
+# 16 commits (No GDAT)
+# ------------------------
+# 64 commits (GDAT)
+#
+# The top two layers are merged and do not have generation data chunk as layer below them does
+# not have generation data chunk.
+#
+# 15 commits (No GDAT)
+# ------------------------
+# 16 commits (No GDAT)
+# ------------------------
+# 64 commits (GDAT)
+#
+test_expect_success 'do not write generation data chunk if the topmost remaining layer does not have generation data chunk' '
+ git clone mixed-no-gdat mixed-merge-no-gdat &&
+ (
+ cd mixed-merge-no-gdat &&
+ for i in $(test_seq $FOURTH_LAYER_SEQUENCE_START $FOURTH_LAYER_SEQUENCE_END)
+ do
+ test_commit $i &&
+ git branch commits/$i || return 1
+ done &&
+ git commit-graph write --reachable --split --size-multiple 1 &&
+ test_line_count = 3 $graphdir/commit-graph-chain &&
+ test-tool read-graph >output &&
+ cat >expect <<-EOF &&
+ header: 43475048 1 $(test_oid oid_version) 4 2
+ num_commits: $(($NUM_THIRD_LAYER_COMMITS + $NUM_FOURTH_LAYER_COMMITS))
+ chunks: oid_fanout oid_lookup commit_metadata
+ EOF
+ test_cmp expect output &&
+ git commit-graph verify
+ )
+'
+
+# Number of commits in each layer of the split-commit graph before merge:
+#
+# 16 commits (No GDAT)
+# ------------------------
+# 15 commits (No GDAT)
+# ------------------------
+# 16 commits (No GDAT)
+# ------------------------
+# 64 commits (GDAT)
+#
+# The top three layers are merged and has generation data chunk as the topmost remaining layer
+# has generation data chunk.
+#
+# 47 commits (GDAT)
+# ------------------------
+# 64 commits (GDAT)
+#
+test_expect_success 'write generation data chunk if topmost remaining layer has generation data chunk' '
+ git clone mixed-merge-no-gdat mixed-merge-gdat &&
+ (
+ cd mixed-merge-gdat &&
+ for i in $(test_seq $FIFTH_LAYER_SEQUENCE_START $FIFTH_LAYER_SEQUENCE_END)
+ do
+ test_commit $i &&
+ git branch commits/$i || return 1
+ done &&
+ git commit-graph write --reachable --split --size-multiple 1 &&
+ test_line_count = 2 $graphdir/commit-graph-chain &&
+ test-tool read-graph >output &&
+ cat >expect <<-EOF &&
+ header: 43475048 1 $(test_oid oid_version) 5 1
+ num_commits: $(($NUM_SECOND_LAYER_COMMITS + $NUM_THIRD_LAYER_COMMITS + $NUM_FOURTH_LAYER_COMMITS + $NUM_FIFTH_LAYER_COMMITS))
+ chunks: oid_fanout oid_lookup commit_metadata generation_data
+ EOF
+ test_cmp expect output
+ )
+'
+
+test_expect_success 'write generation data chunk when commit-graph chain is replaced' '
+ git clone mixed mixed-replace &&
+ (
+ cd mixed-replace &&
+ git commit-graph write --reachable --split=replace &&
+ test_path_is_file $graphdir/commit-graph-chain &&
+ test_line_count = 1 $graphdir/commit-graph-chain &&
+ verify_chain_files_exist $graphdir &&
+ graph_read_expect $(($NUM_FIRST_LAYER_COMMITS + $NUM_SECOND_LAYER_COMMITS)) &&
+ git commit-graph verify
+ )
+'
+
test_done
diff --git a/t/t5325-reverse-index.sh b/t/t5325-reverse-index.sh
new file mode 100755
index 0000000000..da453f68d6
--- /dev/null
+++ b/t/t5325-reverse-index.sh
@@ -0,0 +1,120 @@
+#!/bin/sh
+
+test_description='on-disk reverse index'
+. ./test-lib.sh
+
+# The below tests want control over the 'pack.writeReverseIndex' setting
+# themselves to assert various combinations of it with other options.
+sane_unset GIT_TEST_WRITE_REV_INDEX
+
+packdir=.git/objects/pack
+
+test_expect_success 'setup' '
+ test_commit base &&
+
+ pack=$(git pack-objects --all $packdir/pack) &&
+ rev=$packdir/pack-$pack.rev &&
+
+ test_path_is_missing $rev
+'
+
+test_index_pack () {
+ rm -f $rev &&
+ conf=$1 &&
+ shift &&
+ # remove the index since Windows won't overwrite an existing file
+ rm $packdir/pack-$pack.idx &&
+ git -c pack.writeReverseIndex=$conf index-pack "$@" \
+ $packdir/pack-$pack.pack
+}
+
+test_expect_success 'index-pack with pack.writeReverseIndex' '
+ test_index_pack "" &&
+ test_path_is_missing $rev &&
+
+ test_index_pack false &&
+ test_path_is_missing $rev &&
+
+ test_index_pack true &&
+ test_path_is_file $rev
+'
+
+test_expect_success 'index-pack with --[no-]rev-index' '
+ for conf in "" true false
+ do
+ test_index_pack "$conf" --rev-index &&
+ test_path_exists $rev &&
+
+ test_index_pack "$conf" --no-rev-index &&
+ test_path_is_missing $rev
+ done
+'
+
+test_expect_success 'index-pack can verify reverse indexes' '
+ test_when_finished "rm -f $rev" &&
+ test_index_pack true &&
+
+ test_path_is_file $rev &&
+ git index-pack --rev-index --verify $packdir/pack-$pack.pack &&
+
+ # Intentionally corrupt the reverse index.
+ chmod u+w $rev &&
+ printf "xxxx" | dd of=$rev bs=1 count=4 conv=notrunc &&
+
+ test_must_fail git index-pack --rev-index --verify \
+ $packdir/pack-$pack.pack 2>err &&
+ grep "validation error" err
+'
+
+test_expect_success 'index-pack infers reverse index name with -o' '
+ git index-pack --rev-index -o other.idx $packdir/pack-$pack.pack &&
+ test_path_is_file other.idx &&
+ test_path_is_file other.rev
+'
+
+test_expect_success 'pack-objects respects pack.writeReverseIndex' '
+ test_when_finished "rm -fr pack-1-*" &&
+
+ git -c pack.writeReverseIndex= pack-objects --all pack-1 &&
+ test_path_is_missing pack-1-*.rev &&
+
+ git -c pack.writeReverseIndex=false pack-objects --all pack-1 &&
+ test_path_is_missing pack-1-*.rev &&
+
+ git -c pack.writeReverseIndex=true pack-objects --all pack-1 &&
+ test_path_is_file pack-1-*.rev
+'
+
+test_expect_success 'reverse index is not generated when available on disk' '
+ test_index_pack true &&
+ test_path_is_file $rev &&
+
+ git rev-parse HEAD >tip &&
+ GIT_TEST_REV_INDEX_DIE_IN_MEMORY=1 git cat-file \
+ --batch-check="%(objectsize:disk)" <tip
+'
+
+test_expect_success 'revindex in-memory vs on-disk' '
+ git init repo &&
+ test_when_finished "rm -fr repo" &&
+ (
+ cd repo &&
+
+ test_commit commit &&
+
+ git rev-list --objects --no-object-names --all >objects &&
+
+ git -c pack.writeReverseIndex=false repack -ad &&
+ test_path_is_missing $packdir/pack-*.rev &&
+ git cat-file --batch-check="%(objectsize:disk) %(objectname)" \
+ <objects >in-core &&
+
+ git -c pack.writeReverseIndex=true repack -ad &&
+ test_path_is_file $packdir/pack-*.rev &&
+ git cat-file --batch-check="%(objectsize:disk) %(objectname)" \
+ <objects >on-disk &&
+
+ test_cmp on-disk in-core
+ )
+'
+test_done
diff --git a/t/t5411/common-functions.sh b/t/t5411/common-functions.sh
index 344d13f61a..6694858e18 100644
--- a/t/t5411/common-functions.sh
+++ b/t/t5411/common-functions.sh
@@ -36,9 +36,8 @@ create_commits_in () {
# without having to worry about future changes of the commit ID and spaces
# of the output. Single quotes are replaced with double quotes, because
# it is boring to prepare unquoted single quotes in expect text. We also
-# remove some locale error messages, which break test if we turn on
-# `GIT_TEST_GETTEXT_POISON=true` in order to test unintentional translations
-# on plumbing commands.
+# remove some locale error messages. The emitted human-readable errors are
+# redundant to the more machine-readable output the tests already assert.
make_user_friendly_and_stable_output () {
sed \
-e "s/ *\$//" \
@@ -59,3 +58,18 @@ filter_out_user_friendly_and_stable_output () {
make_user_friendly_and_stable_output |
sed -n ${1+"$@"}
}
+
+test_cmp_refs () {
+ indir=
+ if test "$1" = "-C"
+ then
+ shift
+ indir="$1"
+ shift
+ fi
+ indir=${indir:+"$indir"/}
+ cat >show-ref.expect &&
+ git ${indir:+ -C "$indir"} show-ref >show-ref.pristine &&
+ make_user_friendly_and_stable_output <show-ref.pristine >show-ref.filtered &&
+ test_cmp show-ref.expect show-ref.filtered
+}
diff --git a/t/t5411/once-0010-report-status-v1.sh b/t/t5411/once-0010-report-status-v1.sh
index cb431a9c91..1233a46eac 100644
--- a/t/t5411/once-0010-report-status-v1.sh
+++ b/t/t5411/once-0010-report-status-v1.sh
@@ -83,12 +83,9 @@ test_expect_success "proc-receive: report status v1" '
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/for/main/topic1
<COMMIT-A> refs/heads/foo
<COMMIT-B> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0000-standard-git-push.sh b/t/t5411/test-0000-standard-git-push.sh
index 47b058af7e..e1e0175c12 100644
--- a/t/t5411/test-0000-standard-git-push.sh
+++ b/t/t5411/test-0000-standard-git-push.sh
@@ -19,13 +19,11 @@ test_expect_success "git-push ($PROTOCOL)" '
* [new branch] HEAD -> next
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) next(A)
@@ -35,24 +33,22 @@ test_expect_success "git-push --atomic ($PROTOCOL)" '
test_must_fail git -C workbench push --atomic origin \
main \
$B:refs/heads/next \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; }" \
-e "/^ ! / { p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! [rejected] main -> main (non-fast-forward)
! [rejected] <COMMIT-B> -> next (atomic push failed)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) next(A)
@@ -65,8 +61,8 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL)" '
push origin \
main \
$B:refs/heads/next \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next
@@ -77,13 +73,11 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL)" '
! [rejected] main -> main (non-fast-forward)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
<COMMIT-B> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) next(B)
@@ -119,15 +113,13 @@ test_expect_success "git-push -f ($PROTOCOL)" '
* [new branch] HEAD -> a/b/c
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/a/b/c
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/review/main/topic
<TAG-v123> refs/tags/v123
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) tags/v123 refs/review/main/topic(A) a/b/c(A)
diff --git a/t/t5411/test-0001-standard-git-push--porcelain.sh b/t/t5411/test-0001-standard-git-push--porcelain.sh
index bbead12bbb..bcbda72341 100644
--- a/t/t5411/test-0001-standard-git-push--porcelain.sh
+++ b/t/t5411/test-0001-standard-git-push--porcelain.sh
@@ -20,13 +20,11 @@ test_expect_success "git-push ($PROTOCOL/porcelain)" '
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) next(A)
@@ -36,25 +34,23 @@ test_expect_success "git-push --atomic ($PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --atomic --porcelain origin \
main \
$B:refs/heads/next \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "s/^# GETTEXT POISON #//" \
-e "/^To / { p; }" \
-e "/^! / { p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! refs/heads/main:refs/heads/main [rejected] (non-fast-forward)
! <COMMIT-B>:refs/heads/next [rejected] (atomic push failed)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) next(A)
@@ -67,8 +63,8 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL/porcelain)" '
push --porcelain origin \
main \
$B:refs/heads/next \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next
@@ -80,13 +76,11 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL/porcelain)" '
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
<COMMIT-B> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) next(B)
@@ -123,15 +117,13 @@ test_expect_success "git-push -f ($PROTOCOL/porcelain)" '
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/a/b/c
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/review/main/topic
<TAG-v123> refs/tags/v123
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) tags/v123 refs/review/main/topic(A) a/b/c(A)
diff --git a/t/t5411/test-0002-pre-receive-declined.sh b/t/t5411/test-0002-pre-receive-declined.sh
index e7d113a158..0c3490c9b1 100644
--- a/t/t5411/test-0002-pre-receive-declined.sh
+++ b/t/t5411/test-0002-pre-receive-declined.sh
@@ -12,20 +12,18 @@ test_expect_success "git-push is declined ($PROTOCOL)" '
test_must_fail git -C workbench push origin \
$B:refs/heads/main \
HEAD:refs/heads/next \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! [remote rejected] <COMMIT-B> -> main (pre-receive hook declined)
! [remote rejected] HEAD -> next (pre-receive hook declined)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "cleanup ($PROTOCOL)" '
diff --git a/t/t5411/test-0003-pre-receive-declined--porcelain.sh b/t/t5411/test-0003-pre-receive-declined--porcelain.sh
index cc0cca6a47..e9c9db5d1f 100644
--- a/t/t5411/test-0003-pre-receive-declined--porcelain.sh
+++ b/t/t5411/test-0003-pre-receive-declined--porcelain.sh
@@ -12,8 +12,8 @@ test_expect_success "git-push is declined ($PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
$B:refs/heads/main \
HEAD:refs/heads/next \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! <COMMIT-B>:refs/heads/main [remote rejected] (pre-receive hook declined)
@@ -21,12 +21,10 @@ test_expect_success "git-push is declined ($PROTOCOL/porcelain)" '
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "cleanup ($PROTOCOL/porcelain)" '
diff --git a/t/t5411/test-0011-no-hook-error.sh b/t/t5411/test-0011-no-hook-error.sh
index c50830982f..3ef136e6ef 100644
--- a/t/t5411/test-0011-no-hook-error.sh
+++ b/t/t5411/test-0011-no-hook-error.sh
@@ -5,8 +5,8 @@ test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL)
test_must_fail git -C workbench push origin \
HEAD:next \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
@@ -19,13 +19,11 @@ test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL)
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) next(A)
@@ -41,8 +39,8 @@ test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCO
test_must_fail git -C workbench push --atomic origin \
$B:main \
HEAD:next \
- HEAD:refs/for/main/topic >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
@@ -55,10 +53,8 @@ test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCO
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0012-no-hook-error--porcelain.sh b/t/t5411/test-0012-no-hook-error--porcelain.sh
index 14ea433481..19f66fbd7d 100644
--- a/t/t5411/test-0012-no-hook-error--porcelain.sh
+++ b/t/t5411/test-0012-no-hook-error--porcelain.sh
@@ -5,8 +5,8 @@ test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL/
test_must_fail git -C workbench push --porcelain origin \
HEAD:next \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
@@ -20,13 +20,11 @@ test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL/
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) next(A)
@@ -42,8 +40,8 @@ test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCO
test_must_fail git -C workbench push --porcelain --atomic origin \
$B:main \
HEAD:next \
- HEAD:refs/for/main/topic >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
@@ -57,10 +55,8 @@ test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCO
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0013-bad-protocol.sh b/t/t5411/test-0013-bad-protocol.sh
index b9be12be77..095e613f6f 100644
--- a/t/t5411/test-0013-bad-protocol.sh
+++ b/t/t5411/test-0013-bad-protocol.sh
@@ -11,8 +11,8 @@ test_expect_success "setup proc-receive hook (unknown version, $PROTOCOL)" '
test_expect_success "proc-receive: bad protocol (unknown version, $PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
# Check status report for git-push
sed -n \
@@ -34,12 +34,9 @@ test_expect_success "proc-receive: bad protocol (unknown version, $PROTOCOL)" '
EOF
test_cmp expect actual-error &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (hook --die-read-version, $PROTOCOL)" '
@@ -55,25 +52,22 @@ test_expect_success "setup proc-receive hook (hook --die-read-version, $PROTOCOL
test_expect_success "proc-receive: bad protocol (hook --die-read-version, $PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; }" \
-e "/^ ! / { p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
EOF
test_cmp expect actual &&
- grep "remote: fatal: die with the --die-read-version option" out &&
- grep "remote: error: fail to negotiate version with proc-receive hook" out &&
+ grep "remote: fatal: die with the --die-read-version option" out-$test_count &&
+ grep "remote: error: fail to negotiate version with proc-receive hook" out-$test_count &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (hook --die-write-version, $PROTOCOL)" '
@@ -89,25 +83,22 @@ test_expect_success "setup proc-receive hook (hook --die-write-version, $PROTOCO
test_expect_success "proc-receive: bad protocol (hook --die-write-version, $PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; }" \
-e "/^ ! / { p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
EOF
test_cmp expect actual &&
- grep "remote: fatal: die with the --die-write-version option" out &&
- grep "remote: error: fail to negotiate version with proc-receive hook" out &&
+ grep "remote: fatal: die with the --die-write-version option" out-$test_count &&
+ grep "remote: error: fail to negotiate version with proc-receive hook" out-$test_count &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (hook --die-read-commands, $PROTOCOL)" '
@@ -123,24 +114,21 @@ test_expect_success "setup proc-receive hook (hook --die-read-commands, $PROTOCO
test_expect_success "proc-receive: bad protocol (hook --die-read-commands, $PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; }" \
-e "/^ ! / { p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
EOF
test_cmp expect actual &&
- grep "remote: fatal: die with the --die-read-commands option" out &&
+ grep "remote: fatal: die with the --die-read-commands option" out-$test_count &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (hook --die-read-push-options, $PROTOCOL)" '
@@ -158,24 +146,21 @@ test_expect_success "proc-receive: bad protocol (hook --die-read-push-options, $
test_must_fail git -C workbench push origin \
-o reviewers=user1,user2 \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; }" \
-e "/^ ! / { p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
EOF
test_cmp expect actual &&
- grep "remote: fatal: die with the --die-read-push-options option" out &&
+ grep "remote: fatal: die with the --die-read-push-options option" out-$test_count &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (hook --die-write-report, $PROTOCOL)" '
@@ -191,24 +176,21 @@ test_expect_success "setup proc-receive hook (hook --die-write-report, $PROTOCOL
test_expect_success "proc-receive: bad protocol (hook --die-write-report, $PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; }" \
-e "/^ ! / { p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
EOF
test_cmp expect actual &&
- grep "remote: fatal: die with the --die-write-report option" out &&
+ grep "remote: fatal: die with the --die-write-report option" out-$test_count &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (no report, $PROTOCOL)" '
@@ -224,8 +206,8 @@ test_expect_success "setup proc-receive hook (no report, $PROTOCOL)" '
test_expect_success "proc-receive: bad protocol (no report, $PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/heads/next \
- HEAD:refs/for/main/topic >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
@@ -240,13 +222,10 @@ test_expect_success "proc-receive: bad protocol (no report, $PROTOCOL)" '
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) next(A)
@@ -270,8 +249,8 @@ test_expect_success "setup proc-receive hook (no ref, $PROTOCOL)" '
test_expect_success "proc-receive: bad protocol (no ref, $PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/main/topic\
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
@@ -284,12 +263,9 @@ test_expect_success "proc-receive: bad protocol (no ref, $PROTOCOL)" '
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (unknown status, $PROTOCOL)" '
@@ -306,8 +282,8 @@ test_expect_success "setup proc-receive hook (unknown status, $PROTOCOL)" '
test_expect_success "proc-receive: bad protocol (unknown status, $PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
@@ -320,10 +296,7 @@ test_expect_success "proc-receive: bad protocol (unknown status, $PROTOCOL)" '
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0014-bad-protocol--porcelain.sh b/t/t5411/test-0014-bad-protocol--porcelain.sh
index fdb4569109..a44649789c 100644
--- a/t/t5411/test-0014-bad-protocol--porcelain.sh
+++ b/t/t5411/test-0014-bad-protocol--porcelain.sh
@@ -11,8 +11,8 @@ test_expect_success "setup proc-receive hook (unknown version, $PROTOCOL/porcela
test_expect_success "proc-receive: bad protocol (unknown version, $PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
# Check status report for git-push
sed -n \
@@ -34,12 +34,9 @@ test_expect_success "proc-receive: bad protocol (unknown version, $PROTOCOL/porc
EOF
test_cmp expect actual-error &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (hook --die-read-version, $PROTOCOL/porcelain)" '
@@ -55,25 +52,22 @@ test_expect_success "setup proc-receive hook (hook --die-read-version, $PROTOCOL
test_expect_success "proc-receive: bad protocol (hook --die-read-version, $PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; n; p; n; p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
Done
EOF
test_cmp expect actual &&
- grep "remote: fatal: die with the --die-read-version option" out &&
- grep "remote: error: fail to negotiate version with proc-receive hook" out &&
+ grep "remote: fatal: die with the --die-read-version option" out-$test_count &&
+ grep "remote: error: fail to negotiate version with proc-receive hook" out-$test_count &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (hook --die-write-version, $PROTOCOL/porcelain)" '
@@ -89,25 +83,22 @@ test_expect_success "setup proc-receive hook (hook --die-write-version, $PROTOCO
test_expect_success "proc-receive: bad protocol (hook --die-write-version, $PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; n; p; n; p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
Done
EOF
test_cmp expect actual &&
- grep "remote: fatal: die with the --die-write-version option" out &&
- grep "remote: error: fail to negotiate version with proc-receive hook" out &&
+ grep "remote: fatal: die with the --die-write-version option" out-$test_count &&
+ grep "remote: error: fail to negotiate version with proc-receive hook" out-$test_count &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (hook --die-read-commands, $PROTOCOL/porcelain)" '
@@ -123,24 +114,21 @@ test_expect_success "setup proc-receive hook (hook --die-read-commands, $PROTOCO
test_expect_success "proc-receive: bad protocol (hook --die-read-commands, $PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; n; p; n; p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
Done
EOF
test_cmp expect actual &&
- grep "remote: fatal: die with the --die-read-commands option" out &&
+ grep "remote: fatal: die with the --die-read-commands option" out-$test_count &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (hook --die-read-push-options, $PROTOCOL/porcelain)" '
@@ -158,24 +146,21 @@ test_expect_success "proc-receive: bad protocol (hook --die-read-push-options, $
test_must_fail git -C workbench push --porcelain origin \
-o reviewers=user1,user2 \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; n; p; n; p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
Done
EOF
test_cmp expect actual &&
- grep "remote: fatal: die with the --die-read-push-options option" out &&
+ grep "remote: fatal: die with the --die-read-push-options option" out-$test_count &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (hook --die-write-report, $PROTOCOL/porcelain)" '
@@ -191,24 +176,21 @@ test_expect_success "setup proc-receive hook (hook --die-write-report, $PROTOCOL
test_expect_success "proc-receive: bad protocol (hook --die-write-report, $PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
+ >out-$test_count 2>&1 &&
filter_out_user_friendly_and_stable_output \
-e "/^To / { p; n; p; n; p; }" \
- <out >actual &&
+ <out-$test_count >actual &&
cat >expect <<-EOF &&
To <URL/of/upstream.git>
! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
Done
EOF
test_cmp expect actual &&
- grep "remote: fatal: die with the --die-write-report option" out &&
+ grep "remote: fatal: die with the --die-write-report option" out-$test_count &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (no report, $PROTOCOL/porcelain)" '
@@ -224,8 +206,8 @@ test_expect_success "setup proc-receive hook (no report, $PROTOCOL/porcelain)" '
test_expect_success "proc-receive: bad protocol (no report, $PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/heads/next \
- HEAD:refs/for/main/topic >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
@@ -241,13 +223,10 @@ test_expect_success "proc-receive: bad protocol (no report, $PROTOCOL/porcelain)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) next(A)
@@ -270,8 +249,8 @@ test_expect_success "setup proc-receive hook (no ref, $PROTOCOL/porcelain)" '
test_expect_success "proc-receive: bad protocol (no ref, $PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/main/topic\
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
@@ -285,12 +264,9 @@ test_expect_success "proc-receive: bad protocol (no ref, $PROTOCOL/porcelain)" '
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (unknown status, $PROTOCOL/porcelain)" '
@@ -307,8 +283,8 @@ test_expect_success "setup proc-receive hook (unknown status, $PROTOCOL/porcelai
test_expect_success "proc-receive: bad protocol (unknown status, $PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
@@ -322,10 +298,7 @@ test_expect_success "proc-receive: bad protocol (unknown status, $PROTOCOL/porce
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0020-report-ng.sh b/t/t5411/test-0020-report-ng.sh
index 5a9e0daf2d..ad2c8f6535 100644
--- a/t/t5411/test-0020-report-ng.sh
+++ b/t/t5411/test-0020-report-ng.sh
@@ -12,8 +12,8 @@ test_expect_success "setup proc-receive hook (ng, no message, $PROTOCOL)" '
test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
@@ -24,12 +24,10 @@ test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL)" '
! [remote rejected] HEAD -> refs/for/main/topic (failed)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (ng message, $PROTOCOL)" '
@@ -46,8 +44,8 @@ test_expect_success "setup proc-receive hook (ng message, $PROTOCOL)" '
test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
@@ -58,10 +56,8 @@ test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL)"
! [remote rejected] HEAD -> refs/for/main/topic (error msg)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0021-report-ng--porcelain.sh b/t/t5411/test-0021-report-ng--porcelain.sh
index 93475a83cf..d8ae9d3414 100644
--- a/t/t5411/test-0021-report-ng--porcelain.sh
+++ b/t/t5411/test-0021-report-ng--porcelain.sh
@@ -12,8 +12,8 @@ test_expect_success "setup proc-receive hook (ng, no message, $PROTOCOL/porcelai
test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
@@ -25,12 +25,10 @@ test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL/por
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (ng message, $PROTOCOL/porcelain)" '
@@ -47,8 +45,8 @@ test_expect_success "setup proc-receive hook (ng message, $PROTOCOL/porcelain)"
test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
@@ -60,10 +58,8 @@ test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL/p
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0022-report-unexpect-ref.sh b/t/t5411/test-0022-report-unexpect-ref.sh
index f8be8a0ba1..dbed467186 100644
--- a/t/t5411/test-0022-report-unexpect-ref.sh
+++ b/t/t5411/test-0022-report-unexpect-ref.sh
@@ -13,8 +13,8 @@ test_expect_success "proc-receive: report unexpected ref ($PROTOCOL)" '
test_must_fail git -C workbench push origin \
$B:refs/heads/main \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
@@ -30,12 +30,10 @@ test_expect_success "proc-receive: report unexpected ref ($PROTOCOL)" '
! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B)
diff --git a/t/t5411/test-0023-report-unexpect-ref--porcelain.sh b/t/t5411/test-0023-report-unexpect-ref--porcelain.sh
index 778150fa03..e89096fa13 100644
--- a/t/t5411/test-0023-report-unexpect-ref--porcelain.sh
+++ b/t/t5411/test-0023-report-unexpect-ref--porcelain.sh
@@ -13,8 +13,8 @@ test_expect_success "proc-receive: report unexpected ref ($PROTOCOL/porcelain)"
test_must_fail git -C workbench push --porcelain origin \
$B:refs/heads/main \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
@@ -31,12 +31,10 @@ test_expect_success "proc-receive: report unexpected ref ($PROTOCOL/porcelain)"
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B)
diff --git a/t/t5411/test-0024-report-unknown-ref.sh b/t/t5411/test-0024-report-unknown-ref.sh
index d4e74e4681..77204244b8 100644
--- a/t/t5411/test-0024-report-unknown-ref.sh
+++ b/t/t5411/test-0024-report-unknown-ref.sh
@@ -12,8 +12,8 @@ test_expect_success "setup proc-receive hook (unexpected ref, $PROTOCOL)" '
test_expect_success "proc-receive: report unknown reference ($PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/a/b/c/my/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic
@@ -25,10 +25,8 @@ test_expect_success "proc-receive: report unknown reference ($PROTOCOL)" '
! [remote rejected] HEAD -> refs/for/a/b/c/my/topic (proc-receive failed to report status)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0025-report-unknown-ref--porcelain.sh b/t/t5411/test-0025-report-unknown-ref--porcelain.sh
index 039e8b6163..eeb1ce6b2c 100644
--- a/t/t5411/test-0025-report-unknown-ref--porcelain.sh
+++ b/t/t5411/test-0025-report-unknown-ref--porcelain.sh
@@ -12,8 +12,8 @@ test_expect_success "setup proc-receive hook (unexpected ref, $PROTOCOL/porcelai
test_expect_success "proc-receive: report unknown reference ($PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/a/b/c/my/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic
@@ -26,10 +26,8 @@ test_expect_success "proc-receive: report unknown reference ($PROTOCOL/porcelain
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0026-push-options.sh b/t/t5411/test-0026-push-options.sh
index e88edb16a4..1ec2cb95bc 100644
--- a/t/t5411/test-0026-push-options.sh
+++ b/t/t5411/test-0026-push-options.sh
@@ -16,16 +16,14 @@ test_expect_success "proc-receive: not support push options ($PROTOCOL)" '
-o reviewer=user1 \
origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
test_i18ngrep "fatal: the receiving end does not support push options" \
actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "enable push options ($PROTOCOL)" '
@@ -69,13 +67,11 @@ test_expect_success "proc-receive: ignore push-options for version 0 ($PROTOCOL)
* [new reference] HEAD -> refs/for/main/topic
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
test_expect_success "restore proc-receive hook ($PROTOCOL)" '
@@ -123,13 +119,11 @@ test_expect_success "proc-receive: push with options ($PROTOCOL)" '
* [new reference] HEAD -> refs/for/main/topic
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) next(A)
diff --git a/t/t5411/test-0027-push-options--porcelain.sh b/t/t5411/test-0027-push-options--porcelain.sh
index 3a6561b5ea..447fbfec0c 100644
--- a/t/t5411/test-0027-push-options--porcelain.sh
+++ b/t/t5411/test-0027-push-options--porcelain.sh
@@ -17,16 +17,14 @@ test_expect_success "proc-receive: not support push options ($PROTOCOL/porcelain
-o reviewer=user1 \
origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
test_i18ngrep "fatal: the receiving end does not support push options" \
actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "enable push options ($PROTOCOL/porcelain)" '
@@ -72,13 +70,11 @@ test_expect_success "proc-receive: ignore push-options for version 0 ($PROTOCOL/
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
test_expect_success "restore proc-receive hook ($PROTOCOL/porcelain)" '
@@ -128,13 +124,11 @@ test_expect_success "proc-receive: push with options ($PROTOCOL/porcelain)" '
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) next(A)
diff --git a/t/t5411/test-0030-report-ok.sh b/t/t5411/test-0030-report-ok.sh
index 5d6feef118..8acb4f204f 100644
--- a/t/t5411/test-0030-report-ok.sh
+++ b/t/t5411/test-0030-report-ok.sh
@@ -26,10 +26,8 @@ test_expect_success "proc-receive: ok ($PROTOCOL)" '
* [new reference] HEAD -> refs/for/main/topic
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0031-report-ok--porcelain.sh b/t/t5411/test-0031-report-ok--porcelain.sh
index 91666d32df..a967718046 100644
--- a/t/t5411/test-0031-report-ok--porcelain.sh
+++ b/t/t5411/test-0031-report-ok--porcelain.sh
@@ -27,10 +27,8 @@ test_expect_success "proc-receive: ok ($PROTOCOL/porcelain)" '
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0032-report-with-options.sh b/t/t5411/test-0032-report-with-options.sh
index a0faf5c7ff..437ade012d 100644
--- a/t/t5411/test-0032-report-with-options.sh
+++ b/t/t5411/test-0032-report-with-options.sh
@@ -13,8 +13,8 @@ test_expect_success "setup proc-receive hook (option without matching ok, $PROTO
test_expect_success "proc-receive: report option without matching ok ($PROTOCOL)" '
test_must_fail git -C workbench push origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
@@ -247,10 +247,7 @@ test_expect_success "proc-receive: report with multiple rewrites ($PROTOCOL)" '
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0033-report-with-options--porcelain.sh b/t/t5411/test-0033-report-with-options--porcelain.sh
index 32ae26bcfb..11486720ee 100644
--- a/t/t5411/test-0033-report-with-options--porcelain.sh
+++ b/t/t5411/test-0033-report-with-options--porcelain.sh
@@ -13,8 +13,8 @@ test_expect_success "setup proc-receive hook (option without matching ok, $PROTO
test_expect_success "proc-receive: report option without matching ok ($PROTOCOL/porcelain)" '
test_must_fail git -C workbench push --porcelain origin \
HEAD:refs/for/main/topic \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
@@ -256,10 +256,7 @@ test_expect_success "proc-receive: report with multiple rewrites ($PROTOCOL/porc
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0034-report-ft.sh b/t/t5411/test-0034-report-ft.sh
index c355c290d2..6e0d08b327 100644
--- a/t/t5411/test-0034-report-ft.sh
+++ b/t/t5411/test-0034-report-ft.sh
@@ -28,13 +28,11 @@ test_expect_success "proc-receive: fall throught, let receive-pack to execute ($
* [new reference] <COMMIT-B> -> refs/for/main/topic
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/for/main/topic
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) refs/for/main/topic(A)
diff --git a/t/t5411/test-0035-report-ft--porcelain.sh b/t/t5411/test-0035-report-ft--porcelain.sh
index 8ce4e58f2a..81bae9f2ec 100644
--- a/t/t5411/test-0035-report-ft--porcelain.sh
+++ b/t/t5411/test-0035-report-ft--porcelain.sh
@@ -29,13 +29,11 @@ test_expect_success "proc-receive: fall throught, let receive-pack to execute ($
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/for/main/topic
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) refs/for/main/topic(A)
diff --git a/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh b/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh
index fad8eea8a0..be9b18b2b6 100644
--- a/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh
+++ b/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh
@@ -65,12 +65,10 @@ test_expect_success "proc-receive: multiple rewrite for one ref, no refname for
<OID-A>..<OID-B> HEAD -> refs/changes/25/125/1
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "proc-receive: check remote-tracking #1 ($PROTOCOL)" '
@@ -142,12 +140,10 @@ test_expect_success "proc-receive: multiple rewrites for one ref, no refname for
+ <OID-B>...<OID-A> HEAD -> refs/changes/25/125/1 (forced update)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "proc-receive: check remote-tracking #2 ($PROTOCOL)" '
@@ -205,12 +201,10 @@ test_expect_success "proc-receive: multiple rewrites for one ref ($PROTOCOL)" '
<OID-A>..<OID-B> HEAD -> refs/changes/24/124/2
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "proc-receive: check remote-tracking #3 ($PROTOCOL)" '
diff --git a/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh b/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh
index dc254d57eb..95fb89c031 100644
--- a/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh
+++ b/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh
@@ -51,12 +51,10 @@ test_expect_success "proc-receive: multiple rewrite for one ref, no refname for
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, no refname for the 2nd rewrite, $PROTOCOL/porcelain)" '
@@ -114,12 +112,10 @@ test_expect_success "proc-receive: multiple rewrites for one ref, no refname for
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, $PROTOCOL/porcelain)" '
@@ -163,10 +159,8 @@ test_expect_success "proc-receive: multiple rewrites for one ref ($PROTOCOL/porc
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
diff --git a/t/t5411/test-0038-report-mixed-refs.sh b/t/t5411/test-0038-report-mixed-refs.sh
index 0d071ebaa6..5e005299cc 100644
--- a/t/t5411/test-0038-report-mixed-refs.sh
+++ b/t/t5411/test-0038-report-mixed-refs.sh
@@ -24,8 +24,8 @@ test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL)" '
HEAD:refs/heads/foo \
HEAD:refs/for/main/topic \
HEAD:refs/for/next/topic3 \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
@@ -65,15 +65,13 @@ test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL)" '
! [remote rejected] HEAD -> refs/for/next/topic3 (proc-receive failed to report status)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/bar
<COMMIT-A> refs/heads/baz
<COMMIT-A> refs/heads/foo
<COMMIT-B> refs/heads/main
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) foo(A) bar(A)) baz(A)
diff --git a/t/t5411/test-0039-report-mixed-refs--porcelain.sh b/t/t5411/test-0039-report-mixed-refs--porcelain.sh
index d8409912fd..8f891c5385 100644
--- a/t/t5411/test-0039-report-mixed-refs--porcelain.sh
+++ b/t/t5411/test-0039-report-mixed-refs--porcelain.sh
@@ -24,8 +24,8 @@ test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL/porcel
HEAD:refs/heads/foo \
HEAD:refs/for/main/topic \
HEAD:refs/for/next/topic3 \
- >out 2>&1 &&
- make_user_friendly_and_stable_output <out >actual &&
+ >out-$test_count 2>&1 &&
+ make_user_friendly_and_stable_output <out-$test_count >actual &&
cat >expect <<-EOF &&
remote: # pre-receive hook
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
@@ -66,15 +66,13 @@ test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL/porcel
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/bar
<COMMIT-A> refs/heads/baz
<COMMIT-A> refs/heads/foo
<COMMIT-B> refs/heads/main
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) foo(A) bar(A)) baz(A)
diff --git a/t/t5411/test-0040-process-all-refs.sh b/t/t5411/test-0040-process-all-refs.sh
index 2565302a17..fdcdcc7c2e 100644
--- a/t/t5411/test-0040-process-all-refs.sh
+++ b/t/t5411/test-0040-process-all-refs.sh
@@ -92,14 +92,12 @@ test_expect_success "proc-receive: process all refs ($PROTOCOL)" '
+ <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/bar
<COMMIT-A> refs/heads/baz
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) bar(A) baz(B)
diff --git a/t/t5411/test-0041-process-all-refs--porcelain.sh b/t/t5411/test-0041-process-all-refs--porcelain.sh
index e21420b60d..73b35fe0aa 100644
--- a/t/t5411/test-0041-process-all-refs--porcelain.sh
+++ b/t/t5411/test-0041-process-all-refs--porcelain.sh
@@ -93,14 +93,12 @@ test_expect_success "proc-receive: process all refs ($PROTOCOL/porcelain)" '
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/bar
<COMMIT-A> refs/heads/baz
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) bar(A) baz(B)
diff --git a/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh b/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh
index 2e29518ec5..7214647ada 100644
--- a/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh
+++ b/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh
@@ -50,12 +50,10 @@ test_expect_success "proc-receive: update branch and new tag ($PROTOCOL)" '
* [new reference] v123 -> refs/pull/124/head
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A)
@@ -63,14 +61,12 @@ test_expect_success "proc-receive: update branch and new tag ($PROTOCOL)" '
test_expect_success "setup upstream: create tags/v123 ($PROTOCOL)" '
git -C "$upstream" update-ref refs/heads/topic $A &&
git -C "$upstream" update-ref refs/tags/v123 $TAG &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/heads/topic
<TAG-v123> refs/tags/v123
EOF
- test_cmp expect actual
'
test_expect_success "setup proc-receive hook ($PROTOCOL)" '
@@ -125,11 +121,9 @@ test_expect_success "proc-receive: create/delete branch, and delete tag ($PROTOC
* [new reference] <COMMIT-A> -> refs/pull/124/head
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/main
<COMMIT-B> refs/heads/topic
EOF
- test_cmp expect actual
'
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 1f4cc873a8..8a5d3492c7 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -547,7 +547,7 @@ test_expect_success 'test lonely missing ref' '
cd client &&
test_must_fail git fetch-pack --no-progress .. refs/heads/xyzzy 2>../error-m
) &&
- test_i18ncmp expect-error error-m
+ test_cmp expect-error error-m
'
test_expect_success 'test missing ref after existing' '
@@ -555,7 +555,7 @@ test_expect_success 'test missing ref after existing' '
cd client &&
test_must_fail git fetch-pack --no-progress .. refs/heads/A refs/heads/xyzzy 2>../error-em
) &&
- test_i18ncmp expect-error error-em
+ test_cmp expect-error error-em
'
test_expect_success 'test missing ref before existing' '
@@ -563,7 +563,7 @@ test_expect_success 'test missing ref before existing' '
cd client &&
test_must_fail git fetch-pack --no-progress .. refs/heads/xyzzy refs/heads/A 2>../error-me
) &&
- test_i18ncmp expect-error error-me
+ test_cmp expect-error error-me
'
test_expect_success 'test --all, --depth, and explicit head' '
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 045398b94e..8c462f20ae 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -59,7 +59,7 @@ test_expect_success 'add remote whose URL agrees with url.<...>.insteadOf' '
git remote add myremote git@host.com:team/repo.git
'
-test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' '
+test_expect_success 'remote information for the origin' '
(
cd test &&
tokens_match origin "$(git remote)" &&
@@ -81,7 +81,7 @@ test_expect_success 'add another remote' '
)
'
-test_expect_success C_LOCALE_OUTPUT 'check remote-tracking' '
+test_expect_success 'check remote-tracking' '
(
cd test &&
check_remote_track origin main side &&
@@ -107,7 +107,7 @@ test_expect_success 'remove remote' '
)
'
-test_expect_success C_LOCALE_OUTPUT 'remove remote' '
+test_expect_success 'remove remote' '
(
cd test &&
tokens_match origin "$(git remote)" &&
@@ -140,8 +140,8 @@ test_expect_success 'remove remote protects local branches' '
git remote rm oops 2>actual2 &&
git branch -d foobranch &&
git tag -d footag &&
- test_i18ncmp expect1 actual1 &&
- test_i18ncmp expect2 actual2
+ test_cmp expect1 actual1 &&
+ test_cmp expect2 actual2
)
'
@@ -150,7 +150,7 @@ test_expect_success 'remove errors out early when deleting non-existent branch'
cd test &&
echo "error: No such remote: '\''foo'\''" >expect &&
test_expect_code 2 git remote rm foo 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
)
'
@@ -178,7 +178,7 @@ test_expect_success 'rename errors out early when deleting non-existent branch'
cd test &&
echo "error: No such remote: '\''foo'\''" >expect &&
test_expect_code 2 git remote rename foo bar 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
)
'
@@ -186,14 +186,14 @@ test_expect_success 'rename errors out early when when new name is invalid' '
test_config remote.foo.vcs bar &&
echo "fatal: '\''invalid...name'\'' is not a valid remote name" >expect &&
test_must_fail git remote rename foo invalid...name 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'add existing foreign_vcs remote' '
test_config remote.foo.vcs bar &&
echo "error: remote foo already exists." >expect &&
test_expect_code 3 git remote add foo bar 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'add existing foreign_vcs remote' '
@@ -201,13 +201,13 @@ test_expect_success 'add existing foreign_vcs remote' '
test_config remote.bar.vcs bar &&
echo "error: remote bar already exists." >expect &&
test_expect_code 3 git remote rename foo bar 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'add invalid foreign_vcs remote' '
echo "fatal: '\''invalid...name'\'' is not a valid remote name" >expect &&
test_must_fail git remote add invalid...name bar 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat >test/expect <<EOF
@@ -267,7 +267,7 @@ test_expect_success 'show' '
git config --add remote.two.push refs/heads/main:refs/heads/another &&
git remote show origin two >output &&
git branch -d rebase octopus &&
- test_i18ncmp expect output
+ test_cmp expect output
)
'
@@ -294,7 +294,7 @@ test_expect_success 'show -n' '
cd test &&
git remote show -n origin >output &&
mv ../one.unreachable ../one &&
- test_i18ncmp expect output
+ test_cmp expect output
)
'
@@ -337,7 +337,7 @@ test_expect_success 'set-head --auto has no problem w/multiple HEADs' '
git fetch two "refs/heads/*:refs/remotes/two/*" &&
git remote set-head --auto two >output 2>&1 &&
echo "two/HEAD set to main" >expect &&
- test_i18ncmp expect output
+ test_cmp expect output
)
'
@@ -369,7 +369,7 @@ test_expect_success 'prune --dry-run' '
git remote prune --dry-run origin >output &&
git rev-parse refs/remotes/origin/side2 &&
test_must_fail git rev-parse refs/remotes/origin/side &&
- test_i18ncmp expect output
+ test_cmp expect output
)
'
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 42f5503004..e83b2a6506 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -9,7 +9,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. "$TEST_DIRECTORY"/test-bundle-functions.sh
+. "$TEST_DIRECTORY"/lib-bundle.sh
D=$(pwd)
@@ -1051,7 +1051,7 @@ test_expect_success 'fetch --prune prints the remotes url' '
git fetch --prune origin 2>&1 | head -n1 >../actual
) &&
echo "From ${D}/." >expect &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'branchname D/F conflict resolved by --prune' '
@@ -1097,7 +1097,7 @@ test_expect_success 'fetching with auto-gc does not lock up' '
)
'
-test_expect_success C_LOCALE_OUTPUT 'fetch aligned output' '
+test_expect_success 'fetch aligned output' '
git clone . full-output &&
test_commit looooooooooooong-tag &&
(
@@ -1112,7 +1112,7 @@ test_expect_success C_LOCALE_OUTPUT 'fetch aligned output' '
test_cmp expect actual
'
-test_expect_success C_LOCALE_OUTPUT 'fetch compact output' '
+test_expect_success 'fetch compact output' '
git clone . compact &&
test_commit extraaa &&
(
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index 4a568a2398..f53f58895a 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -150,7 +150,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
# We could just as easily have used "main"; the "*" emphasizes its
# role as a pattern.
test_must_fail git ls-remote "$does_not_exist" >actual 2>&1 &&
- test_i18ncmp exp actual
+ test_cmp exp actual
'
test_expect_success 'die with non-2 for wrong repository even with --exit-code' '
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 15262b4192..f11742ed59 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -820,6 +820,11 @@ test_expect_success 'push --delete refuses src:dest refspecs' '
test_must_fail git push testrepo --delete main:foo
'
+test_expect_success 'push --delete refuses empty string' '
+ mk_test testrepo heads/master &&
+ test_must_fail git push testrepo --delete ""
+'
+
test_expect_success 'warn on push to HEAD of non-bare repository' '
mk_test testrepo heads/main &&
(
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 11513ec15e..ed11569d8d 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -74,7 +74,7 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
git fetch --recurse-submodules >../actual.out 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
'
test_expect_success "submodule.recurse option triggers recursive fetch" '
@@ -84,7 +84,7 @@ test_expect_success "submodule.recurse option triggers recursive fetch" '
git -c submodule.recurse fetch >../actual.out 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
'
test_expect_success "fetch --recurse-submodules -j2 has the same output behaviour" '
@@ -94,7 +94,7 @@ test_expect_success "fetch --recurse-submodules -j2 has the same output behaviou
GIT_TRACE="$TRASH_DIRECTORY/trace.out" git fetch --recurse-submodules -j2 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err &&
+ test_cmp expect.err actual.err &&
grep "2 tasks" trace.out
'
@@ -124,7 +124,7 @@ test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses i
git fetch >../actual.out 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
'
test_expect_success "--no-recurse-submodules overrides .gitmodules config" '
@@ -155,7 +155,7 @@ test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setti
git config --unset submodule.submodule.fetchRecurseSubmodules
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
'
test_expect_success "--quiet propagates to submodules" '
@@ -183,7 +183,7 @@ test_expect_success "--dry-run propagates to submodules" '
git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
'
test_expect_success "Without --dry-run propagates to submodules" '
@@ -192,7 +192,7 @@ test_expect_success "Without --dry-run propagates to submodules" '
git fetch --recurse-submodules >../actual.out 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
'
test_expect_success "recurseSubmodules=true propagates into submodules" '
@@ -203,7 +203,7 @@ test_expect_success "recurseSubmodules=true propagates into submodules" '
git fetch >../actual.out 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
'
test_expect_success "--recurse-submodules overrides config in submodule" '
@@ -217,7 +217,7 @@ test_expect_success "--recurse-submodules overrides config in submodule" '
git fetch --recurse-submodules >../actual.out 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
'
test_expect_success "--no-recurse-submodules overrides config setting" '
@@ -257,7 +257,7 @@ test_expect_success "Recursion stops when no new submodule commits are fetched"
cd downstream &&
git fetch >../actual.out 2>../actual.err
) &&
- test_i18ncmp expect.err.sub actual.err &&
+ test_cmp expect.err.sub actual.err &&
test_must_be_empty actual.out
'
@@ -275,7 +275,7 @@ test_expect_success "Recursion doesn't happen when new superproject commits don'
git fetch >../actual.out 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err.file actual.err
+ test_cmp expect.err.file actual.err
'
test_expect_success "Recursion picks up config in submodule" '
@@ -303,7 +303,7 @@ test_expect_success "Recursion picks up config in submodule" '
git config --unset fetch.recurseSubmodules
)
) &&
- test_i18ncmp expect.err.sub actual.err &&
+ test_cmp expect.err.sub actual.err &&
test_must_be_empty actual.out
'
@@ -336,7 +336,7 @@ test_expect_success "Recursion picks up all submodules when necessary" '
cd downstream &&
git fetch >../actual.out 2>../actual.err
) &&
- test_i18ncmp expect.err.2 actual.err &&
+ test_cmp expect.err.2 actual.err &&
test_must_be_empty actual.out
'
@@ -392,7 +392,7 @@ test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necess
)
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err
+ test_cmp expect.err actual.err
'
test_expect_success "'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
@@ -409,7 +409,7 @@ test_expect_success "'--recurse-submodules=on-demand' stops when no new submodul
git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err.file actual.err
+ test_cmp expect.err.file actual.err
'
test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config" '
@@ -437,7 +437,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config
git config --unset fetch.recurseSubmodules
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err.2 actual.err
+ test_cmp expect.err.2 actual.err
'
test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
@@ -465,7 +465,7 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
git config --unset submodule.submodule.fetchRecurseSubmodules
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err.2 actual.err
+ test_cmp expect.err.2 actual.err
'
test_expect_success "don't fetch submodule when newly recorded commits are already present" '
@@ -484,7 +484,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
git fetch >../actual.out 2>../actual.err
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err actual.err &&
+ test_cmp expect.err actual.err &&
(
cd submodule &&
git checkout -q sub
@@ -520,7 +520,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
git reset --hard
) &&
test_must_be_empty actual.out &&
- test_i18ncmp expect.err.2 actual.err &&
+ test_cmp expect.err.2 actual.err &&
git checkout HEAD^ -- .gitmodules &&
git add .gitmodules &&
git commit -m "new submodule restored .gitmodules"
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index bc5ccf233f..c024fa2818 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -118,7 +118,7 @@ test_expect_success 'rejected update prints status' '
git commit -m dev2 &&
test_must_fail git push origin dev2 2>act &&
sed -e "/^remote: /s/ *$//" <act >cmp &&
- test_i18ncmp exp cmp
+ test_cmp exp cmp
'
rm -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/hooks/update"
diff --git a/t/t5544-pack-objects-hook.sh b/t/t5544-pack-objects-hook.sh
index 4357af1525..dd5f44d986 100755
--- a/t/t5544-pack-objects-hook.sh
+++ b/t/t5544-pack-objects-hook.sh
@@ -59,4 +59,14 @@ test_expect_success 'hook does not run from repo config' '
test_path_is_missing .git/hook.stdout
'
+test_expect_success 'hook works with partial clone' '
+ clear_hook_results &&
+ test_config_global uploadpack.packObjectsHook ./hook &&
+ test_config_global uploadpack.allowFilter true &&
+ git clone --bare --no-local --filter=blob:none . dst.git &&
+ git -C dst.git rev-list --objects --missing=allow-any --no-object-names --all >objects &&
+ git -C dst.git cat-file --batch-check="%(objecttype)" <objects >types &&
+ ! grep blob types
+'
+
test_done
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index 2ecb06bb63..6d9142afc3 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -227,7 +227,10 @@ test_expect_success 'http-fetch --packfile' '
git init packfileclient &&
p=$(cd "$HTTPD_DOCUMENT_ROOT_PATH"/repo_pack.git && ls objects/pack/pack-*.pack) &&
- git -C packfileclient http-fetch --packfile=$ARBITRARY "$HTTPD_URL"/dumb/repo_pack.git/$p >out &&
+ git -C packfileclient http-fetch --packfile=$ARBITRARY \
+ --index-pack-arg=index-pack --index-pack-arg=--stdin \
+ --index-pack-arg=--keep \
+ "$HTTPD_URL"/dumb/repo_pack.git/$p >out &&
grep "^keep.[0-9a-f]\{16,\}$" out &&
cut -c6- out >packhash &&
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 664c913866..e7e6c08955 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -40,7 +40,7 @@ test_expect_success 'clone with excess parameters (2)' '
'
-test_expect_success C_LOCALE_OUTPUT 'output from clone' '
+test_expect_success 'output from clone' '
rm -fr dst &&
git clone -n "file://$(pwd)/src" dst >output 2>&1 &&
test $(grep Clon output | wc -l) = 1
diff --git a/t/t5604-clone-reference.sh b/t/t5604-clone-reference.sh
index 5d682706ae..e845d621f6 100755
--- a/t/t5604-clone-reference.sh
+++ b/t/t5604-clone-reference.sh
@@ -329,7 +329,7 @@ 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 &&
+ -e "/multi-pack-index/d" -e "/rev/d" <$raw >$raw.de-sha-1 &&
sort $raw.de-sha-1 >$raw.de-sha || return 1
done &&
diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh
index 5d6e63a841..52e5789fb0 100755
--- a/t/t5606-clone-options.sh
+++ b/t/t5606-clone-options.sh
@@ -105,11 +105,13 @@ test_expect_success 'redirected clone -v does show progress' '
'
test_expect_success 'chooses correct default initial branch name' '
- git init --bare empty &&
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=foo init --bare empty &&
+ test_config -C empty lsrefs.unborn advertise &&
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
git -c init.defaultBranch=up clone empty whats-up &&
- test refs/heads/up = $(git -C whats-up symbolic-ref HEAD) &&
- test refs/heads/up = $(git -C whats-up config branch.up.merge)
+ test refs/heads/foo = $(git -C whats-up symbolic-ref HEAD) &&
+ test refs/heads/foo = $(git -C whats-up config branch.foo.merge)
'
test_expect_success 'guesses initial branch name correctly' '
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh
index d9143b4bd2..509f379d49 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -15,7 +15,7 @@ test_expect_success 'test capability advertisement' '
cat >expect <<-EOF &&
version 2
agent=git/$(git version | cut -d" " -f3)
- ls-refs
+ ls-refs=unborn
fetch=shallow
server-option
object-format=$(test_oid algo)
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index 3d994e0b1b..994a76ca3c 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -212,6 +212,31 @@ test_expect_success 'clone with file:// using protocol v2' '
grep "ref-prefix refs/tags/" log
'
+test_expect_success 'clone of empty repo propagates name of default branch' '
+ test_when_finished "rm -rf file_empty_parent file_empty_child" &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=mydefaultbranch init file_empty_parent &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=main -c protocol.version=2 \
+ clone "file://$(pwd)/file_empty_parent" file_empty_child &&
+ grep "refs/heads/mydefaultbranch" file_empty_child/.git/HEAD
+'
+
+test_expect_success '...but not if explicitly forbidden by config' '
+ test_when_finished "rm -rf file_empty_parent file_empty_child" &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=mydefaultbranch init file_empty_parent &&
+ test_config -C file_empty_parent lsrefs.unborn ignore &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=main -c protocol.version=2 \
+ clone "file://$(pwd)/file_empty_parent" file_empty_child &&
+ ! grep "refs/heads/mydefaultbranch" file_empty_child/.git/HEAD
+'
+
test_expect_success 'fetch with file:// using protocol v2' '
test_when_finished "rm -f log" &&
@@ -850,8 +875,9 @@ test_expect_success 'part of packfile response provided as URI' '
test -f hfound &&
test -f h2found &&
- # Ensure that there are exactly 6 files (3 .pack and 3 .idx).
- ls http_child/.git/objects/pack/* >filelist &&
+ # Ensure that there are exactly 3 packfiles with associated .idx
+ ls http_child/.git/objects/pack/*.pack \
+ http_child/.git/objects/pack/*.idx >filelist &&
test_line_count = 6 filelist
'
@@ -904,8 +930,9 @@ test_expect_success 'packfile-uri with transfer.fsckobjects' '
-c fetch.uriprotocols=http,https \
clone "$HTTPD_URL/smart/http_parent" http_child &&
- # Ensure that there are exactly 4 files (2 .pack and 2 .idx).
- ls http_child/.git/objects/pack/* >filelist &&
+ # Ensure that there are exactly 2 packfiles with associated .idx
+ ls http_child/.git/objects/pack/*.pack \
+ http_child/.git/objects/pack/*.idx >filelist &&
test_line_count = 4 filelist
'
@@ -939,6 +966,54 @@ test_expect_success 'packfile-uri with transfer.fsckobjects fails on bad object'
test_i18ngrep "invalid author/committer line - missing email" error
'
+test_expect_success 'packfile-uri with transfer.fsckobjects succeeds when .gitmodules is separate from tree' '
+ P="$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
+ rm -rf "$P" http_child &&
+
+ git init "$P" &&
+ git -C "$P" config "uploadpack.allowsidebandall" "true" &&
+
+ echo "[submodule libfoo]" >"$P/.gitmodules" &&
+ echo "path = include/foo" >>"$P/.gitmodules" &&
+ echo "url = git://example.com/git/lib.git" >>"$P/.gitmodules" &&
+ git -C "$P" add .gitmodules &&
+ git -C "$P" commit -m x &&
+
+ configure_exclusion "$P" .gitmodules >h &&
+
+ sane_unset GIT_TEST_SIDEBAND_ALL &&
+ git -c protocol.version=2 -c transfer.fsckobjects=1 \
+ -c fetch.uriprotocols=http,https \
+ clone "$HTTPD_URL/smart/http_parent" http_child &&
+
+ # Ensure that there are exactly 2 packfiles with associated .idx
+ ls http_child/.git/objects/pack/*.pack \
+ http_child/.git/objects/pack/*.idx >filelist &&
+ test_line_count = 4 filelist
+'
+
+test_expect_success 'packfile-uri with transfer.fsckobjects fails when .gitmodules separate from tree is invalid' '
+ P="$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
+ rm -rf "$P" http_child err &&
+
+ git init "$P" &&
+ git -C "$P" config "uploadpack.allowsidebandall" "true" &&
+
+ echo "[submodule \"..\"]" >"$P/.gitmodules" &&
+ echo "path = include/foo" >>"$P/.gitmodules" &&
+ echo "url = git://example.com/git/lib.git" >>"$P/.gitmodules" &&
+ git -C "$P" add .gitmodules &&
+ git -C "$P" commit -m x &&
+
+ configure_exclusion "$P" .gitmodules >h &&
+
+ sane_unset GIT_TEST_SIDEBAND_ALL &&
+ test_must_fail git -c protocol.version=2 -c transfer.fsckobjects=1 \
+ -c fetch.uriprotocols=http,https \
+ clone "$HTTPD_URL/smart/http_parent" http_child 2>err &&
+ test_i18ngrep "disallowed submodule name" 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.
diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh
index 64d8f99325..e9e471621d 100755
--- a/t/t5703-upload-pack-ref-in-want.sh
+++ b/t/t5703-upload-pack-ref-in-want.sh
@@ -19,7 +19,8 @@ get_actual_commits () {
test-tool pkt-line unpack-sideband <out >o.pack &&
git index-pack o.pack &&
git verify-pack -v o.idx >objs &&
- grep commit objs | cut -d" " -f1 | sort >actual_commits
+ sed -n -e 's/\([0-9a-f][0-9a-f]*\) commit .*/\1/p' objs >objs.sed &&
+ sort >actual_commits <objs.sed
}
check_output () {
diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh
index 6249420a80..881f72fd44 100755
--- a/t/t6020-bundle-misc.sh
+++ b/t/t6020-bundle-misc.sh
@@ -9,7 +9,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. "$TEST_DIRECTORY"/test-bundle-functions.sh
+. "$TEST_DIRECTORY"/lib-bundle.sh
# Create a commit or tag and set the variable with the object ID.
test_commit_setvar () {
@@ -175,7 +175,7 @@ test_expect_success 'create bundle from special rev: main^!' '
cat >expect <<-\EOF &&
<COMMIT-P> refs/heads/main
EOF
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
git bundle verify special-rev.bdl |
make_user_friendly_and_stable_output >actual &&
@@ -185,7 +185,7 @@ test_expect_success 'create bundle from special rev: main^!' '
The bundle requires this ref:
<COMMIT-O>
EOF
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
test_bundle_object_count special-rev.bdl 3
'
@@ -207,7 +207,7 @@ test_expect_success 'create bundle with --max-count option' '
The bundle requires this ref:
<COMMIT-O>
EOF
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
test_bundle_object_count max-count.bdl 4
'
@@ -236,7 +236,7 @@ test_expect_success 'create bundle with --since option' '
<COMMIT-M>
<COMMIT-K>
EOF
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
test_bundle_object_count --thin since.bdl 13
'
@@ -262,11 +262,11 @@ test_expect_success 'create bundle 1 - no prerequisites' '
# verify bundle, which has no prerequisites
git bundle verify 1.bdl |
make_user_friendly_and_stable_output >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
git bundle verify stdin-1.bdl |
make_user_friendly_and_stable_output >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
test_bundle_object_count 1.bdl 24 &&
test_bundle_object_count stdin-1.bdl 24
@@ -304,11 +304,11 @@ test_expect_success 'create bundle 2 - has prerequisites' '
git bundle verify 2.bdl |
make_user_friendly_and_stable_output >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
git bundle verify stdin-2.bdl |
make_user_friendly_and_stable_output >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
test_bundle_object_count 2.bdl 16 &&
test_bundle_object_count stdin-2.bdl 16
@@ -326,11 +326,11 @@ test_expect_success 'fail to verify bundle without prerequisites' '
test_must_fail git -C test1.git bundle verify ../2.bdl 2>&1 |
make_user_friendly_and_stable_output >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
test_must_fail git -C test1.git bundle verify ../stdin-2.bdl 2>&1 |
make_user_friendly_and_stable_output >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'create bundle 3 - two refs, same object' '
@@ -363,11 +363,11 @@ test_expect_success 'create bundle 3 - two refs, same object' '
git bundle verify 3.bdl |
make_user_friendly_and_stable_output >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
git bundle verify stdin-3.bdl |
make_user_friendly_and_stable_output >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
test_bundle_object_count 3.bdl 4 &&
test_bundle_object_count stdin-3.bdl 4
@@ -404,11 +404,11 @@ test_expect_success 'create bundle 4 - with tags' '
git bundle verify 4.bdl |
make_user_friendly_and_stable_output >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
git bundle verify stdin-4.bdl |
make_user_friendly_and_stable_output >actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
test_bundle_object_count 4.bdl 3 &&
test_bundle_object_count stdin-4.bdl 3
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 7bcde054d7..0ba5a91b4e 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -578,9 +578,9 @@ test_expect_success 'skipping away from skipped commit' '
test "$para3" = "$PARA_HASH3"
'
-test_expect_success 'erroring out when using bad path parameters' '
+test_expect_success 'erroring out when using bad path arguments' '
test_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt &&
- test_i18ngrep "bad path parameters" error.txt
+ test_i18ngrep "bad path arguments" error.txt
'
test_expect_success 'test bisection on bare repo - --no-checkout specified' '
@@ -829,7 +829,7 @@ test_expect_success 'bisect terms needs 0 or 1 argument' '
test_must_fail git bisect terms 1 2 &&
test_must_fail git bisect terms 2>actual &&
echo "error: no terms defined" >expected &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'bisect terms shows good/bad after start' '
@@ -903,7 +903,7 @@ test_expect_success 'bisect start --term-* does store terms' '
Your current terms are two for the old state
and one for the new state.
EOF
- test_i18ncmp expected actual &&
+ test_cmp expected actual &&
git bisect terms --term-bad >actual &&
echo one >expected &&
test_cmp expected actual &&
diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
index a160b2bf99..a313849406 100755
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
@@ -57,7 +57,7 @@ test_expect_success 'branch -v' '
git branch -v
) |
sed -n -e "$t6040_script" >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat >expect <<\EOF
@@ -75,7 +75,7 @@ test_expect_success 'branch -vv' '
git branch -vv
) |
sed -n -e "$t6040_script" >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'checkout (diverged from upstream)' '
@@ -146,7 +146,7 @@ test_expect_success 'status -s -b (diverged from upstream)' '
git checkout b1 >/dev/null &&
git status -s -b | head -1
) >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat >expect <<\EOF
@@ -159,7 +159,7 @@ test_expect_success 'status -s -b --no-ahead-behind (diverged from upstream)' '
git checkout b1 >/dev/null &&
git status -s -b --no-ahead-behind | head -1
) >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat >expect <<\EOF
@@ -172,7 +172,7 @@ test_expect_success 'status.aheadbehind=false status -s -b (diverged from upstre
git checkout b1 >/dev/null &&
git -c status.aheadbehind=false status -s -b | head -1
) >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat >expect <<\EOF
@@ -187,7 +187,7 @@ test_expect_success 'status --long --branch' '
git checkout b1 >/dev/null &&
git status --long -b | head -3
) >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'status --long --branch' '
@@ -196,7 +196,7 @@ test_expect_success 'status --long --branch' '
git checkout b1 >/dev/null &&
git -c status.aheadbehind=true status --long -b | head -3
) >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat >expect <<\EOF
@@ -210,7 +210,7 @@ test_expect_success 'status --long --branch --no-ahead-behind' '
git checkout b1 >/dev/null &&
git status --long -b --no-ahead-behind | head -2
) >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'status.aheadbehind=false status --long --branch' '
@@ -219,7 +219,7 @@ test_expect_success 'status.aheadbehind=false status --long --branch' '
git checkout b1 >/dev/null &&
git -c status.aheadbehind=false status --long -b | head -2
) >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat >expect <<\EOF
@@ -232,7 +232,7 @@ test_expect_success 'status -s -b (upstream is gone)' '
git checkout b5 >/dev/null &&
git status -s -b | head -1
) >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat >expect <<\EOF
@@ -245,7 +245,7 @@ test_expect_success 'status -s -b (up-to-date with upstream)' '
git checkout b6 >/dev/null &&
git status -s -b | head -1
) >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'fail to track lightweight tags' '
diff --git a/t/t6113-rev-list-bitmap-filters.sh b/t/t6113-rev-list-bitmap-filters.sh
index 2b551e6fd0..3f889949ca 100755
--- a/t/t6113-rev-list-bitmap-filters.sh
+++ b/t/t6113-rev-list-bitmap-filters.sh
@@ -2,6 +2,7 @@
test_description='rev-list combining bitmaps and filters'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-bitmap.sh
test_expect_success 'set up bitmapped repo' '
# one commit will have bitmaps, the other will not
diff --git a/t/t6115-rev-list-du.sh b/t/t6115-rev-list-du.sh
new file mode 100755
index 0000000000..b4aef32b71
--- /dev/null
+++ b/t/t6115-rev-list-du.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+test_description='basic tests of rev-list --disk-usage'
+. ./test-lib.sh
+
+# we want a mix of reachable and unreachable, as well as
+# objects in the bitmapped pack and some outside of it
+test_expect_success 'set up repository' '
+ test_commit --no-tag one &&
+ test_commit --no-tag two &&
+ git repack -adb &&
+ git reset --hard HEAD^ &&
+ test_commit --no-tag three &&
+ test_commit --no-tag four &&
+ git reset --hard HEAD^
+'
+
+# We don't want to hardcode sizes, because they depend on the exact details of
+# packing, zlib, etc. We'll assume that the regular rev-list and cat-file
+# machinery works and compare the --disk-usage output to that.
+disk_usage_slow () {
+ git rev-list --no-object-names "$@" |
+ git cat-file --batch-check="%(objectsize:disk)" |
+ perl -lne '$total += $_; END { print $total}'
+}
+
+# check behavior with given rev-list options; note that
+# whitespace is not preserved in args
+check_du () {
+ args=$*
+
+ test_expect_success "generate expected size ($args)" "
+ disk_usage_slow $args >expect
+ "
+
+ test_expect_success "rev-list --disk-usage without bitmaps ($args)" "
+ git rev-list --disk-usage $args >actual &&
+ test_cmp expect actual
+ "
+
+ test_expect_success "rev-list --disk-usage with bitmaps ($args)" "
+ git rev-list --disk-usage --use-bitmap-index $args >actual &&
+ test_cmp expect actual
+ "
+}
+
+check_du HEAD
+check_du --objects HEAD
+check_du --objects HEAD^..HEAD
+
+test_done
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index 546796f847..e89b6747be 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -136,7 +136,7 @@ warning: tag 'Q' is externally known as 'A'
EOF
check_describe A-* HEAD
test_expect_success 'warning was displayed for Q' '
- test_i18ncmp err.expect err.actual
+ test_cmp err.expect err.actual
'
test_expect_success 'misnamed annotated tag forces long output' '
description=$(git describe --no-long Q^0) &&
diff --git a/t/t6134-pathspec-in-submodule.sh b/t/t6134-pathspec-in-submodule.sh
index c670668409..0f1cb49ced 100755
--- a/t/t6134-pathspec-in-submodule.sh
+++ b/t/t6134-pathspec-in-submodule.sh
@@ -21,7 +21,7 @@ EOF
test_expect_success 'error message for path inside submodule' '
echo a >sub/a &&
test_must_fail git add sub/a 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'error message for path inside submodule from within submodule' '
diff --git a/t/t6301-for-each-ref-errors.sh b/t/t6301-for-each-ref-errors.sh
index 809854fc0c..40edf9dab5 100755
--- a/t/t6301-for-each-ref-errors.sh
+++ b/t/t6301-for-each-ref-errors.sh
@@ -20,8 +20,8 @@ test_expect_success 'Broken refs are reported correctly' '
test_when_finished "rm -f .git/$r" &&
echo "warning: ignoring broken ref $r" >broken-err &&
git for-each-ref >out 2>err &&
- test_i18ncmp full-list out &&
- test_i18ncmp broken-err err
+ test_cmp full-list out &&
+ test_cmp broken-err err
'
test_expect_success 'NULL_SHA1 refs are reported correctly' '
@@ -31,10 +31,10 @@ test_expect_success 'NULL_SHA1 refs are reported correctly' '
echo "warning: ignoring broken ref $r" >zeros-err &&
git for-each-ref >out 2>err &&
test_cmp full-list out &&
- test_i18ncmp zeros-err err &&
+ test_cmp zeros-err err &&
git for-each-ref --format="%(objectname) %(refname)" >brief-out 2>brief-err &&
test_cmp brief-list brief-out &&
- test_i18ncmp zeros-err brief-err
+ test_cmp zeros-err brief-err
'
test_expect_success 'Missing objects are reported correctly' '
@@ -43,7 +43,7 @@ test_expect_success 'Missing objects are reported correctly' '
test_when_finished "rm -f .git/$r" &&
echo "fatal: missing object $MISSING for $r" >missing-err &&
test_must_fail git for-each-ref 2>err &&
- test_i18ncmp missing-err err &&
+ test_cmp missing-err err &&
(
cat brief-list &&
echo "$MISSING $r"
diff --git a/t/t6404-recursive-merge.sh b/t/t6404-recursive-merge.sh
index c7ab7048f5..eaf48e941e 100755
--- a/t/t6404-recursive-merge.sh
+++ b/t/t6404-recursive-merge.sh
@@ -18,6 +18,8 @@ GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100"
export GIT_COMMITTER_DATE
test_expect_success 'setup tests' '
+ GIT_TEST_COMMIT_GRAPH=0 &&
+ export GIT_TEST_COMMIT_GRAPH &&
echo 1 >a1 &&
git add a1 &&
GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1 &&
@@ -69,7 +71,7 @@ test_expect_success 'setup tests' '
'
test_expect_success 'combined merge conflicts' '
- test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git merge -m final G
+ test_must_fail git merge -m final G
'
test_expect_success 'result contains a conflict' '
@@ -85,6 +87,7 @@ test_expect_success 'result contains a conflict' '
'
test_expect_success 'virtual trees were processed' '
+ # TODO: fragile test, relies on ambigious merge-base resolution
git ls-files --stage >out &&
cat >expect <<-EOF &&
diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh
index 4ab133f489..5d3b711fe6 100755
--- a/t/t6423-merge-rename-directories.sh
+++ b/t/t6423-merge-rename-directories.sh
@@ -2905,7 +2905,7 @@ test_setup_9e () {
)
}
-test_expect_success C_LOCALE_OUTPUT '9e: N-to-1 whammo' '
+test_expect_success '9e: N-to-1 whammo' '
test_setup_9e &&
(
cd 9e &&
diff --git a/t/t6426-merge-skip-unneeded-updates.sh b/t/t6426-merge-skip-unneeded-updates.sh
index d7eeee4310..7b5f1c1dcd 100755
--- a/t/t6426-merge-skip-unneeded-updates.sh
+++ b/t/t6426-merge-skip-unneeded-updates.sh
@@ -492,7 +492,9 @@ test_expect_success '3a-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
test_cmp expect actual &&
test_must_fail git rev-parse HEAD:bq HEAD:foo/bq &&
- test_path_is_missing bq foo/bq foo/whatever
+ test_path_is_missing bq &&
+ test_path_is_missing foo/bq &&
+ test_path_is_missing foo/whatever
)
'
@@ -522,7 +524,9 @@ test_expect_success '3a-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
test_cmp expect actual &&
test_must_fail git rev-parse HEAD:bq HEAD:foo/bq &&
- test_path_is_missing bq foo/bq foo/whatever
+ test_path_is_missing bq &&
+ test_path_is_missing foo/bq &&
+ test_path_is_missing foo/whatever
)
'
@@ -588,7 +592,9 @@ test_expect_success '3b-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
test_cmp expect actual &&
test_must_fail git rev-parse HEAD:bq HEAD:foo/bq &&
- test_path_is_missing bq foo/bq foo/whatever
+ test_path_is_missing bq &&
+ test_path_is_missing foo/bq &&
+ test_path_is_missing foo/whatever
)
'
@@ -618,7 +624,9 @@ test_expect_success '3b-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
test_cmp expect actual &&
test_must_fail git rev-parse HEAD:bq HEAD:foo/bq &&
- test_path_is_missing bq foo/bq foo/whatever
+ test_path_is_missing bq &&
+ test_path_is_missing foo/bq &&
+ test_path_is_missing foo/whatever
)
'
diff --git a/t/t6436-merge-overwrite.sh b/t/t6436-merge-overwrite.sh
index 362ae37a12..84b4aacf49 100755
--- a/t/t6436-merge-overwrite.sh
+++ b/t/t6436-merge-overwrite.sh
@@ -139,7 +139,7 @@ test_expect_success 'will not overwrite untracked file in leading path' '
cp important sub &&
cp important sub2 &&
test_must_fail git merge sub 2>out &&
- test_i18ncmp out expect &&
+ test_cmp out expect &&
test_path_is_missing .git/MERGE_HEAD &&
test_cmp important sub &&
test_cmp important sub2 &&
@@ -174,7 +174,7 @@ test_expect_success 'will not overwrite untracked file on unborn branch' '
git checkout --orphan new &&
cp important c0.c &&
test_must_fail git merge c0 2>out &&
- test_i18ncmp out expect
+ test_cmp out expect
'
test_expect_success 'will not overwrite untracked file on unborn branch .git/MERGE_HEAD sanity etc.' '
diff --git a/t/t6439-merge-co-error-msgs.sh b/t/t6439-merge-co-error-msgs.sh
index e176475ed5..5bfb027099 100755
--- a/t/t6439-merge-co-error-msgs.sh
+++ b/t/t6439-merge-co-error-msgs.sh
@@ -40,14 +40,14 @@ EOF
test_expect_success 'untracked files overwritten by merge (fast and non-fast forward)' '
test_must_fail git merge branch 2>out &&
- test_i18ncmp out expect &&
+ test_cmp out expect &&
git commit --allow-empty -m empty &&
(
GIT_MERGE_VERBOSITY=0 &&
export GIT_MERGE_VERBOSITY &&
test_must_fail git merge branch 2>out2
) &&
- test_i18ncmp out2 expect &&
+ test_cmp out2 expect &&
git reset --hard HEAD^
'
@@ -68,7 +68,7 @@ test_expect_success 'untracked files or local changes ovewritten by merge' '
git add three &&
git add four &&
test_must_fail git merge branch 2>out &&
- test_i18ncmp out expect
+ test_cmp out expect
'
cat >expect <<\EOF
@@ -90,7 +90,7 @@ test_expect_success 'cannot switch branches because of local changes' '
echo uno >rep/one &&
echo dos >rep/two &&
test_must_fail git checkout branch 2>out &&
- test_i18ncmp out expect
+ test_cmp out expect
'
cat >expect <<\EOF
@@ -104,7 +104,7 @@ EOF
test_expect_success 'not uptodate file porcelain checkout error' '
git add rep/one rep/two &&
test_must_fail git checkout branch 2>out &&
- test_i18ncmp out expect
+ test_cmp out expect
'
cat >expect <<\EOF
@@ -135,7 +135,7 @@ test_expect_success 'not_uptodate_dir porcelain checkout error' '
>rep/untracked-file &&
>rep2/untracked-file &&
test_must_fail git checkout branch 2>out &&
- test_i18ncmp out ../expect
+ test_cmp out ../expect
'
test_done
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 4a3b8f48ac..60d961b526 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -78,7 +78,7 @@ test_expect_success 'gc --keep-largest-pack' '
git gc &&
( cd .git/objects/pack && ls *.pack ) >pack-list &&
test_line_count = 1 pack-list &&
- BASE_PACK=.git/objects/pack/pack-*.pack &&
+ cp pack-list base-pack-list &&
test_commit four &&
git repack -d &&
test_commit five &&
@@ -90,7 +90,7 @@ test_expect_success 'gc --keep-largest-pack' '
test_line_count = 2 pack-list &&
awk "/^P /{print \$2}" <.git/objects/info/packs >pack-info &&
test_line_count = 2 pack-info &&
- test_path_is_file $BASE_PACK &&
+ test_path_is_file .git/objects/pack/$(cat base-pack-list) &&
git fsck
)
'
@@ -106,17 +106,17 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre
test_commit "$(test_oid obj2)" &&
# Our first gc will create a pack; our second will create a second pack
git gc --auto &&
- ls .git/objects/pack | sort >existing_packs &&
+ ls .git/objects/pack/pack-*.pack | sort >existing_packs &&
test_commit "$(test_oid obj3)" &&
test_commit "$(test_oid obj4)" &&
git gc --auto 2>err &&
test_i18ngrep ! "^warning:" err &&
- ls .git/objects/pack/ | sort >post_packs &&
+ ls .git/objects/pack/pack-*.pack | sort >post_packs &&
comm -1 -3 existing_packs post_packs >new &&
comm -2 -3 existing_packs post_packs >del &&
test_line_count = 0 del && # No packs are deleted
- test_line_count = 2 new # There is one new pack and its .idx
+ test_line_count = 1 new # There is one new pack
'
test_expect_success 'gc --no-quiet' '
diff --git a/t/t6600-test-reach.sh b/t/t6600-test-reach.sh
index f807276337..e2d33a8a4c 100755
--- a/t/t6600-test-reach.sh
+++ b/t/t6600-test-reach.sh
@@ -55,10 +55,13 @@ test_expect_success 'setup' '
git show-ref -s commit-5-5 | git commit-graph write --stdin-commits &&
mv .git/objects/info/commit-graph commit-graph-half &&
chmod u+w commit-graph-half &&
+ GIT_TEST_COMMIT_GRAPH_NO_GDAT=1 git commit-graph write --reachable &&
+ mv .git/objects/info/commit-graph commit-graph-no-gdat &&
+ chmod u+w commit-graph-no-gdat &&
git config core.commitGraph true
'
-run_three_modes () {
+run_all_modes () {
test_when_finished rm -rf .git/objects/info/commit-graph &&
"$@" <input >actual &&
test_cmp expect actual &&
@@ -67,11 +70,14 @@ run_three_modes () {
test_cmp expect actual &&
cp commit-graph-half .git/objects/info/commit-graph &&
"$@" <input >actual &&
+ test_cmp expect actual &&
+ cp commit-graph-no-gdat .git/objects/info/commit-graph &&
+ "$@" <input >actual &&
test_cmp expect actual
}
-test_three_modes () {
- run_three_modes test-tool reach "$@"
+test_all_modes () {
+ run_all_modes test-tool reach "$@"
}
test_expect_success 'ref_newer:miss' '
@@ -80,7 +86,7 @@ test_expect_success 'ref_newer:miss' '
B:commit-4-9
EOF
echo "ref_newer(A,B):0" >expect &&
- test_three_modes ref_newer
+ test_all_modes ref_newer
'
test_expect_success 'ref_newer:hit' '
@@ -89,7 +95,7 @@ test_expect_success 'ref_newer:hit' '
B:commit-2-3
EOF
echo "ref_newer(A,B):1" >expect &&
- test_three_modes ref_newer
+ test_all_modes ref_newer
'
test_expect_success 'in_merge_bases:hit' '
@@ -98,7 +104,7 @@ test_expect_success 'in_merge_bases:hit' '
B:commit-8-8
EOF
echo "in_merge_bases(A,B):1" >expect &&
- test_three_modes in_merge_bases
+ test_all_modes in_merge_bases
'
test_expect_success 'in_merge_bases:miss' '
@@ -107,7 +113,7 @@ test_expect_success 'in_merge_bases:miss' '
B:commit-5-9
EOF
echo "in_merge_bases(A,B):0" >expect &&
- test_three_modes in_merge_bases
+ test_all_modes in_merge_bases
'
test_expect_success 'in_merge_bases_many:hit' '
@@ -117,7 +123,7 @@ test_expect_success 'in_merge_bases_many:hit' '
X:commit-5-7
EOF
echo "in_merge_bases_many(A,X):1" >expect &&
- test_three_modes in_merge_bases_many
+ test_all_modes in_merge_bases_many
'
test_expect_success 'in_merge_bases_many:miss' '
@@ -127,7 +133,7 @@ test_expect_success 'in_merge_bases_many:miss' '
X:commit-8-6
EOF
echo "in_merge_bases_many(A,X):0" >expect &&
- test_three_modes in_merge_bases_many
+ test_all_modes in_merge_bases_many
'
test_expect_success 'in_merge_bases_many:miss-heuristic' '
@@ -137,7 +143,7 @@ test_expect_success 'in_merge_bases_many:miss-heuristic' '
X:commit-6-6
EOF
echo "in_merge_bases_many(A,X):0" >expect &&
- test_three_modes in_merge_bases_many
+ test_all_modes in_merge_bases_many
'
test_expect_success 'is_descendant_of:hit' '
@@ -148,7 +154,7 @@ test_expect_success 'is_descendant_of:hit' '
X:commit-1-1
EOF
echo "is_descendant_of(A,X):1" >expect &&
- test_three_modes is_descendant_of
+ test_all_modes is_descendant_of
'
test_expect_success 'is_descendant_of:miss' '
@@ -159,7 +165,7 @@ test_expect_success 'is_descendant_of:miss' '
X:commit-7-6
EOF
echo "is_descendant_of(A,X):0" >expect &&
- test_three_modes is_descendant_of
+ test_all_modes is_descendant_of
'
test_expect_success 'get_merge_bases_many' '
@@ -174,7 +180,7 @@ test_expect_success 'get_merge_bases_many' '
git rev-parse commit-5-6 \
commit-4-7 | sort
} >expect &&
- test_three_modes get_merge_bases_many
+ test_all_modes get_merge_bases_many
'
test_expect_success 'reduce_heads' '
@@ -196,7 +202,7 @@ test_expect_success 'reduce_heads' '
commit-2-8 \
commit-1-10 | sort
} >expect &&
- test_three_modes reduce_heads
+ test_all_modes reduce_heads
'
test_expect_success 'can_all_from_reach:hit' '
@@ -219,7 +225,7 @@ test_expect_success 'can_all_from_reach:hit' '
Y:commit-8-1
EOF
echo "can_all_from_reach(X,Y):1" >expect &&
- test_three_modes can_all_from_reach
+ test_all_modes can_all_from_reach
'
test_expect_success 'can_all_from_reach:miss' '
@@ -241,7 +247,7 @@ test_expect_success 'can_all_from_reach:miss' '
Y:commit-8-5
EOF
echo "can_all_from_reach(X,Y):0" >expect &&
- test_three_modes can_all_from_reach
+ test_all_modes can_all_from_reach
'
test_expect_success 'can_all_from_reach_with_flag: tags case' '
@@ -264,7 +270,7 @@ test_expect_success 'can_all_from_reach_with_flag: tags case' '
Y:commit-8-1
EOF
echo "can_all_from_reach_with_flag(X,_,_,0,0):1" >expect &&
- test_three_modes can_all_from_reach_with_flag
+ test_all_modes can_all_from_reach_with_flag
'
test_expect_success 'commit_contains:hit' '
@@ -280,8 +286,8 @@ test_expect_success 'commit_contains:hit' '
X:commit-9-3
EOF
echo "commit_contains(_,A,X,_):1" >expect &&
- test_three_modes commit_contains &&
- test_three_modes commit_contains --tag
+ test_all_modes commit_contains &&
+ test_all_modes commit_contains --tag
'
test_expect_success 'commit_contains:miss' '
@@ -297,8 +303,8 @@ test_expect_success 'commit_contains:miss' '
X:commit-9-3
EOF
echo "commit_contains(_,A,X,_):0" >expect &&
- test_three_modes commit_contains &&
- test_three_modes commit_contains --tag
+ test_all_modes commit_contains &&
+ test_all_modes commit_contains --tag
'
test_expect_success 'rev-list: basic topo-order' '
@@ -310,7 +316,7 @@ test_expect_success 'rev-list: basic topo-order' '
commit-6-2 commit-5-2 commit-4-2 commit-3-2 commit-2-2 commit-1-2 \
commit-6-1 commit-5-1 commit-4-1 commit-3-1 commit-2-1 commit-1-1 \
>expect &&
- run_three_modes git rev-list --topo-order commit-6-6
+ run_all_modes git rev-list --topo-order commit-6-6
'
test_expect_success 'rev-list: first-parent topo-order' '
@@ -322,7 +328,7 @@ test_expect_success 'rev-list: first-parent topo-order' '
commit-6-2 \
commit-6-1 commit-5-1 commit-4-1 commit-3-1 commit-2-1 commit-1-1 \
>expect &&
- run_three_modes git rev-list --first-parent --topo-order commit-6-6
+ run_all_modes git rev-list --first-parent --topo-order commit-6-6
'
test_expect_success 'rev-list: range topo-order' '
@@ -334,7 +340,7 @@ test_expect_success 'rev-list: range topo-order' '
commit-6-2 commit-5-2 commit-4-2 \
commit-6-1 commit-5-1 commit-4-1 \
>expect &&
- run_three_modes git rev-list --topo-order commit-3-3..commit-6-6
+ run_all_modes git rev-list --topo-order commit-3-3..commit-6-6
'
test_expect_success 'rev-list: range topo-order' '
@@ -346,7 +352,7 @@ test_expect_success 'rev-list: range topo-order' '
commit-6-2 commit-5-2 commit-4-2 \
commit-6-1 commit-5-1 commit-4-1 \
>expect &&
- run_three_modes git rev-list --topo-order commit-3-8..commit-6-6
+ run_all_modes git rev-list --topo-order commit-3-8..commit-6-6
'
test_expect_success 'rev-list: first-parent range topo-order' '
@@ -358,7 +364,7 @@ test_expect_success 'rev-list: first-parent range topo-order' '
commit-6-2 \
commit-6-1 commit-5-1 commit-4-1 \
>expect &&
- run_three_modes git rev-list --first-parent --topo-order commit-3-8..commit-6-6
+ run_all_modes git rev-list --first-parent --topo-order commit-3-8..commit-6-6
'
test_expect_success 'rev-list: ancestry-path topo-order' '
@@ -368,7 +374,7 @@ test_expect_success 'rev-list: ancestry-path topo-order' '
commit-6-4 commit-5-4 commit-4-4 commit-3-4 \
commit-6-3 commit-5-3 commit-4-3 \
>expect &&
- run_three_modes git rev-list --topo-order --ancestry-path commit-3-3..commit-6-6
+ run_all_modes git rev-list --topo-order --ancestry-path commit-3-3..commit-6-6
'
test_expect_success 'rev-list: symmetric difference topo-order' '
@@ -382,7 +388,7 @@ test_expect_success 'rev-list: symmetric difference topo-order' '
commit-3-8 commit-2-8 commit-1-8 \
commit-3-7 commit-2-7 commit-1-7 \
>expect &&
- run_three_modes git rev-list --topo-order commit-3-8...commit-6-6
+ run_all_modes git rev-list --topo-order commit-3-8...commit-6-6
'
test_expect_success 'get_reachable_subset:all' '
@@ -402,7 +408,7 @@ test_expect_success 'get_reachable_subset:all' '
commit-1-7 \
commit-5-6 | sort
) >expect &&
- test_three_modes get_reachable_subset
+ test_all_modes get_reachable_subset
'
test_expect_success 'get_reachable_subset:some' '
@@ -420,7 +426,7 @@ test_expect_success 'get_reachable_subset:some' '
git rev-parse commit-3-3 \
commit-1-7 | sort
) >expect &&
- test_three_modes get_reachable_subset
+ test_all_modes get_reachable_subset
'
test_expect_success 'get_reachable_subset:none' '
@@ -434,7 +440,7 @@ test_expect_success 'get_reachable_subset:none' '
Y:commit-2-8
EOF
echo "get_reachable_subset(X,Y)" >expect &&
- test_three_modes get_reachable_subset
+ test_all_modes get_reachable_subset
'
test_done
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 63d5f41a12..25bb9bbb89 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -3,74 +3,74 @@
test_description='git mv in subdirs'
. ./test-lib.sh
-test_expect_success \
- 'prepare reference tree' \
- 'mkdir path0 path1 &&
- cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
- git add path0/COPYING &&
- git commit -m add -a'
+test_expect_success 'prepare reference tree' '
+ mkdir path0 path1 &&
+ cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+ git add path0/COPYING &&
+ git commit -m add -a
+'
-test_expect_success \
- 'moving the file out of subdirectory' \
- 'cd path0 && git mv COPYING ../path1/COPYING'
+test_expect_success 'moving the file out of subdirectory' '
+ git -C path0 mv COPYING ../path1/COPYING
+'
# in path0 currently
-test_expect_success \
- 'commiting the change' \
- 'cd .. && git commit -m move-out -a'
+test_expect_success 'commiting the change' '
+ git commit -m move-out -a
+'
-test_expect_success \
- 'checking the commit' \
- 'git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
- grep "^R100..*path0/COPYING..*path1/COPYING" actual'
+test_expect_success 'checking the commit' '
+ git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
+ grep "^R100..*path0/COPYING..*path1/COPYING" actual
+'
-test_expect_success \
- 'moving the file back into subdirectory' \
- 'cd path0 && git mv ../path1/COPYING COPYING'
+test_expect_success 'moving the file back into subdirectory' '
+ git -C path0 mv ../path1/COPYING COPYING
+'
# in path0 currently
-test_expect_success \
- 'commiting the change' \
- 'cd .. && git commit -m move-in -a'
-
-test_expect_success \
- 'checking the commit' \
- 'git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
- grep "^R100..*path1/COPYING..*path0/COPYING" actual'
-
-test_expect_success \
- 'mv --dry-run does not move file' \
- 'git mv -n path0/COPYING MOVED &&
- test -f path0/COPYING &&
- test ! -f MOVED'
-
-test_expect_success \
- 'checking -k on non-existing file' \
- 'git mv -k idontexist path0'
-
-test_expect_success \
- 'checking -k on untracked file' \
- 'touch untracked1 &&
- git mv -k untracked1 path0 &&
- test -f untracked1 &&
- test ! -f path0/untracked1'
-
-test_expect_success \
- 'checking -k on multiple untracked files' \
- 'touch untracked2 &&
- git mv -k untracked1 untracked2 path0 &&
- test -f untracked1 &&
- test -f untracked2 &&
- test ! -f path0/untracked1 &&
- test ! -f path0/untracked2'
-
-test_expect_success \
- 'checking -f on untracked file with existing target' \
- 'touch path0/untracked1 &&
- test_must_fail git mv -f untracked1 path0 &&
- test ! -f .git/index.lock &&
- test -f untracked1 &&
- test -f path0/untracked1'
+test_expect_success 'commiting the change' '
+ git commit -m move-in -a
+'
+
+test_expect_success 'checking the commit' '
+ git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
+ grep "^R100..*path1/COPYING..*path0/COPYING" actual
+'
+
+test_expect_success 'mv --dry-run does not move file' '
+ git mv -n path0/COPYING MOVED &&
+ test -f path0/COPYING &&
+ test ! -f MOVED
+'
+
+test_expect_success 'checking -k on non-existing file' '
+ git mv -k idontexist path0
+'
+
+test_expect_success 'checking -k on untracked file' '
+ >untracked1 &&
+ git mv -k untracked1 path0 &&
+ test -f untracked1 &&
+ test ! -f path0/untracked1
+'
+
+test_expect_success 'checking -k on multiple untracked files' '
+ >untracked2 &&
+ git mv -k untracked1 untracked2 path0 &&
+ test -f untracked1 &&
+ test -f untracked2 &&
+ test ! -f path0/untracked1 &&
+ test ! -f path0/untracked2
+'
+
+test_expect_success 'checking -f on untracked file with existing target' '
+ >path0/untracked1 &&
+ test_must_fail git mv -f untracked1 path0 &&
+ test ! -f .git/index.lock &&
+ test -f untracked1 &&
+ test -f path0/untracked1
+'
# clean up the mess in case bad things happen
rm -f idontexist untracked1 untracked2 \
@@ -78,87 +78,89 @@ rm -f idontexist untracked1 untracked2 \
.git/index.lock
rmdir path1
-test_expect_success \
- 'moving to absent target with trailing slash' \
- 'test_must_fail git mv path0/COPYING no-such-dir/ &&
- test_must_fail git mv path0/COPYING no-such-dir// &&
- git mv path0/ no-such-dir/ &&
- test_path_is_dir no-such-dir'
-
-test_expect_success \
- 'clean up' \
- 'git reset --hard'
-
-test_expect_success \
- 'moving to existing untracked target with trailing slash' \
- 'mkdir path1 &&
- git mv path0/ path1/ &&
- test_path_is_dir path1/path0/'
-
-test_expect_success \
- 'moving to existing tracked target with trailing slash' \
- 'mkdir path2 &&
- >path2/file && git add path2/file &&
- git mv path1/path0/ path2/ &&
- test_path_is_dir path2/path0/'
-
-test_expect_success \
- 'clean up' \
- 'git reset --hard'
-
-test_expect_success \
- 'adding another file' \
- 'cp "$TEST_DIRECTORY"/../README.md path0/README &&
- git add path0/README &&
- git commit -m add2 -a'
-
-test_expect_success \
- 'moving whole subdirectory' \
- 'git mv path0 path2'
-
-test_expect_success \
- 'commiting the change' \
- 'git commit -m dir-move -a'
-
-test_expect_success \
- 'checking the commit' \
- 'git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
- grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
- grep "^R100..*path0/README..*path2/README" actual'
-
-test_expect_success \
- 'succeed when source is a prefix of destination' \
- 'git mv path2/COPYING path2/COPYING-renamed'
-
-test_expect_success \
- 'moving whole subdirectory into subdirectory' \
- 'git mv path2 path1'
-
-test_expect_success \
- 'commiting the change' \
- 'git commit -m dir-move -a'
-
-test_expect_success \
- 'checking the commit' \
- 'git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
- grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
- grep "^R100..*path2/README..*path1/path2/README" actual'
-
-test_expect_success \
- 'do not move directory over existing directory' \
- 'mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0'
-
-test_expect_success \
- 'move into "."' \
- 'git mv path1/path2/ .'
+test_expect_success 'moving to absent target with trailing slash' '
+ test_must_fail git mv path0/COPYING no-such-dir/ &&
+ test_must_fail git mv path0/COPYING no-such-dir// &&
+ git mv path0/ no-such-dir/ &&
+ test_path_is_dir no-such-dir
+'
+
+test_expect_success 'clean up' '
+ git reset --hard
+'
+
+test_expect_success 'moving to existing untracked target with trailing slash' '
+ mkdir path1 &&
+ git mv path0/ path1/ &&
+ test_path_is_dir path1/path0/
+'
+
+test_expect_success 'moving to existing tracked target with trailing slash' '
+ mkdir path2 &&
+ >path2/file && git add path2/file &&
+ git mv path1/path0/ path2/ &&
+ test_path_is_dir path2/path0/
+'
+
+test_expect_success 'clean up' '
+ git reset --hard
+'
+
+test_expect_success 'adding another file' '
+ cp "$TEST_DIRECTORY"/../README.md path0/README &&
+ git add path0/README &&
+ git commit -m add2 -a
+'
+
+test_expect_success 'moving whole subdirectory' '
+ git mv path0 path2
+'
+
+test_expect_success 'commiting the change' '
+ git commit -m dir-move -a
+'
+
+test_expect_success 'checking the commit' '
+ git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
+ grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
+ grep "^R100..*path0/README..*path2/README" actual
+'
+
+test_expect_success 'succeed when source is a prefix of destination' '
+ git mv path2/COPYING path2/COPYING-renamed
+'
+
+test_expect_success 'moving whole subdirectory into subdirectory' '
+ git mv path2 path1
+'
+
+test_expect_success 'commiting the change' '
+ git commit -m dir-move -a
+'
+
+test_expect_success 'checking the commit' '
+ git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
+ grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
+ grep "^R100..*path2/README..*path1/path2/README" actual
+'
+
+test_expect_success 'do not move directory over existing directory' '
+ mkdir path0 &&
+ mkdir path0/path2 &&
+ test_must_fail git mv path2 path0
+'
+
+test_expect_success 'move into "."' '
+ git mv path1/path2/ .
+'
test_expect_success "Michael Cassar's test case" '
rm -fr .git papers partA &&
git init &&
mkdir -p papers/unsorted papers/all-papers partA &&
- echo a > papers/unsorted/Thesis.pdf &&
- echo b > partA/outline.txt &&
- echo c > papers/unsorted/_another &&
+ echo a >papers/unsorted/Thesis.pdf &&
+ echo b >partA/outline.txt &&
+ echo c >papers/unsorted/_another &&
git add papers partA &&
T1=$(git write-tree) &&
@@ -181,43 +183,42 @@ test_expect_success "Sergey Vlasov's test case" '
git mv ab a
'
-test_expect_success 'absolute pathname' '(
-
- rm -fr mine &&
- mkdir mine &&
- cd mine &&
- test_create_repo one &&
- cd one &&
- mkdir sub &&
- >sub/file &&
- git add sub/file &&
-
- git mv sub "$(pwd)/in" &&
- ! test -d sub &&
- test -d in &&
- git ls-files --error-unmatch in/file
-
-
-)'
-
-test_expect_success 'absolute pathname outside should fail' '(
-
- rm -fr mine &&
- mkdir mine &&
- cd mine &&
- out=$(pwd) &&
- test_create_repo one &&
- cd one &&
- mkdir sub &&
- >sub/file &&
- git add sub/file &&
-
- test_must_fail git mv sub "$out/out" &&
- test -d sub &&
- ! test -d ../in &&
- git ls-files --error-unmatch sub/file
+test_expect_success 'absolute pathname' '
+ (
+ rm -fr mine &&
+ mkdir mine &&
+ cd mine &&
+ test_create_repo one &&
+ cd one &&
+ mkdir sub &&
+ >sub/file &&
+ git add sub/file &&
+
+ git mv sub "$(pwd)/in" &&
+ ! test -d sub &&
+ test -d in &&
+ git ls-files --error-unmatch in/file
+ )
+'
-)'
+test_expect_success 'absolute pathname outside should fail' '
+ (
+ rm -fr mine &&
+ mkdir mine &&
+ cd mine &&
+ out=$(pwd) &&
+ test_create_repo one &&
+ cd one &&
+ mkdir sub &&
+ >sub/file &&
+ git add sub/file &&
+
+ test_must_fail git mv sub "$out/out" &&
+ test -d sub &&
+ ! test -d ../in &&
+ git ls-files --error-unmatch sub/file
+ )
+'
test_expect_success 'git mv to move multiple sources into a directory' '
rm -fr .git && git init &&
@@ -227,23 +228,24 @@ test_expect_success 'git mv to move multiple sources into a directory' '
git add dir/?.txt &&
git mv dir/a.txt dir/b.txt other &&
git ls-files >actual &&
- { echo other/a.txt; echo other/b.txt; } >expect &&
+ cat >expect <<-\EOF &&
+ other/a.txt
+ other/b.txt
+ EOF
test_cmp expect actual
'
test_expect_success 'git mv should not change sha1 of moved cache entry' '
-
rm -fr .git &&
git init &&
echo 1 >dirty &&
git add dirty &&
entry="$(git ls-files --stage dirty | cut -f 1)" &&
git mv dirty dirty2 &&
- [ "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" ] &&
+ test "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" &&
echo 2 >dirty2 &&
git mv dirty2 dirty &&
- [ "$entry" = "$(git ls-files --stage dirty | cut -f 1)" ]
-
+ test "$entry" = "$(git ls-files --stage dirty | cut -f 1)"
'
rm -f dirty dirty2
@@ -266,7 +268,6 @@ test_expect_success 'git mv error on conflicted file' '
'
test_expect_success 'git mv should overwrite symlink to a file' '
-
rm -fr .git &&
git init &&
echo 1 >moved &&
@@ -279,13 +280,11 @@ test_expect_success 'git mv should overwrite symlink to a file' '
test "$(cat symlink)" = 1 &&
git update-index --refresh &&
git diff-files --quiet
-
'
rm -f moved symlink
test_expect_success 'git mv should overwrite file with a symlink' '
-
rm -fr .git &&
git init &&
echo 1 >moved &&
@@ -296,11 +295,9 @@ test_expect_success 'git mv should overwrite file with a symlink' '
! test -e symlink &&
git update-index --refresh &&
git diff-files --quiet
-
'
test_expect_success SYMLINKS 'check moved symlink' '
-
test -h moved
'
@@ -335,11 +332,8 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
mkdir mod &&
git mv sub mod/sub &&
! test -e sub &&
- [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
- (
- cd mod/sub &&
- git status
- ) &&
+ test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+ git -C mod/sub status &&
git update-index --refresh &&
git diff-files --quiet
'
@@ -358,11 +352,8 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
mkdir mod &&
git mv sub mod/sub &&
! test -e sub &&
- [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
- (
- cd mod/sub &&
- git status
- ) &&
+ test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+ git -C mod/sub status &&
echo mod/sub >expected &&
git config -f .gitmodules submodule.sub.path >actual &&
test_cmp expected actual &&
@@ -376,16 +367,10 @@ test_expect_success 'git mv moves a submodule with gitfile' '
git submodule update &&
entry="$(git ls-files --stage sub | cut -f 1)" &&
mkdir mod &&
- (
- cd mod &&
- git mv ../sub/ .
- ) &&
+ git -C mod mv ../sub/ . &&
! test -e sub &&
- [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
- (
- cd mod/sub &&
- git status
- ) &&
+ test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+ git -C mod/sub status &&
echo mod/sub >expected &&
git config -f .gitmodules submodule.sub.path >actual &&
test_cmp expected actual &&
@@ -403,11 +388,8 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
git mv sub mod/sub 2>actual.err &&
test_must_be_empty actual.err &&
! test -e sub &&
- [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
- (
- cd mod/sub &&
- git status
- ) &&
+ test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+ git -C mod/sub status &&
git update-index --refresh &&
git diff-files --quiet
'
@@ -427,11 +409,8 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
git mv sub mod/sub 2>actual.err &&
test_must_be_empty actual.err &&
! test -e sub &&
- [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
- (
- cd mod/sub &&
- git status
- ) &&
+ test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+ git -C mod/sub status &&
git update-index --refresh &&
git diff-files --quiet
'
@@ -446,13 +425,10 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
echo "warning: Could not find section in .gitmodules where path=sub" >expect.err &&
mkdir mod &&
git mv sub mod/sub 2>actual.err &&
- test_i18ncmp expect.err actual.err &&
+ test_cmp expect.err actual.err &&
! test -e sub &&
- [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
- (
- cd mod/sub &&
- git status
- ) &&
+ test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
+ git -C mod/sub status &&
git update-index --refresh &&
git diff-files --quiet
'
@@ -515,15 +491,17 @@ test_expect_success 'moving a submodule in nested directories' '
test_expect_success 'moving nested submodules' '
git commit -am "cleanup commit" &&
mkdir sub_nested_nested &&
- (cd sub_nested_nested &&
- touch nested_level2 &&
+ (
+ cd sub_nested_nested &&
+ >nested_level2 &&
git init &&
git add . &&
git commit -m "nested level 2"
) &&
mkdir sub_nested &&
- (cd sub_nested &&
- touch nested_level1 &&
+ (
+ cd sub_nested &&
+ >nested_level1 &&
git init &&
git add . &&
git commit -m "nested level 1" &&
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 943a7d5c1d..2f72c5c688 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -20,6 +20,13 @@ tag_exists () {
git show-ref --quiet --verify refs/tags/"$1"
}
+test_expect_success 'setup' '
+ test_oid_cache <<-EOM
+ othersigheader sha1:gpgsig-sha256
+ othersigheader sha256:gpgsig
+ EOM
+'
+
test_expect_success 'listing all tags in an empty tree should succeed' '
git tag -l &&
git tag
@@ -91,7 +98,7 @@ test_expect_success 'creating a tag with --create-reflog should create reflog' '
git tag --create-reflog tag_with_reflog &&
git reflog exists refs/tags/tag_with_reflog &&
sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'annotated tag with --create-reflog has correct message' '
@@ -102,7 +109,7 @@ test_expect_success 'annotated tag with --create-reflog has correct message' '
git tag -m "annotated tag" --create-reflog tag_with_reflog &&
git reflog exists refs/tags/tag_with_reflog &&
sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success '--create-reflog does not create reflog on failure' '
@@ -1374,6 +1381,24 @@ test_expect_success GPG \
'test_config gpg.program echo &&
test_must_fail git tag -s -m tail tag-gpg-failure'
+# try to produce invalid signature
+test_expect_success GPG 'git verifies tag is valid with double signature' '
+ git tag -s -m tail tag-gpg-double-sig &&
+ git cat-file tag tag-gpg-double-sig >tag &&
+ othersigheader=$(test_oid othersigheader) &&
+ sed -ne "/^\$/q;p" tag >new-tag &&
+ cat <<-EOM >>new-tag &&
+ $othersigheader -----BEGIN PGP SIGNATURE-----
+ someinvaliddata
+ -----END PGP SIGNATURE-----
+ EOM
+ sed -e "1,/^tagger/d" tag >>new-tag &&
+ new_tag=$(git hash-object -t tag -w new-tag) &&
+ git update-ref refs/tags/tag-gpg-double-sig $new_tag &&
+ git verify-tag tag-gpg-double-sig &&
+ git fsck
+'
+
# try to sign with bad user.signingkey
test_expect_success GPGSM \
'git tag -s fails if gpgsm is misconfigured (bad key)' \
@@ -1409,7 +1434,7 @@ test_expect_success 'message in editor has initial comment: first line' '
# check the first line --- should be empty
echo >first.expect &&
sed -e 1q <actual >first.actual &&
- test_i18ncmp first.expect first.actual
+ test_cmp first.expect first.actual
'
test_expect_success \
@@ -1732,7 +1757,7 @@ test_expect_success 'recursive tagging should give advice' '
hint: Disable this message with "git config advice.nestedTag false"
EOF
git tag -m nested nested annotated-v4.0 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'multiple --points-at are OR-ed together' '
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index fdb450e446..0e7cf75435 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -656,4 +656,134 @@ test_expect_success TTY 'git tag with auto-columns ' '
test_cmp expect actual
'
+test_expect_success 'setup trace2' '
+ GIT_TRACE2_BRIEF=1 &&
+ export GIT_TRACE2_BRIEF
+'
+
+test_expect_success TTY 'git returns SIGPIPE on early pager exit' '
+ test_when_finished "rm pager-used trace.normal" &&
+ test_config core.pager ">pager-used; head -n 1; exit 0" &&
+ GIT_TRACE2="$(pwd)/trace.normal" &&
+ export GIT_TRACE2 &&
+ test_when_finished "unset GIT_TRACE2" &&
+
+ if test_have_prereq !MINGW
+ then
+ OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+ test_match_signal 13 "$OUT"
+ else
+ test_terminal git log
+ fi &&
+
+ grep child_exit trace.normal >child-exits &&
+ test_line_count = 1 child-exits &&
+ grep " code:0 " child-exits &&
+ test_path_is_file pager-used
+'
+
+test_expect_success TTY 'git returns SIGPIPE on early pager non-zero exit' '
+ test_when_finished "rm pager-used trace.normal" &&
+ test_config core.pager ">pager-used; head -n 1; exit 1" &&
+ GIT_TRACE2="$(pwd)/trace.normal" &&
+ export GIT_TRACE2 &&
+ test_when_finished "unset GIT_TRACE2" &&
+
+ if test_have_prereq !MINGW
+ then
+ OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+ test_match_signal 13 "$OUT"
+ else
+ test_terminal git log
+ fi &&
+
+ grep child_exit trace.normal >child-exits &&
+ test_line_count = 1 child-exits &&
+ grep " code:1 " child-exits &&
+ test_path_is_file pager-used
+'
+
+test_expect_success TTY 'git discards pager non-zero exit without SIGPIPE' '
+ test_when_finished "rm pager-used trace.normal" &&
+ test_config core.pager "wc >pager-used; exit 1" &&
+ GIT_TRACE2="$(pwd)/trace.normal" &&
+ export GIT_TRACE2 &&
+ test_when_finished "unset GIT_TRACE2" &&
+
+ if test_have_prereq !MINGW
+ then
+ OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+ test "$OUT" -eq 0
+ else
+ test_terminal git log
+ fi &&
+
+ grep child_exit trace.normal >child-exits &&
+ test_line_count = 1 child-exits &&
+ grep " code:1 " child-exits &&
+ test_path_is_file pager-used
+'
+
+test_expect_success TTY 'git discards nonexisting pager without SIGPIPE' '
+ test_when_finished "rm pager-used trace.normal" &&
+ test_config core.pager "wc >pager-used; does-not-exist" &&
+ GIT_TRACE2="$(pwd)/trace.normal" &&
+ export GIT_TRACE2 &&
+ test_when_finished "unset GIT_TRACE2" &&
+
+ if test_have_prereq !MINGW
+ then
+ OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+ test "$OUT" -eq 0
+ else
+ test_terminal git log
+ fi &&
+
+ grep child_exit trace.normal >child-exits &&
+ test_line_count = 1 child-exits &&
+ grep " code:127 " child-exits &&
+ test_path_is_file pager-used
+'
+
+test_expect_success TTY 'git attempts to page to nonexisting pager command, gets SIGPIPE' '
+ test_when_finished "rm trace.normal" &&
+ test_config core.pager "does-not-exist" &&
+ GIT_TRACE2="$(pwd)/trace.normal" &&
+ export GIT_TRACE2 &&
+ test_when_finished "unset GIT_TRACE2" &&
+
+ if test_have_prereq !MINGW
+ then
+ OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+ test_match_signal 13 "$OUT"
+ else
+ test_terminal git log
+ fi &&
+
+ grep child_exit trace.normal >child-exits &&
+ test_line_count = 1 child-exits &&
+ grep " code:-1 " child-exits
+'
+
+test_expect_success TTY 'git returns SIGPIPE on propagated signals from pager' '
+ test_when_finished "rm pager-used trace.normal" &&
+ test_config core.pager ">pager-used; test-tool sigchain" &&
+ GIT_TRACE2="$(pwd)/trace.normal" &&
+ export GIT_TRACE2 &&
+ test_when_finished "unset GIT_TRACE2" &&
+
+ if test_have_prereq !MINGW
+ then
+ OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
+ test_match_signal 13 "$OUT"
+ else
+ test_terminal git log
+ fi &&
+
+ grep child_exit trace.normal >child-exits &&
+ test_line_count = 1 child-exits &&
+ grep " code:143 " child-exits &&
+ test_path_is_file pager-used
+'
+
test_done
diff --git a/t/t7011-skip-worktree-reading.sh b/t/t7011-skip-worktree-reading.sh
index 37525cae3a..26852586ac 100755
--- a/t/t7011-skip-worktree-reading.sh
+++ b/t/t7011-skip-worktree-reading.sh
@@ -109,15 +109,6 @@ test_expect_success 'ls-files --modified' '
test -z "$(git ls-files -m)"
'
-test_expect_success 'grep with skip-worktree file' '
- git update-index --no-skip-worktree 1 &&
- echo test > 1 &&
- git update-index 1 &&
- git update-index --skip-worktree 1 &&
- rm 1 &&
- test "$(git grep --no-ext-grep test)" = "1:test"
-'
-
echo ":000000 100644 $ZERO_OID $EMPTY_BLOB A 1" > expected
test_expect_success 'diff-index does not examine skip-worktree absent entries' '
setup_absent &&
diff --git a/t/t7012-skip-worktree-writing.sh b/t/t7012-skip-worktree-writing.sh
index e5c6a038fb..f2a8e76511 100755
--- a/t/t7012-skip-worktree-writing.sh
+++ b/t/t7012-skip-worktree-writing.sh
@@ -125,13 +125,13 @@ EOF
test_expect_success 'git-clean, absent case' '
setup_absent &&
git clean -n > result &&
- test_i18ncmp expected result
+ test_cmp expected result
'
test_expect_success 'git-clean, dirty case' '
setup_dirty &&
git clean -n > result &&
- test_i18ncmp expected result
+ test_cmp expected result
'
test_expect_success '--ignore-skip-worktree-entries leaves worktree alone' '
diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
index 72fb418b89..0f4344c55e 100755
--- a/t/t7060-wtstatus.sh
+++ b/t/t7060-wtstatus.sh
@@ -56,9 +56,9 @@ EOF
git commit -m delete &&
test_must_fail git merge main &&
test_must_fail git commit --dry-run >../actual &&
- test_i18ncmp ../expect ../actual &&
+ test_cmp ../expect ../actual &&
git status >../actual &&
- test_i18ncmp ../expect ../actual
+ test_cmp ../expect ../actual
)
'
@@ -151,7 +151,7 @@ Unmerged paths:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -185,7 +185,7 @@ Unmerged paths:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -210,7 +210,7 @@ Unmerged paths:
Untracked files not listed (use -u option to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual &&
+ test_cmp expected actual &&
git reset --hard &&
git checkout main
'
@@ -227,7 +227,7 @@ test_expect_success 'status --branch with detached HEAD' '
?? expected
?? mdconflict/
EOF
- test_i18ncmp expected actual
+ test_cmp expected actual
'
## Duplicate the above test and verify --porcelain=v1 arg parsing.
@@ -243,7 +243,7 @@ test_expect_success 'status --porcelain=v1 --branch with detached HEAD' '
?? expected
?? mdconflict/
EOF
- test_i18ncmp expected actual
+ test_cmp expected actual
'
## Verify parser error on invalid --porcelain argument.
diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh
index f01bf27727..accefde72f 100755
--- a/t/t7063-status-untracked-cache.sh
+++ b/t/t7063-status-untracked-cache.sh
@@ -731,7 +731,7 @@ test_expect_success 'test ident field is working' '
cp -R done dthree dtwo four three ../other_worktree &&
GIT_WORK_TREE=../other_worktree git status 2>../err &&
echo "warning: untracked cache is disabled on this system or location" >../expect &&
- test_i18ncmp ../expect ../err
+ test_cmp ../expect ../err
'
test_expect_success 'untracked cache survives a checkout' '
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 7d8fb188ee..601b2bf97f 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -75,14 +75,14 @@ test_expect_success 'reset --hard message' '
hex=$(git log -1 --format="%h") &&
git reset --hard >.actual &&
echo HEAD is now at $hex $(commit_msg) >.expected &&
- test_i18ncmp .expected .actual
+ test_cmp .expected .actual
'
test_expect_success 'reset --hard message (ISO8859-1 logoutputencoding)' '
hex=$(git log -1 --format="%h") &&
git -c "i18n.logOutputEncoding=$test_encoding" reset --hard >.actual &&
echo HEAD is now at $hex $(commit_msg $test_encoding) >.expected &&
- test_i18ncmp .expected .actual
+ test_cmp .expected .actual
'
test_expect_success 'giving a non existing revision should fail' '
@@ -469,7 +469,7 @@ test_expect_success '--mixed refreshes the index' '
EOF
echo 123 >>file2 &&
git reset --mixed HEAD >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'resetting specific path that is unmerged' '
diff --git a/t/t7104-reset-hard.sh b/t/t7104-reset-hard.sh
index 16faa07813..7948ec392b 100755
--- a/t/t7104-reset-hard.sh
+++ b/t/t7104-reset-hard.sh
@@ -33,7 +33,7 @@ test_expect_success 'reset --hard should restore unmerged ones' '
'
-test_expect_success 'reset --hard did not corrupt index or cached-tree' '
+test_expect_success 'reset --hard did not corrupt index or cache-tree' '
T=$(git write-tree) &&
rm -f .git/index &&
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index daf8678b8a..7f6e23a4bb 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -248,7 +248,7 @@ test_expect_success 'checkout to detach HEAD' '
rev=$(git rev-parse --short renamer^) &&
git checkout -f renamer &&
git clean -f &&
- GIT_TEST_GETTEXT_POISON=false git checkout renamer^ 2>messages &&
+ git checkout renamer^ 2>messages &&
grep "HEAD is now at $rev" messages &&
test_line_count -gt 1 messages &&
H=$(git rev-parse --verify HEAD) &&
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index cb5e34d94c..a74816ca8b 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -110,7 +110,7 @@ test_expect_success 'git clean with prefix' '
'
-test_expect_success C_LOCALE_OUTPUT 'git clean with relative prefix' '
+test_expect_success 'git clean with relative prefix' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@@ -123,7 +123,7 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with relative prefix' '
verbose test "$would_clean" = ../src/part3.c
'
-test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' '
+test_expect_success 'git clean with absolute path' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@@ -407,7 +407,7 @@ test_expect_success 'clean.requireForce and -f' '
'
-test_expect_success C_LOCALE_OUTPUT 'core.excludesfile' '
+test_expect_success 'core.excludesfile' '
echo excludes >excludes &&
echo included >included &&
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index d44f696293..a924fdb7a6 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -55,7 +55,7 @@ test_expect_success 'add aborts on repository with no commits' '
EOF
git init repo-no-commits &&
test_must_fail git submodule add ../a ./repo-no-commits 2>actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'status should ignore inner git repo when not added' '
@@ -185,7 +185,7 @@ test_expect_success 'submodule add to .gitignored path fails' '
git add --force .gitignore &&
git commit -m"Ignore everything" &&
! git submodule add "$submodurl" submod >actual 2>&1 &&
- test_i18ncmp expect actual
+ test_cmp expect actual
)
'
diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh
index 7608814708..9c3cc4cf40 100755
--- a/t/t7401-submodule-summary.sh
+++ b/t/t7401-submodule-summary.sh
@@ -190,7 +190,7 @@ test_expect_success 'typechanged submodule(submodule->blob), --cached' "
< Add foo5
EOF
- test_i18ncmp expected actual
+ test_cmp expected actual
"
test_expect_success 'typechanged submodule(submodule->blob), --files' "
@@ -200,7 +200,7 @@ test_expect_success 'typechanged submodule(submodule->blob), --files' "
> Add foo5
EOF
- test_i18ncmp expected actual
+ test_cmp expected actual
"
rm -rf sm1 &&
@@ -211,7 +211,7 @@ test_expect_success 'typechanged submodule(submodule->blob)' "
* sm1 $head4(submodule)->$head5(blob):
EOF
- test_i18ncmp expected actual
+ test_cmp expected actual
"
rm -f sm1 &&
@@ -224,7 +224,7 @@ test_expect_success 'nonexistent commit' "
Warn: sm1 doesn't contain commit $head4_full
EOF
- test_i18ncmp expected actual
+ test_cmp expected actual
"
commit_file
@@ -235,7 +235,7 @@ test_expect_success 'typechanged submodule(blob->submodule)' "
> Add foo7
EOF
- test_i18ncmp expected actual
+ test_cmp expected actual
"
commit_file sm1 &&
@@ -292,7 +292,7 @@ test_expect_success 'given commit' "
test_expect_success '--for-status' "
git submodule summary --for-status HEAD^ >actual &&
- test_i18ncmp - actual <<-EOF
+ test_cmp - actual <<-EOF
* sm1 $head6...0000000:
* sm2 0000000...$head7 (2):
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index b9c1624fba..ff3ba5422e 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -155,9 +155,9 @@ test_expect_success 'submodule update --init --recursive from subdirectory' '
cd tmp &&
git submodule update --init --recursive ../super >../../actual 2>../../actual2
) &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
sort actual2 >actual2.sorted &&
- test_i18ncmp expect2 actual2.sorted
+ test_cmp expect2 actual2.sorted
'
cat <<EOF >expect2
@@ -174,7 +174,7 @@ test_expect_success 'submodule update --init from and of subdirectory' '
git submodule update --init sub 2>../../actual2
)
) &&
- test_i18ncmp expect2 actual2
+ test_cmp expect2 actual2
'
test_expect_success 'submodule update does not fetch already present commits' '
@@ -192,7 +192,7 @@ test_expect_success 'submodule update does not fetch already present commits' '
(cd super &&
git submodule update > ../actual 2> ../actual.err
) &&
- test_i18ncmp expected actual &&
+ test_cmp expected actual &&
test_must_be_empty actual.err
'
@@ -461,7 +461,7 @@ test_expect_success 'submodule update - command in .git/config catches failure'
(cd super &&
test_must_fail git submodule update submodule 2>../actual
) &&
- test_i18ncmp actual expect
+ test_cmp actual expect
'
cat << EOF >expect
@@ -479,7 +479,7 @@ test_expect_success 'submodule update - command in .git/config catches failure -
mkdir tmp && cd tmp &&
test_must_fail git submodule update ../submodule 2>../../actual
) &&
- test_i18ncmp actual expect
+ test_cmp actual expect
'
test_expect_success 'submodule update - command run for initial population of submodule' '
@@ -488,7 +488,7 @@ test_expect_success 'submodule update - command run for initial population of su
EOF
rm -rf super/submodule &&
test_must_fail git -C super submodule update 2>actual &&
- test_i18ncmp expect actual &&
+ test_cmp expect actual &&
git -C super submodule update --checkout
'
@@ -509,7 +509,7 @@ test_expect_success 'recursive submodule update - command in .git/config catches
mkdir -p tmp && cd tmp &&
test_must_fail git submodule update --recursive ../super 2>../../actual
) &&
- test_i18ncmp actual expect
+ test_cmp actual expect
'
test_expect_success 'submodule init does not copy command into .git/config' '
diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh
index 79981b51eb..e2f110b786 100755
--- a/t/t7407-submodule-foreach.sh
+++ b/t/t7407-submodule-foreach.sh
@@ -80,7 +80,7 @@ test_expect_success 'test basic "submodule foreach" usage' '
git config foo.bar zar &&
git submodule foreach "git config --file \"\$toplevel/.git/config\" foo.bar"
) &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat >expect <<EOF
@@ -96,7 +96,7 @@ test_expect_success 'test "submodule foreach" from subdirectory' '
cd clone/sub &&
git submodule foreach "echo \$toplevel-\$name-\$sm_path-\$displaypath-\$sha1" >../../actual
) &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'setup nested submodules' '
@@ -177,7 +177,7 @@ test_expect_success 'test messages from "foreach --recursive"' '
cd clone2 &&
git submodule foreach --recursive "true" > ../actual
) &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat > expect <<EOF
@@ -197,7 +197,7 @@ test_expect_success 'test messages from "foreach --recursive" from subdirectory'
cd untracked &&
git submodule foreach --recursive >../../actual
) &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
sub1sha1=$(cd clone2/sub1 && git rev-parse HEAD)
sub2sha1=$(cd clone2/sub2 && git rev-parse HEAD)
@@ -229,7 +229,7 @@ test_expect_success 'test "submodule foreach --recursive" from subdirectory' '
cd clone2/untracked &&
git submodule foreach --recursive "echo toplevel: \$toplevel name: \$name path: \$sm_path displaypath: \$displaypath hash: \$sha1" >../../actual
) &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
cat > expect <<EOF
diff --git a/t/t7500-commit-template-squash-signoff.sh b/t/t7500-commit-template-squash-signoff.sh
index 6d19ece05d..e41ac18e7e 100755
--- a/t/t7500-commit-template-squash-signoff.sh
+++ b/t/t7500-commit-template-squash-signoff.sh
@@ -15,7 +15,7 @@ commit_msg_is () {
printf "%s" "$(git log --pretty=format:%s%b -1)" >"$actual" &&
printf "%s" "$1" >"$expect" &&
- test_i18ncmp "$expect" "$actual"
+ test_cmp "$expect" "$actual"
}
# A sanity check to see if commit is working at all.
@@ -356,7 +356,7 @@ test_expect_success 'new line found before status message in commit template' '
touch commit-template-check &&
git add commit-template-check &&
GIT_EDITOR="cat >editor-input" git commit --untracked-files=no --allow-empty-message &&
- test_i18ncmp expected-template editor-input
+ test_cmp expected-template editor-input
'
test_expect_success 'setup empty commit with unstaged rename and copy' '
diff --git a/t/t7501-commit-basic-functionality.sh b/t/t7501-commit-basic-functionality.sh
index 0f936182e4..512ae2781f 100755
--- a/t/t7501-commit-basic-functionality.sh
+++ b/t/t7501-commit-basic-functionality.sh
@@ -11,7 +11,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. "$TEST_DIRECTORY/diff-lib.sh"
+. "$TEST_DIRECTORY/lib-diff.sh"
author='The Real Author <someguy@his.email.org>'
diff --git a/t/t7502-commit-porcelain.sh b/t/t7502-commit-porcelain.sh
index e5332adc9a..6396897cc8 100755
--- a/t/t7502-commit-porcelain.sh
+++ b/t/t7502-commit-porcelain.sh
@@ -13,7 +13,7 @@ commit_msg_is () {
printf "%s" "$(git log --pretty=format:%s%b -1)" >$actual &&
printf "%s" "$1" >$expect &&
- test_i18ncmp $expect $actual
+ test_cmp $expect $actual
}
# Arguments: [<prefix] [<commit message>] [<commit options>]
@@ -35,7 +35,7 @@ check_summary_oneline() {
SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')"
echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp &&
- test_i18ncmp exp act
+ test_cmp exp act
}
test_expect_success 'output summary format' '
@@ -300,7 +300,7 @@ echo "sample
# with '#' will be ignored, and an empty message aborts the commit." >expect
test_expect_success 'cleanup commit messages (strip option,-F,-e): output' '
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'cleanup commit message (fail on invalid cleanup mode option)' '
diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh
index 321b4bc0fc..7a8194ce72 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -218,7 +218,7 @@ test_expect_success 'with hook and editor (merge)' '
test_rebase () {
expect=$1 &&
mode=$2 &&
- test_expect_$expect C_LOCALE_OUTPUT "with hook (rebase ${mode:--i})" '
+ test_expect_$expect "with hook (rebase ${mode:--i})" '
test_when_finished "\
git rebase --abort
git checkout -f main
@@ -307,7 +307,7 @@ test_expect_success 'with failing hook (merge)' '
'
-test_expect_success C_LOCALE_OUTPUT 'with failing hook (cherry-pick)' '
+test_expect_success 'with failing hook (cherry-pick)' '
test_when_finished "git checkout -f main" &&
git checkout -B other b &&
test_must_fail git cherry-pick rebase-1 2>actual &&
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index d01aacb66b..2b72451ba3 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -109,13 +109,13 @@ test_expect_success 'status --column' '
#
EOF
COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'status --column status.displayCommentPrefix=false' '
strip_comments expect &&
COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
cat >expect <<\EOF
@@ -144,19 +144,19 @@ EOF
test_expect_success 'status with status.displayCommentPrefix=true' '
git -c status.displayCommentPrefix=true status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'status with status.displayCommentPrefix=false' '
strip_comments expect &&
git -c status.displayCommentPrefix=false status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'status -v' '
(cat expect && git diff --cached) >expect-with-v &&
git status -v >output &&
- test_i18ncmp expect-with-v output
+ test_cmp expect-with-v output
'
test_expect_success 'status -v -v' '
@@ -167,7 +167,7 @@ test_expect_success 'status -v -v' '
echo "Changes not staged for commit:" &&
git -c diff.mnemonicprefix=true diff) >expect-with-v &&
git status -v -v >output &&
- test_i18ncmp expect-with-v output
+ test_cmp expect-with-v output
'
test_expect_success 'setup fake editor' '
@@ -214,7 +214,7 @@ EOF
test_expect_success 'status (advice.statusHints false)' '
test_config advice.statusHints false &&
git status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
@@ -296,7 +296,7 @@ Ignored files:
EOF
git status --ignored >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'status with gitignore (nothing untracked)' '
@@ -358,7 +358,7 @@ Ignored files:
EOF
git status --ignored >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
cat >.gitignore <<\EOF
@@ -380,7 +380,7 @@ EOF
test_expect_success 'status -s -b' '
git status -s -b >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
@@ -390,7 +390,7 @@ test_expect_success 'status -s -z -b' '
git status -s -z -b >output &&
nul_to_q <output >output.q &&
mv output.q output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'setup dir3' '
@@ -418,13 +418,13 @@ Changes not staged for commit:
Untracked files not listed (use -u option to show untracked files)
EOF
git status -uno >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'status (status.showUntrackedFiles no)' '
test_config status.showuntrackedfiles no &&
git status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'status -uno (advice.statusHints false)' '
@@ -443,7 +443,7 @@ Untracked files not listed
EOF
test_config advice.statusHints false &&
git status -uno >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
cat >expect << EOF
@@ -487,13 +487,13 @@ Untracked files:
EOF
git status -unormal >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'status (status.showUntrackedFiles normal)' '
test_config status.showuntrackedfiles normal &&
git status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
cat >expect <<EOF
@@ -543,13 +543,13 @@ Untracked files:
EOF
git status -uall >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'status (status.showUntrackedFiles all)' '
test_config status.showuntrackedfiles all &&
git status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'teardown dir3' '
@@ -601,7 +601,7 @@ Untracked files:
EOF
(cd dir1 && git status) >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
cat >expect <<\EOF
@@ -670,13 +670,13 @@ Untracked files:
EOF
test_config color.ui auto &&
test_terminal git status | test_decode_color >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success TTY 'status with color.status' '
test_config color.status auto &&
test_terminal git status | test_decode_color >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
cat >expect <<\EOF
@@ -718,7 +718,7 @@ EOF
test_expect_success TTY 'status -s -b with color.status' '
test_terminal git status -s -b | test_decode_color >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
@@ -793,7 +793,7 @@ Untracked files:
EOF
test_config status.relativePaths false &&
(cd dir1 && git status) >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
@@ -860,7 +860,7 @@ Untracked files:
EOF
git commit --dry-run dir1/modified >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
cat >expect <<EOF
@@ -921,13 +921,13 @@ Untracked files:
EOF
git status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
# we expect the same as the previous test
test_expect_success 'status --untracked-files=all does not show submodule' '
git status --untracked-files=all >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
cat >expect <<EOF
@@ -984,13 +984,13 @@ Untracked files:
EOF
git config status.submodulesummary 10 &&
git status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'status submodule summary with status.displayCommentPrefix=false' '
strip_comments expect &&
git -c status.displayCommentPrefix=false status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'commit with submodule summary ignores status.displayCommentPrefix' '
@@ -1035,9 +1035,9 @@ EOF
git commit -m "commit submodule" &&
git config status.submodulesummary 10 &&
test_must_fail git commit --dry-run >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
cat >expect <<EOF
@@ -1091,7 +1091,7 @@ Untracked files:
EOF
git config status.submodulesummary 10 &&
git commit --dry-run --amend >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
@@ -1143,17 +1143,17 @@ Untracked files:
EOF
echo modified sm/untracked &&
git status --ignore-submodules=untracked >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
test_config diff.ignoreSubmodules dirty &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config --add -f .gitmodules submodule.subname.ignore untracked &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1163,14 +1163,14 @@ test_expect_success '.git/config ignore=untracked suppresses submodules with unt
git config --add submodule.subname.ignore untracked &&
git config --add submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config --remove-section submodule.subname &&
git config --remove-section -f .gitmodules submodule.subname
'
test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
git status --ignore-submodules=dirty >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
@@ -1180,7 +1180,7 @@ test_expect_success '.gitmodules ignore=dirty suppresses submodules with untrack
git config --add -f .gitmodules submodule.subname.ignore dirty &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1190,7 +1190,7 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with untrack
git config --add submodule.subname.ignore dirty &&
git config --add submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1198,14 +1198,14 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with untrack
test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
echo modified >sm/foo &&
git status --ignore-submodules=dirty >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
git config --add -f .gitmodules submodule.subname.ignore dirty &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1215,7 +1215,7 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with modifie
git config --add submodule.subname.ignore dirty &&
git config --add submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1253,14 +1253,14 @@ Untracked files:
EOF
git status --ignore-submodules=untracked > output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
git config --add -f .gitmodules submodule.subname.ignore untracked &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1270,7 +1270,7 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodules wi
git config --add submodule.subname.ignore untracked &&
git config --add submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1314,14 +1314,14 @@ Untracked files:
EOF
git status --ignore-submodules=untracked > output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
git config --add -f .gitmodules submodule.subname.ignore untracked &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1331,20 +1331,20 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodule sum
git config --add submodule.subname.ignore untracked &&
git config --add submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
git status --ignore-submodules=dirty > output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
git config --add -f .gitmodules submodule.subname.ignore dirty &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1354,7 +1354,7 @@ test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary
git config --add submodule.subname.ignore dirty &&
git config --add submodule.subname.path sm &&
git status >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1398,7 +1398,7 @@ EOF
test_expect_success "status (core.commentchar with submodule summary)" '
test_config core.commentchar ";" &&
git -c status.displayCommentPrefix=true status >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success "status (core.commentchar with two chars with submodule summary)" '
@@ -1429,7 +1429,7 @@ Untracked files:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --ignore-submodules=all > output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success '.gitmodules ignore=all suppresses unstaged submodule summary' '
@@ -1460,7 +1460,7 @@ EOF
git config --add -f .gitmodules submodule.subname.ignore all &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status > output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1470,7 +1470,7 @@ test_expect_success '.git/config ignore=all suppresses unstaged submodule summar
git config --add submodule.subname.ignore all &&
git config --add submodule.subname.path sm &&
git status > output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1571,7 +1571,7 @@ Changes not staged for commit:
Untracked files not listed (use -u option to show untracked files)
EOF
git commit -uno --dry-run >output &&
- test_i18ncmp expect output &&
+ test_cmp expect output &&
git status -s --ignore-submodules=dirty >output &&
test_i18ngrep "^M. sm" output
'
diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index f4bf925bdd..8df5a74f1d 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -175,7 +175,7 @@ test_expect_success GPG 'show signed commit with signature' '
git cat-file commit initial >cat &&
grep -v -e "gpg: " -e "Warning: " show >show.commit &&
grep -e "gpg: " -e "Warning: " show >show.gpg &&
- grep -v "^ " cat | grep -v "^$(test_oid header) " >cat.commit &&
+ grep -v "^ " cat | grep -v "^gpgsig.* " >cat.commit &&
test_cmp show.commit commit &&
test_cmp show.gpg verify.2 &&
test_cmp cat.commit verify.1
@@ -337,4 +337,45 @@ test_expect_success GPG 'show double signature with custom format' '
test_cmp expect actual
'
+
+test_expect_success GPG 'verify-commit verifies multiply signed commits' '
+ git init multiply-signed &&
+ cd multiply-signed &&
+ test_commit first &&
+ echo 1 >second &&
+ git add second &&
+ tree=$(git write-tree) &&
+ parent=$(git rev-parse HEAD^{commit}) &&
+ git commit --gpg-sign -m second &&
+ git cat-file commit HEAD &&
+ # Avoid trailing whitespace.
+ sed -e "s/^Q//" -e "s/^Z/ /" >commit <<-EOF &&
+ Qtree $tree
+ Qparent $parent
+ Qauthor A U Thor <author@example.com> 1112912653 -0700
+ Qcommitter C O Mitter <committer@example.com> 1112912653 -0700
+ Qgpgsig -----BEGIN PGP SIGNATURE-----
+ QZ
+ Q iHQEABECADQWIQRz11h0S+chaY7FTocTtvUezd5DDQUCX/uBDRYcY29tbWl0dGVy
+ Q QGV4YW1wbGUuY29tAAoJEBO29R7N3kMNd+8AoK1I8mhLHviPH+q2I5fIVgPsEtYC
+ Q AKCTqBh+VabJceXcGIZuF0Ry+udbBQ==
+ Q =tQ0N
+ Q -----END PGP SIGNATURE-----
+ Qgpgsig-sha256 -----BEGIN PGP SIGNATURE-----
+ QZ
+ Q iHQEABECADQWIQRz11h0S+chaY7FTocTtvUezd5DDQUCX/uBIBYcY29tbWl0dGVy
+ Q QGV4YW1wbGUuY29tAAoJEBO29R7N3kMN/NEAn0XO9RYSBj2dFyozi0JKSbssYMtO
+ Q AJwKCQ1BQOtuwz//IjU8TiS+6S4iUw==
+ Q =pIwP
+ Q -----END PGP SIGNATURE-----
+ Q
+ Qsecond
+ EOF
+ head=$(git hash-object -t commit -w commit) &&
+ git reset --hard $head &&
+ git verify-commit $head 2>actual &&
+ grep "Good signature from" actual &&
+ ! grep "BAD signature from" actual
+'
+
test_done
diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh
index 9f5e3ce793..7f2956d77a 100755
--- a/t/t7512-status-help.sh
+++ b/t/t7512-status-help.sh
@@ -41,7 +41,7 @@ Unmerged paths:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -61,7 +61,7 @@ Changes to be committed:
Untracked files not listed (use -u option to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -93,7 +93,7 @@ Unmerged paths:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -116,7 +116,7 @@ Changes to be committed:
Untracked files not listed (use -u option to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -154,7 +154,7 @@ Unmerged paths:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -180,7 +180,7 @@ Changes to be committed:
Untracked files not listed (use -u option to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -210,7 +210,7 @@ You are currently editing a commit while rebasing branch '\''rebase_i_edit'\'' o
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -249,7 +249,7 @@ Changes not staged for commit:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -282,7 +282,7 @@ You are currently editing a commit while rebasing branch '\''amend_last'\'' on '
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -321,7 +321,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -356,7 +356,7 @@ Changes not staged for commit:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -387,7 +387,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -418,7 +418,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -454,7 +454,7 @@ Changes not staged for commit:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -486,7 +486,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -519,7 +519,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -557,7 +557,7 @@ Changes not staged for commit:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -591,7 +591,7 @@ You are currently editing a commit while rebasing branch '\''several_edits'\'' o
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -619,7 +619,7 @@ You are in the middle of an am session.
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -641,7 +641,7 @@ You are in the middle of an am session.
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -664,7 +664,7 @@ The current patch is empty.
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -687,7 +687,7 @@ You are currently bisecting, started from branch '\''bisect'\''.
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -712,7 +712,7 @@ Unmerged paths:
no changes added to commit
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -746,7 +746,7 @@ Unmerged paths:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
@@ -770,7 +770,7 @@ Changes to be committed:
Untracked files not listed (use -u option to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'status when cherry-picking after committing conflict resolution' '
@@ -789,7 +789,7 @@ Cherry-pick currently in progress.
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'status shows cherry-pick with invalid oid' '
@@ -798,7 +798,7 @@ test_expect_success 'status shows cherry-pick with invalid oid' '
git status --untracked-files=no >actual 2>err &&
git cherry-pick --quit &&
test_must_be_empty err &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'status does not show error if .git/sequencer is a file' '
@@ -816,7 +816,7 @@ HEAD detached at atag
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual &&
+ test_cmp expected actual &&
git reset --hard HEAD^ &&
cat >expected <<\EOF &&
@@ -824,7 +824,7 @@ HEAD detached from atag
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'status while reverting commit (conflicts)' '
@@ -852,7 +852,7 @@ Unmerged paths:
no changes added to commit (use "git add" and/or "git commit -a")
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'status while reverting commit (conflicts resolved)' '
@@ -872,7 +872,7 @@ Changes to be committed:
Untracked files not listed (use -u option to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'status after reverting commit' '
@@ -882,7 +882,7 @@ On branch main
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'status while reverting after committing conflict resolution' '
@@ -901,7 +901,7 @@ Revert currently in progress.
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'prepare for different number of commits rebased' '
@@ -931,7 +931,7 @@ You are currently editing a commit while rebasing branch '\''several_commits'\''
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'status: two commands done with some white lines in done file' '
@@ -959,7 +959,7 @@ You are currently editing a commit while rebasing branch '\''several_commits'\''
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'status: two remaining commands with some white lines in todo file' '
@@ -988,7 +988,7 @@ You are currently editing a commit while rebasing branch '\''several_commits'\''
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_expect_success 'status: handle not-yet-started rebase -i gracefully' '
@@ -1007,7 +1007,7 @@ You are currently editing a commit while rebasing branch '\''several_commits'\''
nothing to commit (use -u to show untracked files)
EOF
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_done
diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index fbfdcca000..45d025f960 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -236,7 +236,7 @@ test_expect_success 'refresh_index() invalidates fsmonitor cache' '
git reset HEAD~1 &&
git status >actual &&
git -c core.fsmonitor= status >expect &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
# test fsmonitor with and without preloadIndex
@@ -273,7 +273,7 @@ do
git add dir2/new &&
git status >actual &&
git -c core.fsmonitor= status >expect &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
# Make sure it's actually skipping the check for modified and untracked
diff --git a/t/t7521-ignored-mode.sh b/t/t7521-ignored-mode.sh
index 91790943c3..a88b02b06e 100755
--- a/t/t7521-ignored-mode.sh
+++ b/t/t7521-ignored-mode.sh
@@ -30,7 +30,7 @@ test_expect_success 'Verify behavior of status on directories with ignored files
dir/ignored/ignored_1.ign dir/ignored/ignored_2.ign &&
git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'Verify status behavior on directory with tracked & ignored files' '
@@ -55,7 +55,7 @@ test_expect_success 'Verify status behavior on directory with tracked & ignored
git commit -m "commit tracked files" &&
git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'Verify status behavior on directory with untracked and ignored files' '
@@ -80,7 +80,7 @@ test_expect_success 'Verify status behavior on directory with untracked and igno
dir/untracked_ignored/ignored_1.ign dir/untracked_ignored/ignored_2.ign &&
git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'Verify status matching ignored files on ignored directory' '
@@ -96,7 +96,7 @@ test_expect_success 'Verify status matching ignored files on ignored directory'
ignored_dir/ignored_1.ign ignored_dir/ignored_2.ign &&
git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'Verify status behavior on ignored directory containing tracked file' '
@@ -117,7 +117,7 @@ test_expect_success 'Verify status behavior on ignored directory containing trac
git add -f ignored_dir/tracked &&
git commit -m "Force add file in ignored directory" &&
git status --porcelain=v2 --ignored=matching --untracked-files=all >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'Verify matching ignored files with --untracked-files=normal' '
@@ -136,7 +136,7 @@ test_expect_success 'Verify matching ignored files with --untracked-files=normal
ignored_files/ignored_1.ign ignored_files/ignored_2.ign \
untracked_dir/untracked &&
git status --porcelain=v2 --ignored=matching --untracked-files=normal >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'Verify matching ignored files with --untracked-files=normal' '
@@ -155,7 +155,7 @@ test_expect_success 'Verify matching ignored files with --untracked-files=normal
ignored_files/ignored_1.ign ignored_files/ignored_2.ign \
untracked_dir/untracked &&
git status --porcelain=v2 --ignored=matching --untracked-files=normal >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'Verify status behavior on ignored directory containing tracked file' '
@@ -176,7 +176,7 @@ test_expect_success 'Verify status behavior on ignored directory containing trac
git add -f ignored_dir/tracked &&
git commit -m "Force add file in ignored directory" &&
git status --porcelain=v2 --ignored=matching --untracked-files=normal >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'Verify behavior of status with --ignored=no' '
@@ -191,7 +191,7 @@ test_expect_success 'Verify behavior of status with --ignored=no' '
dir/ignored/ignored_1.ign dir/ignored/ignored_2.ign &&
git status --porcelain=v2 --ignored=no --untracked-files=all >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'Verify behavior of status with --ignored=traditional and --untracked-files=all' '
@@ -210,7 +210,7 @@ test_expect_success 'Verify behavior of status with --ignored=traditional and --
dir/ignored/ignored_1.ign dir/ignored/ignored_2.ign &&
git status --porcelain=v2 --ignored=traditional --untracked-files=all >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_expect_success 'Verify behavior of status with --ignored=traditional and --untracked-files=normal' '
@@ -227,7 +227,7 @@ test_expect_success 'Verify behavior of status with --ignored=traditional and --
dir/ignored/ignored_1.ign dir/ignored/ignored_2.ign &&
git status --porcelain=v2 --ignored=traditional --untracked-files=normal >output &&
- test_i18ncmp expect output
+ test_cmp expect output
'
test_done
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index b2c1d861dc..1cbc9715a8 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -272,7 +272,7 @@ test_expect_success 'merge c3 with c7 with commit.cleanup = scissors' '
EOF
git cat-file commit HEAD >raw &&
sed -e "1,/^$/d" raw >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_expect_success 'merge c3 with c7 with --squash commit.cleanup = scissors' '
@@ -296,7 +296,7 @@ test_expect_success 'merge c3 with c7 with --squash commit.cleanup = scissors' '
EOF
git cat-file commit HEAD >raw &&
sed -e "1,/^$/d" raw >actual &&
- test_i18ncmp expect actual
+ test_cmp expect actual
'
test_debug 'git log --graph --decorate --oneline --all'
diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh
index 13859ec859..a9c816b47f 100755
--- a/t/t7602-merge-octopus-many.sh
+++ b/t/t7602-merge-octopus-many.sh
@@ -66,7 +66,7 @@ EOF
test_expect_success 'merge output uses pretty names' '
git reset --hard c1 &&
git merge c2 c3 c4 >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
cat >expected <<\EOF
@@ -84,7 +84,7 @@ test_expect_success 'merge reduces irrelevant remote heads' '
rm expected.tmp
fi &&
GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
cat >expected <<\EOF
@@ -101,7 +101,7 @@ EOF
test_expect_success 'merge fast-forward output uses pretty names' '
git reset --hard c0 &&
git merge c1 c2 >actual &&
- test_i18ncmp expected actual
+ test_cmp expected actual
'
test_done
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 04b0095072..8cc64729ad 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -842,4 +842,22 @@ test_expect_success 'mergetool --tool-help shows recognized tools' '
grep meld mergetools
'
+test_expect_success 'mergetool hideResolved' '
+ test_config mergetool.hideResolved true &&
+ test_when_finished "git reset --hard" &&
+ git checkout -b test${test_count}_b main &&
+ test_write_lines >file1 base "" a &&
+ git commit -a -m "base" &&
+ test_write_lines >file1 base "" c &&
+ git commit -a -m "remote update" &&
+ git checkout -b test${test_count}_a HEAD~ &&
+ test_write_lines >file1 local "" b &&
+ git commit -a -m "local update" &&
+ test_must_fail git merge test${test_count}_b &&
+ yes "" | git mergetool file1 &&
+ test_write_lines >expect local "" c &&
+ test_cmp expect file1 &&
+ git commit -m "test resolved with mergetool"
+'
+
test_done
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 9662abc1e7..3e041e83ae 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -443,20 +443,20 @@ run_dir_diff_test () {
run_dir_diff_test 'difftool -d' '
git difftool -d $symlinks --extcmd ls branch >output &&
- grep sub output &&
- grep file output
+ grep "^sub$" output &&
+ grep "^file$" output
'
run_dir_diff_test 'difftool --dir-diff' '
git difftool --dir-diff $symlinks --extcmd ls branch >output &&
- grep sub output &&
- grep file output
+ grep "^sub$" output &&
+ grep "^file$" output
'
run_dir_diff_test 'difftool --dir-diff ignores --prompt' '
git difftool --dir-diff $symlinks --prompt --extcmd ls branch >output &&
- grep sub output &&
- grep file output
+ grep "^sub$" output &&
+ grep "^file$" output
'
run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
@@ -465,11 +465,11 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
git difftool --dir-diff $symlinks --extcmd ls branch >output &&
# "sub" must only exist in "right"
# "file" and "file2" must be listed in both "left" and "right"
- grep sub output >sub-output &&
+ grep "^sub$" output >sub-output &&
test_line_count = 1 sub-output &&
- grep file"$" output >file-output &&
+ grep "^file$" output >file-output &&
test_line_count = 2 file-output &&
- grep file2 output >file2-output &&
+ grep "^file2$" output >file2-output &&
test_line_count = 2 file2-output
)
'
@@ -480,11 +480,11 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory' '
git difftool --dir-diff $symlinks --extcmd ls v1 >output &&
# "sub" and "file" exist in both v1 and HEAD.
# "file2" is unchanged.
- grep sub output >sub-output &&
+ grep "^sub$" output >sub-output &&
test_line_count = 2 sub-output &&
- grep file output >file-output &&
+ grep "^file$" output >file-output &&
test_line_count = 2 file-output &&
- ! grep file2 output
+ ! grep "^file2$" output
)
'
@@ -494,9 +494,9 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory w/ pathspec' '
git difftool --dir-diff $symlinks --extcmd ls branch -- .>output &&
# "sub" only exists in "right"
# "file" and "file2" must not be listed
- grep sub output >sub-output &&
+ grep "^sub$" output >sub-output &&
test_line_count = 1 sub-output &&
- ! grep file output
+ ! grep "^file$" output
)
'
@@ -506,9 +506,9 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory w/ pathspec' '
git difftool --dir-diff $symlinks --extcmd ls v1 -- .>output &&
# "sub" exists in v1 and HEAD
# "file" is filtered out by the pathspec
- grep sub output >sub-output &&
+ grep "^sub$" output >sub-output &&
test_line_count = 2 sub-output &&
- ! grep file output
+ ! grep "^file$" output
)
'
@@ -521,8 +521,8 @@ run_dir_diff_test 'difftool --dir-diff from subdirectory with GIT_DIR set' '
cd sub &&
git difftool --dir-diff $symlinks --extcmd ls \
branch -- sub >output &&
- grep sub output &&
- ! grep file output
+ grep "^sub$" output &&
+ ! grep "^file$" output
)
'
@@ -530,7 +530,7 @@ run_dir_diff_test 'difftool --dir-diff when worktree file is missing' '
test_when_finished git reset --hard &&
rm file2 &&
git difftool --dir-diff $symlinks --extcmd ls branch main >output &&
- grep file2 output
+ grep "^file2$" output
'
run_dir_diff_test 'difftool --dir-diff with unmerged files' '
@@ -762,4 +762,36 @@ test_expect_success 'difftool --gui, --tool and --extcmd are mutually exclusive'
test_must_fail git difftool --gui --tool=test-tool --extcmd=cat
'
+test_expect_success 'difftool --rotate-to' '
+ difftool_test_setup &&
+ test_when_finished git reset --hard &&
+ echo 1 >1 &&
+ echo 2 >2 &&
+ echo 4 >4 &&
+ git add 1 2 4 &&
+ git commit -a -m "124" &&
+ git difftool --no-prompt --extcmd=cat --rotate-to="2" HEAD^ >output&&
+ cat >expect <<-\EOF &&
+ 2
+ 4
+ 1
+ EOF
+ test_cmp output expect
+'
+
+test_expect_success 'difftool --skip-to' '
+ difftool_test_setup &&
+ test_when_finished git reset --hard &&
+ git difftool --no-prompt --extcmd=cat --skip-to="2" HEAD^ >output &&
+ cat >expect <<-\EOF &&
+ 2
+ 4
+ EOF
+ test_cmp output expect
+'
+
+test_expect_success 'difftool --rotate/skip-to error condition' '
+ test_must_fail git difftool --no-prompt --extcmd=cat --rotate-to="3" HEAD^ &&
+ test_must_fail git difftool --no-prompt --extcmd=cat --skip-to="3" HEAD^
+'
test_done
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index 8f7591c9cc..edfaa9a6d1 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -969,7 +969,7 @@ do
"
done
-test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'grep --threads=N or pack.threads=N warns when no pthreads' '
+test_expect_success !PTHREADS 'grep --threads=N or pack.threads=N warns when no pthreads' '
git grep --threads=2 Hello hello_world 2>err &&
grep ^warning: err >warnings &&
test_line_count = 1 warnings &&
diff --git a/t/t7812-grep-icase-non-ascii.sh b/t/t7812-grep-icase-non-ascii.sh
index 03dba6685a..e5d1e4ea68 100755
--- a/t/t7812-grep-icase-non-ascii.sh
+++ b/t/t7812-grep-icase-non-ascii.sh
@@ -57,7 +57,12 @@ 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
+ git add invalid-0x80 &&
+
+ # Test for PCRE2_MATCH_INVALID_UTF bug
+ # https://bugs.exim.org/show_bug.cgi?id=2642
+ printf "\\345Aæ\\n" >invalid-0xe5 &&
+ git add invalid-0xe5
'
test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep ASCII from invalid UTF-8 data' '
@@ -67,6 +72,13 @@ test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep ASCII from invalid UT
test_cmp expected actual
'
+test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep ASCII from invalid UTF-8 data (PCRE2 bug #2642)' '
+ git grep -h "Aæ" invalid-0xe5 >actual &&
+ test_cmp invalid-0xe5 actual &&
+ git grep -h "(*NO_JIT)Aæ" invalid-0xe5 >actual &&
+ test_cmp invalid-0xe5 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 &&
@@ -74,14 +86,41 @@ test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep non-ASCII from invali
test_cmp expected actual
'
+test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep non-ASCII from invalid UTF-8 data (PCRE2 bug #2642)' '
+ git grep -h "Aæ" invalid-0xe5 >actual &&
+ test_cmp invalid-0xe5 actual &&
+ git grep -h "(*NO_JIT)Aæ" invalid-0xe5 >actual &&
+ test_cmp invalid-0xe5 actual
+'
+
+test_lazy_prereq PCRE2_MATCH_INVALID_UTF '
+ test-tool pcre2-config has-PCRE2_MATCH_INVALID_UTF
+'
+
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_might_fail git grep -hi "(*NO_JIT)Æ" invalid-0x80 >actual
+'
+
+test_expect_success GETTEXT_LOCALE,LIBPCRE2,PCRE2_MATCH_INVALID_UTF 'PCRE v2: grep non-ASCII from invalid UTF-8 data with -i' '
+ git grep -hi "Æ" invalid-0x80 >actual &&
+ test_cmp expected actual &&
+ git grep -hi "(*NO_JIT)Æ" invalid-0x80 >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success GETTEXT_LOCALE,LIBPCRE2,PCRE2_MATCH_INVALID_UTF 'PCRE v2: grep non-ASCII from invalid UTF-8 data with -i (PCRE2 bug #2642)' '
+ git grep -hi "Æ" invalid-0xe5 >actual &&
+ test_cmp invalid-0xe5 actual &&
+ git grep -hi "(*NO_JIT)Æ" invalid-0xe5 >actual &&
+ test_cmp invalid-0xe5 actual &&
+
+ # Only the case of grepping the ASCII part in a way that
+ # relies on -i fails
+ git grep -hi "aÆ" invalid-0xe5 >actual &&
+ test_cmp invalid-0xe5 actual &&
+ git grep -hi "(*NO_JIT)aÆ" invalid-0xe5 >actual &&
+ test_cmp invalid-0xe5 actual
'
test_done
diff --git a/t/t7817-grep-sparse-checkout.sh b/t/t7817-grep-sparse-checkout.sh
new file mode 100755
index 0000000000..590b99bbb6
--- /dev/null
+++ b/t/t7817-grep-sparse-checkout.sh
@@ -0,0 +1,174 @@
+#!/bin/sh
+
+test_description='grep in sparse checkout
+
+This test creates a repo with the following structure:
+
+.
+|-- a
+|-- b
+|-- dir
+| `-- c
+|-- sub
+| |-- A
+| | `-- a
+| `-- B
+| `-- b
+`-- sub2
+ `-- a
+
+Where the outer repository has non-cone mode sparsity patterns, sub is a
+submodule with cone mode sparsity patterns and sub2 is a submodule that is
+excluded by the superproject sparsity patterns. The resulting sparse checkout
+should leave the following structure in the working tree:
+
+.
+|-- a
+|-- sub
+| `-- B
+| `-- b
+`-- sub2
+ `-- a
+
+But note that sub2 should have the SKIP_WORKTREE bit set.
+'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo "text" >a &&
+ echo "text" >b &&
+ mkdir dir &&
+ echo "text" >dir/c &&
+
+ git init sub &&
+ (
+ cd sub &&
+ mkdir A B &&
+ echo "text" >A/a &&
+ echo "text" >B/b &&
+ git add A B &&
+ git commit -m sub &&
+ git sparse-checkout init --cone &&
+ git sparse-checkout set B
+ ) &&
+
+ git init sub2 &&
+ (
+ cd sub2 &&
+ echo "text" >a &&
+ git add a &&
+ git commit -m sub2
+ ) &&
+
+ git submodule add ./sub &&
+ git submodule add ./sub2 &&
+ git add a b dir &&
+ git commit -m super &&
+ git sparse-checkout init --no-cone &&
+ git sparse-checkout set "/*" "!b" "!/*/" "sub" &&
+
+ git tag -am tag-to-commit tag-to-commit HEAD &&
+ tree=$(git rev-parse HEAD^{tree}) &&
+ git tag -am tag-to-tree tag-to-tree $tree &&
+
+ test_path_is_missing b &&
+ test_path_is_missing dir &&
+ test_path_is_missing sub/A &&
+ test_path_is_file a &&
+ test_path_is_file sub/B/b &&
+ test_path_is_file sub2/a &&
+ git branch -m main
+'
+
+# The test below covers a special case: the sparsity patterns exclude '/b' and
+# sparse checkout is enabled, but the path exists in the working tree (e.g.
+# manually created after `git sparse-checkout init`). git grep should skip it.
+test_expect_success 'working tree grep honors sparse checkout' '
+ cat >expect <<-EOF &&
+ a:text
+ EOF
+ test_when_finished "rm -f b" &&
+ echo "new-text" >b &&
+ git grep "text" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'grep searches unmerged file despite not matching sparsity patterns' '
+ cat >expect <<-EOF &&
+ b:modified-b-in-branchX
+ b:modified-b-in-branchY
+ EOF
+ test_when_finished "test_might_fail git merge --abort && \
+ git checkout main && git sparse-checkout init" &&
+
+ git sparse-checkout disable &&
+ git checkout -b branchY main &&
+ test_commit modified-b-in-branchY b &&
+ git checkout -b branchX main &&
+ test_commit modified-b-in-branchX b &&
+
+ git sparse-checkout init &&
+ test_path_is_missing b &&
+ test_must_fail git merge branchY &&
+ git grep "modified-b" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'grep --cached searches entries with the SKIP_WORKTREE bit' '
+ cat >expect <<-EOF &&
+ a:text
+ b:text
+ dir/c:text
+ EOF
+ git grep --cached "text" >actual &&
+ test_cmp expect actual
+'
+
+# Note that sub2/ is present in the worktree but it is excluded by the sparsity
+# patterns, so grep should not recurse into it.
+test_expect_success 'grep --recurse-submodules honors sparse checkout in submodule' '
+ cat >expect <<-EOF &&
+ a:text
+ sub/B/b:text
+ EOF
+ git grep --recurse-submodules "text" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'grep --recurse-submodules --cached searches entries with the SKIP_WORKTREE bit' '
+ cat >expect <<-EOF &&
+ a:text
+ b:text
+ dir/c:text
+ sub/A/a:text
+ sub/B/b:text
+ sub2/a:text
+ EOF
+ git grep --recurse-submodules --cached "text" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'working tree grep does not search the index with CE_VALID and SKIP_WORKTREE' '
+ cat >expect <<-EOF &&
+ a:text
+ EOF
+ test_when_finished "git update-index --no-assume-unchanged b" &&
+ git update-index --assume-unchanged b &&
+ git grep text >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'grep --cached searches index entries with both CE_VALID and SKIP_WORKTREE' '
+ cat >expect <<-EOF &&
+ a:text
+ b:text
+ dir/c:text
+ EOF
+ test_when_finished "git update-index --no-assume-unchanged b" &&
+ git update-index --assume-unchanged b &&
+ git grep --cached text >actual &&
+ test_cmp expect actual
+'
+
+test_done
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index 1074009cc0..2412d8c5c0 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -149,7 +149,31 @@ test_expect_success 'prefetch multiple remotes' '
git log prefetch/remote2/two &&
git fetch --all &&
test_cmp_rev refs/remotes/remote1/one refs/prefetch/remote1/one &&
- test_cmp_rev refs/remotes/remote2/two refs/prefetch/remote2/two
+ test_cmp_rev refs/remotes/remote2/two refs/prefetch/remote2/two &&
+
+ test_cmp_config refs/prefetch/ log.excludedecoration &&
+ git log --oneline --decorate --all >log &&
+ ! grep "prefetch" log
+'
+
+test_expect_success 'prefetch and existing log.excludeDecoration values' '
+ git config --unset-all log.excludeDecoration &&
+ git config log.excludeDecoration refs/remotes/remote1/ &&
+ git maintenance run --task=prefetch &&
+
+ git config --get-all log.excludeDecoration >out &&
+ grep refs/remotes/remote1/ out &&
+ grep refs/prefetch/ out &&
+
+ git log --oneline --decorate --all >log &&
+ ! grep "prefetch" log &&
+ ! grep "remote1" log &&
+ grep "remote2" log &&
+
+ # a second run does not change the config
+ git maintenance run --task=prefetch &&
+ git log --oneline --decorate --all >log2 &&
+ test_cmp log log2
'
test_expect_success 'loose-objects task' '
@@ -232,6 +256,13 @@ test_expect_success 'incremental-repack task' '
HEAD
^HEAD~1
EOF
+
+ # Delete refs that have not been repacked in these packs.
+ git for-each-ref --format="delete %(refname)" \
+ refs/prefetch refs/tags >refs &&
+ git update-ref --stdin <refs &&
+
+ # Replace the object directory with this pack layout.
rm -f $packDir/pack-* &&
rm -f $packDir/loose-* &&
ls $packDir/*.pack >packs-before &&
@@ -312,6 +343,18 @@ test_expect_success 'maintenance.incremental-repack.auto' '
test_subcommand git multi-pack-index write --no-progress <trace-B
'
+test_expect_success 'pack-refs task' '
+ for n in $(test_seq 1 5)
+ do
+ git branch -f to-pack/$n HEAD || return 1
+ done &&
+ GIT_TRACE2_EVENT="$(pwd)/pack-refs.txt" \
+ git maintenance run --task=pack-refs &&
+ ls .git/refs/heads/ >after &&
+ test_must_be_empty after &&
+ test_subcommand git pack-refs --all --prune <pack-refs.txt
+'
+
test_expect_success '--auto and --schedule incompatible' '
test_must_fail git maintenance run --auto --schedule=daily 2>err &&
test_i18ngrep "at most one" err
@@ -365,18 +408,32 @@ test_expect_success 'maintenance.strategy inheritance' '
git maintenance run --schedule=hourly --quiet &&
GIT_TRACE2_EVENT="$(pwd)/incremental-daily.txt" \
git maintenance run --schedule=daily --quiet &&
+ GIT_TRACE2_EVENT="$(pwd)/incremental-weekly.txt" \
+ git maintenance run --schedule=weekly --quiet &&
test_subcommand git commit-graph write --split --reachable \
--no-progress <incremental-hourly.txt &&
test_subcommand ! git prune-packed --quiet <incremental-hourly.txt &&
test_subcommand ! git multi-pack-index write --no-progress \
<incremental-hourly.txt &&
+ test_subcommand ! git pack-refs --all --prune \
+ <incremental-hourly.txt &&
test_subcommand git commit-graph write --split --reachable \
--no-progress <incremental-daily.txt &&
test_subcommand git prune-packed --quiet <incremental-daily.txt &&
test_subcommand git multi-pack-index write --no-progress \
<incremental-daily.txt &&
+ test_subcommand ! git pack-refs --all --prune \
+ <incremental-daily.txt &&
+
+ test_subcommand git commit-graph write --split --reachable \
+ --no-progress <incremental-weekly.txt &&
+ test_subcommand git prune-packed --quiet <incremental-weekly.txt &&
+ test_subcommand git multi-pack-index write --no-progress \
+ <incremental-weekly.txt &&
+ test_subcommand git pack-refs --all --prune \
+ <incremental-weekly.txt &&
# Modify defaults
git config maintenance.commit-graph.schedule daily &&
@@ -575,4 +632,17 @@ test_expect_success 'fails when running outside of a repository' '
nongit test_must_fail git maintenance unregister
'
+test_expect_success 'register and unregister bare repo' '
+ test_when_finished "git config --global --unset-all maintenance.repo || :" &&
+ test_might_fail git config --global --unset-all maintenance.repo &&
+ git init --bare barerepo &&
+ (
+ cd barerepo &&
+ git maintenance register &&
+ git config --get --global --fixed-value maintenance.repo "$(pwd)" &&
+ git maintenance unregister &&
+ test_must_fail git config --global --get-all maintenance.repo
+ )
+'
+
test_done
diff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh
index 03cd5c5423..f00deaf381 100755
--- a/t/t9003-help-autocorrect.sh
+++ b/t/t9003-help-autocorrect.sh
@@ -56,11 +56,8 @@ test_expect_success 'autocorrect can be declined altogether' '
git config help.autocorrect never &&
test_must_fail git lfg 2>actual &&
- if test_have_prereq C_LOCALE_OUTPUT
- then
- grep "is not a git command" actual &&
- test_line_count = 1 actual
- fi
+ grep "is not a git command" actual &&
+ test_line_count = 1 actual
'
test_done
diff --git a/t/t9151-svn-mergeinfo.sh b/t/t9151-svn-mergeinfo.sh
index 696ace2462..1fbe84feb1 100755
--- a/t/t9151-svn-mergeinfo.sh
+++ b/t/t9151-svn-mergeinfo.sh
@@ -12,49 +12,46 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
test_expect_success 'load svn dump' "
svnadmin load -q '$rawsvnrepo' \
- < '$TEST_DIRECTORY/t9151/svn-mergeinfo.dump' &&
+ <'$TEST_DIRECTORY/t9151/svn-mergeinfo.dump' &&
git svn init --minimize-url -R svnmerge \
--rewrite-root=http://svn.example.org \
-T trunk -b branches '$svnrepo' &&
git svn fetch --all
- "
+"
test_expect_success 'all svn merges became git merge commits' '
- unmarked=$(git rev-list --parents --all --grep=Merge |
- grep -v " .* " | cut -f1 -d" ") &&
- [ -z "$unmarked" ]
- '
+ git rev-list --all --no-merges --grep=Merge >unmarked &&
+ test_must_be_empty unmarked
+'
test_expect_success 'cherry picks did not become git merge commits' '
- bad_cherries=$(git rev-list --parents --all --grep=Cherry |
- grep " .* " | cut -f1 -d" ") &&
- [ -z "$bad_cherries" ]
- '
+ git rev-list --all --merges --grep=Cherry >bad-cherries &&
+ test_must_be_empty bad-cherries
+'
test_expect_success 'svn non-merge merge commits did not become git merge commits' '
- bad_non_merges=$(git rev-list --parents --all --grep=non-merge |
- grep " .* " | cut -f1 -d" ") &&
- [ -z "$bad_non_merges" ]
- '
+ git rev-list --all --merges --grep=non-merge >bad-non-merges &&
+ test_must_be_empty bad-non-merges
+'
test_expect_success 'commit made to merged branch is reachable from the merge' '
before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2") &&
merge_commit=$(git rev-list --all --grep="Merge trunk to b2") &&
- not_reachable=$(git rev-list -1 $before_commit --not $merge_commit) &&
- [ -z "$not_reachable" ]
- '
+ git rev-list -1 $before_commit --not $merge_commit >not-reachable &&
+ test_must_be_empty not-reachable
+'
test_expect_success 'merging two branches in one commit is detected correctly' '
f1_commit=$(git rev-list --all --grep="make f1 branch from trunk") &&
f2_commit=$(git rev-list --all --grep="make f2 branch from trunk") &&
merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk") &&
- not_reachable=$(git rev-list -1 $f1_commit $f2_commit --not $merge_commit) &&
- [ -z "$not_reachable" ]
- '
+ git rev-list -1 $f1_commit $f2_commit --not $merge_commit >not-reachable &&
+ test_must_be_empty not-reachable
+'
test_expect_failure 'everything got merged in the end' '
- unmerged=$(git rev-list --all --not main) &&
- [ -z "$unmerged" ]
- '
+ git rev-list --all --not main >unmerged &&
+ test_must_be_empty unmerged
+'
test_done
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 3d17e932a0..5c47ac4465 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -8,7 +8,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
+. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
verify_packs () {
for p in .git/objects/pack/*.pack
@@ -1632,7 +1632,10 @@ test_expect_success 'O: blank lines not necessary after other commands' '
INPUT_END
git fast-import <input &&
- test 8 = $(find .git/objects/pack -type f | grep -v multi-pack-index | wc -l) &&
+ ls -la .git/objects/pack/pack-*.pack >packlist &&
+ ls -la .git/objects/pack/pack-*.pack >idxlist &&
+ test_line_count = 4 idxlist &&
+ test_line_count = 4 packlist &&
test $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&
git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
test_cmp expect actual
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index ee8c6e30e6..0333065d4d 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -13,7 +13,7 @@ or warnings to log.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-. ./gitweb-lib.sh
+. ./lib-gitweb.sh
# ----------------------------------------------------------------------
# no commits (empty, just initialized repository)
diff --git a/t/t9501-gitweb-standalone-http-status.sh b/t/t9501-gitweb-standalone-http-status.sh
index 141610de54..32814e75df 100755
--- a/t/t9501-gitweb-standalone-http-status.sh
+++ b/t/t9501-gitweb-standalone-http-status.sh
@@ -13,7 +13,7 @@ code and message.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-. ./gitweb-lib.sh
+. ./lib-gitweb.sh
#
# Gitweb only provides the functionality tested by the 'modification times'
diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh
index 9cf7ab30a8..3167473b30 100755
--- a/t/t9502-gitweb-standalone-parse-output.sh
+++ b/t/t9502-gitweb-standalone-parse-output.sh
@@ -13,7 +13,7 @@ in the HTTP header or the actual script output.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-. ./gitweb-lib.sh
+. ./lib-gitweb.sh
# ----------------------------------------------------------------------
# snapshot file name and prefix
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index fb67262fc8..04ce884ef5 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -2366,7 +2366,6 @@ test_expect_success 'sourcing the completion script clears cached commands' '
'
test_expect_success 'sourcing the completion script clears cached merge strategies' '
- GIT_TEST_GETTEXT_POISON=false &&
__git_compute_merge_strategies &&
verbose test -n "$__git_merge_strategies" &&
. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 6bca002316..6348e8d733 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -32,11 +32,6 @@ test_set_editor () {
export EDITOR
}
-test_set_index_version () {
- GIT_INDEX_VERSION="$1"
- export GIT_INDEX_VERSION
-}
-
test_decode_color () {
awk '
function name(n) {
@@ -116,13 +111,6 @@ remove_cr () {
tr '\015' Q | sed -e 's/Q$//'
}
-# Generate an output of $1 bytes of all zeroes (NULs, not ASCII zeroes).
-# If $1 is 'infinity', output forever or until the receiving pipe stops reading,
-# whichever comes first.
-generate_zero_bytes () {
- test-tool genzeros "$@"
-}
-
# In some bourne shell implementations, the "unset" builtin returns
# nonzero status when a variable to be unset was not set in the first
# place.
@@ -202,6 +190,7 @@ test_commit () {
author= &&
signoff= &&
indir= &&
+ no_tag= &&
while test $# != 0
do
case "$1" in
@@ -218,10 +207,19 @@ test_commit () {
--signoff)
signoff="$1"
;;
+ --date)
+ notick=yes
+ GIT_COMMITTER_DATE="$2"
+ GIT_AUTHOR_DATE="$2"
+ shift
+ ;;
-C)
indir="$2"
shift
;;
+ --no-tag)
+ no_tag=yes
+ ;;
*)
break
;;
@@ -244,7 +242,10 @@ test_commit () {
git ${indir:+ -C "$indir"} commit \
${author:+ --author "$author"} \
$signoff -m "$1" &&
- git ${indir:+ -C "$indir"} tag "${4:-$1}"
+ if test -z "$no_tag"
+ then
+ git ${indir:+ -C "$indir"} tag "${4:-$1}"
+ fi
}
# Call test_merge with the arguments "<message> <commit>", where <commit>
@@ -729,34 +730,37 @@ test_external_without_stderr () {
}
# debugging-friendly alternatives to "test [-f|-d|-e]"
-# The commands test the existence or non-existence of $1. $2 can be
-# given to provide a more precise diagnosis.
+# The commands test the existence or non-existence of $1
test_path_is_file () {
+ test "$#" -ne 1 && BUG "1 param"
if ! test -f "$1"
then
- echo "File $1 doesn't exist. $2"
+ echo "File $1 doesn't exist"
false
fi
}
test_path_is_dir () {
+ test "$#" -ne 1 && BUG "1 param"
if ! test -d "$1"
then
- echo "Directory $1 doesn't exist. $2"
+ echo "Directory $1 doesn't exist"
false
fi
}
test_path_exists () {
+ test "$#" -ne 1 && BUG "1 param"
if ! test -e "$1"
then
- echo "Path $1 doesn't exist. $2"
+ echo "Path $1 doesn't exist"
false
fi
}
# Check if the directory exists and is empty as expected, barf otherwise.
test_dir_is_empty () {
+ test "$#" -ne 1 && BUG "1 param"
test_path_is_dir "$1" &&
if test -n "$(ls -a1 "$1" | egrep -v '^\.\.?$')"
then
@@ -768,6 +772,7 @@ test_dir_is_empty () {
# Check if the file exists and has a size greater than zero
test_file_not_empty () {
+ test "$#" = 2 && BUG "2 param"
if ! test -s "$1"
then
echo "'$1' is not a non-empty file."
@@ -776,6 +781,7 @@ test_file_not_empty () {
}
test_path_is_missing () {
+ test "$#" -ne 1 && BUG "1 param"
if test -e "$1"
then
echo "Path exists:"
@@ -812,6 +818,7 @@ test_line_count () {
}
test_file_size () {
+ test "$#" -ne 1 && BUG "1 param"
test-tool path-utils file-size "$1"
}
@@ -984,6 +991,7 @@ test_expect_code () {
# - not all diff versions understand "-u"
test_cmp () {
+ test "$#" -ne 2 && BUG "2 param"
eval "$GIT_TEST_CMP" '"$@"'
}
@@ -1013,22 +1021,20 @@ test_cmp_config () {
# test_cmp_bin - helper to compare binary files
test_cmp_bin () {
+ test "$#" -ne 2 && BUG "2 param"
cmp "$@"
}
-# Use this instead of test_cmp to compare files that contain expected and
-# actual output from git commands that can be translated. When running
-# under GIT_TEST_GETTEXT_POISON this pretends that the command produced expected
-# results.
+# Wrapper for test_cmp which used to be used for
+# GIT_TEST_GETTEXT_POISON=false. Only here as a shim for other
+# in-flight changes. Should not be used and will be removed soon.
test_i18ncmp () {
- ! test_have_prereq C_LOCALE_OUTPUT || test_cmp "$@"
+ test_cmp "$@"
}
-# Use this instead of "grep expected-string actual" to see if the
-# output from a git command that can be translated either contains an
-# expected string, or does not contain an unwanted one. When running
-# under GIT_TEST_GETTEXT_POISON this pretends that the command produced expected
-# results.
+# Wrapper for grep which used to be used for
+# GIT_TEST_GETTEXT_POISON=false. Only here as a shim for other
+# in-flight changes. Should not be used and will be removed soon.
test_i18ngrep () {
eval "last_arg=\${$#}"
@@ -1041,12 +1047,6 @@ test_i18ngrep () {
BUG "too few parameters to test_i18ngrep"
fi
- if test_have_prereq !C_LOCALE_OUTPUT
- then
- # pretend success
- return 0
- fi
-
if test "x!" = "x$1"
then
shift
@@ -1082,6 +1082,7 @@ verbose () {
# otherwise.
test_must_be_empty () {
+ test "$#" -ne 1 && BUG "1 param"
test_path_is_file "$1" &&
if test -s "$1"
then
@@ -1105,7 +1106,7 @@ test_cmp_rev () {
fi
if test $# != 2
then
- error "bug in the test script: test_cmp_rev requires two revisions, but got $#"
+ BUG "test_cmp_rev requires two revisions, but got $#"
else
local r1 r2
r1=$(git rev-parse --verify "$1") &&
@@ -1216,7 +1217,7 @@ test_atexit () {
# doing so on Bash is better than nothing (the test will
# silently pass on other shells).
test "${BASH_SUBSHELL-0}" = 0 ||
- error "bug in test script: test_atexit does nothing in a subshell"
+ BUG "test_atexit does nothing in a subshell"
test_atexit_cleanup="{ $*
} && (exit \"\$eval_ret\"); eval_ret=\$?; $test_atexit_cleanup"
}
@@ -1614,33 +1615,6 @@ test_set_port () {
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"
-}
-
# Tests for the hidden file attribute on Windows
test_path_is_hidden () {
test_have_prereq MINGW ||
@@ -1683,3 +1657,45 @@ test_subcommand () {
grep "\[$expr\]"
fi
}
+
+# Check that the given command was invoked as part of the
+# trace2-format trace on stdin.
+#
+# test_region [!] <category> <label> git <command> <args>...
+#
+# For example, to look for trace2_region_enter("index", "do_read_index", repo)
+# in an invocation of "git checkout HEAD~1", run
+#
+# GIT_TRACE2_EVENT="$(pwd)/trace.txt" GIT_TRACE2_EVENT_NESTING=10 \
+# git checkout HEAD~1 &&
+# test_region index do_read_index <trace.txt
+#
+# If the first parameter passed is !, this instead checks that
+# the given region was not entered.
+#
+test_region () {
+ local expect_exit=0
+ if test "$1" = "!"
+ then
+ expect_exit=1
+ shift
+ fi
+
+ grep -e '"region_enter".*"category":"'"$1"'","label":"'"$2"\" "$3"
+ exitcode=$?
+
+ if test $exitcode != $expect_exit
+ then
+ return 1
+ fi
+
+ grep -e '"region_leave".*"category":"'"$1"'","label":"'"$2"\" "$3"
+ exitcode=$?
+
+ if test $exitcode != $expect_exit
+ then
+ return 1
+ fi
+
+ return 0
+}
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 03c1c0836f..d3f6af6a65 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -163,8 +163,8 @@ parse_option () {
;;
--stress-jobs=*)
stress=t;
- stress=${opt#--*=}
- case "$stress" in
+ stress_jobs=${opt#--*=}
+ case "$stress_jobs" in
*[!0-9]*|0*|"")
echo "error: --stress-jobs=<N> requires the number of jobs to run" >&2
exit 1
@@ -262,9 +262,9 @@ then
: # Don't stress test again.
elif test -n "$stress"
then
- if test "$stress" != t
+ if test -n "$stress_jobs"
then
- job_count=$stress
+ job_count=$stress_jobs
elif test -n "$GIT_TEST_STRESS_LOAD"
then
job_count="$GIT_TEST_STRESS_LOAD"
@@ -404,15 +404,6 @@ TZ=UTC
export LANG LC_ALL PAGER TZ
EDITOR=:
-# GIT_TEST_GETTEXT_POISON should not influence git commands executed
-# during initialization of test-lib and the test repo. Back it up,
-# unset and then restore after initialization is finished.
-if test -n "$GIT_TEST_GETTEXT_POISON"
-then
- GIT_TEST_GETTEXT_POISON_ORIG=$GIT_TEST_GETTEXT_POISON
- unset GIT_TEST_GETTEXT_POISON
-fi
-
# A call to "unset" with no arguments causes at least Solaris 10
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
# deriving from the command substitution clustered with the other
@@ -462,36 +453,6 @@ export GIT_DEFAULT_HASH
GIT_TRACE_BARE=1
export GIT_TRACE_BARE
-check_var_migration () {
- # the warnings and hints given from this helper depends
- # on end-user settings, which will disrupt the self-test
- # done on the test framework itself.
- case "$GIT_TEST_FRAMEWORK_SELFTEST" in
- t) return ;;
- esac
-
- old_name=$1 new_name=$2
- eval "old_isset=\${${old_name}:+isset}"
- eval "new_isset=\${${new_name}:+isset}"
-
- case "$old_isset,$new_isset" in
- isset,)
- echo >&2 "warning: $old_name is now $new_name"
- echo >&2 "hint: set $new_name too during the transition period"
- eval "$new_name=\$$old_name"
- ;;
- isset,isset)
- # do this later
- # echo >&2 "warning: $old_name is now $new_name"
- # echo >&2 "hint: remove $old_name"
- ;;
- esac
-}
-
-check_var_migration GIT_FSMONITOR_TEST GIT_TEST_FSMONITOR
-check_var_migration TEST_GIT_INDEX_VERSION GIT_TEST_INDEX_VERSION
-check_var_migration GIT_FORCE_PRELOAD_TEST GIT_TEST_PRELOAD_INDEX
-
# Use specific version of the index file format
if test -n "${GIT_TEST_INDEX_VERSION:+isset}"
then
@@ -1524,22 +1485,10 @@ esac
test -z "$NO_PERL" && test_set_prereq PERL
test -z "$NO_PTHREADS" && test_set_prereq PTHREADS
test -z "$NO_PYTHON" && test_set_prereq PYTHON
-test -n "$USE_LIBPCRE1$USE_LIBPCRE2" && test_set_prereq PCRE
-test -n "$USE_LIBPCRE1" && test_set_prereq LIBPCRE1
+test -n "$USE_LIBPCRE2" && test_set_prereq PCRE
test -n "$USE_LIBPCRE2" && test_set_prereq LIBPCRE2
test -z "$NO_GETTEXT" && test_set_prereq GETTEXT
-if test -n "$GIT_TEST_GETTEXT_POISON_ORIG"
-then
- GIT_TEST_GETTEXT_POISON=$GIT_TEST_GETTEXT_POISON_ORIG
- export GIT_TEST_GETTEXT_POISON
- unset GIT_TEST_GETTEXT_POISON_ORIG
-fi
-
-test_lazy_prereq C_LOCALE_OUTPUT '
- ! test_bool_env GIT_TEST_GETTEXT_POISON false
-'
-
if test -z "$GIT_TEST_CHECK_CACHE_TREE"
then
GIT_TEST_CHECK_CACHE_TREE=true