[Bps-public-commit] Config-GitLike branch, master, updated. 1.00-30-g1678a05

Alex M Vandiver alexmv at bestpractical.com
Fri Dec 4 20:05:10 EST 2009


The branch, master has been updated
       via  1678a055a8f7f98da3af4ff455ec3885633f64b4 (commit)
       via  03e91b3f3840096b7efae2a89b5ff2d69d03e531 (commit)
       via  95ab5a718d8ef4d9cb0bfae833989ae1469c13d9 (commit)
      from  67755db1fbdb6760e5d814f04b79968f29f2c10f (commit)

Summary of changes:
 lib/Config/GitLike.pm |    6 +++++-
 t/t1300-repo-config.t |    8 ++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 95ab5a718d8ef4d9cb0bfae833989ae1469c13d9
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 20:00:37 2009 -0500

    Fix a test that failed because multiple now works, and we're too smart

diff --git a/t/t1300-repo-config.t b/t/t1300-repo-config.t
index 3e588cd..c38743b 100644
--- a/t/t1300-repo-config.t
+++ b/t/t1300-repo-config.t
@@ -353,14 +353,14 @@ noIndent= sillyValue ; 'nother silly comment
 	NoNewLine = wow2 for me
 EOF
     ;
-
-is( slurp($config_filename), $expect, 'multivar replace' );
+is( slurp($config_filename), $expect, 'multivar replace only the first match' );
 
 $config->load;
 throws_ok {
     $config->set(
         key      => 'nextsection.nonewline',
-        filename => $config_filename
+        filename => $config_filename,
+        multiple => 0,  # Otherwise we Do The Right Thing, as we know it's multiple
     );
 }
 qr/Multiple occurrences of non-multiple key/i, 'ambiguous unset';

commit 03e91b3f3840096b7efae2a89b5ff2d69d03e531
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 20:01:42 2009 -0500

    Having a matching filter with multiple and not replace_all does mean replacement

diff --git a/lib/Config/GitLike.pm b/lib/Config/GitLike.pm
index 68f03b0..bfa8083 100644
--- a/lib/Config/GitLike.pm
+++ b/lib/Config/GitLike.pm
@@ -796,7 +796,7 @@ sub group_set {
 
         if (defined $args{value}) {
             if (@replace
-                    && (!$args{multiple} || $args{replace_all})) {
+                    && (!$args{multiple} || $args{filter} || $args{replace_all})) {
                 # Replacing existing value(s)
 
                 # if the string we're replacing with is not the same length as

commit 1678a055a8f7f98da3af4ff455ec3885633f64b4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 20:04:11 2009 -0500

    Filter without replace_all should only replace the _first_ match

diff --git a/lib/Config/GitLike.pm b/lib/Config/GitLike.pm
index bfa8083..35d92f9 100644
--- a/lib/Config/GitLike.pm
+++ b/lib/Config/GitLike.pm
@@ -794,6 +794,10 @@ sub group_set {
         die "Multiple occurrences of non-multiple key?"
             if @replace > 1 && !$args{multiple};
 
+        # We're only replacing the first occurrance unless they said
+        # to replace them all.
+        @replace = ($replace[0]) if @replace and $args{value} and not $args{replace_all};
+
         if (defined $args{value}) {
             if (@replace
                     && (!$args{multiple} || $args{filter} || $args{replace_all})) {
diff --git a/t/t1300-repo-config.t b/t/t1300-repo-config.t
index c38743b..7388983 100644
--- a/t/t1300-repo-config.t
+++ b/t/t1300-repo-config.t
@@ -339,7 +339,7 @@ is_deeply(
 $config->set(
     key      => 'nextsection.nonewline',
     value    => 'wow3',
-    filter   => qr/wow$/,
+    filter   => qr/wow/,
     filename => $config_filename
 );
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list