diff options
Diffstat (limited to 't')
-rw-r--r-- | t/lib-httpd/apache.conf | 3 | ||||
-rwxr-xr-x | t/t0001-init.sh | 20 | ||||
-rwxr-xr-x | t/t1300-repo-config.sh | 17 | ||||
-rwxr-xr-x | t/t3001-ls-files-others-exclude.sh | 7 | ||||
-rwxr-xr-x | t/t3007-ls-files-other-negative.sh | 153 | ||||
-rwxr-xr-x | t/t5313-pack-bounds-checks.sh | 179 | ||||
-rwxr-xr-x | t/t5510-fetch.sh | 10 | ||||
-rwxr-xr-x | t/t7400-submodule-basic.sh | 13 | ||||
-rwxr-xr-x | t/t9108-git-svn-glob.sh | 9 | ||||
-rwxr-xr-x | t/t9109-git-svn-multi-glob.sh | 9 | ||||
-rwxr-xr-x | t/t9115-git-svn-dcommit-funky-renames.sh | 4 | ||||
-rwxr-xr-x | t/t9117-git-svn-init-clone.sh | 6 | ||||
-rwxr-xr-x | t/t9168-git-svn-partially-globbed-names.sh | 223 | ||||
-rwxr-xr-x | t/t9700/test.pl | 8 |
14 files changed, 473 insertions, 188 deletions
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf index 7d15e6d44c..f667e7ce2f 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 295aa5949a..a5b9e7a4c7 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/t1300-repo-config.sh b/t/t1300-repo-config.sh index 8867ce10f8..6767da87cb 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 @@ -1209,6 +1205,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 +1307,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 +1336,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 +1345,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/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh index d043078da5..3fc484e8c3 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 0797b86ad0..0000000000 --- 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/t5313-pack-bounds-checks.sh b/t/t5313-pack-bounds-checks.sh new file mode 100755 index 0000000000..a8a587abc3 --- /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/t5510-fetch.sh b/t/t5510-fetch.sh index 0c10c856a9..38321d19ef 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/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index be82a75e54..e1abd19230 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/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh index a526d60379..a94286c8ec 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 f36b749242..8d99e848d4 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 0990f8d235..a87d3d3fc1 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 a66f43c6b1..69a675052e 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 0000000000..8b22f2272c --- /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/t9700/test.pl b/t/t9700/test.pl index 7e8c40b97b..1b75c91965 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"); |