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

[PATCH 2/4] Convert executable flag

From
Karl Hasselström <kha@treskal.com>
Date
Feb 26, 2006, 05:11 UTC
Message-ID
<20060226051126.24860.61044.stgit@backpacker.hemma.treskal.com>
In-Reply-To
<20060226050335.24860.95155.stgit@backpacker.hemma.treskal.com>

Convert the svn:executable property to file mode 755 when converting an SVN repository to GIT.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---
 git-svnimport.perl |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/git-svnimport.perl b/git-svnimport.perl
index ee2940f..6603b96 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -112,16 +112,22 @@ sub file {
 		    DIR => File::Spec->tmpdir(), UNLINK => 1);
 
 	print "... $rev $path ...\n" if $opt_v;
-	my $pool = SVN::Pool->new();
-	eval { $self->{'svn'}->get_file($path,$rev,$fh,$pool); };
-	$pool->clear;
+	my (undef, $properties);
+	eval { (undef, $properties)
+		   = $self->{'svn'}->get_file($path,$rev,$fh); };
 	if($@) {
 		return undef if $@ =~ /Attempted to get checksum/;
 		die $@;
 	}
+	my $mode;
+	if (exists $properties->{'svn:executable'}) {
+		$mode = '0755';
+	} else {
+		$mode = '0644';
+	}
 	close ($fh);
 
-	return $name;
+	return ($name, $mode);
 }
 
 package main;
@@ -296,7 +302,7 @@ sub get_file($$$) {
 	my $svnpath = revert_split_path($branch,$path);
 
 	# now get it
-	my $name;
+	my ($name,$mode);
 	if($opt_d) {
 		my($req,$res);
 
@@ -316,8 +322,9 @@ sub get_file($$$) {
 			return undef if $res->code == 301; # directory?
 			die $res->status_line." at $url\n";
 		}
+		$mode = '0644'; # can't obtain mode via direct http request?
 	} else {
-		$name = $svn->file("$svnpath",$rev);
+		($name,$mode) = $svn->file("$svnpath",$rev);
 		return undef unless defined $name;
 	}
 
@@ -331,7 +338,6 @@ sub get_file($$$) {
 	chomp $sha;
 	close $F;
 	unlink $name;
-	my $mode = "0644"; # SV does not seem to store any file modes
 	return [$mode, $sha, $path];
 }
 
Previous: Karl HasselströmNext: Karl Hasselström
Message 3 of 12 in “some git-svnimport improvements”
  1. 0/4 some git-svnimport improvementsKarl Hasselström, Feb 26, 2006
  2. 1/4 Mention -r in usage summaryKarl Hasselström, Feb 26, 2006
  3. 2/4 Convert executable flagKarl Hasselström, Feb 26, 2006
  4. 3/4 Convert the svn:ignore propertyKarl Hasselström, Feb 26, 2006
  5. 4/4 Read author names and emails from a fileKarl Hasselström, Feb 26, 2006
  6. Andreas EricssonFeb 26, 2006
  7. Junio C HamanoFeb 27, 2006
  8. Karl HasselströmFeb 27, 2006
  9. 1/2 Let git-svnimport's author file use same syntax as git-cvsimport'sKarl Hasselström, Feb 27, 2006
  10. Jon LoeligerMar 1, 2006
  11. Karl HasselströmMar 2, 2006
  12. 2/2 Save username -> Full Name <email@addr.es> map fileKarl Hasselström, Feb 27, 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.