Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/helper/test-bloom.c4
-rw-r--r--t/helper/test-pkt-line.c4
-rw-r--r--t/helper/test-regex.c94
-rw-r--r--t/lib-httpd.sh2
-rw-r--r--t/lib-httpd/apache.conf8
-rw-r--r--t/lib-httpd/incomplete-body-upload-pack-v2-http.sh3
-rw-r--r--t/lib-httpd/incomplete-length-upload-pack-v2-http.sh3
-rwxr-xr-xt/perf/p5310-pack-bitmaps.sh10
-rwxr-xr-xt/t0091-bugreport.sh15
-rwxr-xr-xt/t0095-bloom.sh8
-rwxr-xr-xt/t0500-progress-display.sh26
-rwxr-xr-xt/t1450-fsck.sh29
-rwxr-xr-xt/t1509-root-work-tree.sh4
-rwxr-xr-xt/t2018-checkout-branch.sh10
-rwxr-xr-xt/t2027-checkout-track.sh24
-rwxr-xr-xt/t2060-switch.sh8
-rwxr-xr-xt/t3415-rebase-autosquash.sh16
-rwxr-xr-xt/t3701-add-interactive.sh19
-rwxr-xr-xt/t4014-format-patch.sh13
-rwxr-xr-xt/t4045-diff-relative.sh82
-rwxr-xr-xt/t4067-diff-partial-clone.sh4
-rwxr-xr-xt/t4202-log.sh2
-rwxr-xr-xt/t4210-log-i18n.sh77
-rwxr-xr-xt/t4211-line-log.sh68
-rwxr-xr-xt/t4216-log-bloom.sh4
-rwxr-xr-xt/t5318-commit-graph.sh25
-rwxr-xr-xt/t5319-multi-pack-index.sh27
-rwxr-xr-xt/t5500-fetch-pack.sh12
-rwxr-xr-xt/t5520-pull.sh2
-rwxr-xr-xt/t5608-clone-2gb.sh11
-rwxr-xr-xt/t5616-partial-clone.sh7
-rwxr-xr-xt/t5702-protocol-v2.sh47
-rwxr-xr-xt/t5703-upload-pack-ref-in-want.sh9
-rwxr-xr-xt/t6030-bisect-porcelain.sh9
-rwxr-xr-xt/t6042-merge-rename-corner-cases.sh55
-rwxr-xr-xt/t6113-rev-list-bitmap-filters.sh21
-rwxr-xr-xt/t6200-fmt-merge-msg.sh2
-rwxr-xr-xt/t9300-fast-import.sh28
-rwxr-xr-xt/t9834-git-p4-file-dir-bug.sh70
-rw-r--r--t/test-lib.sh34
40 files changed, 781 insertions, 115 deletions
diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c
index 77eb27adac..f0aa80b98e 100644
--- a/t/helper/test-bloom.c
+++ b/t/helper/test-bloom.c
@@ -3,7 +3,7 @@
#include "test-tool.h"
#include "commit.h"
-struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;
+static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;
static void add_string_to_filter(const char *data, struct bloom_filter *filter) {
struct bloom_key key;
@@ -44,7 +44,7 @@ static void get_bloom_filter_for_commit(const struct object_id *commit_oid)
}
static const char *bloom_usage = "\n"
-" test-tool bloom get_murmer3 <string>\n"
+" test-tool bloom get_murmur3 <string>\n"
" test-tool bloom generate_filter <string> [<string>...]\n"
" test-tool get_filter_for_commit <commit-hex>\n";
diff --git a/t/helper/test-pkt-line.c b/t/helper/test-pkt-line.c
index 12ca698e17..69152958e5 100644
--- a/t/helper/test-pkt-line.c
+++ b/t/helper/test-pkt-line.c
@@ -46,6 +46,9 @@ static void unpack(void)
case PACKET_READ_DELIM:
printf("0001\n");
break;
+ case PACKET_READ_RESPONSE_END:
+ printf("0002\n");
+ break;
}
}
}
@@ -75,6 +78,7 @@ static void unpack_sideband(void)
case PACKET_READ_FLUSH:
return;
case PACKET_READ_DELIM:
+ case PACKET_READ_RESPONSE_END:
break;
}
}
diff --git a/t/helper/test-regex.c b/t/helper/test-regex.c
index 10284cc56f..d6f28ca8d1 100644
--- a/t/helper/test-regex.c
+++ b/t/helper/test-regex.c
@@ -1,5 +1,4 @@
#include "test-tool.h"
-#include "git-compat-util.h"
#include "gettext.h"
struct reg_flag {
@@ -8,12 +7,13 @@ struct reg_flag {
};
static struct reg_flag reg_flags[] = {
- { "EXTENDED", REG_EXTENDED },
- { "NEWLINE", REG_NEWLINE },
- { "ICASE", REG_ICASE },
- { "NOTBOL", REG_NOTBOL },
+ { "EXTENDED", REG_EXTENDED },
+ { "NEWLINE", REG_NEWLINE },
+ { "ICASE", REG_ICASE },
+ { "NOTBOL", REG_NOTBOL },
+ { "NOTEOL", REG_NOTEOL },
#ifdef REG_STARTEND
- { "STARTEND", REG_STARTEND },
+ { "STARTEND", REG_STARTEND },
#endif
{ NULL, 0 }
};
@@ -41,36 +41,74 @@ int cmd__regex(int argc, const char **argv)
{
const char *pat;
const char *str;
- int flags = 0;
+ int ret, silent = 0, flags = 0;
regex_t r;
regmatch_t m[1];
-
- if (argc == 2 && !strcmp(argv[1], "--bug"))
- return test_regex_bug();
- else if (argc < 3)
- usage("test-tool regex --bug\n"
- "test-tool regex <pattern> <string> [<options>]");
+ char errbuf[64];
argv++;
- pat = *argv++;
- str = *argv++;
- while (*argv) {
- struct reg_flag *rf;
- for (rf = reg_flags; rf->name; rf++)
- if (!strcmp(*argv, rf->name)) {
- flags |= rf->flag;
- break;
- }
- if (!rf->name)
- die("do not recognize %s", *argv);
+ argc--;
+
+ if (!argc)
+ goto usage;
+
+ if (!strcmp(*argv, "--bug")) {
+ if (argc == 1)
+ return test_regex_bug();
+ else
+ goto usage;
+ }
+ if (!strcmp(*argv, "--silent")) {
+ silent = 1;
argv++;
+ argc--;
+ }
+ if (!argc)
+ goto usage;
+
+ pat = *argv++;
+ if (argc == 1)
+ str = NULL;
+ else {
+ str = *argv++;
+ while (*argv) {
+ struct reg_flag *rf;
+ for (rf = reg_flags; rf->name; rf++)
+ if (!strcmp(*argv, rf->name)) {
+ flags |= rf->flag;
+ break;
+ }
+ if (!rf->name)
+ die("do not recognize flag %s", *argv);
+ argv++;
+ }
}
git_setup_gettext();
- if (regcomp(&r, pat, flags))
- die("failed regcomp() for pattern '%s'", pat);
- if (regexec(&r, str, 1, m, 0))
- return 1;
+ ret = regcomp(&r, pat, flags);
+ if (ret) {
+ if (silent)
+ return ret;
+
+ regerror(ret, &r, errbuf, sizeof(errbuf));
+ die("failed regcomp() for pattern '%s' (%s)", pat, errbuf);
+ }
+ if (!str)
+ return 0;
+
+ ret = regexec(&r, str, 1, m, 0);
+ if (ret) {
+ if (silent || ret == REG_NOMATCH)
+ return ret;
+
+ regerror(ret, &r, errbuf, sizeof(errbuf));
+ die("failed regexec() for subject '%s' (%s)", str, errbuf);
+ }
return 0;
+usage:
+ usage("\ttest-tool regex --bug\n"
+ "\ttest-tool regex [--silent] <pattern>\n"
+ "\ttest-tool regex [--silent] <pattern> <string> [<options>]");
+ return -1;
}
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 1449ee95e9..d2edfa4c50 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -129,6 +129,8 @@ install_script () {
prepare_httpd() {
mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH"
cp "$TEST_PATH"/passwd "$HTTPD_ROOT_PATH"
+ install_script incomplete-length-upload-pack-v2-http.sh
+ install_script incomplete-body-upload-pack-v2-http.sh
install_script broken-smart-http.sh
install_script error-smart-http.sh
install_script error.sh
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 994e5290d6..afa91e38b0 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -117,6 +117,8 @@ Alias /auth/dumb/ www/auth/dumb/
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
SetEnv GIT_HTTP_EXPORT_ALL
</LocationMatch>
+ScriptAlias /smart/incomplete_length/git-upload-pack incomplete-length-upload-pack-v2-http.sh/
+ScriptAlias /smart/incomplete_body/git-upload-pack incomplete-body-upload-pack-v2-http.sh/
ScriptAliasMatch /error_git_upload_pack/(.*)/git-upload-pack error.sh/
ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1
ScriptAlias /broken_smart/ broken-smart-http.sh/
@@ -126,6 +128,12 @@ ScriptAliasMatch /one_time_perl/(.*) apply-one-time-perl.sh/$1
<Directory ${GIT_EXEC_PATH}>
Options FollowSymlinks
</Directory>
+<Files incomplete-length-upload-pack-v2-http.sh>
+ Options ExecCGI
+</Files>
+<Files incomplete-body-upload-pack-v2-http.sh>
+ Options ExecCGI
+</Files>
<Files broken-smart-http.sh>
Options ExecCGI
</Files>
diff --git a/t/lib-httpd/incomplete-body-upload-pack-v2-http.sh b/t/lib-httpd/incomplete-body-upload-pack-v2-http.sh
new file mode 100644
index 0000000000..90e73ef8d5
--- /dev/null
+++ b/t/lib-httpd/incomplete-body-upload-pack-v2-http.sh
@@ -0,0 +1,3 @@
+printf "Content-Type: text/%s\n" "application/x-git-upload-pack-result"
+echo
+printf "%s%s" "0079" "45"
diff --git a/t/lib-httpd/incomplete-length-upload-pack-v2-http.sh b/t/lib-httpd/incomplete-length-upload-pack-v2-http.sh
new file mode 100644
index 0000000000..dce552e348
--- /dev/null
+++ b/t/lib-httpd/incomplete-length-upload-pack-v2-http.sh
@@ -0,0 +1,3 @@
+printf "Content-Type: text/%s\n" "application/x-git-upload-pack-result"
+echo
+printf "%s" "00"
diff --git a/t/perf/p5310-pack-bitmaps.sh b/t/perf/p5310-pack-bitmaps.sh
index 80c53edca7..b3e725f031 100755
--- a/t/perf/p5310-pack-bitmaps.sh
+++ b/t/perf/p5310-pack-bitmaps.sh
@@ -53,6 +53,11 @@ test_perf 'rev-list count with blob:limit=1k' '
--filter=blob:limit=1k >/dev/null
'
+test_perf 'rev-list count with tree:0' '
+ git rev-list --use-bitmap-index --count --objects --all \
+ --filter=tree:0 >/dev/null
+'
+
test_perf 'simulated partial clone' '
git pack-objects --stdout --all --filter=blob:none </dev/null >/dev/null
'
@@ -86,4 +91,9 @@ test_perf 'pack to file (partial bitmap)' '
git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
'
+test_perf 'rev-list with tree filter (partial bitmap)' '
+ git rev-list --use-bitmap-index --count --objects --all \
+ --filter=tree:0 >/dev/null
+'
+
test_done
diff --git a/t/t0091-bugreport.sh b/t/t0091-bugreport.sh
index 2e73658a5c..526304ff95 100755
--- a/t/t0091-bugreport.sh
+++ b/t/t0091-bugreport.sh
@@ -57,5 +57,20 @@ test_expect_success 'can create leading directories outside of a git dir' '
nongit git bugreport -o foo/bar/baz
'
+test_expect_success 'indicates populated hooks' '
+ test_when_finished rm git-bugreport-hooks.txt &&
+ test_when_finished rm -fr .git/hooks &&
+ rm -fr .git/hooks &&
+ mkdir .git/hooks &&
+ for hook in applypatch-msg prepare-commit-msg.sample
+ do
+ write_script ".git/hooks/$hook" <<-EOF || return 1
+ echo "hook $hook exists"
+ EOF
+ done &&
+ git bugreport -s hooks &&
+ grep applypatch-msg git-bugreport-hooks.txt &&
+ ! grep prepare-commit-msg git-bugreport-hooks.txt
+'
test_done
diff --git a/t/t0095-bloom.sh b/t/t0095-bloom.sh
index 8f9eef116d..232ba2c485 100755
--- a/t/t0095-bloom.sh
+++ b/t/t0095-bloom.sh
@@ -89,8 +89,8 @@ test_expect_success 'get bloom filter for commit with 10 changes' '
git add smallDir &&
git commit -m "commit with 10 changes" &&
cat >expect <<-\EOF &&
- Filter_Length:25
- Filter_Data:82|a0|65|47|0c|92|90|c0|a1|40|02|a0|e2|40|e0|04|0a|9a|66|cf|80|19|85|42|23|
+ Filter_Length:14
+ Filter_Data:02|b3|c4|a0|34|e7|fe|eb|cb|47|fe|a0|e8|72|
EOF
test-tool bloom get_filter_for_commit "$(git rev-parse HEAD)" >actual &&
test_cmp expect actual
@@ -100,7 +100,7 @@ test_expect_success EXPENSIVE 'get bloom filter for commit with 513 changes' '
rm actual &&
rm expect &&
mkdir bigDir &&
- for i in $(test_seq 0 512)
+ for i in $(test_seq 0 511)
do
echo $i >bigDir/$i
done &&
@@ -114,4 +114,4 @@ test_expect_success EXPENSIVE 'get bloom filter for commit with 513 changes' '
test_cmp expect actual
'
-test_done \ No newline at end of file
+test_done
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index d2d088d9a0..1ed1df351c 100755
--- a/t/t0500-progress-display.sh
+++ b/t/t0500-progress-display.sh
@@ -283,4 +283,30 @@ test_expect_success 'cover up after throughput shortens a lot' '
test_i18ncmp expect out
'
+test_expect_success 'progress generates traces' '
+ cat >in <<-\EOF &&
+ throughput 102400 1000
+ update
+ progress 10
+ throughput 204800 2000
+ update
+ progress 20
+ throughput 307200 3000
+ update
+ progress 30
+ throughput 409600 4000
+ update
+ progress 40
+ EOF
+
+ GIT_TRACE2_EVENT="$(pwd)/trace.event" test-tool progress --total=40 \
+ "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 &&
+ grep "\"key\":\"total_objects\",\"value\":\"40\"" trace.event &&
+ grep "\"key\":\"total_bytes\",\"value\":\"409600\"" trace.event
+'
+
test_done
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 449ebc5657..344a2aad82 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -257,6 +257,35 @@ test_expect_success 'tree object with duplicate entries' '
test_i18ngrep "error in tree .*contains duplicate file entries" out
'
+check_duplicate_names () {
+ expect=$1 &&
+ shift &&
+ names=$@ &&
+ test_expect_$expect "tree object with duplicate names: $names" '
+ test_when_finished "remove_object \$blob" &&
+ test_when_finished "remove_object \$tree" &&
+ test_when_finished "remove_object \$badtree" &&
+ blob=$(echo blob | git hash-object -w --stdin) &&
+ printf "100644 blob %s\t%s\n" $blob x.2 >tree &&
+ tree=$(git mktree <tree) &&
+ for name in $names
+ do
+ case "$name" in
+ */) printf "040000 tree %s\t%s\n" $tree "${name%/}" ;;
+ *) printf "100644 blob %s\t%s\n" $blob "$name" ;;
+ esac
+ done >badtree &&
+ badtree=$(git mktree <badtree) &&
+ test_must_fail git fsck 2>out &&
+ test_i18ngrep "$badtree" out &&
+ test_i18ngrep "error in tree .*contains duplicate file entries" out
+ '
+}
+
+check_duplicate_names success x x.1 x/
+check_duplicate_names success x x.1.2 x.1/ x/
+check_duplicate_names success x x.1 x.1.2 x/
+
test_expect_success 'unparseable tree object' '
test_oid_cache <<-\EOF &&
junk sha1:twenty-bytes-of-junk
diff --git a/t/t1509-root-work-tree.sh b/t/t1509-root-work-tree.sh
index 553a3f601b..fd2f7abf1c 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_cmp expected result
+ test_i18ncmp 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_cmp expected result
+ test_i18ncmp expected result
'
test_vars 'auto gitdir, root' "." "" ""
diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh
index 21583154d8..5f761bc616 100755
--- a/t/t2018-checkout-branch.sh
+++ b/t/t2018-checkout-branch.sh
@@ -260,4 +260,14 @@ test_expect_success 'checkout -b to a new branch preserves mergeable changes des
test_cmp expect actual
'
+test_expect_success 'checkout -b rejects an invalid start point' '
+ test_must_fail git checkout -b branch4 file1 2>err &&
+ test_i18ngrep "is not a commit" err
+'
+
+test_expect_success 'checkout -b rejects an extra path argument' '
+ test_must_fail git checkout -b branch5 branch1 file1 2>err &&
+ test_i18ngrep "Cannot update paths and switch to branch" err
+'
+
test_done
diff --git a/t/t2027-checkout-track.sh b/t/t2027-checkout-track.sh
new file mode 100755
index 0000000000..bcba1bf90c
--- /dev/null
+++ b/t/t2027-checkout-track.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+test_description='tests for git branch --track'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ test_commit one &&
+ test_commit two
+'
+
+test_expect_success 'checkout --track -b creates a new tracking branch' '
+ git checkout --track -b branch1 master &&
+ test $(git rev-parse --abbrev-ref HEAD) = branch1 &&
+ test $(git config --get branch.branch1.remote) = . &&
+ test $(git config --get branch.branch1.merge) = refs/heads/master
+'
+
+test_expect_success 'checkout --track -b rejects an extra path argument' '
+ test_must_fail git checkout --track -b branch2 master one.t 2>err &&
+ test_i18ngrep "cannot be used with updating paths" err
+'
+
+test_done
diff --git a/t/t2060-switch.sh b/t/t2060-switch.sh
index f9efa29dfb..2c1b8c0d6d 100755
--- a/t/t2060-switch.sh
+++ b/t/t2060-switch.sh
@@ -68,6 +68,14 @@ test_expect_success 'new orphan branch from empty' '
test_cmp expected tracked-files
'
+test_expect_success 'orphan branch works with --discard-changes' '
+ test_when_finished git switch master &&
+ echo foo >foo.txt &&
+ git switch --discard-changes --orphan new-orphan2 &&
+ git ls-files >tracked-files &&
+ test_must_be_empty tracked-files
+'
+
test_expect_success 'switching ignores file of same branch name' '
test_when_finished git switch master &&
: >first-branch &&
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index 093de9005b..7bab6000dc 100755
--- a/t/t3415-rebase-autosquash.sh
+++ b/t/t3415-rebase-autosquash.sh
@@ -424,4 +424,20 @@ test_expect_success 'abort last squash' '
! grep first actual
'
+test_expect_success 'fixup a fixup' '
+ echo 0to-fixup >file0 &&
+ test_tick &&
+ git commit -m "to-fixup" file0 &&
+ test_tick &&
+ git commit --squash HEAD -m X --allow-empty &&
+ test_tick &&
+ git commit --squash HEAD^ -m Y --allow-empty &&
+ test_tick &&
+ git commit -m "squash! $(git rev-parse HEAD^)" -m Z --allow-empty &&
+ test_tick &&
+ git commit -m "squash! $(git rev-parse HEAD^^)" -m W --allow-empty &&
+ git rebase -ki --autosquash HEAD~5 &&
+ test XZWY = $(git show | tr -cd W-Z)
+'
+
test_done
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index b3d8bb7577..49decbac71 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -412,6 +412,25 @@ test_expect_success 'deleting an empty file' '
diff_cmp expected diff
'
+test_expect_success 'adding an empty file' '
+ git init added &&
+ (
+ cd added &&
+ test_commit initial &&
+ >empty &&
+ git add empty &&
+ test_tick &&
+ git commit -m empty &&
+ git tag added-file &&
+ git reset --hard HEAD^ &&
+ test_path_is_missing empty &&
+
+ echo y | git checkout -p added-file -- >actual &&
+ test_path_is_file empty &&
+ test_i18ngrep "Apply addition to index and worktree" actual
+ )
+'
+
test_expect_success 'split hunk setup' '
git reset --hard &&
test_write_lines 10 20 30 40 50 60 >test &&
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index db7e733af9..575e079cc2 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -1602,6 +1602,19 @@ test_expect_success 'format patch ignores color.ui' '
test_cmp expect actual
'
+test_expect_success 'format patch respects diff.relative' '
+ rm -rf subdir &&
+ mkdir subdir &&
+ echo other content >subdir/file2 &&
+ git add subdir/file2 &&
+ git commit -F msg &&
+ test_unconfig diff.relative &&
+ git format-patch --relative=subdir --stdout -1 >expect &&
+ test_config diff.relative true &&
+ git -C subdir format-patch --stdout -1 >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'cover letter with invalid --cover-from-description and config' '
test_config branch.rebuild-1.description "config subject
diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
index 258808708e..7be1de736d 100755
--- a/t/t4045-diff-relative.sh
+++ b/t/t4045-diff-relative.sh
@@ -8,7 +8,8 @@ test_expect_success 'setup' '
echo content >file1 &&
mkdir subdir &&
echo other content >subdir/file2 &&
- blob=$(git hash-object subdir/file2) &&
+ blob_file1=$(git hash-object file1) &&
+ blob_file2=$(git hash-object subdir/file2) &&
git add . &&
git commit -m one
'
@@ -18,7 +19,7 @@ check_diff () {
shift
expect=$1
shift
- short_blob=$(git rev-parse --short $blob)
+ short_blob=$(git rev-parse --short $blob_file2)
cat >expected <<-EOF
diff --git a/$expect b/$expect
new file mode 100644
@@ -70,7 +71,7 @@ check_raw () {
expect=$1
shift
cat >expected <<-EOF
- :000000 100644 $ZERO_OID $blob A $expect
+ :000000 100644 $ZERO_OID $blob_file2 A $expect
EOF
test_expect_success "--raw $*" "
git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual &&
@@ -86,4 +87,79 @@ do
check_$type . dir/file2 --relative=sub
done
+check_diff_relative_option () {
+ dir=$1
+ shift
+ expect=$1
+ shift
+ relative_opt=$1
+ shift
+ test_expect_success "config diff.relative $relative_opt -p $*" "
+ short_blob=\$(git rev-parse --short $blob_file2) &&
+ cat >expected <<-EOF &&
+ diff --git a/$expect b/$expect
+ new file mode 100644
+ index 0000000..\$short_blob
+ --- /dev/null
+ +++ b/$expect
+ @@ -0,0 +1 @@
+ +other content
+ EOF
+ test_config -C $dir diff.relative $relative_opt &&
+ git -C '$dir' diff -p $* HEAD^ >actual &&
+ test_cmp expected actual
+ "
+}
+
+check_diff_no_relative_option () {
+ dir=$1
+ shift
+ expect=$1
+ shift
+ relative_opt=$1
+ shift
+ test_expect_success "config diff.relative $relative_opt -p $*" "
+ short_blob_file1=\$(git rev-parse --short $blob_file1) &&
+ short_blob_file2=\$(git rev-parse --short $blob_file2) &&
+ cat >expected <<-EOF &&
+ diff --git a/file1 b/file1
+ new file mode 100644
+ index 0000000..\$short_blob_file1
+ --- /dev/null
+ +++ b/file1
+ @@ -0,0 +1 @@
+ +content
+ diff --git a/$expect b/$expect
+ new file mode 100644
+ index 0000000..\$short_blob_file2
+ --- /dev/null
+ +++ b/$expect
+ @@ -0,0 +1 @@
+ +other content
+ EOF
+ test_config -C $dir diff.relative $relative_opt &&
+ git -C '$dir' diff -p $* HEAD^ >actual &&
+ test_cmp expected actual
+ "
+}
+
+check_diff_no_relative_option . subdir/file2 false
+check_diff_no_relative_option . subdir/file2 true --no-relative
+check_diff_no_relative_option . subdir/file2 false --no-relative
+check_diff_no_relative_option subdir subdir/file2 false
+check_diff_no_relative_option subdir subdir/file2 true --no-relative
+check_diff_no_relative_option subdir subdir/file2 false --no-relative
+
+check_diff_relative_option . file2 false --relative=subdir/
+check_diff_relative_option . file2 false --relative=subdir
+check_diff_relative_option . file2 true --relative=subdir/
+check_diff_relative_option . file2 true --relative=subdir
+check_diff_relative_option subdir file2 false --relative
+check_diff_relative_option subdir file2 true --relative
+check_diff_relative_option subdir file2 true
+check_diff_relative_option subdir file2 false --no-relative --relative
+check_diff_relative_option subdir file2 true --no-relative --relative
+check_diff_relative_option . file2 false --no-relative --relative=subdir
+check_diff_relative_option . file2 true --no-relative --relative=subdir
+
test_done
diff --git a/t/t4067-diff-partial-clone.sh b/t/t4067-diff-partial-clone.sh
index c1ed1c2fc4..ef8e0e9cb0 100755
--- a/t/t4067-diff-partial-clone.sh
+++ b/t/t4067-diff-partial-clone.sh
@@ -125,8 +125,8 @@ test_expect_success 'diff with rename detection batches blobs' '
# Ensure that there is exactly 1 negotiation by checking that there is
# only 1 "done" line sent. ("done" marks the end of negotiation.)
- GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff -M HEAD^ HEAD >out &&
- grep "similarity index" out &&
+ GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff --raw -M HEAD^ HEAD >out &&
+ grep ":100644 100644.*R[0-9][0-9][0-9].*b.*c" out &&
grep "git> done" trace >done_lines &&
test_line_count = 1 done_lines
'
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index f1ea7d97f5..a0930599aa 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -1692,7 +1692,7 @@ test_expect_success GPG 'log --graph --show-signature for merged tag with missin
GNUPGHOME=. git log --graph --show-signature -n1 plain-nokey >actual &&
grep "^|\\\ merged tag" actual &&
grep "^| | gpg: Signature made" actual &&
- grep "^| | gpg: Can'"'"'t check signature: \(public key not found\|No public key\)" actual
+ grep -E "^| | gpg: Can'"'"'t check signature: (public key not found|No public key)" actual
'
test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' '
diff --git a/t/t4210-log-i18n.sh b/t/t4210-log-i18n.sh
index c3792081e6..d2dfcf164e 100755
--- a/t/t4210-log-i18n.sh
+++ b/t/t4210-log-i18n.sh
@@ -10,6 +10,13 @@ latin1_e=$(printf '\351')
# invalid UTF-8
invalid_e=$(printf '\303\50)') # ")" at end to close opening "("
+have_reg_illseq=
+if test_have_prereq GETTEXT_LOCALE &&
+ ! LC_ALL=$is_IS_locale test-tool regex --silent $latin1_e
+then
+ have_reg_illseq=1
+fi
+
test_expect_success 'create commits in different encodings' '
test_tick &&
cat >msg <<-EOF &&
@@ -51,43 +58,77 @@ test_expect_success !MINGW 'log --grep does not find non-reencoded values (utf8)
test_must_be_empty actual
'
-test_expect_success !MINGW 'log --grep does not find non-reencoded values (latin1)' '
+test_expect_success 'log --grep does not find non-reencoded values (latin1)' '
git log --encoding=ISO-8859-1 --format=%s --grep=$utf8_e >actual &&
test_must_be_empty actual
'
+triggers_undefined_behaviour () {
+ local engine=$1
+
+ case $engine in
+ fixed)
+ if test -n "$have_reg_illseq" &&
+ ! test_have_prereq LIBPCRE2
+ then
+ return 0
+ fi
+ ;;
+ basic|extended)
+ if test -n "$have_reg_illseq"
+ then
+ return 0
+ fi
+ ;;
+ esac
+ return 1
+}
+
+mismatched_git_log () {
+ local pattern=$1
+
+ LC_ALL=$is_IS_locale git log --encoding=ISO-8859-1 --format=%s \
+ --grep=$pattern
+}
+
for engine in fixed basic extended perl
do
prereq=
if test $engine = "perl"
then
- prereq="PCRE"
- else
- prereq=""
+ prereq=PCRE
fi
force_regex=
if test $engine != "fixed"
then
- force_regex=.*
+ force_regex='.*'
fi
- test_expect_success !MINGW,!REGEX_ILLSEQ,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not find non-reencoded values (latin1 + locale)" "
- cat >expect <<-\EOF &&
- latin1
- utf8
- EOF
- LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$latin1_e\" >actual &&
- test_cmp expect actual
- "
- test_expect_success !MINGW,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not find non-reencoded values (latin1 + locale)" "
- LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$utf8_e\" >actual &&
- test_must_be_empty actual
+ test_expect_success $prereq "config grep.patternType=$engine" "
+ git config grep.patternType $engine
"
- test_expect_success !MINGW,!REGEX_ILLSEQ,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not die on invalid UTF-8 value (latin1 + locale + invalid needle)" "
- LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$invalid_e\" >actual &&
+ test_expect_success GETTEXT_LOCALE,$prereq "log --grep does not find non-reencoded values (latin1 + locale)" "
+ mismatched_git_log '$force_regex$utf8_e' >actual &&
test_must_be_empty actual
"
+
+ if ! triggers_undefined_behaviour $engine
+ then
+ test_expect_success !MINGW,GETTEXT_LOCALE,$prereq "log --grep searches in log output encoding (latin1 + locale)" "
+ cat >expect <<-\EOF &&
+ latin1
+ utf8
+ EOF
+ mismatched_git_log '$force_regex$latin1_e' >actual &&
+ test_cmp expect actual
+ "
+
+ test_expect_success GETTEXT_LOCALE,$prereq "log --grep does not die on invalid UTF-8 value (latin1 + locale + invalid needle)" "
+ mismatched_git_log '$force_regex$invalid_e' >actual &&
+ test_must_be_empty actual
+ "
+ fi
done
test_done
diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh
index cda58186c2..1428eae262 100755
--- a/t/t4211-line-log.sh
+++ b/t/t4211-line-log.sh
@@ -215,4 +215,72 @@ test_expect_success 'fancy rename following #2' '
test_cmp expect actual
'
+# Create the following linear history, where each commit does what its
+# subject line promises:
+#
+# * 66c6410 Modify func2() in file.c
+# * 50834e5 Modify other-file
+# * fe5851c Modify func1() in file.c
+# * 8c7c7dd Add other-file
+# * d5f4417 Add func1() and func2() in file.c
+test_expect_success 'setup for checking line-log and parent oids' '
+ git checkout --orphan parent-oids &&
+ git reset --hard &&
+
+ cat >file.c <<-\EOF &&
+ int func1()
+ {
+ return F1;
+ }
+
+ int func2()
+ {
+ return F2;
+ }
+ EOF
+ git add file.c &&
+ test_tick &&
+ git commit -m "Add func1() and func2() in file.c" &&
+
+ echo 1 >other-file &&
+ git add other-file &&
+ git commit -m "Add other-file" &&
+
+ sed -e "s/F1/F1 + 1/" file.c >tmp &&
+ mv tmp file.c &&
+ git commit -a -m "Modify func1() in file.c" &&
+
+ echo 2 >other-file &&
+ git commit -a -m "Modify other-file" &&
+
+ sed -e "s/F2/F2 + 2/" file.c >tmp &&
+ mv tmp file.c &&
+ git commit -a -m "Modify func2() in file.c" &&
+
+ head_oid=$(git rev-parse --short HEAD) &&
+ prev_oid=$(git rev-parse --short HEAD^) &&
+ root_oid=$(git rev-parse --short HEAD~4)
+'
+
+# Parent oid should be from immediate parent.
+test_expect_success 'parent oids without parent rewriting' '
+ cat >expect <<-EOF &&
+ $head_oid $prev_oid Modify func2() in file.c
+ $root_oid Add func1() and func2() in file.c
+ EOF
+ git log --format="%h %p %s" --no-patch -L:func2:file.c >actual &&
+ test_cmp expect actual
+'
+
+# Parent oid should be from the most recent ancestor touching func2(),
+# i.e. in this case from the root commit.
+test_expect_success 'parent oids with parent rewriting' '
+ cat >expect <<-EOF &&
+ $head_oid $root_oid Modify func2() in file.c
+ $root_oid Add func1() and func2() in file.c
+ EOF
+ git log --format="%h %p %s" --no-patch -L:func2:file.c --parents >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh
index c7011f33e2..c855bcd3e7 100755
--- a/t/t4216-log-bloom.sh
+++ b/t/t4216-log-bloom.sh
@@ -70,7 +70,7 @@ test_bloom_filters_used () {
test_bloom_filters_not_used () {
log_args=$1
setup "$log_args" &&
- !(grep -q "statistics:{\"filter_not_present\":" "$TRASH_DIRECTORY/trace.perf") &&
+ ! grep -q "statistics:{\"filter_not_present\":" "$TRASH_DIRECTORY/trace.perf" &&
test_cmp log_wo_bloom log_w_bloom
}
@@ -152,4 +152,4 @@ test_expect_success 'Use Bloom filters if they exist in the latest but not all c
test_bloom_filters_used_when_some_filters_are_missing "-- A/B"
'
-test_done \ No newline at end of file
+test_done
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 424599959c..a79c624875 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -46,15 +46,6 @@ test_expect_success 'create commits and repack' '
git repack
'
-test_expect_success 'exit with correct error on bad input to --stdin-commits' '
- cd "$TRASH_DIRECTORY/full" &&
- echo HEAD | test_expect_code 1 git commit-graph write --stdin-commits 2>stderr &&
- test_i18ngrep "unexpected non-hex object ID: HEAD" stderr &&
- # valid tree OID, but not a commit OID
- git rev-parse HEAD^{tree} | test_expect_code 1 git commit-graph write --stdin-commits 2>stderr &&
- test_i18ngrep "invalid commit object id" stderr
-'
-
graph_git_two_modes() {
git -c core.commitGraph=true $1 >output
git -c core.commitGraph=false $1 >expect
@@ -95,6 +86,22 @@ graph_read_expect() {
test_cmp expect output
}
+test_expect_success 'exit with correct error on bad input to --stdin-commits' '
+ cd "$TRASH_DIRECTORY/full" &&
+ # invalid, non-hex OID
+ echo HEAD >in &&
+ test_expect_code 1 git commit-graph write --stdin-commits <in 2>stderr &&
+ test_i18ngrep "unexpected non-hex object ID: HEAD" stderr &&
+ # non-existent OID
+ echo $ZERO_OID >in &&
+ test_expect_code 1 git commit-graph write --stdin-commits <in 2>stderr &&
+ test_i18ngrep "invalid object" stderr &&
+ # valid commit and tree OID
+ git rev-parse HEAD HEAD^{tree} >in &&
+ git commit-graph write --stdin-commits <in &&
+ graph_read_expect 3
+'
+
test_expect_success 'write graph' '
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 030a7222b2..7214cab36c 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -538,6 +538,33 @@ test_expect_success 'repack with minimum size does not alter existing packs' '
)
'
+test_expect_success 'repack respects repack.packKeptObjects=false' '
+ test_when_finished rm -f dup/.git/objects/pack/*keep &&
+ (
+ cd dup &&
+ ls .git/objects/pack/*idx >idx-list &&
+ test_line_count = 5 idx-list &&
+ ls .git/objects/pack/*.pack | sed "s/\.pack/.keep/" >keep-list &&
+ test_line_count = 5 keep-list &&
+ for keep in $(cat keep-list)
+ do
+ touch $keep || return 1
+ done &&
+ git multi-pack-index repack --batch-size=0 &&
+ ls .git/objects/pack/*idx >idx-list &&
+ test_line_count = 5 idx-list &&
+ test-tool read-midx .git/objects | grep idx >midx-list &&
+ test_line_count = 5 midx-list &&
+ THIRD_SMALLEST_SIZE=$(test-tool path-utils file-size .git/objects/pack/*pack | sort -n | sed -n 3p) &&
+ BATCH_SIZE=$((THIRD_SMALLEST_SIZE + 1)) &&
+ git multi-pack-index repack --batch-size=$BATCH_SIZE &&
+ ls .git/objects/pack/*idx >idx-list &&
+ test_line_count = 5 idx-list &&
+ test-tool read-midx .git/objects | grep idx >midx-list &&
+ test_line_count = 5 midx-list
+ )
+'
+
test_expect_success 'repack creates a new pack' '
(
cd dup &&
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 52dd1a688c..8c54e34ef1 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -386,7 +386,7 @@ test_expect_success 'clone shallow with packed refs' '
'
test_expect_success 'in_vain not triggered before first ACK' '
- rm -rf myserver myclient trace &&
+ rm -rf myserver myclient &&
git init myserver &&
test_commit -C myserver foo &&
git clone "file://$(pwd)/myserver" myclient &&
@@ -399,12 +399,12 @@ test_expect_success 'in_vain not triggered before first ACK' '
# The new commit that the client wants to fetch.
test_commit -C myserver bar &&
- GIT_TRACE_PACKET="$(pwd)/trace" git -C myclient fetch --progress origin &&
- test_i18ngrep "Total 3 " trace
+ git -C myclient fetch --progress origin 2>log &&
+ test_i18ngrep "remote: Total 3 " log
'
test_expect_success 'in_vain resetted upon ACK' '
- rm -rf myserver myclient trace &&
+ rm -rf myserver myclient &&
git init myserver &&
# Linked list of commits on master. The first is common; the rest are
@@ -429,8 +429,8 @@ test_expect_success 'in_vain resetted upon ACK' '
# first. The 256th commit is common between the client and the server,
# and should reset in_vain. This allows negotiation to continue until
# the client reports that first_anotherbranch_commit is common.
- GIT_TRACE_PACKET="$(pwd)/trace" git -C myclient fetch --progress origin master &&
- test_i18ngrep "Total 3 " trace
+ git -C myclient fetch --progress origin master 2>log &&
+ test_i18ngrep "Total 3 " log
'
test_expect_success 'fetch in shallow repo unreachable shallow objects' '
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 37535d63a9..9fae07cdfa 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -28,7 +28,7 @@ test_pull_autostash_fail () {
echo dirty >new_file &&
git add new_file &&
test_must_fail git pull "$@" . copy 2>err &&
- test_i18ngrep "\(uncommitted changes.\)\|\(overwritten by merge:\)" err
+ test_i18ngrep -E "uncommitted changes.|overwritten by merge:" err
}
test_expect_success setup '
diff --git a/t/t5608-clone-2gb.sh b/t/t5608-clone-2gb.sh
index eee0842888..4c476d2fa1 100755
--- a/t/t5608-clone-2gb.sh
+++ b/t/t5608-clone-2gb.sh
@@ -5,12 +5,11 @@ test_description='Test cloning a repository larger than 2 gigabyte'
if ! test_bool_env GIT_TEST_CLONE_2GB false
then
- say 'Skipping expensive 2GB clone test; enable it with GIT_TEST_CLONE_2GB=t'
-else
- test_set_prereq CLONE_2GB
+ skip_all='expensive 2GB clone test; enable with GIT_TEST_CLONE_2GB=true'
+ test_done
fi
-test_expect_success CLONE_2GB 'setup' '
+test_expect_success 'setup' '
git config pack.compression 0 &&
git config pack.depth 0 &&
@@ -38,13 +37,13 @@ test_expect_success CLONE_2GB 'setup' '
'
-test_expect_success CLONE_2GB 'clone - bare' '
+test_expect_success 'clone - bare' '
git clone --bare --no-hardlinks . clone-bare
'
-test_expect_success CLONE_2GB 'clone - with worktree, file:// protocol' '
+test_expect_success 'clone - with worktree, file:// protocol' '
git clone "file://$(pwd)" clone-wt
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index 88002b24af..8a27452a51 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -384,12 +384,11 @@ test_expect_success 'fetch lazy-fetches only to resolve deltas, protocol v2' '
grep "want $(cat hash)" trace
'
-# The following two tests must be in this order, or else
-# the first will not fail. It is important that the srv.bare
-# repository did not have tags during clone, but has tags
+# The following two tests must be in this order. It is important that
+# the srv.bare repository did not have tags during clone, but has tags
# in the fetch.
-test_expect_failure 'verify fetch succeeds when asking for new tags' '
+test_expect_success 'verify fetch succeeds when asking for new tags' '
git clone --filter=blob:none "file://$(pwd)/srv.bare" tag-test &&
for i in I J K
do
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index 5039e66dc4..8da65e60de 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -586,6 +586,53 @@ test_expect_success 'clone with http:// using protocol v2' '
! grep "Send header: Transfer-Encoding: chunked" log
'
+test_expect_success 'clone repository with http:// using protocol v2 with incomplete pktline length' '
+ test_when_finished "rm -f log" &&
+
+ git init "$HTTPD_DOCUMENT_ROOT_PATH/incomplete_length" &&
+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/incomplete_length" file &&
+
+ test_must_fail env GIT_TRACE_PACKET="$(pwd)/log" GIT_TRACE_CURL="$(pwd)/log" git -c protocol.version=2 \
+ clone "$HTTPD_URL/smart/incomplete_length" incomplete_length_child 2>err &&
+
+ # Client requested to use protocol v2
+ grep "Git-Protocol: version=2" log &&
+ # Server responded using protocol v2
+ grep "git< version 2" log &&
+ # Client reported appropriate failure
+ test_i18ngrep "bytes of length header were received" err
+'
+
+test_expect_success 'clone repository with http:// using protocol v2 with incomplete pktline body' '
+ test_when_finished "rm -f log" &&
+
+ git init "$HTTPD_DOCUMENT_ROOT_PATH/incomplete_body" &&
+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/incomplete_body" file &&
+
+ test_must_fail env GIT_TRACE_PACKET="$(pwd)/log" GIT_TRACE_CURL="$(pwd)/log" git -c protocol.version=2 \
+ clone "$HTTPD_URL/smart/incomplete_body" incomplete_body_child 2>err &&
+
+ # Client requested to use protocol v2
+ grep "Git-Protocol: version=2" log &&
+ # Server responded using protocol v2
+ grep "git< version 2" log &&
+ # Client reported appropriate failure
+ test_i18ngrep "bytes of body are still expected" err
+'
+
+test_expect_success 'clone with http:// using protocol v2 and invalid parameters' '
+ test_when_finished "rm -f log" &&
+
+ test_must_fail env GIT_TRACE_PACKET="$(pwd)/log" GIT_TRACE_CURL="$(pwd)/log" \
+ git -c protocol.version=2 \
+ clone --shallow-since=20151012 "$HTTPD_URL/smart/http_parent" http_child_invalid &&
+
+ # Client requested to use protocol v2
+ grep "Git-Protocol: version=2" log &&
+ # Server responded using protocol v2
+ grep "git< version 2" log
+'
+
test_expect_success 'clone big repository with http:// using protocol v2' '
test_when_finished "rm -f log" &&
diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh
index a34460f7d8..92ad5eeec0 100755
--- a/t/t5703-upload-pack-ref-in-want.sh
+++ b/t/t5703-upload-pack-ref-in-want.sh
@@ -49,15 +49,18 @@ test_expect_success 'setup repository' '
test_expect_success 'config controls ref-in-want advertisement' '
test-tool serve-v2 --advertise-capabilities >out &&
- ! grep -a ref-in-want out &&
+ perl -ne "/ref-in-want/ and print" out >out.filter &&
+ test_must_be_empty out.filter &&
git config uploadpack.allowRefInWant false &&
test-tool serve-v2 --advertise-capabilities >out &&
- ! grep -a ref-in-want out &&
+ perl -ne "/ref-in-want/ and print" out >out.filter &&
+ test_must_be_empty out.filter &&
git config uploadpack.allowRefInWant true &&
test-tool serve-v2 --advertise-capabilities >out &&
- grep -a ref-in-want out
+ perl -ne "/ref-in-want/ and print" out >out.filter &&
+ test_file_not_empty out.filter
'
test_expect_success 'invalid want-ref line' '
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 1313142564..36d9b2b2e4 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -792,6 +792,13 @@ test_expect_success 'bisect replay with old and new' '
git bisect reset
'
+test_expect_success 'bisect replay with CRLF log' '
+ append_cr <log_to_replay.txt >log_to_replay_crlf.txt &&
+ git bisect replay log_to_replay_crlf.txt >bisect_result_crlf &&
+ grep "$HASH2 is the first new commit" bisect_result_crlf &&
+ git bisect reset
+'
+
test_expect_success 'bisect cannot mix old/new and good/bad' '
git bisect start &&
git bisect bad $HASH4 &&
@@ -859,7 +866,9 @@ test_expect_success 'bisect cannot mix terms' '
test_expect_success 'bisect terms rejects invalid terms' '
git bisect reset &&
+ test_must_fail git bisect start --term-good &&
test_must_fail git bisect start --term-good invalid..term &&
+ test_must_fail git bisect start --term-bad &&
test_must_fail git bisect terms --term-bad invalid..term &&
test_must_fail git bisect terms --term-good bad &&
test_must_fail git bisect terms --term-good old &&
diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh
index b047cf1c1c..f163893ff9 100755
--- a/t/t6042-merge-rename-corner-cases.sh
+++ b/t/t6042-merge-rename-corner-cases.sh
@@ -1379,4 +1379,59 @@ test_expect_success 'check nested conflicts from rename/rename(2to1)' '
)
'
+# Testcase rename/rename(1to2) of a binary file
+# Commit O: orig
+# Commit A: orig-A
+# Commit B: orig-B
+# Expected: CONFLICT(rename/rename) message, three unstaged entries in the
+# index, and contents of orig-[AB] at path orig-[AB]
+test_setup_rename_rename_1_to_2_binary () {
+ test_create_repo rename_rename_1_to_2_binary &&
+ (
+ cd rename_rename_1_to_2_binary &&
+
+ echo '* binary' >.gitattributes &&
+ git add .gitattributes &&
+
+ test_seq 1 10 >orig &&
+ git add orig &&
+ git commit -m orig &&
+
+ git branch A &&
+ git branch B &&
+
+ git checkout A &&
+ git mv orig orig-A &&
+ test_seq 1 11 >orig-A &&
+ git add orig-A &&
+ git commit -m orig-A &&
+
+ git checkout B &&
+ git mv orig orig-B &&
+ test_seq 0 10 >orig-B &&
+ git add orig-B &&
+ git commit -m orig-B
+
+ )
+}
+
+test_expect_success 'rename/rename(1to2) with a binary file' '
+ test_setup_rename_rename_1_to_2_binary &&
+ (
+ cd rename_rename_1_to_2_binary &&
+
+ git checkout A^0 &&
+
+ test_must_fail git merge -s recursive B^0 &&
+
+ # Make sure the index has the right number of entries
+ git ls-files -s >actual &&
+ test_line_count = 4 actual &&
+
+ git rev-parse A:orig-A B:orig-B >expect &&
+ git hash-object orig-A orig-B >actual &&
+ test_cmp expect actual
+ )
+'
+
test_done
diff --git a/t/t6113-rev-list-bitmap-filters.sh b/t/t6113-rev-list-bitmap-filters.sh
index 145603f124..2b551e6fd0 100755
--- a/t/t6113-rev-list-bitmap-filters.sh
+++ b/t/t6113-rev-list-bitmap-filters.sh
@@ -53,4 +53,25 @@ test_expect_success 'blob:limit filter with specified blob' '
test_bitmap_traversal expect actual
'
+test_expect_success 'tree:0 filter' '
+ git rev-list --objects --filter=tree:0 HEAD >expect &&
+ git rev-list --use-bitmap-index \
+ --objects --filter=tree:0 HEAD >actual &&
+ test_bitmap_traversal expect actual
+'
+
+test_expect_success 'tree:0 filter with specified blob, tree' '
+ git rev-list --objects --filter=tree:0 HEAD HEAD:two.t >expect &&
+ git rev-list --use-bitmap-index \
+ --objects --filter=tree:0 HEAD HEAD:two.t >actual &&
+ test_bitmap_traversal expect actual
+'
+
+test_expect_success 'tree:1 filter' '
+ git rev-list --objects --filter=tree:1 HEAD >expect &&
+ git rev-list --use-bitmap-index \
+ --objects --filter=tree:1 HEAD >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index b15582a7a2..e4c2a6eca4 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -103,7 +103,7 @@ test_expect_success GPG 'message for merging local tag signed by unknown key' '
GNUPGHOME=. git fmt-merge-msg <.git/FETCH_HEAD >actual 2>&1 &&
grep "^Merge tag ${apos}signed-good-tag${apos}" actual &&
grep "^# gpg: Signature made" actual &&
- grep "^# gpg: Can${apos}t check signature: \(public key not found\|No public key\)" actual
+ grep -E "^# gpg: Can${apos}t check signature: (public key not found|No public key)" actual
'
test_expect_success 'message for merging external branch' '
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 768257b29e..e151df81c0 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -410,6 +410,34 @@ test_expect_success 'B: accept empty committer' '
test -z "$out"
'
+test_expect_success 'B: reject invalid timezone' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/invalid-timezone
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800
+ data <<COMMIT
+ empty commit
+ COMMIT
+ INPUT_END
+
+ test_when_finished "git update-ref -d refs/heads/invalid-timezone" &&
+ test_must_fail git fast-import <input
+'
+
+test_expect_success 'B: accept invalid timezone with raw-permissive' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/invalid-timezone
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800
+ data <<COMMIT
+ empty commit
+ COMMIT
+ INPUT_END
+
+ git init invalid-timezone &&
+ git -C invalid-timezone fast-import --date-format=raw-permissive <input &&
+ git -C invalid-timezone cat-file -p invalid-timezone >out &&
+ grep "1234567890 [+]051800" out
+'
+
test_expect_success 'B: accept and fixup committer with no name' '
cat >input <<-INPUT_END &&
commit refs/heads/empty-committer-2
diff --git a/t/t9834-git-p4-file-dir-bug.sh b/t/t9834-git-p4-file-dir-bug.sh
new file mode 100755
index 0000000000..031e1f8668
--- /dev/null
+++ b/t/t9834-git-p4-file-dir-bug.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+test_description='git p4 directory/file bug handling
+
+This test creates files and directories with the same name in perforce and
+checks that git-p4 recovers from the error at the same time as the perforce
+repository.'
+
+. ./lib-git-p4.sh
+
+test_expect_success 'start p4d' '
+ start_p4d &&
+ test_might_fail p4 configure set submit.collision.check=0
+'
+
+test_expect_success 'init depot' '
+ (
+ cd "$cli" &&
+
+ touch add_file_add_dir_del_file add_file_add_dir_del_dir &&
+ p4 add add_file_add_dir_del_file add_file_add_dir_del_dir &&
+ mkdir add_dir_add_file_del_file add_dir_add_file_del_dir &&
+ touch add_dir_add_file_del_file/file add_dir_add_file_del_dir/file &&
+ p4 add add_dir_add_file_del_file/file add_dir_add_file_del_dir/file &&
+ p4 submit -d "add initial" &&
+
+ rm -f add_file_add_dir_del_file add_file_add_dir_del_dir &&
+ mkdir add_file_add_dir_del_file add_file_add_dir_del_dir &&
+ touch add_file_add_dir_del_file/file add_file_add_dir_del_dir/file &&
+ p4 add add_file_add_dir_del_file/file add_file_add_dir_del_dir/file &&
+ rm -rf add_dir_add_file_del_file add_dir_add_file_del_dir &&
+ touch add_dir_add_file_del_file add_dir_add_file_del_dir &&
+ p4 add add_dir_add_file_del_file add_dir_add_file_del_dir &&
+ p4 submit -d "add conflicting" &&
+
+ p4 delete -k add_file_add_dir_del_file &&
+ p4 delete -k add_file_add_dir_del_dir/file &&
+ p4 delete -k add_dir_add_file_del_file &&
+ p4 delete -k add_dir_add_file_del_dir/file &&
+ p4 submit -d "delete conflicting" &&
+
+ p4 delete -k "add_file_add_dir_del_file/file" &&
+ p4 delete -k "add_file_add_dir_del_dir" &&
+ p4 delete -k "add_dir_add_file_del_file/file" &&
+ p4 delete -k "add_dir_add_file_del_dir" &&
+ p4 submit -d "delete remaining"
+ )
+'
+
+test_expect_success 'clone with git-p4' '
+ git p4 clone --dest="$git" //depot/@1,3
+'
+
+test_expect_success 'check contents' '
+ test_path_is_dir "$git/add_file_add_dir_del_file" &&
+ test_path_is_file "$git/add_file_add_dir_del_dir" &&
+ test_path_is_dir "$git/add_dir_add_file_del_file" &&
+ test_path_is_file "$git/add_dir_add_file_del_dir"
+'
+
+test_expect_success 'rebase and check empty' '
+ git -C "$git" p4 rebase &&
+
+ test_path_is_missing "$git/add_file_add_dir_del_file" &&
+ test_path_is_missing "$git/add_file_add_dir_del_dir" &&
+ test_path_is_missing "$git/add_dir_add_file_del_file" &&
+ test_path_is_missing "$git/add_dir_add_file_del_dir"
+'
+
+test_done
diff --git a/t/test-lib.sh b/t/test-lib.sh
index baf94546da..dbc027ff26 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -675,20 +675,6 @@ die () {
fi
}
-file_lineno () {
- test -z "$GIT_TEST_FRAMEWORK_SELFTEST" && test -n "$BASH" || return 0
- eval '
- local i
- for i in ${!BASH_SOURCE[*]}
- do
- case $i,"${BASH_SOURCE[$i]##*/}" in
- 0,t[0-9]*.sh) echo "t/${BASH_SOURCE[$i]}:$LINENO: ${1+$1: }"; return;;
- *,t[0-9]*.sh) echo "t/${BASH_SOURCE[$i]}:${BASH_LINENO[$(($i-1))]}: ${1+$1: }"; return;;
- esac
- done
- '
-}
-
GIT_EXIT_OK=
trap 'die' EXIT
# Disable '-x' tracing, because with some shells, notably dash, it
@@ -734,7 +720,7 @@ test_failure_ () {
write_junit_xml_testcase "$1" " $junit_insert"
fi
test_failure=$(($test_failure + 1))
- say_color error "$(file_lineno error)not ok $test_count - $1"
+ say_color error "not ok $test_count - $1"
shift
printf '%s\n' "$*" | sed -e 's/^/# /'
test "$immediate" = "" || { finalize_junit_xml; GIT_EXIT_OK=t; exit 1; }
@@ -1503,12 +1489,6 @@ case $uname_s in
test_set_prereq SED_STRIPS_CR
test_set_prereq GREP_STRIPS_CR
;;
-FreeBSD)
- test_set_prereq REGEX_ILLSEQ
- test_set_prereq POSIXPERM
- test_set_prereq BSLASHPSPEC
- test_set_prereq EXECKEEPSPID
- ;;
*)
test_set_prereq POSIXPERM
test_set_prereq BSLASHPSPEC
@@ -1516,6 +1496,14 @@ FreeBSD)
;;
esac
+# Detect arches where a few things don't work
+uname_m=$(uname -m)
+case $uname_m in
+parisc* | hppa*)
+ test_set_prereq HPPA
+ ;;
+esac
+
( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
test -z "$NO_PERL" && test_set_prereq PERL
test -z "$NO_PTHREADS" && test_set_prereq PTHREADS
@@ -1655,7 +1643,7 @@ run_with_limited_cmdline () {
}
test_lazy_prereq CMDLINE_LIMIT '
- test_have_prereq !MINGW,!CYGWIN &&
+ test_have_prereq !HPPA,!MINGW,!CYGWIN &&
run_with_limited_cmdline true
'
@@ -1664,7 +1652,7 @@ run_with_limited_stack () {
}
test_lazy_prereq ULIMIT_STACK_SIZE '
- test_have_prereq !MINGW,!CYGWIN &&
+ test_have_prereq !HPPA,!MINGW,!CYGWIN &&
run_with_limited_stack true
'