aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/lib-gpg.sh5
-rw-r--r--t/lib-httpd/apache.conf3
-rwxr-xr-xt/t0001-init.sh20
-rwxr-xr-xt/t0300-credentials.sh11
-rwxr-xr-xt/t1300-repo-config.sh20
-rwxr-xr-xt/t1506-rev-parse-diagnosis.sh5
-rwxr-xr-xt/t1515-rev-parse-outside-repo.sh45
-rwxr-xr-xt/t3001-ls-files-others-exclude.sh7
-rwxr-xr-xt/t3007-ls-files-other-negative.sh153
-rwxr-xr-xt/t4001-diff-rename.sh125
-rwxr-xr-xt/t4013-diff-various.sh2
-rwxr-xr-xt/t4014-format-patch.sh4
-rwxr-xr-xt/t4047-diff-dirstat.sh3
-rwxr-xr-xt/t4202-log.sh8
-rwxr-xr-xt/t5300-pack-object.sh6
-rwxr-xr-xt/t5313-pack-bounds-checks.sh179
-rwxr-xr-xt/t5500-fetch-pack.sh14
-rwxr-xr-xt/t5510-fetch.sh10
-rwxr-xr-xt/t6302-for-each-ref-filter.sh95
-rwxr-xr-xt/t7400-submodule-basic.sh13
-rwxr-xr-xt/t7810-grep.sh27
-rwxr-xr-xt/t9108-git-svn-glob.sh9
-rwxr-xr-xt/t9109-git-svn-multi-glob.sh9
-rwxr-xr-xt/t9115-git-svn-dcommit-funky-renames.sh4
-rwxr-xr-xt/t9117-git-svn-init-clone.sh6
-rwxr-xr-xt/t9168-git-svn-partially-globbed-names.sh223
-rwxr-xr-xt/t9300-fast-import.sh4
-rwxr-xr-xt/t9700/test.pl8
28 files changed, 752 insertions, 266 deletions
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index db2ef22e8..ec2aa8f68 100755
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -1,9 +1,8 @@
#!/bin/sh
gpg_version=$(gpg --version 2>&1)
-if test $? = 127; then
- say "You do not seem to have gpg installed"
-else
+if test $? != 127
+then
# As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
# the gpg version 1.0.6 didn't parse trust packets correctly, so for
# that version, creation of signed tags using the generated key fails.
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 7d15e6d44..f667e7ce2 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -64,6 +64,9 @@ LockFile accept.lock
<IfModule !mod_mpm_prefork.c>
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
</IfModule>
+<IfModule !mod_unixd.c>
+ LoadModule unixd_module modules/mod_unixd.so
+</IfModule>
</IfVersion>
PassEnv GIT_VALGRIND
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 295aa5949..a5b9e7a4c 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -88,19 +88,17 @@ test_expect_success 'plain nested in bare through aliased command' '
'
test_expect_success 'No extra GIT_* on alias scripts' '
- (
- env | sed -ne "/^GIT_/s/=.*//p" &&
- echo GIT_PREFIX && # setup.c
- echo GIT_TEXTDOMAINDIR # wrapper-for-bin.sh
- ) | sort | uniq >expected &&
- cat <<-\EOF >script &&
- #!/bin/sh
- env | sed -ne "/^GIT_/s/=.*//p" | sort >actual
- exit 0
+ write_script script <<-\EOF &&
+ env |
+ sed -n \
+ -e "/^GIT_PREFIX=/d" \
+ -e "/^GIT_TEXTDOMAINDIR=/d" \
+ -e "/^GIT_/s/=.*//p" |
+ sort
EOF
- chmod 755 script &&
+ ./script >expected &&
git config alias.script \!./script &&
- ( mkdir sub && cd sub && git script ) &&
+ ( mkdir sub && cd sub && git script >../actual ) &&
test_cmp expected actual
'
diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh
index d7ef44b4a..03bd31e9f 100755
--- a/t/t0300-credentials.sh
+++ b/t/t0300-credentials.sh
@@ -298,4 +298,15 @@ test_expect_success 'helpers can abort the process' '
test_cmp expect stdout
'
+test_expect_success 'empty helper spec resets helper list' '
+ test_config credential.helper "verbatim file file" &&
+ check fill "" "verbatim cmdline cmdline" <<-\EOF
+ --
+ username=cmdline
+ password=cmdline
+ --
+ verbatim: get
+ EOF
+'
+
test_done
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 8867ce10f..3d6f1db9d 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -699,17 +699,13 @@ test_expect_success 'invalid unit' '
echo 1auto >expect &&
git config aninvalid.unit >actual &&
test_cmp expect actual &&
- cat >expect <<-\EOF &&
- fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in file .git/config: invalid unit
- EOF
test_must_fail git config --int --get aninvalid.unit 2>actual &&
- test_i18ncmp expect actual
+ test_i18ngrep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
'
test_expect_success 'invalid stdin config' '
- echo "fatal: bad config line 1 in standard input " >expect &&
echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
- test_cmp expect output
+ test_i18ngrep "bad config line 1 in standard input" output
'
cat > expect << EOF
@@ -1148,6 +1144,9 @@ test_expect_success 'urlmatch' '
cookieFile = /tmp/cookie.txt
EOF
+ test_expect_code 1 git config --bool --get-urlmatch doesnt.exist https://good.example.com >actual &&
+ test_must_be_empty actual &&
+
echo true >expect &&
git config --bool --get-urlmatch http.SSLverify https://good.example.com >actual &&
test_cmp expect actual &&
@@ -1209,6 +1208,9 @@ test_expect_success POSIXPERM,PERL 'preserves existing permissions' '
"die q(badrename) if ((stat(q(.git/config)))[2] & 07777) != 0600"
'
+! test_have_prereq MINGW ||
+HOME="$(pwd)" # convert to Windows path
+
test_expect_success 'set up --show-origin tests' '
INCLUDE_DIR="$HOME/include" &&
mkdir -p "$INCLUDE_DIR" &&
@@ -1308,7 +1310,7 @@ test_expect_success 'set up custom config file' '
EOF
'
-test_expect_success '--show-origin escape special file name characters' '
+test_expect_success !MINGW '--show-origin escape special file name characters' '
cat >expect <<-\EOF &&
file:"file\" (dq) and spaces.conf" user.custom=true
EOF
@@ -1337,7 +1339,7 @@ test_expect_success '--show-origin stdin with file include' '
test_cmp expect output
'
-test_expect_success '--show-origin blob' '
+test_expect_success !MINGW '--show-origin blob' '
cat >expect <<-\EOF &&
blob:a9d9f9e555b5c6f07cbe09d3f06fe3df11e09c08 user.custom=true
EOF
@@ -1346,7 +1348,7 @@ test_expect_success '--show-origin blob' '
test_cmp expect output
'
-test_expect_success '--show-origin blob ref' '
+test_expect_success !MINGW '--show-origin blob ref' '
cat >expect <<-\EOF &&
blob:"master:file\" (dq) and spaces.conf" user.custom=true
EOF
diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh
index 613d9bfe1..86c2ff255 100755
--- a/t/t1506-rev-parse-diagnosis.sh
+++ b/t/t1506-rev-parse-diagnosis.sh
@@ -166,11 +166,6 @@ test_expect_success 'relative path when cwd is outside worktree' '
grep "relative path syntax can.t be used outside working tree." error
'
-test_expect_success 'relative path when startup_info is NULL' '
- test_must_fail test-match-trees HEAD:./file.txt HEAD:./file.txt 2>error &&
- grep "BUG: startup_info struct is not initialized." error
-'
-
test_expect_success '<commit>:file correctly diagnosed after a pathname' '
test_must_fail git rev-parse file.txt HEAD:file.txt 1>actual 2>error &&
test_i18ngrep ! "exists on disk" error &&
diff --git a/t/t1515-rev-parse-outside-repo.sh b/t/t1515-rev-parse-outside-repo.sh
new file mode 100755
index 000000000..3ec2971ee
--- /dev/null
+++ b/t/t1515-rev-parse-outside-repo.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+test_description='check that certain rev-parse options work outside repo'
+. ./test-lib.sh
+
+test_expect_success 'set up non-repo directory' '
+ GIT_CEILING_DIRECTORIES=$(pwd) &&
+ export GIT_CEILING_DIRECTORIES &&
+ mkdir non-repo &&
+ cd non-repo &&
+ # confirm that git does not find a repo
+ test_must_fail git rev-parse --git-dir
+'
+
+# Rather than directly test the output of sq-quote directly,
+# make sure the shell can read back a tricky case, since
+# that's what we really care about anyway.
+tricky="really tricky with \\ and \" and '"
+dump_args () {
+ for i in "$@"; do
+ echo "arg: $i"
+ done
+}
+test_expect_success 'rev-parse --sq-quote' '
+ dump_args "$tricky" easy >expect &&
+ eval "dump_args $(git rev-parse --sq-quote "$tricky" easy)" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'rev-parse --local-env-vars' '
+ git rev-parse --local-env-vars >actual &&
+ # we do not want to depend on the complete list here,
+ # so just look for something plausible
+ grep ^GIT_DIR actual
+'
+
+test_expect_success 'rev-parse --resolve-git-dir' '
+ git init --separate-git-dir repo dir &&
+ test_must_fail git rev-parse --resolve-git-dir . &&
+ echo "$(pwd)/repo" >expect &&
+ git rev-parse --resolve-git-dir dir/.git >actual &&
+ test_cmp expect actual
+'
+
+test_done
diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh
index d043078da..3fc484e8c 100755
--- a/t/t3001-ls-files-others-exclude.sh
+++ b/t/t3001-ls-files-others-exclude.sh
@@ -175,10 +175,13 @@ test_expect_success 'negated exclude matches can override previous ones' '
grep "^a.1" output
'
-test_expect_success 'excluded directory does not override content patterns' '
+test_expect_success 'excluded directory overrides content patterns' '
git ls-files --others --exclude="one" --exclude="!one/a.1" >output &&
- grep "^one/a.1" output
+ if grep "^one/a.1" output
+ then
+ false
+ fi
'
test_expect_success 'negated directory doesn'\''t affect content patterns' '
diff --git a/t/t3007-ls-files-other-negative.sh b/t/t3007-ls-files-other-negative.sh
deleted file mode 100755
index 0797b86ad..000000000
--- a/t/t3007-ls-files-other-negative.sh
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/bin/sh
-
-test_description='test re-include patterns'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
- mkdir -p fooo foo/bar tmp &&
- touch abc foo/def foo/bar/ghi foo/bar/bar
-'
-
-test_expect_success 'no match, do not enter subdir and waste cycles' '
- cat >.gitignore <<-\EOF &&
- /tmp
- /foo
- !fooo/bar/bar
- EOF
- GIT_TRACE_EXCLUDE="$(pwd)/tmp/trace" git ls-files -o --exclude-standard >tmp/actual &&
- ! grep "enter .foo/.\$" tmp/trace &&
- cat >tmp/expected <<-\EOF &&
- .gitignore
- abc
- EOF
- test_cmp tmp/expected tmp/actual
-'
-
-test_expect_success 'match, excluded by literal pathname pattern' '
- cat >.gitignore <<-\EOF &&
- /tmp
- /fooo
- /foo
- !foo/bar/bar
- EOF
- cat >fooo/.gitignore <<-\EOF &&
- !/*
- EOF git ls-files -o --exclude-standard >tmp/actual &&
- cat >tmp/expected <<-\EOF &&
- .gitignore
- abc
- foo/bar/bar
- EOF
- test_cmp tmp/expected tmp/actual
-'
-
-test_expect_success 'match, excluded by wildcard pathname pattern' '
- cat >.gitignore <<-\EOF &&
- /tmp
- /fooo
- /fo?
- !foo/bar/bar
- EOF
- git ls-files -o --exclude-standard >tmp/actual &&
- cat >tmp/expected <<-\EOF &&
- .gitignore
- abc
- foo/bar/bar
- EOF
- test_cmp tmp/expected tmp/actual
-'
-
-test_expect_success 'match, excluded by literal basename pattern' '
- cat >.gitignore <<-\EOF &&
- /tmp
- /fooo
- foo
- !foo/bar/bar
- EOF
- git ls-files -o --exclude-standard >tmp/actual &&
- cat >tmp/expected <<-\EOF &&
- .gitignore
- abc
- foo/bar/bar
- EOF
- test_cmp tmp/expected tmp/actual
-'
-
-test_expect_success 'match, excluded by wildcard basename pattern' '
- cat >.gitignore <<-\EOF &&
- /tmp
- /fooo
- fo?
- !foo/bar/bar
- EOF
- git ls-files -o --exclude-standard >tmp/actual &&
- cat >tmp/expected <<-\EOF &&
- .gitignore
- abc
- foo/bar/bar
- EOF
- test_cmp tmp/expected tmp/actual
-'
-
-test_expect_success 'match, excluded by literal mustbedir, basename pattern' '
- cat >.gitignore <<-\EOF &&
- /tmp
- /fooo
- foo/
- !foo/bar/bar
- EOF
- git ls-files -o --exclude-standard >tmp/actual &&
- cat >tmp/expected <<-\EOF &&
- .gitignore
- abc
- foo/bar/bar
- EOF
- test_cmp tmp/expected tmp/actual
-'
-
-test_expect_success 'match, excluded by literal mustbedir, pathname pattern' '
- cat >.gitignore <<-\EOF &&
- /tmp
- /fooo
- /foo/
- !foo/bar/bar
- EOF
- git ls-files -o --exclude-standard >tmp/actual &&
- cat >tmp/expected <<-\EOF &&
- .gitignore
- abc
- foo/bar/bar
- EOF
- test_cmp tmp/expected tmp/actual
-'
-
-test_expect_success 'prepare for nested negatives' '
- cat >.git/info/exclude <<-\EOF &&
- /.gitignore
- /tmp
- /foo
- /abc
- EOF
- git ls-files -o --exclude-standard >tmp/actual &&
- test_must_be_empty tmp/actual &&
- mkdir -p 1/2/3/4 &&
- touch 1/f 1/2/f 1/2/3/f 1/2/3/4/f
-'
-
-test_expect_success 'match, literal pathname, nested negatives' '
- cat >.gitignore <<-\EOF &&
- /1
- !1/2
- 1/2/3
- !1/2/3/4
- EOF
- git ls-files -o --exclude-standard >tmp/actual &&
- cat >tmp/expected <<-\EOF &&
- 1/2/3/4/f
- 1/2/f
- EOF
- test_cmp tmp/expected tmp/actual
-'
-
-test_done
diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
index 2f327b749..c7e58b69a 100755
--- a/t/t4001-diff-rename.sh
+++ b/t/t4001-diff-rename.sh
@@ -9,21 +9,84 @@ test_description='Test rename detection in diff engine.
. ./test-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh
-echo >path0 'Line 1
-Line 2
-Line 3
-Line 4
-Line 5
-Line 6
-Line 7
-Line 8
-Line 9
-Line 10
-line 11
-Line 12
-Line 13
-Line 14
-Line 15
+test_expect_success 'setup' '
+ cat >path0 <<-\EOF &&
+ Line 1
+ Line 2
+ Line 3
+ Line 4
+ Line 5
+ Line 6
+ Line 7
+ Line 8
+ Line 9
+ Line 10
+ line 11
+ Line 12
+ Line 13
+ Line 14
+ Line 15
+ EOF
+ cat >expected <<-\EOF &&
+ diff --git a/path0 b/path1
+ rename from path0
+ rename to path1
+ --- a/path0
+ +++ b/path1
+ @@ -8,7 +8,7 @@ Line 7
+ Line 8
+ Line 9
+ Line 10
+ -line 11
+ +Line 11
+ Line 12
+ Line 13
+ Line 14
+ EOF
+ cat >no-rename <<-\EOF
+ diff --git a/path0 b/path0
+ deleted file mode 100644
+ index fdbec44..0000000
+ --- a/path0
+ +++ /dev/null
+ @@ -1,15 +0,0 @@
+ -Line 1
+ -Line 2
+ -Line 3
+ -Line 4
+ -Line 5
+ -Line 6
+ -Line 7
+ -Line 8
+ -Line 9
+ -Line 10
+ -line 11
+ -Line 12
+ -Line 13
+ -Line 14
+ -Line 15
+ diff --git a/path1 b/path1
+ new file mode 100644
+ index 0000000..752c50e
+ --- /dev/null
+ +++ b/path1
+ @@ -0,0 +1,15 @@
+ +Line 1
+ +Line 2
+ +Line 3
+ +Line 4
+ +Line 5
+ +Line 6
+ +Line 7
+ +Line 8
+ +Line 9
+ +Line 10
+ +Line 11
+ +Line 12
+ +Line 13
+ +Line 14
+ +Line 15
+ EOF
'
test_expect_success \
@@ -43,27 +106,27 @@ test_expect_success \
test_expect_success \
'git diff-index -p -M after rename and editing.' \
'git diff-index -p -M $tree >current'
-cat >expected <<\EOF
-diff --git a/path0 b/path1
-rename from path0
-rename to path1
---- a/path0
-+++ b/path1
-@@ -8,7 +8,7 @@ Line 7
- Line 8
- Line 9
- Line 10
--line 11
-+Line 11
- Line 12
- Line 13
- Line 14
-EOF
+
test_expect_success \
'validate the output.' \
'compare_diff_patch current expected'
+test_expect_success 'test diff.renames=true' '
+ git -c diff.renames=true diff --cached $tree >current &&
+ compare_diff_patch current expected
+'
+
+test_expect_success 'test diff.renames=false' '
+ git -c diff.renames=false diff --cached $tree >current &&
+ compare_diff_patch current no-rename
+'
+
+test_expect_success 'test diff.renames unset' '
+ git diff --cached $tree >current &&
+ compare_diff_patch current expected
+'
+
test_expect_success 'favour same basenames over different ones' '
cp path1 another-path &&
git add another-path &&
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 6ec607211..94ef5000e 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -90,6 +90,8 @@ test_expect_success setup '
git commit -m "Rearranged lines in dir/sub" &&
git checkout master &&
+ git config diff.renames false &&
+
git show-branch
'
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 3b99434e3..eed2981b9 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -549,7 +549,7 @@ test_expect_success 'cover-letter inherits diff options' '
git mv file foo &&
git commit -m foo &&
- git format-patch --cover-letter -1 &&
+ git format-patch --no-renames --cover-letter -1 &&
check_patch 0000-cover-letter.patch &&
! grep "file => foo .* 0 *\$" 0000-cover-letter.patch &&
git format-patch --cover-letter -1 -M &&
@@ -703,7 +703,7 @@ test_expect_success 'options no longer allowed for format-patch' '
test_expect_success 'format-patch --numstat should produce a patch' '
git format-patch --numstat --stdout master..side > output &&
- test 6 = $(grep "^diff --git a/" output | wc -l)'
+ test 5 = $(grep "^diff --git a/" output | wc -l)'
test_expect_success 'format-patch -- <path>' '
git format-patch master..side -- file 2>error &&
diff --git a/t/t4047-diff-dirstat.sh b/t/t4047-diff-dirstat.sh
index 3b8b7921d..447a8ffa3 100755
--- a/t/t4047-diff-dirstat.sh
+++ b/t/t4047-diff-dirstat.sh
@@ -248,7 +248,8 @@ EOF
git rm -r src/move/unchanged &&
git rm -r src/move/changed &&
git rm -r src/move/rearranged &&
- git commit -m "changes"
+ git commit -m "changes" &&
+ git config diff.renames false
'
cat <<EOF >expect_diff_stat
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index cb82eb7e6..128ba9353 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -101,8 +101,8 @@ test_expect_success 'oneline' '
test_expect_success 'diff-filter=A' '
- git log --pretty="format:%s" --diff-filter=A HEAD > actual &&
- git log --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
+ git log --no-renames --pretty="format:%s" --diff-filter=A HEAD > actual &&
+ git log --no-renames --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
printf "fifth\nfourth\nthird\ninitial" > expect &&
test_cmp expect actual &&
test_cmp expect actual-separate
@@ -119,7 +119,7 @@ test_expect_success 'diff-filter=M' '
test_expect_success 'diff-filter=D' '
- actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
+ actual=$(git log --no-renames --pretty="format:%s" --diff-filter=D HEAD) &&
expect=$(echo sixth ; echo third) &&
verbose test "$actual" = "$expect"
@@ -848,7 +848,7 @@ sanitize_output () {
}
test_expect_success 'log --graph with diff and stats' '
- git log --graph --pretty=short --stat -p >actual &&
+ git log --no-renames --graph --pretty=short --stat -p >actual &&
sanitize_output >actual.sanitized <actual &&
test_i18ncmp expect actual.sanitized
'
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index fc2be63e0..899e52d50 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -284,6 +284,12 @@ test_expect_success \
git index-pack test-3.pack &&
cmp test-3.idx test-3-${packname_3}.idx &&
+ cat test-1-${packname_1}.pack >test-4.pack &&
+ rm -f test-4.keep &&
+ git index-pack --keep=why test-4.pack &&
+ cmp test-1-${packname_1}.idx test-4.idx &&
+ test -f test-4.keep &&
+
:'
test_expect_success 'unpacking with --strict' '
diff --git a/t/t5313-pack-bounds-checks.sh b/t/t5313-pack-bounds-checks.sh
new file mode 100755
index 000000000..a8a587abc
--- /dev/null
+++ b/t/t5313-pack-bounds-checks.sh
@@ -0,0 +1,179 @@
+#!/bin/sh
+
+test_description='bounds-checking of access to mmapped on-disk file formats'
+. ./test-lib.sh
+
+clear_base () {
+ test_when_finished 'restore_base' &&
+ rm -f $base
+}
+
+restore_base () {
+ cp base-backup/* .git/objects/pack/
+}
+
+do_pack () {
+ pack_objects=$1; shift
+ sha1=$(
+ for i in $pack_objects
+ do
+ echo $i
+ done | git pack-objects "$@" .git/objects/pack/pack
+ ) &&
+ pack=.git/objects/pack/pack-$sha1.pack &&
+ idx=.git/objects/pack/pack-$sha1.idx &&
+ chmod +w $pack $idx &&
+ test_when_finished 'rm -f "$pack" "$idx"'
+}
+
+munge () {
+ printf "$3" | dd of="$1" bs=1 conv=notrunc seek=$2
+}
+
+# Offset in a v2 .idx to its initial and extended offset tables. For an index
+# with "nr" objects, this is:
+#
+# magic(4) + version(4) + fan-out(4*256) + sha1s(20*nr) + crc(4*nr),
+#
+# for the initial, and another ofs(4*nr) past that for the extended.
+#
+ofs_table () {
+ echo $((4 + 4 + 4*256 + 20*$1 + 4*$1))
+}
+extended_table () {
+ echo $(($(ofs_table "$1") + 4*$1))
+}
+
+test_expect_success 'set up base packfile and variables' '
+ # the hash of this content starts with ff, which
+ # makes some later computations much simpler
+ echo 74 >file &&
+ git add file &&
+ git commit -m base &&
+ git repack -ad &&
+ base=$(echo .git/objects/pack/*) &&
+ chmod +w $base &&
+ mkdir base-backup &&
+ cp $base base-backup/ &&
+ object=$(git rev-parse HEAD:file)
+'
+
+test_expect_success 'pack/index object count mismatch' '
+ do_pack $object &&
+ munge $pack 8 "\377\0\0\0" &&
+ clear_base &&
+
+ # We enumerate the objects from the completely-fine
+ # .idx, but notice later that the .pack is bogus
+ # and fail to show any data.
+ echo "$object missing" >expect &&
+ git cat-file --batch-all-objects --batch-check >actual &&
+ test_cmp expect actual &&
+
+ # ...and here fail to load the object (without segfaulting),
+ # but fallback to a good copy if available.
+ test_must_fail git cat-file blob $object &&
+ restore_base &&
+ git cat-file blob $object >actual &&
+ test_cmp file actual &&
+
+ # ...and make sure that index-pack --verify, which has its
+ # own reading routines, does not segfault.
+ test_must_fail git index-pack --verify $pack
+'
+
+test_expect_success 'matched bogus object count' '
+ do_pack $object &&
+ munge $pack 8 "\377\0\0\0" &&
+ munge $idx $((255 * 4)) "\377\0\0\0" &&
+ clear_base &&
+
+ # Unlike above, we should notice early that the .idx is totally
+ # bogus, and not even enumerate its contents.
+ >expect &&
+ git cat-file --batch-all-objects --batch-check >actual &&
+ test_cmp expect actual &&
+
+ # But as before, we can do the same object-access checks.
+ test_must_fail git cat-file blob $object &&
+ restore_base &&
+ git cat-file blob $object >actual &&
+ test_cmp file actual &&
+
+ test_must_fail git index-pack --verify $pack
+'
+
+# Note that we cannot check the fallback case for these
+# further .idx tests, as we notice the problem in functions
+# whose interface doesn't allow an error return (like use_pack()),
+# and thus we just die().
+#
+# There's also no point in doing enumeration tests, as
+# we are munging offsets here, which are about looking up
+# specific objects.
+
+test_expect_success 'bogus object offset (v1)' '
+ do_pack $object --index-version=1 &&
+ munge $idx $((4 * 256)) "\377\0\0\0" &&
+ clear_base &&
+ test_must_fail git cat-file blob $object &&
+ test_must_fail git index-pack --verify $pack
+'
+
+test_expect_success 'bogus object offset (v2, no msb)' '
+ do_pack $object --index-version=2 &&
+ munge $idx $(ofs_table 1) "\0\377\0\0" &&
+ clear_base &&
+ test_must_fail git cat-file blob $object &&
+ test_must_fail git index-pack --verify $pack
+'
+
+test_expect_success 'bogus offset into v2 extended table' '
+ do_pack $object --index-version=2 &&
+ munge $idx $(ofs_table 1) "\377\0\0\0" &&
+ clear_base &&
+ test_must_fail git cat-file blob $object &&
+ test_must_fail git index-pack --verify $pack
+'
+
+test_expect_success 'bogus offset inside v2 extended table' '
+ # We need two objects here, so we can plausibly require
+ # an extended table (if the first object were larger than 2^31).
+ do_pack "$object $(git rev-parse HEAD)" --index-version=2 &&
+
+ # We have to make extra room for the table, so we cannot
+ # just munge in place as usual.
+ {
+ dd if=$idx bs=1 count=$(($(ofs_table 2) + 4)) &&
+ printf "\200\0\0\0" &&
+ printf "\377\0\0\0\0\0\0\0" &&
+ dd if=$idx bs=1 skip=$(extended_table 2)
+ } >tmp &&
+ mv tmp "$idx" &&
+ clear_base &&
+ test_must_fail git cat-file blob $object &&
+ test_must_fail git index-pack --verify $pack
+'
+
+test_expect_success 'bogus OFS_DELTA in packfile' '
+ # Generate a pack with a delta in it.
+ base=$(test-genrandom foo 3000 | git hash-object --stdin -w) &&
+ delta=$(test-genrandom foo 2000 | git hash-object --stdin -w) &&
+ do_pack "$base $delta" --delta-base-offset &&
+ rm -f .git/objects/??/* &&
+
+ # Double check that we have the delta we expect.
+ echo $base >expect &&
+ echo $delta | git cat-file --batch-check="%(deltabase)" >actual &&
+ test_cmp expect actual &&
+
+ # Now corrupt it. We assume the varint size for the delta is small
+ # enough to fit in the first byte (which it should be, since it
+ # is a pure deletion from the base), and that original ofs_delta
+ # takes 2 bytes (which it should, as it should be ~3000).
+ ofs=$(git show-index <$idx | grep $delta | cut -d" " -f1) &&
+ munge $pack $(($ofs + 1)) "\177\377" &&
+ test_must_fail git cat-file blob $delta >/dev/null
+'
+
+test_done
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index e5f83bf5e..9b9bec468 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -531,6 +531,20 @@ test_expect_success 'shallow fetch with tags does not break the repository' '
git fsck
)
'
+
+test_expect_success 'fetch-pack can fetch a raw sha1' '
+ git init hidden &&
+ (
+ cd hidden &&
+ test_commit 1 &&
+ test_commit 2 &&
+ git update-ref refs/hidden/one HEAD^ &&
+ git config transfer.hiderefs refs/hidden &&
+ git config uploadpack.allowtipsha1inwant true
+ ) &&
+ git fetch-pack hidden $(git -C hidden rev-parse refs/hidden/one)
+'
+
check_prot_path () {
cat >expected <<-EOF &&
Diag: url=$1
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 0c10c856a..38321d19e 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -679,10 +679,12 @@ test_expect_success 'fetching with auto-gc does not lock up' '
EOF
git clone "file://$D" auto-gc &&
test_commit test2 &&
- cd auto-gc &&
- git config gc.autoPackLimit 1 &&
- GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 &&
- ! grep "Should I try again" fetch.out
+ (
+ cd auto-gc &&
+ git config gc.autoPackLimit 1 &&
+ GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 &&
+ ! grep "Should I try again" fetch.out
+ )
'
test_done
diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
index bcf472bf5..70afb4427 100755
--- a/t/t6302-for-each-ref-filter.sh
+++ b/t/t6302-for-each-ref-filter.sh
@@ -5,11 +5,14 @@ test_description='test for-each-refs usage of ref-filter APIs'
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-gpg.sh
-if ! test_have_prereq GPG
-then
- skip_all="skipping for-each-ref tests, GPG not available"
- test_done
-fi
+test_prepare_expect () {
+ if test_have_prereq GPG
+ then
+ cat
+ else
+ sed '/signed/d'
+ fi
+}
test_expect_success 'setup some history and refs' '
test_commit one &&
@@ -17,8 +20,13 @@ test_expect_success 'setup some history and refs' '
test_commit three &&
git checkout -b side &&
test_commit four &&
- git tag -s -m "A signed tag message" signed-tag &&
- git tag -s -m "Annonated doubly" double-tag signed-tag &&
+ git tag -m "An annotated tag" annotated-tag &&
+ git tag -m "Annonated doubly" doubly-annotated-tag annotated-tag &&
+ if test_have_prereq GPG
+ then
+ git tag -s -m "A signed tag" signed-tag &&
+ git tag -s -m "Signed doubly" doubly-signed-tag signed-tag
+ fi &&
git checkout master &&
git update-ref refs/odd/spot master
'
@@ -34,8 +42,9 @@ test_expect_success 'filtering with --points-at' '
'
test_expect_success 'check signed tags with --points-at' '
- sed -e "s/Z$//" >expect <<-\EOF &&
+ test_prepare_expect <<-\EOF | sed -e "s/Z$//" >expect &&
refs/heads/side Z
+ refs/tags/annotated-tag four
refs/tags/four Z
refs/tags/signed-tag four
EOF
@@ -56,9 +65,11 @@ test_expect_success 'filtering with --merged' '
'
test_expect_success 'filtering with --no-merged' '
- cat >expect <<-\EOF &&
+ test_prepare_expect >expect <<-\EOF &&
refs/heads/side
- refs/tags/double-tag
+ refs/tags/annotated-tag
+ refs/tags/doubly-annotated-tag
+ refs/tags/doubly-signed-tag
refs/tags/four
refs/tags/signed-tag
EOF
@@ -67,11 +78,13 @@ test_expect_success 'filtering with --no-merged' '
'
test_expect_success 'filtering with --contains' '
- cat >expect <<-\EOF &&
+ test_prepare_expect >expect <<-\EOF &&
refs/heads/master
refs/heads/side
refs/odd/spot
- refs/tags/double-tag
+ refs/tags/annotated-tag
+ refs/tags/doubly-annotated-tag
+ refs/tags/doubly-signed-tag
refs/tags/four
refs/tags/signed-tag
refs/tags/three
@@ -86,11 +99,13 @@ test_expect_success '%(color) must fail' '
'
test_expect_success 'left alignment is default' '
- cat >expect <<-\EOF &&
+ test_prepare_expect >expect <<-\EOF &&
refname is refs/heads/master |refs/heads/master
refname is refs/heads/side |refs/heads/side
refname is refs/odd/spot |refs/odd/spot
- refname is refs/tags/double-tag|refs/tags/double-tag
+ refname is refs/tags/annotated-tag|refs/tags/annotated-tag
+ refname is refs/tags/doubly-annotated-tag|refs/tags/doubly-annotated-tag
+ refname is refs/tags/doubly-signed-tag|refs/tags/doubly-signed-tag
refname is refs/tags/four |refs/tags/four
refname is refs/tags/one |refs/tags/one
refname is refs/tags/signed-tag|refs/tags/signed-tag
@@ -102,11 +117,13 @@ test_expect_success 'left alignment is default' '
'
test_expect_success 'middle alignment' '
- cat >expect <<-\EOF &&
+ test_prepare_expect >expect <<-\EOF &&
| refname is refs/heads/master |refs/heads/master
| refname is refs/heads/side |refs/heads/side
| refname is refs/odd/spot |refs/odd/spot
- |refname is refs/tags/double-tag|refs/tags/double-tag
+ |refname is refs/tags/annotated-tag|refs/tags/annotated-tag
+ |refname is refs/tags/doubly-annotated-tag|refs/tags/doubly-annotated-tag
+ |refname is refs/tags/doubly-signed-tag|refs/tags/doubly-signed-tag
| refname is refs/tags/four |refs/tags/four
| refname is refs/tags/one |refs/tags/one
|refname is refs/tags/signed-tag|refs/tags/signed-tag
@@ -118,11 +135,13 @@ test_expect_success 'middle alignment' '
'
test_expect_success 'right alignment' '
- cat >expect <<-\EOF &&
+ test_prepare_expect >expect <<-\EOF &&
| refname is refs/heads/master|refs/heads/master
| refname is refs/heads/side|refs/heads/side
| refname is refs/odd/spot|refs/odd/spot
- |refname is refs/tags/double-tag|refs/tags/double-tag
+ |refname is refs/tags/annotated-tag|refs/tags/annotated-tag
+ |refname is refs/tags/doubly-annotated-tag|refs/tags/doubly-annotated-tag
+ |refname is refs/tags/doubly-signed-tag|refs/tags/doubly-signed-tag
| refname is refs/tags/four|refs/tags/four
| refname is refs/tags/one|refs/tags/one
|refname is refs/tags/signed-tag|refs/tags/signed-tag
@@ -133,11 +152,13 @@ test_expect_success 'right alignment' '
test_cmp expect actual
'
-cat >expect <<-\EOF
+test_prepare_expect >expect <<-\EOF
| refname is refs/heads/master |refs/heads/master
| refname is refs/heads/side |refs/heads/side
| refname is refs/odd/spot |refs/odd/spot
-| refname is refs/tags/double-tag |refs/tags/double-tag
+| refname is refs/tags/annotated-tag |refs/tags/annotated-tag
+|refname is refs/tags/doubly-annotated-tag |refs/tags/doubly-annotated-tag
+| refname is refs/tags/doubly-signed-tag |refs/tags/doubly-signed-tag
| refname is refs/tags/four |refs/tags/four
| refname is refs/tags/one |refs/tags/one
| refname is refs/tags/signed-tag |refs/tags/signed-tag
@@ -178,11 +199,13 @@ EOF
# Individual atoms inside %(align:...) and %(end) must not be quoted.
test_expect_success 'alignment with format quote' "
- cat >expect <<-\EOF &&
+ test_prepare_expect >expect <<-\EOF &&
|' '\''master| A U Thor'\'' '|
|' '\''side| A U Thor'\'' '|
|' '\''odd/spot| A U Thor'\'' '|
- |' '\''double-tag| '\'' '|
+ |' '\''annotated-tag| '\'' '|
+ |' '\''doubly-annotated-tag| '\'' '|
+ |' '\''doubly-signed-tag| '\'' '|
|' '\''four| A U Thor'\'' '|
|' '\''one| A U Thor'\'' '|
|' '\''signed-tag| '\'' '|
@@ -194,11 +217,13 @@ test_expect_success 'alignment with format quote' "
"
test_expect_success 'nested alignment with quote formatting' "
- cat >expect <<-\EOF &&
+ test_prepare_expect >expect <<-\EOF &&
|' master '|
|' side '|
|' odd/spot '|
- |' double-tag '|
+ |' annotated-tag '|
+ |'doubly-annotated-tag '|
+ |'doubly-signed-tag '|
|' four '|
|' one '|
|' signed-tag '|
@@ -210,14 +235,16 @@ test_expect_success 'nested alignment with quote formatting' "
"
test_expect_success 'check `%(contents:lines=1)`' '
- cat >expect <<-\EOF &&
+ test_prepare_expect >expect <<-\EOF &&
master |three
side |four
odd/spot |three
- double-tag |Annonated doubly
+ annotated-tag |An annotated tag
+ doubly-annotated-tag |Annonated doubly
+ doubly-signed-tag |Signed doubly
four |four
one |one
- signed-tag |A signed tag message
+ signed-tag |A signed tag
three |three
two |two
EOF
@@ -226,11 +253,13 @@ test_expect_success 'check `%(contents:lines=1)`' '
'
test_expect_success 'check `%(contents:lines=0)`' '
- cat >expect <<-\EOF &&
+ test_prepare_expect >expect <<-\EOF &&
master |
side |
odd/spot |
- double-tag |
+ annotated-tag |
+ doubly-annotated-tag |
+ doubly-signed-tag |
four |
one |
signed-tag |
@@ -242,14 +271,16 @@ test_expect_success 'check `%(contents:lines=0)`' '
'
test_expect_success 'check `%(contents:lines=99999)`' '
- cat >expect <<-\EOF &&
+ test_prepare_expect >expect <<-\EOF &&
master |three
side |four
odd/spot |three
- double-tag |Annonated doubly
+ annotated-tag |An annotated tag
+ doubly-annotated-tag |Annonated doubly
+ doubly-signed-tag |Signed doubly
four |four
one |one
- signed-tag |A signed tag message
+ signed-tag |A signed tag
three |three
two |two
EOF
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index be82a75e5..e1abd1923 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -849,6 +849,19 @@ test_expect_success 'set up a second submodule' '
git commit -m "submodule example2 added"
'
+test_expect_success 'submodule deinit works on repository without submodules' '
+ test_when_finished "rm -rf newdirectory" &&
+ mkdir newdirectory &&
+ (
+ cd newdirectory &&
+ git init &&
+ >file &&
+ git add file &&
+ git commit -m "repo should not be empty"
+ git submodule deinit .
+ )
+'
+
test_expect_success 'submodule deinit should remove the whole submodule section from .git/config' '
git config submodule.example.foo bar &&
git config submodule.example2.frotz nitfol &&
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index b54094440..1e72971a1 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -905,6 +905,33 @@ test_expect_success 'inside git repository but with --no-index' '
)
'
+test_expect_success 'grep --no-index descends into repos, but not .git' '
+ rm -fr non &&
+ mkdir -p non/git &&
+ (
+ GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
+ export GIT_CEILING_DIRECTORIES &&
+ cd non/git &&
+
+ echo magic >file &&
+ git init repo &&
+ (
+ cd repo &&
+ echo magic >file &&
+ git add file &&
+ git commit -m foo &&
+ echo magic >.git/file
+ ) &&
+
+ cat >expect <<-\EOF &&
+ file
+ repo/file
+ EOF
+ git grep -l --no-index magic >actual &&
+ test_cmp expect actual
+ )
+'
+
test_expect_success 'setup double-dash tests' '
cat >double-dash <<EOF &&
--
diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh
index a526d6037..a94286c8e 100755
--- a/t/t9108-git-svn-glob.sh
+++ b/t/t9108-git-svn-glob.sh
@@ -86,9 +86,12 @@ test_expect_success 'test left-hand-side only globbing' '
test_cmp expect.two output.two
'
-echo "Only one set of wildcard directories" \
- "(e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'" > expect.three
-echo "" >> expect.three
+test_expect_success 'prepare test disallow multi-globs' "
+cat >expect.three <<EOF
+Only one set of wildcards (e.g. '*' or '*/*/*') is supported: branches/*/t/*
+
+EOF
+ "
test_expect_success 'test disallow multi-globs' '
git config --add svn-remote.three.url "$svnrepo" &&
diff --git a/t/t9109-git-svn-multi-glob.sh b/t/t9109-git-svn-multi-glob.sh
index f36b74924..8d99e848d 100755
--- a/t/t9109-git-svn-multi-glob.sh
+++ b/t/t9109-git-svn-multi-glob.sh
@@ -135,9 +135,12 @@ test_expect_success 'test another branch' '
test_cmp expect.four output.four
'
-echo "Only one set of wildcard directories" \
- "(e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'" > expect.three
-echo "" >> expect.three
+test_expect_success 'prepare test disallow multiple globs' "
+cat >expect.three <<EOF
+Only one set of wildcards (e.g. '*' or '*/*/*') is supported: branches/*/t/*
+
+EOF
+ "
test_expect_success 'test disallow multiple globs' '
git config --add svn-remote.three.url "$svnrepo" &&
diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh
index 0990f8d23..a87d3d3fc 100755
--- a/t/t9115-git-svn-dcommit-funky-renames.sh
+++ b/t/t9115-git-svn-dcommit-funky-renames.sh
@@ -93,7 +93,7 @@ test_expect_success 'git svn rebase works inside a fresh-cloned repository' '
# > to special UNICODE characters in the range 0xf000 to 0xf0ff (the
# > "Private use area") when creating or accessing files.
prepare_a_utf8_locale
-test_expect_success UTF8 'svn.pathnameencoding=cp932 new file on dcommit' '
+test_expect_success UTF8,!MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 new file on dcommit' '
LC_ALL=$a_utf8_locale &&
export LC_ALL &&
neq=$(printf "\201\202") &&
@@ -105,7 +105,7 @@ test_expect_success UTF8 'svn.pathnameencoding=cp932 new file on dcommit' '
'
# See the comment on the above test for setting of LC_ALL.
-test_expect_success 'svn.pathnameencoding=cp932 rename on dcommit' '
+test_expect_success !MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 rename on dcommit' '
LC_ALL=$a_utf8_locale &&
export LC_ALL &&
inf=$(printf "\201\207") &&
diff --git a/t/t9117-git-svn-init-clone.sh b/t/t9117-git-svn-init-clone.sh
index a66f43c6b..69a675052 100755
--- a/t/t9117-git-svn-init-clone.sh
+++ b/t/t9117-git-svn-init-clone.sh
@@ -119,4 +119,10 @@ test_expect_success 'clone with -s/-T/-b/-t and --prefix "" still works' '
rm -f warning
'
+test_expect_success 'init with -T as a full url works' '
+ test ! -d project &&
+ git svn init -T "$svnrepo"/project/trunk project &&
+ rm -rf project
+ '
+
test_done
diff --git a/t/t9168-git-svn-partially-globbed-names.sh b/t/t9168-git-svn-partially-globbed-names.sh
new file mode 100755
index 000000000..8b22f2272
--- /dev/null
+++ b/t/t9168-git-svn-partially-globbed-names.sh
@@ -0,0 +1,223 @@
+#!/bin/sh
+test_description='git svn globbing refspecs with prefixed globs'
+. ./lib-git-svn.sh
+
+test_expect_success 'prepare test refspec prefixed globbing' '
+ cat >expect.end <<EOF
+the end
+hi
+start a new branch
+initial
+EOF
+ '
+
+test_expect_success 'test refspec prefixed globbing' '
+ mkdir -p trunk/src/a trunk/src/b trunk/doc &&
+ echo "hello world" >trunk/src/a/readme &&
+ echo "goodbye world" >trunk/src/b/readme &&
+ svn_cmd import -m "initial" trunk "$svnrepo"/trunk &&
+ svn_cmd co "$svnrepo" tmp &&
+ (
+ cd tmp &&
+ mkdir branches tags &&
+ svn_cmd add branches tags &&
+ svn_cmd cp trunk branches/b_start &&
+ svn_cmd commit -m "start a new branch" &&
+ svn_cmd up &&
+ echo "hi" >>branches/b_start/src/b/readme &&
+ poke branches/b_start/src/b/readme &&
+ echo "hey" >>branches/b_start/src/a/readme &&
+ poke branches/b_start/src/a/readme &&
+ svn_cmd commit -m "hi" &&
+ svn_cmd up &&
+ svn_cmd cp branches/b_start tags/t_end &&
+ echo "bye" >>tags/t_end/src/b/readme &&
+ poke tags/t_end/src/b/readme &&
+ echo "aye" >>tags/t_end/src/a/readme &&
+ poke tags/t_end/src/a/readme &&
+ svn_cmd commit -m "the end" &&
+ echo "byebye" >>tags/t_end/src/b/readme &&
+ poke tags/t_end/src/b/readme &&
+ svn_cmd commit -m "nothing to see here"
+ ) &&
+ git config --add svn-remote.svn.url "$svnrepo" &&
+ git config --add svn-remote.svn.fetch \
+ "trunk/src/a:refs/remotes/trunk" &&
+ git config --add svn-remote.svn.branches \
+ "branches/b_*/src/a:refs/remotes/branches/b_*" &&
+ git config --add svn-remote.svn.tags\
+ "tags/t_*/src/a:refs/remotes/tags/t_*" &&
+ git svn multi-fetch &&
+ git log --pretty=oneline refs/remotes/tags/t_end | \
+ sed -e "s/^.\{41\}//" >output.end &&
+ test_cmp expect.end output.end &&
+ test "$(git rev-parse refs/remotes/tags/t_end~1)" = \
+ "$(git rev-parse refs/remotes/branches/b_start)" &&
+ test "$(git rev-parse refs/remotes/branches/b_start~2)" = \
+ "$(git rev-parse refs/remotes/trunk)" &&
+ test_must_fail git rev-parse refs/remotes/tags/t_end@3
+ '
+
+test_expect_success 'prepare test left-hand-side only prefixed globbing' '
+ echo try to try >expect.two &&
+ echo nothing to see here >>expect.two &&
+ cat expect.end >>expect.two
+ '
+
+test_expect_success 'test left-hand-side only prefixed globbing' '
+ git config --add svn-remote.two.url "$svnrepo" &&
+ git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
+ git config --add svn-remote.two.branches \
+ "branches/b_*:refs/remotes/two/branches/*" &&
+ git config --add svn-remote.two.tags \
+ "tags/t_*:refs/remotes/two/tags/*" &&
+ (
+ cd tmp &&
+ echo "try try" >>tags/t_end/src/b/readme &&
+ poke tags/t_end/src/b/readme &&
+ svn_cmd commit -m "try to try"
+ ) &&
+ git svn fetch two &&
+ test $(git rev-list refs/remotes/two/tags/t_end | wc -l) -eq 6 &&
+ test $(git rev-list refs/remotes/two/branches/b_start | wc -l) -eq 3 &&
+ test $(git rev-parse refs/remotes/two/branches/b_start~2) = \
+ $(git rev-parse refs/remotes/two/trunk) &&
+ test $(git rev-parse refs/remotes/two/tags/t_end~3) = \
+ $(git rev-parse refs/remotes/two/branches/b_start) &&
+ git log --pretty=oneline refs/remotes/two/tags/t_end | \
+ sed -e "s/^.\{41\}//" >output.two &&
+ test_cmp expect.two output.two
+ '
+
+test_expect_success 'prepare test prefixed globs match just prefix' '
+ cat >expect.three <<EOF
+Tag commit to t_
+Branch commit to b_
+initial
+EOF
+ '
+
+test_expect_success 'test prefixed globs match just prefix' '
+ git config --add svn-remote.three.url "$svnrepo" &&
+ git config --add svn-remote.three.fetch \
+ trunk:refs/remotes/three/trunk &&
+ git config --add svn-remote.three.branches \
+ "branches/b_*:refs/remotes/three/branches/*" &&
+ git config --add svn-remote.three.tags \
+ "tags/t_*:refs/remotes/three/tags/*" &&
+ (
+ cd tmp &&
+ svn_cmd cp trunk branches/b_ &&
+ echo "Branch commit to b_" >>branches/b_/src/a/readme &&
+ poke branches/b_/src/a/readme &&
+ svn_cmd commit -m "Branch commit to b_" &&
+ svn_cmd up && svn_cmd cp branches/b_ tags/t_ &&
+ echo "Tag commit to t_" >>tags/t_/src/a/readme &&
+ poke tags/t_/src/a/readme &&
+ svn_cmd commit -m "Tag commit to t_" &&
+ svn_cmd up
+ ) &&
+ git svn fetch three &&
+ test $(git rev-list refs/remotes/three/branches/b_ | wc -l) -eq 2 &&
+ test $(git rev-list refs/remotes/three/tags/t_ | wc -l) -eq 3 &&
+ test $(git rev-parse refs/remotes/three/branches/b_~1) = \
+ $(git rev-parse refs/remotes/three/trunk) &&
+ test $(git rev-parse refs/remotes/three/tags/t_~1) = \
+ $(git rev-parse refs/remotes/three/branches/b_) &&
+ git log --pretty=oneline refs/remotes/three/tags/t_ | \
+ sed -e "s/^.\{41\}//" >output.three &&
+ test_cmp expect.three output.three
+ '
+
+test_expect_success 'prepare test disallow prefixed multi-globs' "
+cat >expect.four <<EOF
+Only one set of wildcards (e.g. '*' or '*/*/*') is supported: branches/b_*/t/*
+
+EOF
+ "
+
+test_expect_success 'test disallow prefixed multi-globs' '
+ git config --add svn-remote.four.url "$svnrepo" &&
+ git config --add svn-remote.four.fetch \
+ trunk:refs/remotes/four/trunk &&
+ git config --add svn-remote.four.branches \
+ "branches/b_*/t/*:refs/remotes/four/branches/*" &&
+ git config --add svn-remote.four.tags \
+ "tags/t_*/*:refs/remotes/four/tags/*" &&
+ (
+ cd tmp &&
+ echo "try try" >>tags/t_end/src/b/readme &&
+ poke tags/t_end/src/b/readme &&
+ svn_cmd commit -m "try to try"
+ ) &&
+ test_must_fail git svn fetch four 2>stderr.four &&
+ test_cmp expect.four stderr.four &&
+ git config --unset svn-remote.four.branches &&
+ git config --unset svn-remote.four.tags
+ '
+
+test_expect_success 'prepare test globbing in the middle of the word' '
+ cat >expect.five <<EOF
+Tag commit to fghij
+Branch commit to abcde
+initial
+EOF
+ '
+
+test_expect_success 'test globbing in the middle of the word' '
+ git config --add svn-remote.five.url "$svnrepo" &&
+ git config --add svn-remote.five.fetch \
+ trunk:refs/remotes/five/trunk &&
+ git config --add svn-remote.five.branches \
+ "branches/a*e:refs/remotes/five/branches/*" &&
+ git config --add svn-remote.five.tags \
+ "tags/f*j:refs/remotes/five/tags/*" &&
+ (
+ cd tmp &&
+ svn_cmd cp trunk branches/abcde &&
+ echo "Branch commit to abcde" >>branches/abcde/src/a/readme &&
+ poke branches/b_/src/a/readme &&
+ svn_cmd commit -m "Branch commit to abcde" &&
+ svn_cmd up &&
+ svn_cmd cp branches/abcde tags/fghij &&
+ echo "Tag commit to fghij" >>tags/fghij/src/a/readme &&
+ poke tags/fghij/src/a/readme &&
+ svn_cmd commit -m "Tag commit to fghij" &&
+ svn_cmd up
+ ) &&
+ git svn fetch five &&
+ test $(git rev-list refs/remotes/five/branches/abcde | wc -l) -eq 2 &&
+ test $(git rev-list refs/remotes/five/tags/fghij | wc -l) -eq 3 &&
+ test $(git rev-parse refs/remotes/five/branches/abcde~1) = \
+ $(git rev-parse refs/remotes/five/trunk) &&
+ test $(git rev-parse refs/remotes/five/tags/fghij~1) = \
+ $(git rev-parse refs/remotes/five/branches/abcde) &&
+ git log --pretty=oneline refs/remotes/five/tags/fghij | \
+ sed -e "s/^.\{41\}//" >output.five &&
+ test_cmp expect.five output.five
+ '
+
+test_expect_success 'prepare test disallow multiple asterisks in one word' "
+ echo \"Only one '*' is allowed in a pattern: 'a*c*e'\" >expect.six &&
+ echo \"\" >>expect.six
+ "
+
+test_expect_success 'test disallow multiple asterisks in one word' '
+ git config --add svn-remote.six.url "$svnrepo" &&
+ git config --add svn-remote.six.fetch \
+ trunk:refs/remotes/six/trunk &&
+ git config --add svn-remote.six.branches \
+ "branches/a*c*e:refs/remotes/six/branches/*" &&
+ git config --add svn-remote.six.tags \
+ "tags/f*h*j:refs/remotes/six/tags/*" &&
+ (
+ cd tmp &&
+ echo "try try" >>tags/fghij/src/b/readme &&
+ poke tags/fghij/src/b/readme &&
+ svn_cmd commit -m "try to try"
+ ) &&
+ test_must_fail git svn fetch six 2>stderr.six &&
+ test_cmp expect.six stderr.six
+ '
+
+test_done
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 4c5f3c9d4..25bb60b28 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -55,6 +55,10 @@ test_expect_success 'empty stream succeeds' '
git fast-import </dev/null
'
+test_expect_success 'truncated stream complains' '
+ echo "tag foo" | test_must_fail git fast-import
+'
+
test_expect_success 'A: create pack from stdin' '
test_tick &&
cat >input <<-INPUT_END &&
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 7e8c40b97..1b75c9196 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -17,6 +17,12 @@ BEGIN {
use Cwd;
use File::Basename;
+sub adjust_dirsep {
+ my $path = shift;
+ $path =~ s{\\}{/}g;
+ return $path;
+}
+
BEGIN { use_ok('Git') }
# set up
@@ -33,7 +39,7 @@ is($r->config_int("test.int"), 2048, "config_int: integer");
is($r->config_int("test.nonexistent"), undef, "config_int: nonexistent");
ok($r->config_bool("test.booltrue"), "config_bool: true");
ok(!$r->config_bool("test.boolfalse"), "config_bool: false");
-is($r->config_path("test.path") =~ s/\\/\//gr, $r->config("test.pathexpanded"),
+is(adjust_dirsep($r->config_path("test.path")), $r->config("test.pathexpanded"),
"config_path: ~/foo expansion");
is_deeply([$r->config_path("test.pathmulti")], ["foo", "bar"],
"config_path: multiple values");