* git-svn and renames
@ 2007-07-10 13:11 Rogan Dawes
2007-07-10 13:20 ` David Kastrup
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Rogan Dawes @ 2007-07-10 13:11 UTC (permalink / raw)
To: Git Mailing List, Eric Wong
Hi folks,
I am trying to push my local changes to an imported SVN project back to
the SVN repo. For anyone who cares, this is the WebGoat repository which
you can find at http://dawes.za.net/rogan/webgoat/webgoat.git/
I am trying to push it back to the primary GoogleCode repo. I have
successfully managed to push 20 or so commits, but I am now running up
against a problem with a renamed/moved file.
I moved a file from a directory to a subdirectory, and made minimal
changes to this file so that it remained a valid Java class. i.e. I
changed the package, and a few other minor things. As can be seen at
<http://dawes.za.net/gitweb.cgi?p=rogan/webgoat/webgoat.git;a=commitdiff;h=486416188a3e49d60e1510166ac197e5e66cc4d2>,
git detects the rename with 93% similarity.
However, when I try to push this change to the Google repo, git-svn dies
with the following error:
$ git svn dcommit
RA layer request failed: PROPFIND request failed on '/svn/trunk/
webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
PROPFIND of '/svn/trunk/
webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
400 Bad Request (https://webgoat.googlecode.com) at
/home/rdawes/bin/git-svn line 400
[Yes, those paths have a space in them, however this does not seem to
have prevented me from committing the previous 20 or so changes.]
I noted the following in the git-svn documentation, with regards to
handling renames. However, I am not renaming a directory, only a couple
of files.
---- quote ----
BUGS
----
We ignore all SVN properties except svn:executable. Any unhandled
properties are logged to $GIT_DIR/svn/<refname>/unhandled.log
Renamed and copied directories are not detected by git and hence not
tracked when committing to SVN. I do not plan on adding support for
this as it's quite difficult and time-consuming to get working for all
the possible corner cases (git doesn't do it, either). Committing
renamed and copied files are fully supported if they're similar enough
for git to detect them.
---- end quote ----
This is using the latest git as of today:
$ git --version
git version 1.5.3.rc0.81.g1ed84
Any ideas?
Thanks
Rogan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-svn and renames
2007-07-10 13:11 git-svn and renames Rogan Dawes
@ 2007-07-10 13:20 ` David Kastrup
2007-07-10 14:18 ` Rogan Dawes
2007-07-10 13:42 ` Florian Weimer
2007-07-11 8:20 ` Eric Wong
2 siblings, 1 reply; 10+ messages in thread
From: David Kastrup @ 2007-07-10 13:20 UTC (permalink / raw)
To: git
Rogan Dawes <lists@dawes.za.net> writes:
> However, when I try to push this change to the Google repo, git-svn
> dies with the following error:
>
> $ git svn dcommit
> RA layer request failed: PROPFIND request failed on '/svn/trunk/
> webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
> PROPFIND of '/svn/trunk/
> webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
> 400 Bad Request (https://webgoat.googlecode.com) at
> /home/rdawes/bin/git-svn line 400
>
> [Yes, those paths have a space in them, however this does not seem to
> have prevented me from committing the previous 20 or so changes.]
>
> I noted the following in the git-svn documentation, with regards to
> handling renames. However, I am not renaming a directory, only a
> couple of files.
> ---- quote ----
[...]
>
> Renamed and copied directories are not detected by git and hence not
> tracked when committing to SVN. I do not plan on adding support for
> this as it's quite difficult and time-consuming to get working for all
> the possible corner cases (git doesn't do it, either). Committing
> renamed and copied files are fully supported if they're similar enough
> for git to detect them.
> Any ideas?
dcommit Commit several diffs to merge with upstream
--quiet, -q
--fetch-all, --all
--no-auth-cache
--no-rebase
--no-checkout
--rmdir
--dry-run, -n
--find-copies-harder
--follow-parent, --follow!
--authors-file, -A <arg>
--copy-similarity, -C <num>
--username <arg>
--repack-flags, --repack-args, --repack-opts <arg>
--repack <num>
--verbose, -v
--edit, -e
--log-window-size <num>
--config-dir <arg>
-l <num>
--merge, -m, -M
--strategy, -s <arg>
Try playing with the --copy-similarity and --find-copies-harder flags.
--
David Kastrup
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-svn and renames
2007-07-10 13:11 git-svn and renames Rogan Dawes
2007-07-10 13:20 ` David Kastrup
@ 2007-07-10 13:42 ` Florian Weimer
2007-07-10 14:01 ` Rogan Dawes
2007-07-11 8:20 ` Eric Wong
2 siblings, 1 reply; 10+ messages in thread
From: Florian Weimer @ 2007-07-10 13:42 UTC (permalink / raw)
To: git
* Rogan Dawes:
> $ git svn dcommit
> RA layer request failed: PROPFIND request failed on '/svn/trunk/
> webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
> PROPFIND of '/svn/trunk/
> webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
> 400 Bad Request (https://webgoat.googlecode.com) at
> /home/rdawes/bin/git-svn line 400
Does the "lessons" directory exist before that commit?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-svn and renames
2007-07-10 13:42 ` Florian Weimer
@ 2007-07-10 14:01 ` Rogan Dawes
0 siblings, 0 replies; 10+ messages in thread
From: Rogan Dawes @ 2007-07-10 14:01 UTC (permalink / raw)
To: Florian Weimer; +Cc: git
Florian Weimer wrote:
> * Rogan Dawes:
>
>> $ git svn dcommit
>> RA layer request failed: PROPFIND request failed on '/svn/trunk/
>> webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
>> PROPFIND of '/svn/trunk/
>> webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
>> 400 Bad Request (https://webgoat.googlecode.com) at
>> /home/rdawes/bin/git-svn line 400
>
> Does the "lessons" directory exist before that commit?
Yes. The file was in the lessons/ directory, and was moved to
lessons/GoatHillsFinancial/. This new directory also existed prior to
this commit.
Rogan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-svn and renames
2007-07-10 13:20 ` David Kastrup
@ 2007-07-10 14:18 ` Rogan Dawes
0 siblings, 0 replies; 10+ messages in thread
From: Rogan Dawes @ 2007-07-10 14:18 UTC (permalink / raw)
To: David Kastrup; +Cc: git
David Kastrup wrote:
> Rogan Dawes <lists@dawes.za.net> writes:
>
>> However, when I try to push this change to the Google repo, git-svn
>> dies with the following error:
>>
>> $ git svn dcommit
>> RA layer request failed: PROPFIND request failed on '/svn/trunk/
>> webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
>> PROPFIND of '/svn/trunk/
>> webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
>> 400 Bad Request (https://webgoat.googlecode.com) at
>> /home/rdawes/bin/git-svn line 400
>>
>> [Yes, those paths have a space in them, however this does not seem to
>> have prevented me from committing the previous 20 or so changes.]
>>
>> I noted the following in the git-svn documentation, with regards to
>> handling renames. However, I am not renaming a directory, only a
>> couple of files.
>
>> ---- quote ----
>
> [...]
>> Renamed and copied directories are not detected by git and hence not
>> tracked when committing to SVN. I do not plan on adding support for
>> this as it's quite difficult and time-consuming to get working for all
>> the possible corner cases (git doesn't do it, either). Committing
>> renamed and copied files are fully supported if they're similar enough
>> for git to detect them.
>
>> Any ideas?
>
> dcommit Commit several diffs to merge with upstream
> --quiet, -q
> --fetch-all, --all
> --no-auth-cache
> --no-rebase
> --no-checkout
> --rmdir
> --dry-run, -n
> --find-copies-harder
> --follow-parent, --follow!
> --authors-file, -A <arg>
> --copy-similarity, -C <num>
> --username <arg>
> --repack-flags, --repack-args, --repack-opts <arg>
> --repack <num>
> --verbose, -v
> --edit, -e
> --log-window-size <num>
> --config-dir <arg>
> -l <num>
> --merge, -m, -M
> --strategy, -s <arg>
>
>
> Try playing with the --copy-similarity and --find-copies-harder flags.
>
Thanks for the suggestion.
However, even going all the way to 50% had no impact. I get the exact
same message.
$ git svn --find-copies-harder -C 50 dcommit
RA layer request failed: PROPFIND request failed on '/svn/trunk/
webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
PROPFIND of '/svn/trunk/
webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
400 Bad Request (https://webgoat.googlecode.com) at
/home/rdawes/bin/git-svn line 400
Unfortunately, the error seems to be in the SVN::Ra library, and I can
find no way to enable debugging output on this code.
One thing I did note is that performing a dry-run completes successfully:
$ git svn dcommit -n
diff-tree 486416188a3e49d60e1510166ac197e5e66cc4d2~1
486416188a3e49d60e1510166ac197e5e66cc4d2
diff-tree e0100ee6353c2160eca642ec600639004d92a99e~1
e0100ee6353c2160eca642ec600639004d92a99e
diff-tree ba64aa781efdc31a4ffceed8648ece45ac955186~1
ba64aa781efdc31a4ffceed8648ece45ac955186
diff-tree 23202df6f1533bf79c0ad127fdcb06db35d8b634~1
23202df6f1533bf79c0ad127fdcb06db35d8b634
diff-tree 42af98c396e66cc2c0377e267e5431414fb8d580~1
42af98c396e66cc2c0377e267e5431414fb8d580
diff-tree 16c76a9129cb66378851bb0bec8e983354d0c936~1
16c76a9129cb66378851bb0bec8e983354d0c936
diff-tree d1a1992abfdcba1a97989c29dd0f25257b03f16a~1
d1a1992abfdcba1a97989c29dd0f25257b03f16a
diff-tree dc7071e954e33a0c859db575f3b4be767194fa7e~1
dc7071e954e33a0c859db575f3b4be767194fa7e
diff-tree 107ef202137ba38325c28b95983ded23d67cae89~1
107ef202137ba38325c28b95983ded23d67cae89
diff-tree 01891b7a0cc03234145a29582dbd5061aed0b347~1
01891b7a0cc03234145a29582dbd5061aed0b347
diff-tree f047c06823632a10379255957302698375e62d26~1
f047c06823632a10379255957302698375e62d26
diff-tree 634664ef291c5f33594202dec9f5e081348e10d2~1
634664ef291c5f33594202dec9f5e081348e10d2
diff-tree 13e731927bc32e27a240cba647f1c6425cea6247~1
13e731927bc32e27a240cba647f1c6425cea6247
diff-tree df62b0a2ef3f5556b52b933b08409dc05a2ba671~1
df62b0a2ef3f5556b52b933b08409dc05a2ba671
diff-tree 745ec078b881cc87234a7bfe59635f7856094d8e~1
745ec078b881cc87234a7bfe59635f7856094d8e
diff-tree 91b08b5f2bc6bc1d235cb9d624be23346c5a2749~1
91b08b5f2bc6bc1d235cb9d624be23346c5a2749
diff-tree 8c1805e3be9595099832d9c55cdf740f3c20bd16~1
8c1805e3be9595099832d9c55cdf740f3c20bd16
diff-tree b06b234c5dbb046e4a56ee30f4a8b1bf17758794~1
b06b234c5dbb046e4a56ee30f4a8b1bf17758794
diff-tree 52313b6cb19fc962a7c51eacf9016870b93e2467~1
52313b6cb19fc962a7c51eacf9016870b93e2467
diff-tree 8689b19c8fc48a603c0b9992a7ba04f7e57f4e70~1
8689b19c8fc48a603c0b9992a7ba04f7e57f4e70
diff-tree 23e348e97ee5220e7514249a163647b187aa4f8b~1
23e348e97ee5220e7514249a163647b187aa4f8b
diff-tree 76479ab494bd6edfa306271be0919d4b210d1296~1
76479ab494bd6edfa306271be0919d4b210d1296
[word wrapped, unfortunately]
Thanks for your help.
Regards,
Rogan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-svn and renames
2007-07-10 13:11 git-svn and renames Rogan Dawes
2007-07-10 13:20 ` David Kastrup
2007-07-10 13:42 ` Florian Weimer
@ 2007-07-11 8:20 ` Eric Wong
2007-07-12 9:06 ` Eric Wong
2 siblings, 1 reply; 10+ messages in thread
From: Eric Wong @ 2007-07-11 8:20 UTC (permalink / raw)
To: Rogan Dawes; +Cc: Git Mailing List
Rogan Dawes <lists@dawes.za.net> wrote:
> Hi folks,
>
> I am trying to push my local changes to an imported SVN project back to
> the SVN repo. For anyone who cares, this is the WebGoat repository which
> you can find at http://dawes.za.net/rogan/webgoat/webgoat.git/
>
> I am trying to push it back to the primary GoogleCode repo. I have
> successfully managed to push 20 or so commits, but I am now running up
> against a problem with a renamed/moved file.
>
> I moved a file from a directory to a subdirectory, and made minimal
> changes to this file so that it remained a valid Java class. i.e. I
> changed the package, and a few other minor things. As can be seen at
> <http://dawes.za.net/gitweb.cgi?p=rogan/webgoat/webgoat.git;a=commitdiff;h=486416188a3e49d60e1510166ac197e5e66cc4d2>,
> git detects the rename with 93% similarity.
>
> However, when I try to push this change to the Google repo, git-svn dies
> with the following error:
>
> $ git svn dcommit
> RA layer request failed: PROPFIND request failed on '/svn/trunk/
> webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
> PROPFIND of '/svn/trunk/
> webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
> 400 Bad Request (https://webgoat.googlecode.com) at
> /home/rdawes/bin/git-svn line 400
>
> [Yes, those paths have a space in them, however this does not seem to
> have prevented me from committing the previous 20 or so changes.]
>
> I noted the following in the git-svn documentation, with regards to
> handling renames. However, I am not renaming a directory, only a couple
> of files.
I've personally noted a rename issue with committing funky characters
"#{}" in filenames (I was renaming to get rid of those funky characters of
course). Haven't had proper time to look into it.
Did any previous successful commits have renames in them? You may want
to set similarity to 100% to disable rename detection.
--
Eric Wong
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-svn and renames
2007-07-11 8:20 ` Eric Wong
@ 2007-07-12 9:06 ` Eric Wong
2007-07-12 16:51 ` Rogan Dawes
2007-07-16 4:53 ` [PATCH] git-svn: fix commiting renames over DAV with funky file names Eric Wong
0 siblings, 2 replies; 10+ messages in thread
From: Eric Wong @ 2007-07-12 9:06 UTC (permalink / raw)
To: Rogan Dawes; +Cc: Git Mailing List
Eric Wong <normalperson@yhbt.net> wrote:
> Rogan Dawes <lists@dawes.za.net> wrote:
> > Hi folks,
> >
> > I am trying to push my local changes to an imported SVN project back to
> > the SVN repo. For anyone who cares, this is the WebGoat repository which
> > you can find at http://dawes.za.net/rogan/webgoat/webgoat.git/
> >
> > I am trying to push it back to the primary GoogleCode repo. I have
> > successfully managed to push 20 or so commits, but I am now running up
> > against a problem with a renamed/moved file.
> >
> > I moved a file from a directory to a subdirectory, and made minimal
> > changes to this file so that it remained a valid Java class. i.e. I
> > changed the package, and a few other minor things. As can be seen at
> > <http://dawes.za.net/gitweb.cgi?p=rogan/webgoat/webgoat.git;a=commitdiff;h=486416188a3e49d60e1510166ac197e5e66cc4d2>,
> > git detects the rename with 93% similarity.
> >
> > However, when I try to push this change to the Google repo, git-svn dies
> > with the following error:
> >
> > $ git svn dcommit
> > RA layer request failed: PROPFIND request failed on '/svn/trunk/
> > webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
> > PROPFIND of '/svn/trunk/
> > webgoat/main/project/JavaSource/org/owasp/webgoat/lessons/DefaultLessonAction.java':
> > 400 Bad Request (https://webgoat.googlecode.com) at
> > /home/rdawes/bin/git-svn line 400
> >
> > [Yes, those paths have a space in them, however this does not seem to
> > have prevented me from committing the previous 20 or so changes.]
> >
> > I noted the following in the git-svn documentation, with regards to
> > handling renames. However, I am not renaming a directory, only a couple
> > of files.
>
> I've personally noted a rename issue with committing funky characters
> "#{}" in filenames (I was renaming to get rid of those funky characters of
> course). Haven't had proper time to look into it.
>
> Did any previous successful commits have renames in them? You may want
> to set similarity to 100% to disable rename detection.
SVN over HTTP is most definitely behaves differently from svn:// and
file:// wrt strange file names. I'll see if I can work on this again in
day or two, or if anybody wants to pick up where I left off, my
work-in-progress test case is below (it's currently failing, of course).
I'll have to look into how (if) svk handles it and also at the svn
command-line client. I'm fairly sure the command-line svn client
handles it somehow...
Right now I'm getting sleepy, my vision is blurring and I'm seeing
"SVN" as "S/M" through my tired eyes...
>From 4c0165488390ad0cafb3eea700d8c873576131c2 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Thu, 12 Jul 2007 01:48:14 -0700
Subject: [PATCH] git-svn: WIP test for commiting renames over DAV with funky file names
---
t/lib-git-svn.sh | 26 +++++++
t/t9115-git-svn-dcommit-funky-renames.sh | 37 +++++++++++
t/t9115/funky-names.dump | 105 ++++++++++++++++++++++++++++++
3 files changed, 168 insertions(+), 0 deletions(-)
create mode 100755 t/t9115-git-svn-dcommit-funky-renames.sh
create mode 100644 t/t9115/funky-names.dump
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index f6fe78c..60b26d4 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -48,3 +48,29 @@ svnrepo="file://$svnrepo"
poke() {
test-chmtime +1 "$1"
}
+
+SVN_HTTPD_MODULE_PATH=/usr/lib/apache2/modules
+SVN_HTTPD_PATH=/usr/sbin/apache2
+SVN_HTTPD_PORT=3443
+start_httpd () {
+mkdir $GIT_DIR/logs
+
+ cat > "$GIT_DIR/httpd.conf" <<EOF
+ServerName "git-svn test"
+ServerRoot "$GIT_DIR"
+DocumentRoot "$GIT_DIR"
+PidFile "$GIT_DIR/httpd.pid"
+Listen 127.0.0.1:$SVN_HTTPD_PORT
+LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so
+LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so
+<Location /svn>
+ DAV svn
+ SVNPath $rawsvnrepo
+</Location>
+EOF
+ $SVN_HTTPD_PATH -f $GIT_DIR/httpd.conf -k start
+}
+
+stop_httpd () {
+ $SVN_HTTPD_PATH -f $GIT_DIR/httpd.conf -k stop
+}
diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh
new file mode 100755
index 0000000..b451ca2
--- /dev/null
+++ b/t/t9115-git-svn-dcommit-funky-renames.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Eric Wong
+
+
+test_description='git-svn dcommit can commit renames of files with ugly names'
+
+. ./lib-git-svn.sh
+
+test_expect_success 'load repository with strange names' "
+ svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+ start_httpd
+"
+
+test_expect_success 'init and fetch repository' "
+ git svn init http://127.0.0.1:$SVN_HTTPD_PORT/svn &&
+ git svn fetch &&
+ git reset --hard git-svn
+ "
+
+test_expect_success 'create file in existing ugly and empty dir' '
+ mkdir "#{bad_directory_name}" &&
+ echo hi > "#{bad_directory_name}/ foo" &&
+ git update-index --add "#{bad_directory_name}/ foo" &&
+ git commit -m "new file in ugly parent" &&
+ git svn dcommit
+ '
+
+test_expect_success 'rename ugly file' '
+ git mv "#{bad_directory_name}/ foo" "file name with feces" &&
+ git commit -m "rename ugly file" &&
+ git svn dcommit --rmdir
+ '
+
+stop_httpd
+
+test_done
diff --git a/t/t9115/funky-names.dump b/t/t9115/funky-names.dump
new file mode 100644
index 0000000..da0440a
--- /dev/null
+++ b/t/t9115/funky-names.dump
@@ -0,0 +1,105 @@
+SVN-fs-dump-format-version: 2
+
+UUID: 819c44fe-2bcc-4066-88e4-985e2bc0b418
+
+Revision-number: 0
+Prop-content-length: 56
+Content-length: 56
+
+K 8
+svn:date
+V 27
+2007-07-12T07:54:26.062914Z
+PROPS-END
+
+Revision-number: 1
+Prop-content-length: 152
+Content-length: 152
+
+K 7
+svn:log
+V 44
+what will those wacky people think of next?
+
+K 10
+svn:author
+V 12
+normalperson
+K 8
+svn:date
+V 27
+2007-07-12T08:00:05.011573Z
+PROPS-END
+
+Node-path: leading space
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+Node-path: leading space file
+Node-kind: file
+Node-action: add
+Prop-content-length: 10
+Text-content-length: 5
+Text-content-md5: e4fa20c67542cdc21271e08d329397ab
+Content-length: 15
+
+PROPS-END
+ugly
+
+
+Node-path: #{bad_directory_name}
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+Node-path: #{cool_name}
+Node-kind: file
+Node-action: add
+Prop-content-length: 10
+Text-content-length: 18
+Text-content-md5: 87dac40ca337dfa3dcc8911388c3ddda
+Content-length: 28
+
+PROPS-END
+strange name here
+
+
+Node-path: dir name with spaces
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+Node-path: file name with spaces
+Node-kind: file
+Node-action: add
+Prop-content-length: 10
+Text-content-length: 7
+Text-content-md5: c1f10cfd640618484a2a475c11410fd3
+Content-length: 17
+
+PROPS-END
+spaces
+
+
+Node-path: regular_dir_name
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
--
Eric Wong
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: git-svn and renames
2007-07-12 9:06 ` Eric Wong
@ 2007-07-12 16:51 ` Rogan Dawes
2007-07-16 4:53 ` [PATCH] git-svn: fix commiting renames over DAV with funky file names Eric Wong
1 sibling, 0 replies; 10+ messages in thread
From: Rogan Dawes @ 2007-07-12 16:51 UTC (permalink / raw)
To: Eric Wong; +Cc: Git Mailing List
Eric Wong wrote:
>> I've personally noted a rename issue with committing funky characters
>> "#{}" in filenames (I was renaming to get rid of those funky characters of
>> course). Haven't had proper time to look into it.
>>
>> Did any previous successful commits have renames in them? You may want
>> to set similarity to 100% to disable rename detection.
>
> SVN over HTTP is most definitely behaves differently from svn:// and
> file:// wrt strange file names. I'll see if I can work on this again in
> day or two, or if anybody wants to pick up where I left off, my
> work-in-progress test case is below (it's currently failing, of course).
>
> I'll have to look into how (if) svk handles it and also at the svn
> command-line client. I'm fairly sure the command-line svn client
> handles it somehow...
>
> Right now I'm getting sleepy, my vision is blurring and I'm seeing
> "SVN" as "S/M" through my tired eyes...
>
Hi Eric,
This doesn't seem to be my problem. In my case, the filenames are quite
simple and straightforward.
Thanks
Rogan
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] git-svn: fix commiting renames over DAV with funky file names
2007-07-12 9:06 ` Eric Wong
2007-07-12 16:51 ` Rogan Dawes
@ 2007-07-16 4:53 ` Eric Wong
2007-07-16 6:36 ` Rogan Dawes
1 sibling, 1 reply; 10+ messages in thread
From: Eric Wong @ 2007-07-16 4:53 UTC (permalink / raw)
To: Rogan Dawes, Junio C Hamano; +Cc: git
Renaming files with non-URI friendly characters caused
breakage when committing to DAV repositories (over http(s)).
Even if I try leaving out the $self->{url} from the return value
of url_path(), a partial (without host), unescaped path name
does not work.
Filenames for DAV repos need to be URI-encoded before being
passed to the library. Since this bug did not affect file://
and svn:// repos, the git-svn test library needed to be expanded
to include support for starting Apache with mod_dav_svn enabled.
This new test is not enabled by default, but can be enabled by
setting SVN_HTTPD_PORT to any available TCP/IP port on
127.0.0.1.
Additionally, for running this test, the following variables
(with defaults shown) can be changed for the suitable system.
The default values are set for Debian systems:
SVN_HTTPD_MODULE_PATH=/usr/lib/apache2/modules
SVN_HTTPD_PATH=/usr/sbin/apache2
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
Rogan: the patch should help, a single space anywhere in the
path causes SVN to screw up the file names. Of course I'm at a
loss as to why only DAV repositories need it and why the SVN
libraries don't abstract that away from me.
git-svn.perl | 3 +
t/lib-git-svn.sh | 34 ++++++++++
t/t9115-git-svn-dcommit-funky-renames.sh | 54 +++++++++++++++
t/t9115/funky-names.dump | 105 ++++++++++++++++++++++++++++++
4 files changed, 196 insertions(+), 0 deletions(-)
create mode 100755 t/t9115-git-svn-dcommit-funky-renames.sh
create mode 100644 t/t9115/funky-names.dump
diff --git a/git-svn.perl b/git-svn.perl
index 299b40f..01c3904 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2724,6 +2724,9 @@ sub repo_path {
sub url_path {
my ($self, $path) = @_;
+ if ($self->{url} =~ m#^https?://#) {
+ $path =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;
+ }
$self->{url} . '/' . $self->repo_path($path);
}
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index f6fe78c..8d4a447 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -48,3 +48,37 @@ svnrepo="file://$svnrepo"
poke() {
test-chmtime +1 "$1"
}
+
+SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
+SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
+
+start_httpd () {
+ if test -z "$SVN_HTTPD_PORT"
+ then
+ echo >&2 'SVN_HTTPD_PORT is not defined!'
+ return
+ fi
+
+ mkdir "$GIT_DIR"/logs
+
+ cat > "$GIT_DIR/httpd.conf" <<EOF
+ServerName "git-svn test"
+ServerRoot "$GIT_DIR"
+DocumentRoot "$GIT_DIR"
+PidFile "$GIT_DIR/httpd.pid"
+Listen 127.0.0.1:$SVN_HTTPD_PORT
+LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so
+LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so
+<Location /svn>
+ DAV svn
+ SVNPath $rawsvnrepo
+</Location>
+EOF
+ "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start
+ svnrepo=http://127.0.0.1:$SVN_HTTPD_PORT/svn
+}
+
+stop_httpd () {
+ test -z "$SVN_HTTPD_PORT" && return
+ "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop
+}
diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh
new file mode 100755
index 0000000..182299c
--- /dev/null
+++ b/t/t9115-git-svn-dcommit-funky-renames.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Eric Wong
+
+
+test_description='git-svn dcommit can commit renames of files with ugly names'
+
+. ./lib-git-svn.sh
+
+test_expect_success 'load repository with strange names' "
+ svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+ start_httpd
+ "
+
+test_expect_success 'init and fetch repository' "
+ git svn init $svnrepo &&
+ git svn fetch &&
+ git reset --hard git-svn
+ "
+
+test_expect_success 'create file in existing ugly and empty dir' '
+ mkdir "#{bad_directory_name}" &&
+ echo hi > "#{bad_directory_name}/ foo" &&
+ git update-index --add "#{bad_directory_name}/ foo" &&
+ git commit -m "new file in ugly parent" &&
+ git svn dcommit
+ '
+
+test_expect_success 'rename ugly file' '
+ git mv "#{bad_directory_name}/ foo" "file name with feces" &&
+ git commit -m "rename ugly file" &&
+ git svn dcommit
+ '
+
+test_expect_success 'rename pretty file' '
+ echo :x > pretty &&
+ git update-index --add pretty &&
+ git commit -m "pretty :x" &&
+ git svn dcommit &&
+ mkdir regular_dir_name &&
+ git mv pretty regular_dir_name/pretty &&
+ git commit -m "moved pretty file" &&
+ git svn dcommit
+ '
+
+test_expect_success 'rename pretty file into ugly one' '
+ git mv regular_dir_name/pretty "#{bad_directory_name}/ booboo" &&
+ git commit -m booboo &&
+ git svn dcommit
+ '
+
+stop_httpd
+
+test_done
diff --git a/t/t9115/funky-names.dump b/t/t9115/funky-names.dump
new file mode 100644
index 0000000..da0440a
--- /dev/null
+++ b/t/t9115/funky-names.dump
@@ -0,0 +1,105 @@
+SVN-fs-dump-format-version: 2
+
+UUID: 819c44fe-2bcc-4066-88e4-985e2bc0b418
+
+Revision-number: 0
+Prop-content-length: 56
+Content-length: 56
+
+K 8
+svn:date
+V 27
+2007-07-12T07:54:26.062914Z
+PROPS-END
+
+Revision-number: 1
+Prop-content-length: 152
+Content-length: 152
+
+K 7
+svn:log
+V 44
+what will those wacky people think of next?
+
+K 10
+svn:author
+V 12
+normalperson
+K 8
+svn:date
+V 27
+2007-07-12T08:00:05.011573Z
+PROPS-END
+
+Node-path: leading space
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+Node-path: leading space file
+Node-kind: file
+Node-action: add
+Prop-content-length: 10
+Text-content-length: 5
+Text-content-md5: e4fa20c67542cdc21271e08d329397ab
+Content-length: 15
+
+PROPS-END
+ugly
+
+
+Node-path: #{bad_directory_name}
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+Node-path: #{cool_name}
+Node-kind: file
+Node-action: add
+Prop-content-length: 10
+Text-content-length: 18
+Text-content-md5: 87dac40ca337dfa3dcc8911388c3ddda
+Content-length: 28
+
+PROPS-END
+strange name here
+
+
+Node-path: dir name with spaces
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+Node-path: file name with spaces
+Node-kind: file
+Node-action: add
+Prop-content-length: 10
+Text-content-length: 7
+Text-content-md5: c1f10cfd640618484a2a475c11410fd3
+Content-length: 17
+
+PROPS-END
+spaces
+
+
+Node-path: regular_dir_name
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
--
1.5.3.rc2.1.g4e223
--
Eric Wong
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] git-svn: fix commiting renames over DAV with funky file names
2007-07-16 4:53 ` [PATCH] git-svn: fix commiting renames over DAV with funky file names Eric Wong
@ 2007-07-16 6:36 ` Rogan Dawes
0 siblings, 0 replies; 10+ messages in thread
From: Rogan Dawes @ 2007-07-16 6:36 UTC (permalink / raw)
To: Eric Wong; +Cc: Junio C Hamano, git
Eric Wong wrote:
> Renaming files with non-URI friendly characters caused
> breakage when committing to DAV repositories (over http(s)).
>
> Even if I try leaving out the $self->{url} from the return value
> of url_path(), a partial (without host), unescaped path name
> does not work.
>
> Filenames for DAV repos need to be URI-encoded before being
> passed to the library. Since this bug did not affect file://
> and svn:// repos, the git-svn test library needed to be expanded
> to include support for starting Apache with mod_dav_svn enabled.
>
> This new test is not enabled by default, but can be enabled by
> setting SVN_HTTPD_PORT to any available TCP/IP port on
> 127.0.0.1.
>
> Additionally, for running this test, the following variables
> (with defaults shown) can be changed for the suitable system.
> The default values are set for Debian systems:
>
> SVN_HTTPD_MODULE_PATH=/usr/lib/apache2/modules
> SVN_HTTPD_PATH=/usr/sbin/apache2
>
> Signed-off-by: Eric Wong <normalperson@yhbt.net>
> ---
>
> Rogan: the patch should help, a single space anywhere in the
> path causes SVN to screw up the file names. Of course I'm at a
> loss as to why only DAV repositories need it and why the SVN
> libraries don't abstract that away from me.
>
Hi Eric,
Unfortunately, I cannot test this patch, as I have since worked around
the problem, and it has not reappeared.
If it does, I'll be sure to test and let you know. Unless this patch
makes it into the version of git I am using, of course!
Rogan
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-07-16 6:37 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-10 13:11 git-svn and renames Rogan Dawes
2007-07-10 13:20 ` David Kastrup
2007-07-10 14:18 ` Rogan Dawes
2007-07-10 13:42 ` Florian Weimer
2007-07-10 14:01 ` Rogan Dawes
2007-07-11 8:20 ` Eric Wong
2007-07-12 9:06 ` Eric Wong
2007-07-12 16:51 ` Rogan Dawes
2007-07-16 4:53 ` [PATCH] git-svn: fix commiting renames over DAV with funky file names Eric Wong
2007-07-16 6:36 ` Rogan Dawes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).