From fc47391e2478b26d33cae033f13405b6ee6af97b Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 13 Aug 2020 11:00:17 -0400 Subject: drop vcs-svn experiment The code in vcs-svn was started in 2010 as an attempt to build a remote-helper for interacting with svn repositories (as opposed to git-svn). However, we never got as far as shipping a mature remote helper, and the last substantive commit was e99d012a6bc in 2012. We do have a git-remote-testsvn, and it is even installed as part of "make install". But given the name, it seems unlikely to be used by anybody (you'd have to explicitly "git clone testsvn::$url", and there have been zero mentions of that on the mailing list since 2013, and even that includes the phrase "you might need to hack a bit to get it working properly"[1]). We also ship contrib/svn-fe, which builds on the vcs-svn work. However, it does not seem to build out of the box for me, as the link step misses some required libraries for using libgit.a. Curiously, the original build breakage bisects for me to eff80a9fd9 (Allow custom "comment char", 2013-01-16), which seems unrelated. There was an attempt to fix it in da011cb0e7 (contrib/svn-fe: fix Makefile, 2014-08-28), but on my system that only switches the error message. So it seems like the result is not really usable by anybody in practice. It would be wonderful if somebody wanted to pick up the topic again, and potentially it's worth carrying around for that reason. But the flip side is that people doing tree-wide operations have to deal with this code. And you can see the list with (replace "HEAD" with this commit as appropriate): { echo "--" git diff-tree --diff-filter=D -r --name-only HEAD^ HEAD } | git log --no-merges --oneline e99d012a6bc.. --stdin which shows 58 times somebody had to deal with the code, generally due to a compile or test failure, or a tree-wide style fix or API change. Let's drop it and let anybody who wants to pick it up do so by resurrecting it from the git history. As a bonus, this also reduces the size of a stripped installation of Git from 21MB to 19MB. [1] https://lore.kernel.org/git/CALkWK0mPHzKfzFKKpZkfAus3YVC9NFYDbFnt+5JQYVKipk3bQQ@mail.gmail.com/ Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/helper/.gitignore | 2 - t/helper/test-line-buffer.c | 81 ---- t/helper/test-svn-fe.c | 52 -- t/t0081-line-buffer.sh | 90 ---- t/t9010-svn-fe.sh | 1105 ------------------------------------------- t/t9011-svn-da.sh | 248 ---------- t/t9020-remote-svn.sh | 95 ---- t/test-lib-functions.sh | 2 +- 8 files changed, 1 insertion(+), 1674 deletions(-) delete mode 100644 t/helper/test-line-buffer.c delete mode 100644 t/helper/test-svn-fe.c delete mode 100755 t/t0081-line-buffer.sh delete mode 100755 t/t9010-svn-fe.sh delete mode 100755 t/t9011-svn-da.sh delete mode 100755 t/t9020-remote-svn.sh (limited to 't') diff --git a/t/helper/.gitignore b/t/helper/.gitignore index 48c7bb0bbb..8c2ddcce95 100644 --- a/t/helper/.gitignore +++ b/t/helper/.gitignore @@ -1,4 +1,2 @@ /test-tool /test-fake-ssh -/test-line-buffer -/test-svn-fe diff --git a/t/helper/test-line-buffer.c b/t/helper/test-line-buffer.c deleted file mode 100644 index 078dd7e29d..0000000000 --- a/t/helper/test-line-buffer.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * test-line-buffer.c: code to exercise the svn importer's input helper - */ - -#include "git-compat-util.h" -#include "strbuf.h" -#include "vcs-svn/line_buffer.h" - -static uint32_t strtouint32(const char *s) -{ - char *end; - uintmax_t n = strtoumax(s, &end, 10); - if (*s == '\0' || *end != '\0') - die("invalid count: %s", s); - return (uint32_t) n; -} - -static void handle_command(const char *command, const char *arg, struct line_buffer *buf) -{ - if (starts_with(command, "binary ")) { - struct strbuf sb = STRBUF_INIT; - strbuf_addch(&sb, '>'); - buffer_read_binary(buf, &sb, strtouint32(arg)); - fwrite(sb.buf, 1, sb.len, stdout); - strbuf_release(&sb); - } else if (starts_with(command, "copy ")) { - buffer_copy_bytes(buf, strtouint32(arg)); - } else if (starts_with(command, "skip ")) { - buffer_skip_bytes(buf, strtouint32(arg)); - } else { - die("unrecognized command: %s", command); - } -} - -static void handle_line(const char *line, struct line_buffer *stdin_buf) -{ - const char *arg = strchr(line, ' '); - if (!arg) - die("no argument in line: %s", line); - handle_command(line, arg + 1, stdin_buf); -} - -int cmd_main(int argc, const char **argv) -{ - struct line_buffer stdin_buf = LINE_BUFFER_INIT; - struct line_buffer file_buf = LINE_BUFFER_INIT; - struct line_buffer *input = &stdin_buf; - const char *filename; - char *s; - - if (argc == 1) - filename = NULL; - else if (argc == 2) - filename = argv[1]; - else - usage("test-line-buffer [file | &fd] < script"); - - if (buffer_init(&stdin_buf, NULL)) - die_errno("open error"); - if (filename) { - if (*filename == '&') { - if (buffer_fdinit(&file_buf, strtouint32(filename + 1))) - die_errno("error opening fd %s", filename + 1); - } else { - if (buffer_init(&file_buf, filename)) - die_errno("error opening %s", filename); - } - input = &file_buf; - } - - while ((s = buffer_read_line(&stdin_buf))) - handle_line(s, input); - - if (filename && buffer_deinit(&file_buf)) - die("error reading from %s", filename); - if (buffer_deinit(&stdin_buf)) - die("input error"); - if (ferror(stdout)) - die("output error"); - return 0; -} diff --git a/t/helper/test-svn-fe.c b/t/helper/test-svn-fe.c deleted file mode 100644 index 7667c0803f..0000000000 --- a/t/helper/test-svn-fe.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * test-svn-fe: Code to exercise the svn import lib - */ - -#include "git-compat-util.h" -#include "vcs-svn/svndump.h" -#include "vcs-svn/svndiff.h" -#include "vcs-svn/sliding_window.h" -#include "vcs-svn/line_buffer.h" - -static const char test_svnfe_usage[] = - "test-svn-fe ( | [-d] )"; - -static int apply_delta(int argc, const char **argv) -{ - struct line_buffer preimage = LINE_BUFFER_INIT; - struct line_buffer delta = LINE_BUFFER_INIT; - struct sliding_view preimage_view = SLIDING_VIEW_INIT(&preimage, -1); - - if (argc != 5) - usage(test_svnfe_usage); - - if (buffer_init(&preimage, argv[2])) - die_errno("cannot open preimage"); - if (buffer_init(&delta, argv[3])) - die_errno("cannot open delta"); - if (svndiff0_apply(&delta, (off_t) strtoumax(argv[4], NULL, 0), - &preimage_view, stdout)) - return 1; - if (buffer_deinit(&preimage)) - die_errno("cannot close preimage"); - if (buffer_deinit(&delta)) - die_errno("cannot close delta"); - strbuf_release(&preimage_view.buf); - return 0; -} - -int cmd_main(int argc, const char **argv) -{ - if (argc == 2) { - if (svndump_init(argv[1])) - return 1; - svndump_read(NULL, "refs/heads/master", "refs/notes/svn/revs"); - svndump_deinit(); - svndump_reset(); - return 0; - } - - if (argc >= 2 && !strcmp(argv[1], "-d")) - return apply_delta(argc, argv); - usage(test_svnfe_usage); -} diff --git a/t/t0081-line-buffer.sh b/t/t0081-line-buffer.sh deleted file mode 100755 index ce92e6acad..0000000000 --- a/t/t0081-line-buffer.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh - -test_description="Test the svn importer's input handling routines. - -These tests provide some simple checks that the line_buffer API -behaves as advertised. - -While at it, check that input of newlines and null bytes are handled -correctly. -" -. ./test-lib.sh - -test_expect_success 'hello world' ' - echo ">HELLO" >expect && - test-line-buffer <<-\EOF >actual && - binary 6 - HELLO - EOF - test_cmp expect actual -' - -test_expect_success '0-length read, send along greeting' ' - echo ">HELLO" >expect && - test-line-buffer <<-\EOF >actual && - binary 0 - copy 6 - HELLO - EOF - test_cmp expect actual -' - -test_expect_success !MINGW 'read from file descriptor' ' - rm -f input && - echo hello >expect && - echo hello >input && - echo copy 6 | - test-line-buffer "&4" 4actual && - test_cmp expect actual -' - -test_expect_success 'skip, copy null byte' ' - echo Q | q_to_nul >expect && - q_to_nul <<-\EOF | test-line-buffer >actual && - skip 2 - Q - copy 2 - Q - EOF - test_cmp expect actual -' - -test_expect_success 'read null byte' ' - echo ">QhelloQ" | q_to_nul >expect && - q_to_nul <<-\EOF | test-line-buffer >actual && - binary 8 - QhelloQ - EOF - test_cmp expect actual -' - -test_expect_success 'long reads are truncated' ' - echo ">foo" >expect && - test-line-buffer <<-\EOF >actual && - binary 5 - foo - EOF - test_cmp expect actual -' - -test_expect_success 'long copies are truncated' ' - printf "%s\n" ">" foo >expect && - test-line-buffer <<-\EOF >actual && - binary 1 - - copy 5 - foo - EOF - test_cmp expect actual -' - -test_expect_success 'long binary reads are truncated' ' - echo ">foo" >expect && - test-line-buffer <<-\EOF >actual && - binary 5 - foo - EOF - test_cmp expect actual -' - -test_done diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh deleted file mode 100755 index 83f8f5cacb..0000000000 --- a/t/t9010-svn-fe.sh +++ /dev/null @@ -1,1105 +0,0 @@ -#!/bin/sh - -test_description='check svn dumpfile importer' - -. ./test-lib.sh - -if test_have_prereq !PIPE -then - skip_all="svn dumpfile importer testing requires the PIPE prerequisite" - test_done -fi - -reinit_git () { - rm -fr .git && - rm -f stream backflow && - git init && - mkfifo stream backflow -} - -try_dump () { - input=$1 && - maybe_fail_svnfe=${2:+test_$2} && - maybe_fail_fi=${3:+test_$3} && - - { - $maybe_fail_svnfe test-svn-fe "$input" >stream 3backflow && - wait $! -} - -properties () { - while test "$#" -ne 0 - do - property="$1" && - value="$2" && - printf "%s\n" "K ${#property}" && - printf "%s\n" "$property" && - printf "%s\n" "V ${#value}" && - printf "%s\n" "$value" && - shift 2 || - return 1 - done -} - -text_no_props () { - text="$1 -" && - printf "%s\n" "Prop-content-length: 10" && - printf "%s\n" "Text-content-length: ${#text}" && - printf "%s\n" "Content-length: $((${#text} + 10))" && - printf "%s\n" "" "PROPS-END" && - printf "%s\n" "$text" -} - -test_expect_success 'empty dump' ' - reinit_git && - echo "SVN-fs-dump-format-version: 2" >input && - try_dump input -' - -test_expect_success 'v4 dumps not supported' ' - reinit_git && - echo "SVN-fs-dump-format-version: 4" >v4.dump && - try_dump v4.dump must_fail -' - -test_expect_failure 'empty revision' ' - reinit_git && - printf "rev : %s\n" "" "" >expect && - cat >emptyrev.dump <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 0 - Content-length: 0 - - Revision-number: 2 - Prop-content-length: 0 - Content-length: 0 - - EOF - try_dump emptyrev.dump && - git log -p --format="rev <%an, %ae>: %s" HEAD >actual && - test_cmp expect actual -' - -test_expect_success 'empty properties' ' - reinit_git && - printf "rev : %s\n" "" "" >expect && - cat >emptyprop.dump <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Revision-number: 2 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - EOF - try_dump emptyprop.dump && - git log -p --format="rev <%an, %ae>: %s" HEAD >actual && - test_cmp expect actual -' - -test_expect_success 'author name and commit message' ' - reinit_git && - echo "" >expect.author && - cat >message <<-\EOF && - A concise summary of the change - - A detailed description of the change, why it is needed, what - was broken and why applying this is the best course of action. - - * file.c - Details pertaining to an individual file. - EOF - { - properties \ - svn:author author@example.com \ - svn:log "$(cat message)" && - echo PROPS-END - } >props && - { - echo "SVN-fs-dump-format-version: 3" && - echo && - echo "Revision-number: 1" && - echo Prop-content-length: $(wc -c log.dump && - try_dump log.dump && - git log -p --format="%B" HEAD >actual.log && - git log --format="<%an, %ae>" >actual.author && - test_cmp message actual.log && - test_cmp expect.author actual.author -' - -test_expect_success 'unsupported properties are ignored' ' - reinit_git && - echo author >expect && - cat >extraprop.dump <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 56 - Content-length: 56 - - K 8 - nonsense - V 1 - y - K 10 - svn:author - V 6 - author - PROPS-END - EOF - try_dump extraprop.dump && - git log -p --format=%an HEAD >actual && - test_cmp expect actual -' - -test_expect_failure 'timestamp and empty file' ' - echo author@example.com >expect.author && - echo 1999-01-01 >expect.date && - echo file >expect.files && - reinit_git && - { - properties \ - svn:author author@example.com \ - svn:date "1999-01-01T00:01:002.000000Z" \ - svn:log "add empty file" && - echo PROPS-END - } >props && - { - cat <<-EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - EOF - echo Prop-content-length: $(wc -c emptyfile.dump && - try_dump emptyfile.dump && - git log --format=%an HEAD >actual.author && - git log --date=short --format=%ad HEAD >actual.date && - git ls-tree -r --name-only HEAD >actual.files && - test_cmp expect.author actual.author && - test_cmp expect.date actual.date && - test_cmp expect.files actual.files && - git checkout HEAD empty-file && - test_must_be_empty file -' - -test_expect_success 'directory with files' ' - reinit_git && - printf "%s\n" directory/file1 directory/file2 >expect.files && - echo hi >hi && - echo hello >hello && - { - properties \ - svn:author author@example.com \ - svn:date "1999-02-01T00:01:002.000000Z" \ - svn:log "add directory with some files in it" && - echo PROPS-END - } >props && - { - cat <<-EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - EOF - echo Prop-content-length: $(wc -c directory.dump && - try_dump directory.dump && - - git ls-tree -r --name-only HEAD >actual.files && - git checkout HEAD directory && - test_cmp expect.files actual.files && - test_cmp hello directory/file1 && - test_cmp hi directory/file2 -' - -test_expect_success 'branch name with backslash' ' - reinit_git && - sort <<-\EOF >expect.branch-files && - trunk/file1 - trunk/file2 - "branches/UpdateFOPto094\\/file1" - "branches/UpdateFOPto094\\/file2" - EOF - - echo hi >hi && - echo hello >hello && - { - properties \ - svn:author author@example.com \ - svn:date "1999-02-02T00:01:02.000000Z" \ - svn:log "add directory with some files in it" && - echo PROPS-END - } >props.setup && - { - properties \ - svn:author brancher@example.com \ - svn:date "2007-12-06T21:38:34.000000Z" \ - svn:log "Updating fop to .94 and adjust fo-stylesheets" && - echo PROPS-END - } >props.branch && - { - cat <<-EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - EOF - echo Prop-content-length: $(wc -c branch.dump && - try_dump branch.dump && - - git ls-tree -r --name-only HEAD | - sort >actual.branch-files && - test_cmp expect.branch-files actual.branch-files -' - -test_expect_success 'node without action' ' - reinit_git && - cat >inaction.dump <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: directory - Node-kind: dir - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - EOF - try_dump inaction.dump must_fail -' - -test_expect_success 'action: add node without text' ' - reinit_git && - cat >textless.dump <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: textless - Node-kind: file - Node-action: add - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - EOF - try_dump textless.dump must_fail -' - -test_expect_failure 'change file mode but keep old content' ' - reinit_git && - cat >expect <<-\EOF && - OBJID - :120000 100644 OBJID OBJID T greeting - OBJID - :100644 120000 OBJID OBJID T greeting - OBJID - :000000 100644 OBJID OBJID A greeting - EOF - echo "link hello" >expect.blob && - echo hello >hello && - cat >filemode.dump <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: greeting - Node-kind: file - Node-action: add - Prop-content-length: 10 - Text-content-length: 11 - Content-length: 21 - - PROPS-END - link hello - - Revision-number: 2 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: greeting - Node-kind: file - Node-action: change - Prop-content-length: 33 - Content-length: 33 - - K 11 - svn:special - V 1 - * - PROPS-END - - Revision-number: 3 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: greeting - Node-kind: file - Node-action: change - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - EOF - try_dump filemode.dump && - { - git rev-list HEAD | - git diff-tree --root --stdin | - sed "s/$OID_REGEX/OBJID/g" - } >actual && - git show HEAD:greeting >actual.blob && - git show HEAD^:greeting >actual.target && - test_cmp expect actual && - test_cmp expect.blob actual.blob && - test_cmp hello actual.target -' - -test_expect_success 'NUL in property value' ' - reinit_git && - echo "commit message" >expect.message && - { - properties \ - unimportant "something with a NUL (Q)" \ - svn:log "commit message" && - echo PROPS-END - } | - q_to_nul >props && - { - cat <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - EOF - echo Prop-content-length: $(wc -c nulprop.dump && - try_dump nulprop.dump && - git diff-tree --always -s --format=%s HEAD >actual.message && - test_cmp expect.message actual.message -' - -test_expect_success 'NUL in log message, file content, and property name' ' - # Caveat: svnadmin 1.6.16 (r1073529) truncates at \0 in the - # svn:specialQnotreally example. - reinit_git && - cat >expect <<-\EOF && - OBJID - :100644 100644 OBJID OBJID M greeting - OBJID - :000000 100644 OBJID OBJID A greeting - EOF - printf "\n%s\n" "something with an ASCII NUL (Q)" >expect.message && - printf "%s\n" "helQo" >expect.hello1 && - printf "%s\n" "link hello" >expect.hello2 && - { - properties svn:log "something with an ASCII NUL (Q)" && - echo PROPS-END - } | - q_to_nul >props && - { - q_to_nul <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: greeting - Node-kind: file - Node-action: add - Prop-content-length: 10 - Text-content-length: 6 - Content-length: 16 - - PROPS-END - helQo - - Revision-number: 2 - EOF - echo Prop-content-length: $(wc -c 8bitclean.dump && - try_dump 8bitclean.dump && - { - git rev-list HEAD | - git diff-tree --root --stdin | - sed "s/$OID_REGEX/OBJID/g" - } >actual && - { - git cat-file commit HEAD | nul_to_q && - echo - } | - sed -ne "/^\$/,\$ p" >actual.message && - git cat-file blob HEAD^:greeting | nul_to_q >actual.hello1 && - git cat-file blob HEAD:greeting | nul_to_q >actual.hello2 && - test_cmp expect actual && - test_cmp expect.message actual.message && - test_cmp expect.hello1 actual.hello1 && - test_cmp expect.hello2 actual.hello2 -' - -test_expect_success 'change file mode and reiterate content' ' - reinit_git && - cat >expect <<-\EOF && - OBJID - :120000 100644 OBJID OBJID T greeting - OBJID - :100644 120000 OBJID OBJID T greeting - OBJID - :000000 100644 OBJID OBJID A greeting - EOF - echo "link hello" >expect.blob && - echo hello >hello && - cat >filemode2.dump <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: greeting - Node-kind: file - Node-action: add - Prop-content-length: 10 - Text-content-length: 11 - Content-length: 21 - - PROPS-END - link hello - - Revision-number: 2 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: greeting - Node-kind: file - Node-action: change - Prop-content-length: 33 - Text-content-length: 11 - Content-length: 44 - - K 11 - svn:special - V 1 - * - PROPS-END - link hello - - Revision-number: 3 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: greeting - Node-kind: file - Node-action: change - Prop-content-length: 10 - Text-content-length: 11 - Content-length: 21 - - PROPS-END - link hello - EOF - try_dump filemode2.dump && - { - git rev-list HEAD | - git diff-tree --root --stdin | - sed "s/$OID_REGEX/OBJID/g" - } >actual && - git show HEAD:greeting >actual.blob && - git show HEAD^:greeting >actual.target && - test_cmp expect actual && - test_cmp expect.blob actual.blob && - test_cmp hello actual.target -' - -test_expect_success 'deltas supported' ' - reinit_git && - { - # (old) h + (inline) ello + (old) \n - printf "SVNQ%b%b%s" "Q\003\006\005\004" "\001Q\0204\001\002" "ello" | - q_to_nul - } >delta && - { - properties \ - svn:author author@example.com \ - svn:date "1999-01-05T00:01:002.000000Z" \ - svn:log "add greeting" && - echo PROPS-END - } >props && - { - properties \ - svn:author author@example.com \ - svn:date "1999-01-06T00:01:002.000000Z" \ - svn:log "change it" && - echo PROPS-END - } >props2 && - { - echo SVN-fs-dump-format-version: 3 && - echo && - echo Revision-number: 1 && - echo Prop-content-length: $(wc -c delta.dump && - try_dump delta.dump -' - -test_expect_success 'property deltas supported' ' - reinit_git && - cat >expect <<-\EOF && - OBJID - :100755 100644 OBJID OBJID M script.sh - EOF - { - properties \ - svn:author author@example.com \ - svn:date "1999-03-06T00:01:002.000000Z" \ - svn:log "make an executable, or chmod -x it" && - echo PROPS-END - } >revprops && - { - echo SVN-fs-dump-format-version: 3 && - echo && - echo Revision-number: 1 && - echo Prop-content-length: $(wc -c propdelta.dump && - try_dump propdelta.dump && - { - git rev-list HEAD | - git diff-tree --stdin | - sed "s/$OID_REGEX/OBJID/g" - } >actual && - test_cmp expect actual -' - -test_expect_success 'properties on /' ' - reinit_git && - cat <<-\EOF >expect && - OBJID - OBJID - :000000 100644 OBJID OBJID A greeting - EOF - sed -e "s/X$//" <<-\EOF >changeroot.dump && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: greeting - Node-kind: file - Node-action: add - Text-content-length: 0 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Revision-number: 2 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: X - Node-kind: dir - Node-action: change - Prop-delta: true - Prop-content-length: 43 - Content-length: 43 - - K 10 - svn:ignore - V 11 - build-area - - PROPS-END - EOF - try_dump changeroot.dump && - { - git rev-list HEAD | - git diff-tree --root --always --stdin | - sed "s/$OID_REGEX/OBJID/g" - } >actual && - test_cmp expect actual -' - -test_expect_success 'deltas for typechange' ' - reinit_git && - cat >expect <<-\EOF && - OBJID - :120000 100644 OBJID OBJID T test-file - OBJID - :100755 120000 OBJID OBJID T test-file - OBJID - :000000 100755 OBJID OBJID A test-file - EOF - cat >deleteprop.dump <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: test-file - Node-kind: file - Node-action: add - Prop-delta: true - Prop-content-length: 35 - Text-content-length: 17 - Content-length: 52 - - K 14 - svn:executable - V 0 - - PROPS-END - link testing 123 - - Revision-number: 2 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: test-file - Node-kind: file - Node-action: change - Prop-delta: true - Prop-content-length: 53 - Text-content-length: 17 - Content-length: 70 - - K 11 - svn:special - V 1 - * - D 14 - svn:executable - PROPS-END - link testing 231 - - Revision-number: 3 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: test-file - Node-kind: file - Node-action: change - Prop-delta: true - Prop-content-length: 27 - Text-content-length: 17 - Content-length: 44 - - D 11 - svn:special - PROPS-END - link testing 321 - EOF - try_dump deleteprop.dump && - { - git rev-list HEAD | - git diff-tree --root --stdin | - sed "s/$OID_REGEX/OBJID/g" - } >actual && - test_cmp expect actual -' - -test_expect_success 'deltas need not consume the whole preimage' ' - reinit_git && - cat >expect <<-\EOF && - OBJID - :120000 100644 OBJID OBJID T postimage - OBJID - :100644 120000 OBJID OBJID T postimage - OBJID - :000000 100644 OBJID OBJID A postimage - EOF - echo "first preimage" >expect.1 && - printf target >expect.2 && - printf lnk >expect.3 && - { - printf "SVNQ%b%b%b" "QQ\017\001\017" "\0217" "first preimage\n" | - q_to_nul - } >delta.1 && - { - properties svn:special "*" && - echo PROPS-END - } >symlink.props && - { - printf "SVNQ%b%b%b" "Q\002\013\004\012" "\0201\001\001\0211" "lnk target" | - q_to_nul - } >delta.2 && - { - printf "SVNQ%b%b" "Q\004\003\004Q" "\001Q\002\002" | - q_to_nul - } >delta.3 && - { - cat <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: postimage - Node-kind: file - Node-action: add - Text-delta: true - Prop-content-length: 10 - EOF - echo Text-content-length: $(wc -c deltapartial.dump && - try_dump deltapartial.dump && - { - git rev-list HEAD | - git diff-tree --root --stdin | - sed "s/$OID_REGEX/OBJID/g" - } >actual && - test_cmp expect actual && - git show HEAD:postimage >actual.3 && - git show HEAD^:postimage >actual.2 && - git show HEAD^^:postimage >actual.1 && - test_cmp expect.1 actual.1 && - test_cmp expect.2 actual.2 && - test_cmp expect.3 actual.3 -' - -test_expect_success 'no hang for delta trying to read past end of preimage' ' - reinit_git && - { - # COPY 1 - printf "SVNQ%b%b" "Q\001\001\002Q" "\001Q" | - q_to_nul - } >greedy.delta && - { - cat <<-\EOF && - SVN-fs-dump-format-version: 3 - - Revision-number: 1 - Prop-content-length: 10 - Content-length: 10 - - PROPS-END - - Node-path: bootstrap - Node-kind: file - Node-action: add - Text-delta: true - Prop-content-length: 10 - EOF - echo Text-content-length: $(wc -c greedydelta.dump && - try_dump greedydelta.dump must_fail might_fail -' - -test_expect_success 'set up svn repo' ' - svnconf=$PWD/svnconf && - mkdir -p "$svnconf" && - - if - svnadmin -h >/dev/null 2>&1 && - svnadmin create simple-svn && - svnadmin load simple-svn <"$TEST_DIRECTORY/t9135/svn.dump" && - svn export --config-dir "$svnconf" "file://$PWD/simple-svn" simple-svnco - then - test_set_prereq SVNREPO - fi -' - -test_expect_success SVNREPO 't9135/svn.dump' ' - mkdir -p simple-git && - ( - cd simple-git && - reinit_git && - try_dump "$TEST_DIRECTORY/t9135/svn.dump" - ) && - ( - cd simple-svnco && - git init && - git add . && - git fetch ../simple-git master && - git diff --exit-code FETCH_HEAD - ) -' - -test_done diff --git a/t/t9011-svn-da.sh b/t/t9011-svn-da.sh deleted file mode 100755 index ab1ef28fd9..0000000000 --- a/t/t9011-svn-da.sh +++ /dev/null @@ -1,248 +0,0 @@ -#!/bin/sh - -test_description='test parsing of svndiff0 files - -Using the "test-svn-fe -d" helper, check that svn-fe correctly -interprets deltas using various facilities (some from the spec, -some only learned from practice). -' -. ./test-lib.sh - ->empty -printf foo >preimage - -test_expect_success 'reject empty delta' ' - test_must_fail test-svn-fe -d preimage empty 0 -' - -test_expect_success 'delta can empty file' ' - printf "SVNQ" | q_to_nul >clear.delta && - test-svn-fe -d preimage clear.delta 4 >actual && - test_must_be_empty actual -' - -test_expect_success 'reject svndiff2' ' - printf "SVN\002" >bad.filetype && - test_must_fail test-svn-fe -d preimage bad.filetype 4 -' - -test_expect_success 'one-window empty delta' ' - printf "SVNQ%s" "QQQQQ" | q_to_nul >clear.onewindow && - test-svn-fe -d preimage clear.onewindow 9 >actual && - test_must_be_empty actual -' - -test_expect_success 'reject incomplete window header' ' - printf "SVNQ%s" "QQQQQ" | q_to_nul >clear.onewindow && - printf "SVNQ%s" "QQ" | q_to_nul >clear.partialwindow && - test_must_fail test-svn-fe -d preimage clear.onewindow 6 && - test_must_fail test-svn-fe -d preimage clear.partialwindow 6 -' - -test_expect_success 'reject declared delta longer than actual delta' ' - printf "SVNQ%s" "QQQQQ" | q_to_nul >clear.onewindow && - printf "SVNQ%s" "QQ" | q_to_nul >clear.partialwindow && - test_must_fail test-svn-fe -d preimage clear.onewindow 14 && - test_must_fail test-svn-fe -d preimage clear.partialwindow 9 -' - -test_expect_success 'two-window empty delta' ' - printf "SVNQ%s%s" "QQQQQ" "QQQQQ" | q_to_nul >clear.twowindow && - test-svn-fe -d preimage clear.twowindow 14 >actual && - test_must_fail test-svn-fe -d preimage clear.twowindow 13 && - test_must_be_empty actual -' - -test_expect_success 'noisy zeroes' ' - printf "SVNQ%s" \ - "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRQQQQQ" | - tr R "\200" | - q_to_nul >clear.noisy && - len=$(wc -c clear.badmagic && - test_must_fail test-svn-fe -d preimage clear.badmagic 5 -' - -test_expect_success 'reject truncated integer' ' - printf "SVNQ%s%s" "QQQQQ" "QQQQRRQ" | - tr R "\200" | - q_to_nul >clear.fullint && - printf "SVNQ%s%s" "QQQQQ" "QQQQRR" | - tr RT "\201" | - q_to_nul >clear.partialint && - test_must_fail test-svn-fe -d preimage clear.fullint 15 && - test-svn-fe -d preimage clear.fullint 16 && - test_must_fail test-svn-fe -d preimage clear.partialint 15 -' - -test_expect_success 'nonempty (but unused) preimage view' ' - printf "SVNQ%b" "Q\003QQQ" | q_to_nul >clear.readpreimage && - test-svn-fe -d preimage clear.readpreimage 9 >actual && - test_must_be_empty actual -' - -test_expect_success 'preimage view: right endpoint cannot backtrack' ' - printf "SVNQ%b%b" "Q\003QQQ" "Q\002QQQ" | - q_to_nul >clear.backtrack && - test_must_fail test-svn-fe -d preimage clear.backtrack 14 -' - -test_expect_success 'preimage view: left endpoint can advance' ' - printf "SVNQ%b%b" "Q\003QQQ" "\001\002QQQ" | - q_to_nul >clear.preshrink && - printf "SVNQ%b%b" "Q\003QQQ" "\001\001QQQ" | - q_to_nul >clear.shrinkbacktrack && - test-svn-fe -d preimage clear.preshrink 14 >actual && - test_must_fail test-svn-fe -d preimage clear.shrinkbacktrack 14 && - test_must_be_empty actual -' - -test_expect_success 'preimage view: offsets compared by value' ' - printf "SVNQ%b%b" "\001\001QQQ" "\0200Q\003QQQ" | - q_to_nul >clear.noisybacktrack && - printf "SVNQ%b%b" "\001\001QQQ" "\0200\001\002QQQ" | - q_to_nul >clear.noisyadvance && - test_must_fail test-svn-fe -d preimage clear.noisybacktrack 15 && - test-svn-fe -d preimage clear.noisyadvance 15 && - test_must_be_empty actual -' - -test_expect_success 'preimage view: reject truncated preimage' ' - printf "SVNQ%b" "\010QQQQ" | q_to_nul >clear.lateemptyread && - printf "SVNQ%b" "\010\001QQQ" | q_to_nul >clear.latenonemptyread && - printf "SVNQ%b" "\001\010QQQ" | q_to_nul >clear.longread && - test_must_fail test-svn-fe -d preimage clear.lateemptyread 9 && - test_must_fail test-svn-fe -d preimage clear.latenonemptyread 9 && - test_must_fail test-svn-fe -d preimage clear.longread 9 -' - -test_expect_success 'forbid unconsumed inline data' ' - printf "SVNQ%b%s%b%s" "QQQQ\003" "bar" "QQQQ\001" "x" | - q_to_nul >inline.clear && - test_must_fail test-svn-fe -d preimage inline.clear 18 >actual -' - -test_expect_success 'reject truncated inline data' ' - printf "SVNQ%b%s" "QQQQ\003" "b" | q_to_nul >inline.trunc && - test_must_fail test-svn-fe -d preimage inline.trunc 10 -' - -test_expect_success 'reject truncated inline data (after instruction section)' ' - printf "SVNQ%b%b%s" "QQ\001\001\003" "\0201" "b" | q_to_nul >insn.trunc && - test_must_fail test-svn-fe -d preimage insn.trunc 11 -' - -test_expect_success 'copyfrom_data' ' - echo hi >expect && - printf "SVNQ%b%b%b" "QQ\003\001\003" "\0203" "hi\n" | q_to_nul >copydat && - test-svn-fe -d preimage copydat 13 >actual && - test_cmp expect actual -' - -test_expect_success 'multiple copyfrom_data' ' - echo hi >expect && - printf "SVNQ%b%b%b%b%b" "QQ\003\002\003" "\0201\0202" "hi\n" \ - "QQQ\002Q" "\0200Q" | q_to_nul >copy.multi && - len=$(wc -c actual && - test_cmp expect actual -' - -test_expect_success 'incomplete multiple insn' ' - printf "SVNQ%b%b%b" "QQ\003\002\003" "\0203\0200" "hi\n" | - q_to_nul >copy.partial && - len=$(wc -c copy.incomplete && - len=$(wc -c expect && - printf "SVNQ%b%b%s" "QQ\006\004\003" "\0203\0100\003Q" "foo" | - q_to_nul >copytarget.repeat && - len=$(wc -c actual && - test_cmp expect actual -' - -test_expect_success 'copyfrom target out of order' ' - printf foooof >expect && - printf "SVNQ%b%b%s" \ - "QQ\006\007\003" "\0203\0101\002\0101\001\0101Q" "foo" | - q_to_nul >copytarget.reverse && - len=$(wc -c actual && - test_cmp expect actual -' - -test_expect_success 'catch copyfrom future' ' - printf "SVNQ%b%b%s" "QQ\004\004\003" "\0202\0101\002\0201" "XYZ" | - q_to_nul >copytarget.infuture && - len=$(wc -c expect && - printf "SVNQ%b%b%s" "QQ\014\004\003" "\0202\0111Q\0201" "XYZ" | - q_to_nul >copytarget.sustain && - len=$(wc -c actual && - test_cmp expect actual -' - -test_expect_success 'catch copy that overflows' ' - printf "SVNQ%b%b%s" "QQ\003\003\001" "\0201\0177Q" X | - q_to_nul >copytarget.overflow && - len=$(wc -c expect && - printf "SVNQ%b%b" "Q\003\003\002Q" "\003Q" | q_to_nul >copysource.all && - test-svn-fe -d preimage copysource.all 11 >actual && - test_cmp expect actual -' - -test_expect_success 'copy backwards' ' - printf oof >expect && - printf "SVNQ%b%b" "Q\003\003\006Q" "\001\002\001\001\001Q" | - q_to_nul >copysource.rev && - test-svn-fe -d preimage copysource.rev 15 >actual && - test_cmp expect actual -' - -test_expect_success 'offsets are relative to window' ' - printf fo >expect && - printf "SVNQ%b%b%b%b" "Q\003\001\002Q" "\001Q" \ - "\002\001\001\002Q" "\001Q" | - q_to_nul >copysource.two && - test-svn-fe -d preimage copysource.two 18 >actual && - test_cmp expect actual -' - -test_expect_success 'example from notes/svndiff' ' - printf aaaaccccdddddddd >expect && - printf aaaabbbbcccc >source && - printf "SVNQ%b%b%s" "Q\014\020\007\001" \ - "\004Q\004\010\0201\0107\010" d | - q_to_nul >delta.example && - len=$(wc -c actual && - test_cmp expect actual -' - -test_done diff --git a/t/t9020-remote-svn.sh b/t/t9020-remote-svn.sh deleted file mode 100755 index 754c4a3284..0000000000 --- a/t/t9020-remote-svn.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh - -test_description='tests remote-svn' - -. ./test-lib.sh - -MARKSPATH=.git/info/fast-import/remote-svn - -if ! test_have_prereq PYTHON -then - skip_all='skipping remote-svn tests, python not available' - test_done -fi - -# Override svnrdump with our simulator -PATH="$HOME:$PATH" -export PATH PYTHON_PATH GIT_BUILD_DIR - -write_script "$HOME/svnrdump" <<\EOF -exec "$PYTHON_PATH" "$GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py" "$@" -EOF - -init_git () { - rm -fr .git && - git init && - #git remote add svnsim testsvn::sim:///$TEST_DIRECTORY/t9020/example.svnrdump - # let's reuse an existing dump file!? - git remote add svnsim "testsvn::sim://$TEST_DIRECTORY/t9154/svn.dump" - git remote add svnfile "testsvn::file://$TEST_DIRECTORY/t9154/svn.dump" -} - -if test -e "$GIT_BUILD_DIR/git-remote-testsvn" -then - test_set_prereq REMOTE_SVN -fi - -test_debug ' - git --version - type git - type svnrdump -' - -test_expect_success REMOTE_SVN 'simple fetch' ' - init_git && - git fetch svnsim && - test_cmp .git/refs/svn/svnsim/master .git/refs/remotes/svnsim/master && - cp .git/refs/remotes/svnsim/master master.good -' - -test_debug ' - git show-ref -s refs/svn/svnsim/master - git show-ref -s refs/remotes/svnsim/master -' - -test_expect_success REMOTE_SVN 'repeated fetch, nothing shall change' ' - git fetch svnsim && - test_cmp master.good .git/refs/remotes/svnsim/master -' - -test_expect_success REMOTE_SVN 'fetch from a file:// url gives the same result' ' - git fetch svnfile -' - -test_expect_failure REMOTE_SVN 'the sha1 differ because the git-svn-id line in the commit msg contains the url' ' - test_cmp .git/refs/remotes/svnfile/master .git/refs/remotes/svnsim/master -' - -test_expect_success REMOTE_SVN 'mark-file regeneration' ' - # filter out any other marks, that can not be regenerated. Only up to 3 digit revisions are allowed here - grep ":[0-9]\{1,3\} " $MARKSPATH/svnsim.marks > $MARKSPATH/svnsim.marks.old && - rm $MARKSPATH/svnsim.marks && - git fetch svnsim && - test_cmp $MARKSPATH/svnsim.marks.old $MARKSPATH/svnsim.marks -' - -test_expect_success REMOTE_SVN 'incremental imports must lead to the same head' ' - SVNRMAX=3 && - export SVNRMAX && - init_git && - git fetch svnsim && - test_cmp .git/refs/svn/svnsim/master .git/refs/remotes/svnsim/master && - unset SVNRMAX && - git fetch svnsim && - test_cmp master.good .git/refs/remotes/svnsim/master -' - -test_expect_success REMOTE_SVN 'respects configured default initial branch' ' - git -c init.defaultBranch=trunk remote add -f trunk \ - "testsvn::file://$TEST_DIRECTORY/t9154/svn.dump" && - git rev-parse --verify refs/remotes/trunk/trunk -' - -test_debug 'git branch -a' - -test_done diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 596c549cdd..6d9ea1bb67 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -820,7 +820,7 @@ test_must_fail_acceptable () { fi case "$1" in - git|__git*|test-tool|test-svn-fe|test_terminal) + git|__git*|test-tool|test_terminal) return 0 ;; *) -- cgit v1.2.3