git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RFC] svn test: escape peg revision separator using empty peg rev

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Oct 9, 2012, 09:47 UTC
Message-ID
<5073F2C0.6000504@drmicha.warpmail.net>
In-Reply-To
<20121009084145.GA19784@elie.Belkin>
Jonathan Nieder venit, vidit, dixit 09.10.2012 10:41:
Show 32 quoted lines
> This test script uses "svn cp" to create a branch with an @-sign in
> its name:
> 
> 	svn cp "pr ject/trunk" "pr ject/branches/not-a@{0}reflog"
> 
> That sets up for later tests that fetch the branch and check that git
> svn mangles the refname appropriately.
> 
> Unfortunately, modern svn versions interpret path arguments with an
> @-sign as an example of path@revision syntax (which pegs a path to a
> particular revision) and truncate the path or error out with message
> "svn: E205000: Syntax error parsing peg revision '{0}reflog'".
> 
> When using subversion 1.6.x, escaping the @ sign as %40 avoids trouble
> (see 08fd28bb, 2010-07-08).  Newer versions are stricter:
> 
> 	$ svn cp "$repo/pr ject/trunk" "$repo/pr ject/branches/not-a%40{reflog}"
> 	svn: E205000: Syntax error parsing peg revision '%7B0%7Dreflog'
> 
> The recommended method for escaping a literal @ sign in a path passed
> to subversion is to add an empty peg revision at the end of the path
> ("branches/not-a@{0}reflog@").  Do that.
> 
> Pre-1.6.12 versions of Subversion probably treat the trailing @ as
> another literal @-sign (svn issue 3651).  Luckily ever since
> v1.8.0-rc0~155^2~7 (t9118: workaround inconsistency between SVN
> versions, 2012-07-28) the test can survive that.
> 
> Tested with Debian Subversion 1.6.12dfsg-6 and 1.7.5-1 and r1395837
> of Subversion trunk (1.8.x).
> 
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Tested with Subversion 1.6.18.
Show 33 quoted lines
> ---
> Michael G Schwern wrote:
>> On 2012.7.28 7:16 AM, Jonathan Nieder wrote:
>>> Michael G. Schwern wrote:
> 
>>>> -		git rev-parse "refs/remotes/not-a%40{0}reflog"
>>>> +		git rev-parse "refs/remotes/$non_reflog"
>>>
>>> Doesn't this defeat the point of the testcase (checking that git-svn
>>> is able to avoid creating git refs containing @{, following the rules
>>> from git-check-ref-format(1))?
>>
>> Unless I messed up, entirely possible as I'm not a shell programmer, the test
>> is still useful for testing SVN 1.6.  Under SVN 1.6 $non_reflog should be
>> 'not-a%40{0}reflog' as before.
> 
> Here's a patch to make the test useful again for SVN 1.7.  Sensible?
> 
>  t/t9118-git-svn-funky-branch-names.sh |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
> index 193d3cab..15f93b4c 100755
> --- a/t/t9118-git-svn-funky-branch-names.sh
> +++ b/t/t9118-git-svn-funky-branch-names.sh
> @@ -28,7 +28,7 @@ test_expect_success 'setup svnrepo' '
>  	svn_cmd cp -m "trailing .lock" "$svnrepo/pr ject/trunk" \
>  			"$svnrepo/pr ject/branches/trailing_dotlock.lock" &&
>  	svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \
> -			"$svnrepo/pr ject/branches/not-a%40{0}reflog" &&
> +			"$svnrepo/pr ject/branches/not-a@{0}reflog@" &&
>  	start_httpd
>  	'

I haven't checked other svn versions but this approach looks perfectly sensible. It makes us test branch names which can't even be created easily with current svn. Does svn really deserve this much attention? ;)

Seriously, our tests prepare us well for an svn remote helper...
Previous: Jonathan NiederNext: Jonathan Nieder
Message 6 of 50 in “Fix git-svn for SVN 1.7”
  1. Michael G. SchwernJul 28, 2012
  2. 1/8 SVN 1.7 will truncate "not-a%40{0}" to just "not-a".Michael G. Schwern, Jul 28, 2012
  3. Jonathan NiederJul 28, 2012
  4. Michael G SchwernJul 28, 2012
  5. svn test: escape peg revision separator using empty peg revJonathan Nieder, Oct 9, 2012
  6. Michael J GruberOct 9, 2012
  7. Jonathan NiederOct 9, 2012
  8. Eric WongOct 10, 2012
  9. Jonathan NiederOct 10, 2012
  10. Eric WongOct 10, 2012
  11. Jonathan NiederOct 10, 2012
  12. Eric WongOct 10, 2012
  13. Junio C HamanoOct 10, 2012
  14. 2/8 Fix typo in testMichael G. Schwern, Jul 28, 2012
  15. 3/8 Improve our URL canonicalization to be more like SVN 1.7's.Michael G. Schwern, Jul 28, 2012
  16. 4/8 Replace hand rolled URL escapes with canonicalizationMichael G. Schwern, Jul 28, 2012
  17. 5/8 Canonicalize earlier in a couple spots.Michael G. Schwern, Jul 28, 2012
  18. 6/8 Add function to append a path to a URL.Michael G. Schwern, Jul 28, 2012
  19. 7/8 Turn on canonicalization on newly minted URLs.Michael G. Schwern, Jul 28, 2012
  20. test: work around SVN 1.7 mishandling of svn:special changesJonathan Nieder, Oct 6, 2012
  21. git svn: work around SVN 1.7 mishandling of svn:special changesJonathan Nieder, Oct 9, 2012
  22. Eric WongOct 10, 2012
  23. git svn: work around SVN 1.7 mishandling of svn:special changesJonathan Nieder, Oct 10, 2012
  24. 8/8 Remove some ad hoc canonicalizations.Michael G. Schwern, Jul 28, 2012
  25. Eric WongJul 30, 2012
  26. Michael G SchwernJul 30, 2012
  27. Eric WongJul 30, 2012
  28. Michael G SchwernJul 31, 2012
  29. Eric WongJul 31, 2012
  30. Michael G SchwernJul 31, 2012
  31. Junio C HamanoJul 31, 2012
  32. Michael G SchwernJul 31, 2012
  33. Eric WongJul 31, 2012
  34. Junio C HamanoJul 31, 2012
  35. Michael G SchwernJul 31, 2012
  36. Michael G SchwernJul 31, 2012
  37. Eric WongAug 1, 2012
  38. Eric WongAug 2, 2012
  39. Jonathan NiederAug 2, 2012
  40. Junio C HamanoAug 2, 2012
  41. Robin H. JohnsonAug 2, 2012
  42. Eric WongAug 2, 2012
  43. Junio C HamanoAug 21, 2012
  44. Eric WongAug 21, 2012
  45. Junio C HamanoAug 21, 2012
  46. Eric WongAug 2, 2012
  47. Junio C HamanoAug 2, 2012
  48. Eric WongAug 2, 2012
  49. Eric WongAug 2, 2012
  50. Junio C HamanoAug 2, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.