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

Re: [PATCH] git-svnimport symlink support

From
Junio C Hamano <junkio@cox.net>
Date
Apr 17, 2006, 19:29 UTC
Message-ID
<7v3bgcngqc.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<E1FVRRH-0003Wz-6w@fencepost.gnu.org>
Herbert Valerio Riedel <hvr@gnu.org> writes:
> added svn:special symlink support for access methods other than
> direct-http

I think what the patch does makes sense. When svn:special exists, check if it is of form "link " and munge the way a symlink is represented to match what we expect.

My understanding is that currently there is any type of special svn blob defined other than "link ", and dying rather than punting and silently doing a wrong thing when we see something else in the future makes sense to me as well.

Previously we were feeding "update-index --cacheinfo" with '0755' and '0644', but this patch changes it to send 100755/100644; technically this is not necessary, because create_ce_mode(m) makes it a regular file unless S_ISLNK(m), but I think this is good for consistency.

Karl, Martin, Smurf, Comments?
Show 48 quoted lines
> Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
>
>
> ---
>
>  git-svnimport.perl |   18 ++++++++++++++++--
>  1 files changed, 16 insertions(+), 2 deletions(-)
>
> edb2adf980e2193570a6910efc01c7ac47dcf474
> diff --git a/git-svnimport.perl b/git-svnimport.perl
> index 4d5371c..60ed7ae 100755
> --- a/git-svnimport.perl
> +++ b/git-svnimport.perl
> @@ -98,6 +98,7 @@ package SVNconn;
>  use File::Spec;
>  use File::Temp qw(tempfile);
>  use POSIX qw(strftime dup2);
> +use Fcntl qw(SEEK_SET);
>  
>  sub new {
>  	my($what,$repo) = @_;
> @@ -143,9 +144,22 @@ sub file {
>  	}
>  	my $mode;
>  	if (exists $properties->{'svn:executable'}) {
> -		$mode = '0755';
> +		$mode = '100755';
> +	} elsif (exists $properties->{'svn:special'}) {
> +		my ($special_content, $filesize);
> +		$filesize = tell $fh;
> +		seek $fh, 0, SEEK_SET;
> +		read $fh, $special_content, $filesize;
> +		if ($special_content =~ s/^link //) {
> +			$mode = '120000';
> +			seek $fh, 0, SEEK_SET;
> +			truncate $fh, 0;
> +			print $fh $special_content;
> +		} else {
> +			die "unexpected svn:special file encountered";
> +		}
>  	} else {
> -		$mode = '0644';
> +		$mode = '100644';
>  	}
>  	close ($fh);
>  
> -- 
> 1.1.3
Next: smurf@smurf.noris.de
Message 1 of 5 in “Re: [PATCH] git-svnimport symlink support”
  1. Junio C HamanoApr 17, 2006
  2. smurf@smurf.noris.deApr 18, 2006
  3. Martin LanghoffApr 19, 2006
  4. smurf@smurf.noris.deApr 20, 2006
  5. Junio C HamanoApr 20, 2006

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.