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

[PATCH 3/4] SVN/Fetcher.pm: Add svn-remote.<id>.enable-filters to enable the filters.

From
Matteo Bertini <naufraghi@develer.com>
Date
May 31, 2016, 15:07 UTC
Message-ID
<20160531150749.24840-4-naufraghi@develer.com>
In-Reply-To
<20160531150749.24840-1-naufraghi@develer.com>
From: Matteo Bertini <matteo@naufraghi.net>

Given the fact that git-svn uses temporary files to build the index, provide the real $path to hash_and_insert_object if the filters are enabled.

Signed-off-by: Matteo Bertini <naufraghi@develer.com>
---
 perl/Git/SVN/Fetcher.pm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/perl/Git/SVN/Fetcher.pm b/perl/Git/SVN/Fetcher.pm
index d8c21ad..3557abe 100644
--- a/perl/Git/SVN/Fetcher.pm
+++ b/perl/Git/SVN/Fetcher.pm
@@ -1,7 +1,7 @@
 package Git::SVN::Fetcher;
 use vars qw/@ISA $_ignore_regex $_include_regex $_preserve_empty_dirs
             $_placeholder_filename @deleted_gpath %added_placeholder
-            $repo_id/;
+            $repo_id $_enable_filters/;
 use strict;
 use warnings;
 use SVN::Delta;
@@ -46,6 +46,10 @@ sub new {
 		$_placeholder_filename = $v;
 	}
 
+	$k = "svn-remote.$repo_id.enable-filters";
+	$v = eval { command_oneline('config', '--get', '--bool', $k) };
+	$_enable_filters = 1
+		if ($v && $v eq 'true');
 	# Load the list of placeholder files added during previous invocations.
 	$k = "svn-remote.$repo_id.added-placeholder";
 	$v = eval { command_oneline('config', '--get-all', $k) };
@@ -415,9 +419,13 @@ sub close_file {
 				Git::temp_release($tmp_fh, 1);
 			}
 		}
-
-		$hash = $::_repository->hash_and_insert_object(
-				Git::temp_path($fh));
+		if ($_enable_filters) {
+			$hash = $::_repository->hash_and_insert_object(
+					Git::temp_path($fh), $path, $_enable_filters);
+		} else {
+			$hash = $::_repository->hash_and_insert_object(
+					Git::temp_path($fh));
+		}
 		$hash =~ /^[a-f\d]{40}$/ or die "not a sha1: $hash\n";
 
 		Git::temp_release($fb->{base}, 1);
-- 
2.9.0.rc0.39.gb9f310b.dirty
Previous: Matteo BertiniNext: Matteo Bertini
Message 4 of 9 in “Add option to enable filters in git-svn”
  1. 0/4 Add option to enable filters in git-svnMatteo Bertini, May 31, 2016
  2. 1/4 hash-object.c: Allow distinct file/path in stdin mode too.Matteo Bertini, May 31, 2016
  3. 2/4 Git.pm: Add $path and $enable_filters arguments to hash_and_insert_object.Matteo Bertini, May 31, 2016
  4. 3/4 SVN/Fetcher.pm: Add svn-remote.<id>.enable-filters to enable the filters.Matteo Bertini, May 31, 2016
  5. 4/4 git-svn.perl: Add git svn init --enable-filters option.Matteo Bertini, May 31, 2016
  6. Matteo BertiniMay 31, 2016
  7. Eric WongMay 31, 2016
  8. Matteo BertiniMay 31, 2016
  9. Eric WongJun 2, 2016

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.