{"thread":{"id":"8585","subject":"[PATCH 0/3] git-svn: several house-keeping fixes","startedAt":"2007-06-13T09:37:02Z","lastAt":"2007-06-13T09:37:05Z","messageCount":4,"participants":["Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"44909","messageId":"11817274254011-git-send-email-normalperson@yhbt.net","threadId":"8585","inReplyTo":null,"subject":"[PATCH 0/3] git-svn: several house-keeping fixes","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-06-13T09:37:02Z","receivedAt":"2007-06-13T09:37:02Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"[PATCH 1/3] git-svn: cleanup: factor out longest_common_path() function\n - readability\n\n[PATCH 2/3] git-svn: test for creating new directories over svn://\n - The bug is already long fixed, but I'd like to add it for\n   documentation/regression testing purposes in case it breaks again.\n\n[PATCH 3/3] git-svn: reduce stat() calls for a backwards compatibility check\n - There's actually a small bugfix in there, too.  This should go to maint.\n\n-- \nEric Wong\n"},{"id":"44910","messageId":"11817274261148-git-send-email-normalperson@yhbt.net","threadId":"8585","inReplyTo":"11817274254011-git-send-email-normalperson@yhbt.net","subject":"[PATCH 1/3] git-svn: cleanup: factor out longest_common_path() function","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-06-13T09:37:03Z","receivedAt":"2007-06-13T09:37:03Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"I hadn't looked at this code in a while and had to read this\nagain to figure out what it did.  To avoid having to do this\nagain in the future, I just gave gave the hunk a descriptive\nname.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl |   16 +++++++++++-----\n 1 files changed, 11 insertions(+), 5 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex e350061..58f7dd0 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3072,11 +3072,8 @@ sub gs_do_switch {\n \t$editor->{git_commit_ok};\n }\n \n-sub gs_fetch_loop_common {\n-\tmy ($self, $base, $head, $gsv, $globs) = @_;\n-\treturn if ($base > $head);\n-\tmy $inc = $_log_window_size;\n-\tmy ($min, $max) = ($base, $head < $base + $inc ? $head : $base + $inc);\n+sub longest_common_path {\n+\tmy ($gsv, $globs) = @_;\n \tmy %common;\n \tmy $common_max = scalar @$gsv;\n \n@@ -3108,6 +3105,15 @@ sub gs_fetch_loop_common {\n \t\t\tlast;\n \t\t}\n \t}\n+\t$longest_path;\n+}\n+\n+sub gs_fetch_loop_common {\n+\tmy ($self, $base, $head, $gsv, $globs) = @_;\n+\treturn if ($base > $head);\n+\tmy $inc = $_log_window_size;\n+\tmy ($min, $max) = ($base, $head < $base + $inc ? $head : $base + $inc);\n+\tmy $longest_path = longest_common_path($gsv, $globs);\n \twhile (1) {\n \t\tmy %revs;\n \t\tmy $err;\n-- \n1.5.2.1.243.gbe00\n"},{"id":"44911","messageId":"11817274282332-git-send-email-normalperson@yhbt.net","threadId":"8585","inReplyTo":"11817274254011-git-send-email-normalperson@yhbt.net","subject":"[PATCH 2/3] git-svn: test for creating new directories over svn://","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-06-13T09:37:04Z","receivedAt":"2007-06-13T09:37:04Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"As reported by Matthieu Moy, this is causing svnserve to\nterminate connections (because it segfaults) segfault.\n\nThis test is disabled by default and can be enabled by setting\nSVNSERVE_PORT to an unbound (for 127.0.0.1) TCP port in the\nenvironment (in addition to SVN_TESTS=1).  I'm not comfortable\nwith having a test start a daemon by default and take up a port\nthat could potentially stay running if the test failed.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n t/t9113-git-svn-dcommit-new-file.sh |   40 +++++++++++++++++++++++++++++++++++\n 1 files changed, 40 insertions(+), 0 deletions(-)\n create mode 100755 t/t9113-git-svn-dcommit-new-file.sh\n\ndiff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh\nnew file mode 100755\nindex 0000000..9ef0db9\n--- /dev/null\n+++ b/t/t9113-git-svn-dcommit-new-file.sh\n@@ -0,0 +1,40 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2007 Eric Wong\n+#\n+\n+# Don't run this test by default unless the user really wants it\n+# I don't like the idea of taking a port and possibly leaving a\n+# daemon running on a users system if the test fails.\n+# Not all git users will need to interact with SVN.\n+test -z \"$SVNSERVE_PORT\" && exit 0\n+\n+test_description='git-svn dcommit new files over svn:// test'\n+\n+. ./lib-git-svn.sh\n+\n+start_svnserve () {\n+\tsvnserve --listen-port $SVNSERVE_PORT \\\n+\t         --root $rawsvnrepo \\\n+\t         --listen-once \\\n+\t         --listen-host 127.0.0.1 &\n+}\n+\n+test_expect_success 'start tracking an empty repo' \"\n+\tsvn mkdir -m 'empty dir' $svnrepo/empty-dir &&\n+\techo anon-access = write >> $rawsvnrepo/conf/svnserve.conf &&\n+\tstart_svnserve &&\n+\tgit svn init svn://127.0.0.1:$SVNSERVE_PORT &&\n+\tgit svn fetch\n+\t\"\n+\n+test_expect_success 'create files in new directory with dcommit' \"\n+\tmkdir git-new-dir &&\n+\techo hello > git-new-dir/world &&\n+\tgit update-index --add git-new-dir/world &&\n+\tgit commit -m hello &&\n+\tstart_svnserve &&\n+\tgit svn dcommit\n+\t\"\n+\n+test_done\n-- \n1.5.2.1.243.gbe00\n"},{"id":"44912","messageId":"11817274293330-git-send-email-normalperson@yhbt.net","threadId":"8585","inReplyTo":"11817274254011-git-send-email-normalperson@yhbt.net","subject":"[PATCH 3/3] git-svn: reduce stat() calls for a backwards compatibility check","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-06-13T09:37:05Z","receivedAt":"2007-06-13T09:37:05Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Also, this fixes a bug where in an odd case a remote named\n\"config\" could get renamed to \".metadata\".\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 58f7dd0..0ae8d70 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1457,7 +1457,7 @@ sub tmp_config {\n \tmy (@args) = @_;\n \tmy $old_def_config = \"$ENV{GIT_DIR}/svn/config\";\n \tmy $config = \"$ENV{GIT_DIR}/svn/.metadata\";\n-\tif (-e $old_def_config && ! -e $config) {\n+\tif (! -f $config && -f $old_def_config) {\n \t\trename $old_def_config, $config or\n \t\t       die \"Failed rename $old_def_config => $config: $!\\n\";\n \t}\n-- \n1.5.2.1.243.gbe00\n"}]}