Discussion:
[PATCH 2/2] Save init/clone --ignore-paths option as svn-remotes.svn.ignore-paths
Ben Jackson
2009-04-09 21:58:09 UTC
Permalink
Signed-off-by: Ben Jackson <***@ben.com>
---
Documentation/git-svn.txt | 4 ++++
git-svn.perl | 3 +++
t/t9134-git-svn-ignore-paths.sh | 4 ++--
3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index af2d6c2..cd47bff 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -85,6 +85,10 @@ COMMANDS
specified, the prefix must include a trailing slash.
Setting a prefix is useful if you wish to track multiple
projects that share a common repository.
+--ignore-paths=<regex>;;
+ When passed to 'init' or 'clone' this regular expression will
+ be preserved as a config key. See 'fetch' for a description
+ of '--ignore-paths'.

'fetch'::
Fetch unfetched revisions from the Subversion remote we are
diff --git a/git-svn.perl b/git-svn.perl
index 2599e4c..1516916 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -334,6 +334,9 @@ sub do_git_init_db {
command_noisy('config', "$pfx.$i", $icv{$i});
$set = $i;
}
+ my $ignore_regex = \$SVN::Git::Fetcher::_ignore_regex;
+ command_noisy('config', "$pfx.ignore-paths", $$ignore_regex)
+ if defined $$ignore_regex;
}

sub init_subdir {
diff --git a/t/t9134-git-svn-ignore-paths.sh b/t/t9134-git-svn-ignore-paths.sh
index c393f4e..67ab953 100755
--- a/t/t9134-git-svn-ignore-paths.sh
+++ b/t/t9134-git-svn-ignore-paths.sh
@@ -31,10 +31,10 @@ test_expect_success 'clone an SVN repository with ignored www directory' '
test_cmp expect expect2
'

-test_expect_success 'set persistent ignore-paths config' '
+test_expect_success 'verify ignore-paths config saved by clone' '
(
cd g &&
- git config svn-remote.svn.ignore-paths "^www"
+ git config --get svn-remote.svn.ignore-paths | fgrep "www"
)
'
--
1.6.2.2
Eric Wong
2009-04-11 01:22:57 UTC
Permalink
The --ignore-paths option to fetch is very useful for working on a subset
of a SVN repository. For proper operation, every command that causes a
fetch (explicit or implied) must include a matching --ignore-paths option.
This patch adds a persistent svn-remote.$repo_id.ignore-paths config by
promoting Fetcher::is_path_ignored to a member function and initializing
$self->{ignore_regex} in Fetcher::new. Command line --ignore-paths is
still recognized and acts in addition to the config value.
Hi Ben, the patch looks useful, but there are some minor issues
with comments inline.
--- a/git-svn.perl
+++ b/git-svn.perl
# return value: 0 -- don't ignore, 1 -- ignore
sub is_path_ignored {
return 1 if in_dot_git($path);
+ return 1 if defined($self->{ignore_regex}) &&
+ $path =~ m!$self->{ignore_regex}!o;
Since we're making the regex per-remote, I'd remove the "o" operator. It
can break things if Git::SVN::Fetcher ever gets reused by multiple SVN
remotes within the same process.
--- a/t/t9134-git-svn-ignore-paths.sh
+++ b/t/t9134-git-svn-ignore-paths.sh
@@ -44,7 +51,7 @@ test_expect_success 'SVN-side change outside of www' '
test_expect_success 'update git svn-cloned repo' '
(
cd g &&
- git svn rebase --ignore-paths="^www" &&
+ git svn rebase &&
I'd rather not change the existing tests since existing behavior
can break. Instead, augment the existing tests so we test both
the .git/config and command-line cases.

Thanks.
--
Eric Wong
Loading...