summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/README19
-rw-r--r--t/helper/test-dir-iterator.c65
-rw-r--r--t/helper/test-example-decorate.c6
-rw-r--r--t/helper/test-hashmap.c9
-rw-r--r--t/helper/test-match-trees.c2
-rw-r--r--t/helper/test-oidmap.c112
-rw-r--r--t/helper/test-tool.c2
-rw-r--r--t/helper/test-tool.h2
-rw-r--r--t/lib-git-daemon.sh7
-rw-r--r--t/lib-git-svn.sh11
-rw-r--r--t/lib-httpd.sh15
-rw-r--r--t/lib-patch-mode.sh12
-rwxr-xr-xt/perf/p5600-clone-reference.sh27
-rwxr-xr-xt/t0000-basic.sh24
-rwxr-xr-xt/t0001-init.sh4
-rwxr-xr-xt/t0007-git-var.sh2
-rwxr-xr-xt/t0011-hashmap.sh67
-rwxr-xr-xt/t0016-oidmap.sh110
-rwxr-xr-xt/t0017-env-helper.sh99
-rwxr-xr-xt/t0027-auto-crlf.sh6
-rwxr-xr-xt/t0066-dir-iterator.sh148
-rwxr-xr-xt/t0090-cache-tree.sh4
-rwxr-xr-xt/t0205-gettext-poison.sh7
-rwxr-xr-xt/t1007-hash-object.sh58
-rwxr-xr-xt/t1090-sparse-checkout-scope.sh14
-rwxr-xr-xt/t1305-config-include.sh60
-rwxr-xr-xt/t1309-early-config.sh5
-rwxr-xr-xt/t1410-reflog.sh16
-rwxr-xr-xt/t1450-fsck.sh41
-rwxr-xr-xt/t1700-split-index.sh51
-rwxr-xr-xt/t2014-checkout-switch.sh (renamed from t/t2014-switch.sh)0
-rwxr-xr-xt/t2020-checkout-detach.sh28
-rwxr-xr-xt/t2060-switch.sh96
-rwxr-xr-xt/t2070-restore.sh98
-rwxr-xr-xt/t2071-restore-patch.sh110
-rwxr-xr-xt/t2203-add-intent.sh6
-rwxr-xr-xt/t2400-worktree-add.sh5
-rwxr-xr-xt/t3200-branch.sh16
-rwxr-xr-xt/t3203-branch-output.sh44
-rwxr-xr-xt/t3206-range-diff.sh124
-rw-r--r--t/t3206/history.export84
-rwxr-xr-xt/t3311-notes-merge-fanout.sh10
-rwxr-xr-xt/t3400-rebase.sh2
-rwxr-xr-xt/t3420-rebase-autostash.sh19
-rwxr-xr-xt/t3430-rebase-merges.sh13
-rwxr-xr-xt/t3510-cherry-pick-sequence.sh122
-rwxr-xr-xt/t3903-stash.sh7
-rwxr-xr-xt/t4014-format-patch.sh102
-rwxr-xr-xt/t4018-diff-funcname.sh1
-rw-r--r--t/t4018/matlab-class-definition5
-rw-r--r--t/t4018/matlab-function4
-rw-r--r--t/t4018/matlab-octave-section-13
-rw-r--r--t/t4018/matlab-octave-section-23
-rw-r--r--t/t4018/matlab-section3
-rw-r--r--t/t4018/rust-fn5
-rw-r--r--t/t4018/rust-impl5
-rw-r--r--t/t4018/rust-struct5
-rw-r--r--t/t4018/rust-trait5
-rwxr-xr-xt/t4202-log.sh2
-rwxr-xr-xt/t4203-mailmap.sh33
-rwxr-xr-xt/t5000-tar-tree.sh16
-rw-r--r--t/t5000/huge-object (renamed from t/t5000/19f9c8273ec45a8938e6999cb59b3ff66739902a)bin2048 -> 2048 bytes
-rwxr-xr-xt/t5200-update-server-info.sh41
-rwxr-xr-xt/t5310-pack-bitmaps.sh15
-rwxr-xr-xt/t5318-commit-graph.sh2
-rwxr-xr-xt/t5319-multi-pack-index.sh184
-rwxr-xr-xt/t5324-split-commit-graph.sh345
-rwxr-xr-xt/t5504-fetch-receive-strict.sh14
-rwxr-xr-xt/t5510-fetch.sh23
-rwxr-xr-xt/t5512-ls-remote.sh3
-rwxr-xr-xt/t5514-fetch-multiple.sh7
-rwxr-xr-xt/t5604-clone-reference.sh133
-rwxr-xr-xt/t5617-clone-submodules-remote.sh54
-rwxr-xr-xt/t5618-alternate-refs.sh60
-rwxr-xr-xt/t5702-protocol-v2.sh10
-rwxr-xr-xt/t5703-upload-pack-ref-in-want.sh4
-rwxr-xr-xt/t6000-rev-list-misc.sh20
-rwxr-xr-xt/t6030-bisect-porcelain.sh31
-rwxr-xr-xt/t6040-tracking-info.sh37
-rwxr-xr-xt/t6043-merge-rename-directories.sh111
-rwxr-xr-xt/t6200-fmt-merge-msg.sh7
-rwxr-xr-xt/t6300-for-each-ref.sh26
-rwxr-xr-xt/t6302-for-each-ref-filter.sh13
-rwxr-xr-xt/t7004-tag.sh21
-rwxr-xr-xt/t7060-wtstatus.sh5
-rwxr-xr-xt/t7064-wtstatus-pv2.sh8
-rwxr-xr-xt/t7201-co.sh2
-rwxr-xr-xt/t7405-submodule-merge.sh2
-rwxr-xr-xt/t7502-commit-porcelain.sh2
-rwxr-xr-xt/t7508-status.sh144
-rwxr-xr-xt/t7512-status-help.sh50
-rwxr-xr-xt/t7600-merge.sh46
-rwxr-xr-xt/t7610-mergetool.sh309
-rwxr-xr-xt/t7700-repack.sh23
-rwxr-xr-xt/t7810-grep.sh6
-rwxr-xr-xt/t7814-grep-recurse-submodules.sh18
-rwxr-xr-xt/t8003-blame-corner-cases.sh36
-rwxr-xr-xt/t8013-blame-ignore-revs.sh274
-rwxr-xr-xt/t8014-blame-ignore-fuzzy.sh437
-rwxr-xr-xt/t9001-send-email.sh102
-rwxr-xr-xt/t9300-fast-import.sh20
-rwxr-xr-xt/t9350-fast-export.sh78
-rw-r--r--t/t9350/broken-iso-8859-7-commit-message.txt1
-rw-r--r--t/t9350/simple-iso-8859-7-commit-message.txt1
-rwxr-xr-xt/t9801-git-p4-branch.sh132
-rwxr-xr-xt/t9817-git-p4-exclude.sh51
-rwxr-xr-xt/t9902-completion.sh2
-rwxr-xr-xt/t9903-bash-prompt.sh20
-rw-r--r--t/test-lib-functions.sh206
-rw-r--r--t/test-lib.sh28
110 files changed, 4478 insertions, 667 deletions
diff --git a/t/README b/t/README
index 6404f33e19..60d5b77bcc 100644
--- a/t/README
+++ b/t/README
@@ -334,11 +334,20 @@ that cannot be easily covered by a few specific test cases. These
could be enabled by running the test suite with correct GIT_TEST_
environment set.
-GIT_TEST_GETTEXT_POISON=<non-empty?> turns all strings marked for
-translation into gibberish if non-empty (think "test -n"). 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_FAIL_PREREQS=<boolean> fails all prerequisites. This is
+useful for discovering issues with the tests where say a later test
+implicitly depends on an optional earlier test.
+
+There's a "FAIL_PREREQS" prerequisite that can be used to test for
+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.
diff --git a/t/helper/test-dir-iterator.c b/t/helper/test-dir-iterator.c
new file mode 100644
index 0000000000..659b6bfa81
--- /dev/null
+++ b/t/helper/test-dir-iterator.c
@@ -0,0 +1,65 @@
+#include "test-tool.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
+#include "iterator.h"
+#include "dir-iterator.h"
+
+static const char *error_name(int error_number)
+{
+ switch (error_number) {
+ case ENOENT: return "ENOENT";
+ case ENOTDIR: return "ENOTDIR";
+ default: return "ESOMETHINGELSE";
+ }
+}
+
+/*
+ * usage:
+ * tool-test dir-iterator [--follow-symlinks] [--pedantic] directory_path
+ */
+int cmd__dir_iterator(int argc, const char **argv)
+{
+ struct dir_iterator *diter;
+ unsigned int flags = 0;
+ int iter_status;
+
+ for (++argv, --argc; *argv && starts_with(*argv, "--"); ++argv, --argc) {
+ if (strcmp(*argv, "--follow-symlinks") == 0)
+ flags |= DIR_ITERATOR_FOLLOW_SYMLINKS;
+ else if (strcmp(*argv, "--pedantic") == 0)
+ flags |= DIR_ITERATOR_PEDANTIC;
+ else
+ die("invalid option '%s'", *argv);
+ }
+
+ if (!*argv || argc != 1)
+ die("dir-iterator needs exactly one non-option argument");
+
+ diter = dir_iterator_begin(*argv, flags);
+
+ if (!diter) {
+ printf("dir_iterator_begin failure: %s\n", error_name(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ while ((iter_status = dir_iterator_advance(diter)) == ITER_OK) {
+ if (S_ISDIR(diter->st.st_mode))
+ printf("[d] ");
+ else if (S_ISREG(diter->st.st_mode))
+ printf("[f] ");
+ else if (S_ISLNK(diter->st.st_mode))
+ printf("[s] ");
+ else
+ printf("[?] ");
+
+ printf("(%s) [%s] %s\n", diter->relative_path, diter->basename,
+ diter->path.buf);
+ }
+
+ if (iter_status != ITER_DONE) {
+ printf("dir_iterator_advance failure\n");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/t/helper/test-example-decorate.c b/t/helper/test-example-decorate.c
index a20a6161e4..c8a1cde7d2 100644
--- a/t/helper/test-example-decorate.c
+++ b/t/helper/test-example-decorate.c
@@ -26,8 +26,8 @@ int cmd__example_decorate(int argc, const char **argv)
* Add 2 objects, one with a non-NULL decoration and one with a NULL
* decoration.
*/
- one = lookup_unknown_object(one_oid.hash);
- two = lookup_unknown_object(two_oid.hash);
+ one = lookup_unknown_object(&one_oid);
+ two = lookup_unknown_object(&two_oid);
ret = add_decoration(&n, one, &decoration_a);
if (ret)
BUG("when adding a brand-new object, NULL should be returned");
@@ -56,7 +56,7 @@ int cmd__example_decorate(int argc, const char **argv)
ret = lookup_decoration(&n, two);
if (ret != &decoration_b)
BUG("lookup should return added declaration");
- three = lookup_unknown_object(three_oid.hash);
+ three = lookup_unknown_object(&three_oid);
ret = lookup_decoration(&n, three);
if (ret)
BUG("lookup for unknown object should return NULL");
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c
index 23d2b172fe..aaf17b0ddf 100644
--- a/t/helper/test-hashmap.c
+++ b/t/helper/test-hashmap.c
@@ -173,14 +173,7 @@ int cmd__hashmap(int argc, const char **argv)
p2 = strtok(NULL, DELIM);
}
- if (!strcmp("hash", cmd) && p1) {
-
- /* print results of different hash functions */
- printf("%u %u %u %u\n",
- strhash(p1), memhash(p1, strlen(p1)),
- strihash(p1), memihash(p1, strlen(p1)));
-
- } else if (!strcmp("add", cmd) && p1 && p2) {
+ if (!strcmp("add", cmd) && p1 && p2) {
/* create entry with key = p1, value = p2 */
entry = alloc_test_entry(hash, p1, p2);
diff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c
index 96857f26ac..b9fd427571 100644
--- a/t/helper/test-match-trees.c
+++ b/t/helper/test-match-trees.c