summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/README6
-rwxr-xr-xt/check-non-portable-shell.pl2
-rw-r--r--t/helper/.gitignore1
-rw-r--r--t/helper/test-delta.c2
-rw-r--r--t/helper/test-hashmap.c3
-rw-r--r--t/helper/test-line-buffer.c32
-rw-r--r--t/helper/test-parse-options.c2
-rw-r--r--t/helper/test-ref-store.c2
-rw-r--r--t/helper/test-string-list.c2
-rwxr-xr-xt/lib-credential.sh19
-rwxr-xr-xt/t0001-init.sh12
-rwxr-xr-xt/t0040-parse-options.sh2
-rwxr-xr-xt/t1004-read-tree-m-u-wf.sh2
-rwxr-xr-xt/t1400-update-ref.sh5
-rwxr-xr-xt/t1401-symbolic-ref.sh26
-rwxr-xr-xt/t1402-check-ref-format.sh16
-rwxr-xr-xt/t1404-update-ref-errors.sh141
-rwxr-xr-xt/t1407-worktree-ref-store.sh30
-rwxr-xr-xt/t1450-fsck.sh22
-rwxr-xr-xt/t1500-rev-parse.sh15
-rwxr-xr-xt/t1502-rev-parse-parseopt.sh112
-rwxr-xr-xt/t3200-branch.sh327
-rwxr-xr-xt/t3203-branch-output.sh8
-rwxr-xr-xt/t3205-branch-color.sh5
-rwxr-xr-xt/t3308-notes-merge.sh2
-rwxr-xr-xt/t3404-rebase-interactive.sh33
-rwxr-xr-xt/t3415-rebase-autosquash.sh28
-rwxr-xr-xt/t3426-rebase-submodule.sh17
-rwxr-xr-xt/t3600-rm.sh2
-rwxr-xr-xt/t3701-add-interactive.sh18
-rwxr-xr-xt/t4013-diff-various.sh12
-rw-r--r--t/t4013/diff.diff-tree_--stat_initial_mode4
-rw-r--r--t/t4013/diff.diff-tree_--summary_initial_mode3
-rw-r--r--t/t4013/diff.diff-tree_initial_mode3
-rw-r--r--t/t4013/diff.log_--decorate=full_--all6
-rw-r--r--t/t4013/diff.log_--decorate_--all6
-rwxr-xr-xt/t4015-diff-whitespace.sh261
-rwxr-xr-xt/t4059-diff-submodule-not-initialized.sh2
-rwxr-xr-xt/t4201-shortlog.sh5
-rwxr-xr-xt/t4202-log.sh2
-rwxr-xr-xt/t4205-log-pretty-formats.sh6
-rwxr-xr-xt/t5001-archive-attr.sh47
-rwxr-xr-xt/t5002-archive-attr-pattern.sh2
-rwxr-xr-xt/t5004-archive-corner-cases.sh4
-rwxr-xr-xt/t5150-request-pull.sh4
-rwxr-xr-xt/t5304-prune.sh37
-rwxr-xr-xt/t5531-deep-submodule-push.sh10
-rwxr-xr-xt/t5572-pull-submodule.sh32
-rwxr-xr-xt/t5580-clone-push-unc.sh14
-rwxr-xr-xt/t5601-clone.sh2
-rwxr-xr-xt/t6002-rev-list-bisect.sh18
-rwxr-xr-xt/t6006-rev-list-format.sh3
-rwxr-xr-xt/t6007-rev-list-cherry-pick-file.sh32
-rwxr-xr-xt/t6013-rev-list-reverse-parents.sh4
-rwxr-xr-xt/t6040-tracking-info.sh24
-rwxr-xr-xt/t6120-describe.sh89
-rwxr-xr-xt/t6132-pathspec-exclude.sh13
-rwxr-xr-xt/t6300-for-each-ref.sh103
-rwxr-xr-xt/t7001-mv.sh29
-rwxr-xr-xt/t7004-tag.sh15
-rwxr-xr-xt/t7005-editor.sh6
-rwxr-xr-xt/t7006-pager.sh20
-rwxr-xr-xt/t7061-wtstatus-ignore.sh11
-rwxr-xr-xt/t7102-reset.sh4
-rwxr-xr-xt/t7201-co.sh4
-rwxr-xr-xt/t7301-clean-interactive.sh5
-rwxr-xr-xt/t7400-submodule-basic.sh2
-rwxr-xr-xt/t7405-submodule-merge.sh2
-rwxr-xr-xt/t7406-submodule-update.sh8
-rwxr-xr-xt/t7502-commit.sh4
-rwxr-xr-xt/t7504-commit-msg-hook.sh64
-rwxr-xr-xt/t7506-status-submodule.sh4
-rwxr-xr-xt/t7508-status.sh51
-rwxr-xr-xt/t7600-merge.sh6
-rwxr-xr-xt/t7610-mergetool.sh4
-rwxr-xr-xt/t8010-cat-file-filters.sh5
-rwxr-xr-xt/t9001-send-email.sh10
-rwxr-xr-xt/t9010-svn-fe.sh55
-rwxr-xr-xt/t9114-git-svn-dcommit-merge.sh4
-rwxr-xr-xt/t9300-fast-import.sh142
-rwxr-xr-xt/t9350-fast-export.sh20
-rwxr-xr-xt/t9400-git-cvsserver-server.sh48
-rwxr-xr-xt/t9902-completion.sh4
-rw-r--r--t/test-lib.sh38
-rwxr-xr-xt/test-terminal.perl1
85 files changed, 1868 insertions, 340 deletions
diff --git a/t/README b/t/README
index 2f95860369..4b079e4494 100644
--- a/t/README
+++ b/t/README
@@ -265,12 +265,12 @@ or:
$ sh ./t9200-git-cvsexport-commit.sh --run='-3 21'
-As noted above, the test set is built going though items left to
-right, so this:
+As noted above, the test set is built by going through the items
+from left to right, so this:
$ sh ./t9200-git-cvsexport-commit.sh --run='1-4 !3'
-will run tests 1, 2, and 4. Items that comes later have higher
+will run tests 1, 2, and 4. Items that come later have higher
precedence. It means that this:
$ sh ./t9200-git-cvsexport-commit.sh --run='!3 1-4'
diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
index b170cbc045..03dc9d2852 100755
--- a/t/check-non-portable-shell.pl
+++ b/t/check-non-portable-shell.pl
@@ -17,7 +17,7 @@ sub err {
while (<>) {
chomp;
/\bsed\s+-i/ and err 'sed -i is not portable';
- /\becho\s+-n/ and err 'echo -n is not portable (please use printf)';
+ /\becho\s+-[neE]/ and err 'echo with option is not portable (please use printf)';
/^\s*declare\s+/ and err 'arrays/declare not portable';
/^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)';
/\btest\s+[^=]*==/ and err '"test a == b" is not portable (please use =)';
diff --git a/t/helper/.gitignore b/t/helper/.gitignore
index 721650256e..7c9d28a834 100644
--- a/t/helper/.gitignore
+++ b/t/helper/.gitignore
@@ -35,3 +35,4 @@
/test-svn-fe
/test-urlmatch-normalization
/test-wildmatch
+/test-write-cache
diff --git a/t/helper/test-delta.c b/t/helper/test-delta.c
index 59937dc1be..591730adc4 100644
--- a/t/helper/test-delta.c
+++ b/t/helper/test-delta.c
@@ -69,7 +69,7 @@ int cmd_main(int argc, const char **argv)
}
fd = open (argv[4], O_WRONLY|O_CREAT|O_TRUNC, 0666);
- if (fd < 0 || write_in_full(fd, out_buf, out_size) != out_size) {
+ if (fd < 0 || write_in_full(fd, out_buf, out_size) < 0) {
perror(argv[4]);
return 1;
}
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c
index 6004c81f0b..1145d51671 100644
--- a/t/helper/test-hashmap.c
+++ b/t/helper/test-hashmap.c
@@ -235,7 +235,8 @@ int cmd_main(int argc, const char **argv)
} else if (!strcmp("size", cmd)) {
/* print table sizes */
- printf("%u %u\n", map.tablesize, map.size);
+ printf("%u %u\n", map.tablesize,
+ hashmap_get_size(&map));
} else if (!strcmp("intern", cmd) && l1) {
diff --git a/t/helper/test-line-buffer.c b/t/helper/test-line-buffer.c
index 81575fe2ab..078dd7e29d 100644
--- a/t/helper/test-line-buffer.c
+++ b/t/helper/test-line-buffer.c
@@ -17,27 +17,17 @@ static uint32_t strtouint32(const char *s)
static void handle_command(const char *command, const char *arg, struct line_buffer *buf)
{
- switch (*command) {
- case 'b':
- if (starts_with(command, "binary ")) {
- struct strbuf sb = STRBUF_INIT;
- strbuf_addch(&sb, '>');
- buffer_read_binary(buf, &sb, strtouint32(arg));
- fwrite(sb.buf, 1, sb.len, stdout);
- strbuf_release(&sb);
- return;
- }
- case 'c':
- if (starts_with(command, "copy ")) {
- buffer_copy_bytes(buf, strtouint32(arg));
- return;
- }
- case 's':
- if (starts_with(command, "skip ")) {
- buffer_skip_bytes(buf, strtouint32(arg));
- return;
- }
- default:
+ if (starts_with(command, "binary ")) {
+ struct strbuf sb = STRBUF_INIT;
+ strbuf_addch(&sb, '>');
+ buffer_read_binary(buf, &sb, strtouint32(arg));
+ fwrite(sb.buf, 1, sb.len, stdout);
+ strbuf_release(&sb);
+ } else if (starts_with(command, "copy ")) {
+ buffer_copy_bytes(buf, strtouint32(arg));
+ } else if (starts_with(command, "skip ")) {
+ buffer_skip_bytes(buf, strtouint32(arg));
+ } else {
die("unrecognized command: %s", command);
}
}
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c
index 75fe883aac..630c76d127 100644
--- a/t/helper/test-parse-options.c
+++ b/t/helper/test-parse-options.c
@@ -99,6 +99,8 @@ int cmd_main(int argc, const char **argv)
const char *prefix = "prefix/";
const char *usage[] = {
"test-parse-options <options>",
+ "",
+ "A helper function for the parse-options API.",
NULL
};
struct string_list expect = STRING_LIST_INIT_NODUP;
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index 05d8c4d8af..6ec2670044 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -135,7 +135,7 @@ static int cmd_resolve_ref(struct ref_store *refs, const char **argv)
ref = refs_resolve_ref_unsafe(refs, refname, resolve_flags,
sha1, &flags);
- printf("%s %s 0x%x\n", sha1_to_hex(sha1), ref, flags);
+ printf("%s %s 0x%x\n", sha1_to_hex(sha1), ref ? ref : "(null)", flags);
return ref ? 0 : 1;
}
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index c502fa16d3..829ec3d7d2 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -108,7 +108,7 @@ int cmd_main(int argc, const char **argv)
* Split by newline, but don't create a string_list item
* for the empty string after the last separator.
*/
- if (sb.buf[sb.len - 1] == '\n')
+ if (sb.len && sb.buf[sb.len - 1] == '\n')
strbuf_setlen(&sb, sb.len - 1);
string_list_split_in_place(&list, sb.buf, '\n', -1);
diff --git a/t/lib-credential.sh b/t/lib-credential.sh
index d8e41f7ddd..937b831ea6 100755
--- a/t/lib-credential.sh
+++ b/t/lib-credential.sh
@@ -44,6 +44,7 @@ helper_test_clean() {
reject $1 https example.com user2
reject $1 http path.tld user
reject $1 https timeout.tld user
+ reject $1 https sso.tld
}
reject() {
@@ -250,6 +251,24 @@ helper_test() {
password=pass2
EOF
'
+
+ test_expect_success "helper ($HELPER) can store empty username" '
+ check approve $HELPER <<-\EOF &&
+ protocol=https
+ host=sso.tld
+ username=
+ password=
+ EOF
+ check fill $HELPER <<-\EOF
+ protocol=https
+ host=sso.tld
+ --
+ protocol=https
+ host=sso.tld
+ username=
+ password=
+ EOF
+ '
}
helper_test_timeout() {
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 86c1a51654..c413bff9cf 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -453,4 +453,16 @@ test_expect_success 're-init from a linked worktree' '
)
'
+test_expect_success MINGW 'redirect std handles' '
+ GIT_REDIRECT_STDOUT=output.txt git rev-parse --git-dir &&
+ test .git = "$(cat output.txt)" &&
+ test -z "$(GIT_REDIRECT_STDOUT=off git rev-parse --git-dir)" &&
+ test_must_fail env \
+ GIT_REDIRECT_STDOUT=output.txt \
+ GIT_REDIRECT_STDERR="2>&1" \
+ git rev-parse --git-dir --verify refs/invalid &&
+ printf ".git\nfatal: Needed a single revision\n" >expect &&
+ test_cmp expect output.txt
+'
+
test_done
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 74d2cd76fe..0c2fc81d7b 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -10,6 +10,8 @@ test_description='our own option parser'
cat >expect <<\EOF
usage: test-parse-options <options>
+ A helper function for the parse-options API.
+
--yes get a boolean
-D, --no-doubt begins with 'no-'
-B, --no-fear be brave
diff --git a/t/t1004-read-tree-m-u-wf.sh b/t/t1004-read-tree-m-u-wf.sh
index c70cf42300..c7ce5d8bb5 100755
--- a/t/t1004-read-tree-m-u-wf.sh
+++ b/t/t1004-read-tree-m-u-wf.sh
@@ -218,7 +218,7 @@ test_expect_success 'D/F' '
echo "100644 $a 2 subdir/file2"
echo "100644 $b 3 subdir/file2/another"
) >expect &&
- test_cmp actual expect
+ test_cmp expect actual
'
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index dc98b4bc6d..664a3a4e4e 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -1253,7 +1253,10 @@ run_with_limited_open_files () {
(ulimit -n 32 && "$@")
}
-test_lazy_prereq ULIMIT_FILE_DESCRIPTORS 'run_with_limited_open_files true'
+test_lazy_prereq ULIMIT_FILE_DESCRIPTORS '
+ test_have_prereq !MINGW,!CYGWIN &&
+ run_with_limited_open_files true
+'
test_expect_success ULIMIT_FILE_DESCRIPTORS 'large transaction creating branches does not burst open file limit' '
(
diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh
index eec3e90f9c..9e782a8122 100755
--- a/t/t1401-symbolic-ref.sh
+++ b/t/t1401-symbolic-ref.sh
@@ -129,11 +129,35 @@ test_expect_success 'symbolic-ref does not create ref d/f conflicts' '
test_must_fail git symbolic-ref refs/heads/df/conflict refs/heads/df
'
-test_expect_success 'symbolic-ref handles existing pointer to invalid name' '
+test_expect_success 'symbolic-ref can overwrite pointer to invalid name' '
+ test_when_finished reset_to_sane &&
head=$(git rev-parse HEAD) &&
git symbolic-ref HEAD refs/heads/outer &&
+ test_when_finished "git update-ref -d refs/heads/outer/inner" &&
git update-ref refs/heads/outer/inner $head &&
git symbolic-ref HEAD refs/heads/unrelated
'
+test_expect_success 'symbolic-ref can resolve d/f name (EISDIR)' '
+ test_when_finished reset_to_sane &&
+ head=$(git rev-parse HEAD) &&
+ git symbolic-ref HEAD refs/heads/outer/inner &&
+ test_when_finished "git update-ref -d refs/heads/outer" &&
+ git update-ref refs/heads/outer $head &&
+ echo refs/heads/outer/inner >expect &&
+ git symbolic-ref HEAD >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'symbolic-ref can resolve d/f name (ENOTDIR)' '
+ test_when_finished reset_to_sane &&
+ head=$(git rev-parse HEAD) &&
+ git symbolic-ref HEAD refs/heads/outer &&
+ test_when_finished "git update-ref -d refs/heads/outer/inner" &&
+ git update-ref refs/heads/outer/inner $head &&
+ echo refs/heads/outer >expect &&
+ git symbolic-ref HEAD >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh
index 0790edf60d..98e4a8613b 100755
--- a/t/t1402-check-ref-format.sh
+++ b/t/t1402-check-ref-format.sh
@@ -144,6 +144,11 @@ test_expect_success "check-ref-format --branch @{-1}" '
refname2=$(git check-ref-format --branch @{-2}) &&
test "$refname2" = master'
+test_expect_success 'check-ref-format --branch -naster' '
+ test_must_fail git check-ref-format --branch -naster >actual &&
+ test_must_be_empty actual
+'
+
test_expect_success 'check-ref-format --branch from subdir' '
mkdir subdir &&
@@ -161,6 +166,17 @@ test_expect_success 'check-ref-format --branch from subdir' '
test "$refname" = "$sha1"
'
+test_expect_success 'check-ref-format --branch @{-1} from non-repo' '
+ nongit test_must_fail git check-ref-format --branch @{-1} >actual &&
+ test_must_be_empty actual
+'
+
+test_expect_success 'check-ref-format --branch master from non-repo' '
+ echo master >expect &&
+ nongit git check-ref-format --branch master >actual &&