[PATCH] fixup! config: arbitrary number of matches for --unset and --replace-all

2013-12-06 Thread Junio C Hamano
---
 * I'll squash this to tr/config-multivalue-lift-max in preparation
   for merging it to 'master',which should happen by the end of
   this week.

   Thanks.

 config.c|  8 
 t/t1303-wacky-config.sh | 14 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/config.c b/config.c
index 431dcb7..a1e80da 100644
--- a/config.c
+++ b/config.c
@@ -1192,7 +1192,7 @@ static int store_aux(const char *key, const char *value, 
void *cb)
warning(%s has multiple values, key);
}
 
-   ALLOC_GROW(store.offset, store.seen+1,
+   ALLOC_GROW(store.offset, store.seen + 1,
   store.offset_alloc);
 
store.offset[store.seen] = cf-do_ftell(cf);
@@ -1222,14 +1222,14 @@ static int store_aux(const char *key, const char 
*value, void *cb)
 * Do not increment matches: this is no match, but we
 * just made sure we are in the desired section.
 */
-   ALLOC_GROW(store.offset, store.seen+1,
+   ALLOC_GROW(store.offset, store.seen + 1,
   store.offset_alloc);
store.offset[store.seen] = cf-do_ftell(cf);
/* fallthru */
case SECTION_END_SEEN:
case START:
if (matches(key, value)) {
-   ALLOC_GROW(store.offset, store.seen+1,
+   ALLOC_GROW(store.offset, store.seen + 1,
   store.offset_alloc);
store.offset[store.seen] = cf-do_ftell(cf);
store.state = KEY_SEEN;
@@ -1239,7 +1239,7 @@ static int store_aux(const char *key, const char *value, 
void *cb)
  !strncmp(key, store.key, store.baselen)) {
store.state = SECTION_SEEN;
ALLOC_GROW(store.offset,
-  store.seen+1,
+  store.seen + 1,
   store.offset_alloc);
store.offset[store.seen] = 
cf-do_ftell(cf);
}
diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh
index 7d55730..3a2c819 100755
--- a/t/t1303-wacky-config.sh
+++ b/t/t1303-wacky-config.sh
@@ -66,13 +66,13 @@ setup_many() {
# Semi-efficient way of concatenating 5^5 = 3125 lines. Note
# that because 'setup' already put one line, this means 3126
# entries for section.key in the config file.
-   cat 5to1 EOF
-  key = foo
-  key = foo
-  key = foo
-  key = foo
-  key = foo
-EOF
+   cat 5to1 -\EOF 
+ key = foo
+ key = foo
+ key = foo
+ key = foo
+ key = foo
+   EOF
cat 5to1 5to1 5to1 5to1 5to1 5to2   # 25
cat 5to2 5to2 5to2 5to2 5to2 5to3   # 125
cat 5to3 5to3 5to3 5to3 5to3 5to4   # 635
-- 
1.8.5.1-402-gdd8f092

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] fixup! config: arbitrary number of matches for --unset and --replace-all

2013-12-06 Thread Jeff King
On Fri, Dec 06, 2013 at 10:46:42AM -0800, Junio C Hamano wrote:

 ---
  * I'll squash this to tr/config-multivalue-lift-max in preparation
for merging it to 'master',which should happen by the end of
this week.

Yeah, all makes sense to me. Thanks.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html