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

Re: [PATCH 2/2] git svn: canonicalize_url(): use svn_path_canonicalize when available

From
EWEric Wong <normalperson@yhbt.net>
Date
Oct 23, 2012, 22:58 UTC
Message-ID
<20121023225812.GA21716@dcvr.yhbt.net>
In-Reply-To
<20121014114857.GB21106@elie.Belkin>
Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 8 quoted lines
> Until Subversion 1.7 (more precisely r873487), the standard way to
> canonicalize a URI was to call svn_path_canonicalize().  Use it.
> 
> This saves "git svn" from having to rely on our imperfect
> reimplementation of the same.  If the function doesn't exist or
> returns undef, though, it can use the fallback code, which we keep to
> be conservative.  Since svn_path_canonicalize() was added before
> Subversion 1.1, hopefully that doesn't happen often.

Hi Jonathan, this fails for me using http (but not file:// or svn://). 1/2 of this RFC looks fine, though.

subversion 1.6.12dfsg-6, apache2-mpm-prefork 2.2.16-6+squeeze8 (Debian squeeze)

$ SVN_HTTPD_PORT=12345 sh t9118-git-svn-funky-branch-names.sh -v
Initialized empty Git repository in /home/ew/git-core/t/trash directory.t9118-git-svn-funky-branch-names/.git/
expecting success: 
	mkdir project project/trunk project/branches project/tags &&
	echo foo > project/trunk/foo &&
	svn_cmd import -m "$test_description" project "$svnrepo/pr ject" &&
	rm -rf project &&
	svn_cmd cp -m "fun" "$svnrepo/pr ject/trunk" \
	                "$svnrepo/pr ject/branches/fun plugin" &&
	svn_cmd cp -m "more fun!" "$svnrepo/pr ject/branches/fun plugin" \
	                      "$svnrepo/pr ject/branches/more fun plugin!" &&
	svn_cmd cp -m "scary" "$svnrepo/pr ject/branches/fun plugin" \
	              "$svnrepo/pr ject/branches/$scary_uri" &&
	svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \
			"$svnrepo/pr ject/branches/.leading_dot" &&
	svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
			"$svnrepo/pr ject/branches/trailing_dot." &&
	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@{0}reflog@" &&
	start_httpd
	
Adding         project/trunk
Adding         project/trunk/foo
Adding         project/branches
Adding         project/tags
Committed revision 1.
Committed revision 2.
Committed revision 3.
Committed revision 4.
Committed revision 5.
Committed revision 6.
Committed revision 7.

Committed revision 8. ok 1 - setup svnrepo

expecting success: 
	git svn clone -s "$svnrepo/pr ject" project &&
	(
		cd project &&
		git rev-parse "refs/remotes/fun%20plugin" &&
		git rev-parse "refs/remotes/more%20fun%20plugin!" &&
		git rev-parse "refs/remotes/$scary_ref" &&
		git rev-parse "refs/remotes/%2Eleading_dot" &&
		git rev-parse "refs/remotes/trailing_dot%2E" &&
		git rev-parse "refs/remotes/trailing_dotlock%2Elock" &&
		git rev-parse "refs/remotes/$non_reflog"
	)
	
Initialized empty Git repository in /home/ew/git-core/t/trash directory.t9118-git-svn-funky-branch-names/project/.git/
Bad URL passed to RA layer: URL 'http://127.0.0.1:12345/pr ject' is malformed or the scheme or host or path is missing at /home/ew/git-core/perl/blib/lib/Git/SVN.pm line 310

not ok - 2 test clone with funky branch names # # git svn clone -s "$svnrepo/pr ject" project && # ( # cd project && # git rev-parse "refs/remotes/fun%20plugin" && # git rev-parse "refs/remotes/more%20fun%20plugin!" && # git rev-parse "refs/remotes/$scary_ref" && # git rev-parse "refs/remotes/%2Eleading_dot" && # git rev-parse "refs/remotes/trailing_dot%2E" && # git rev-parse "refs/remotes/trailing_dotlock%2Elock" && # git rev-parse "refs/remotes/$non_reflog" # ) #

expecting success: 
	(
		cd project &&
		git reset --hard 'refs/remotes/more%20fun%20plugin!' &&
		echo hello >> foo &&
		git commit -m 'hello' -- foo &&
		git svn dcommit
	)
	
fatal: ambiguous argument 'refs/remotes/more%20fun%20plugin!': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
not ok - 3 test dcommit to funky branch
#	
#		(
#			cd project &&
#			git reset --hard 'refs/remotes/more%20fun%20plugin!' &&
#			echo hello >> foo &&
#			git commit -m 'hello' -- foo &&
#			git svn dcommit
#		)
#		
expecting success: 
	(
		cd project &&
		git reset --hard "refs/remotes/$scary_ref" &&
		echo urls are scary >> foo &&
		git commit -m "eep" -- foo &&
		git svn dcommit
	)
	
fatal: ambiguous argument 'refs/remotes/Abo-Uebernahme%20(Bug%20#994)': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
not ok - 4 test dcommit to scary branch
#	
#		(
#			cd project &&
#			git reset --hard "refs/remotes/$scary_ref" &&
#			echo urls are scary >> foo &&
#			git commit -m "eep" -- foo &&
#			git svn dcommit
#		)
#		
expecting success: 
	(
		cd project &&
		git reset --hard "refs/remotes/trailing_dotlock%2Elock" &&
		echo who names branches like this anyway? >> foo &&
		git commit -m "bar" -- foo &&
		git svn dcommit
	)
	
fatal: ambiguous argument 'refs/remotes/trailing_dotlock%2Elock': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
not ok - 5 test dcommit to trailing_dotlock branch
#	
#		(
#			cd project &&
#			git reset --hard "refs/remotes/trailing_dotlock%2Elock" &&
#			echo who names branches like this anyway? >> foo &&
#			git commit -m "bar" -- foo &&
#			git svn dcommit
#		)
#		

# failed 4 among 5 test(s) 1..5

Previous: Jonathan NiederNext: Michael G. Schwern
Message 14 of 39 in “Canonicalize the git-svn path & url accessors”
  1. Michael G. SchwernJul 28, 2012
  2. 1/7 Move the canonicalization functions to Git::SVN::UtilsMichael G. Schwern, Jul 28, 2012
  3. 2/7 Change canonicalize_url() to use the SVN 1.7 API when available.Michael G. Schwern, Jul 28, 2012
  4. Jonathan NiederJul 28, 2012
  5. Michael G SchwernJul 28, 2012
  6. Jonathan NiederJul 28, 2012
  7. Michael G SchwernJul 28, 2012
  8. Jonathan NiederJul 28, 2012
  9. Jonathan NiederJul 28, 2012
  10. Michael G SchwernJul 28, 2012
  11. 0/2 Re: [PATCH 2/7] Change canonicalize_url() to use the SVN 1.7 API when available.Jonathan Nieder, Oct 14, 2012
  12. 1/2 git svn: do not overescape URLs (fallback case)Jonathan Nieder, Oct 14, 2012
  13. 2/2 git svn: canonicalize_url(): use svn_path_canonicalize when availableJonathan Nieder, Oct 14, 2012
  14. Eric WongOct 23, 2012
  15. 3/7 Extract, test and enhance the logic to collapse ../foo paths.Michael G. Schwern, Jul 28, 2012
  16. Eric WongJul 30, 2012
  17. Michael G SchwernJul 30, 2012
  18. Jonathan NiederSep 26, 2012
  19. Eric WongSep 26, 2012
  20. Jonathan NiederSep 26, 2012
  21. Eric WongSep 26, 2012
  22. Jonathan NiederSep 26, 2012
  23. Eric WongSep 27, 2012
  24. Jonathan NiederSep 27, 2012
  25. 4/7 Add join_paths() to safely concatenate paths.Michael G. Schwern, Jul 28, 2012
  26. Jonathan NiederSep 26, 2012
  27. 5/7 Remove irrelevant comment.Michael G. Schwern, Jul 28, 2012
  28. 6/7 Switch path canonicalization to use the SVN API.Michael G. Schwern, Jul 28, 2012
  29. Jonathan NiederJul 28, 2012
  30. Michael G SchwernJul 28, 2012
  31. Eric WongJul 30, 2012
  32. Eric WongAug 2, 2012
  33. Michael G SchwernAug 2, 2012
  34. git-svn: keep leading slash when canonicalizing paths (fallback case)Jonathan Nieder, Oct 5, 2012
  35. Eric WongOct 5, 2012
  36. Junio C HamanoOct 6, 2012
  37. 7/7 Make Git::SVN and Git::SVN::Ra canonicalize paths and urls.Michael G. Schwern, Jul 28, 2012
  38. Jonathan NiederJul 28, 2012
  39. Michael G SchwernJul 28, 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.