Re: [PATCH 05/18] Allow demoting errors to warnings via receive.fsck.key = warn

2014-12-22 Thread Johannes Schindelin
Hi Junio,

On Wed, 10 Dec 2014, Junio C Hamano wrote:

 Johannes Schindelin johannes.schinde...@gmx.de writes:
 
  For example, missing emails in commit and tag objects can be demoted to
  mere warnings with
 
  git config receive.fsck.missing-email warn
 
 No punctuations in the first and the last level of configuration
 variable names, please.  I.e. s/missing-email/missingEmail/ or
 something.

Fixed.

Ciao,
Dscho
--
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 05/18] Allow demoting errors to warnings via receive.fsck.key = warn

2014-12-10 Thread Junio C Hamano
Johannes Schindelin johannes.schinde...@gmx.de writes:

 For example, missing emails in commit and tag objects can be demoted to
 mere warnings with

   git config receive.fsck.missing-email warn

No punctuations in the first and the last level of configuration
variable names, please.  I.e. s/missing-email/missingEmail/ or
something.

--
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


[PATCH 05/18] Allow demoting errors to warnings via receive.fsck.key = warn

2014-12-08 Thread Johannes Schindelin
For example, missing emails in commit and tag objects can be demoted to
mere warnings with

git config receive.fsck.missing-email warn

As git receive-pack does not actually perform the checks, it hands off
the setting to index-pack or unpack-objects in the form of an optional
argument to the --strict option.

Signed-off-by: Johannes Schindelin johannes.schinde...@gmx.de
---
 builtin/index-pack.c |  4 
 builtin/receive-pack.c   | 27 +++
 builtin/unpack-objects.c |  5 +
 3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 1c17c3f..34a11b3 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1565,6 +1565,10 @@ int cmd_index_pack(int argc, const char **argv, const 
char *prefix)
} else if (!strcmp(arg, --strict)) {
strict = 1;
do_fsck_object = 1;
+   } else if (starts_with(arg, --strict=)) {
+   strict = 1;
+   do_fsck_object = 1;
+   fsck_strict_mode(fsck_options, arg + 9);
} else if (!strcmp(arg, 
--check-self-contained-and-connected)) {
strict = 1;
check_self_contained_and_connected = 1;
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index e908d07..111e514 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -35,6 +35,7 @@ static enum deny_action deny_current_branch = 
DENY_UNCONFIGURED;
 static enum deny_action deny_delete_current = DENY_UNCONFIGURED;
 static int receive_fsck_objects = -1;
 static int transfer_fsck_objects = -1;
+static struct strbuf fsck_strict_mode = STRBUF_INIT;
 static int receive_unpack_limit = -1;
 static int transfer_unpack_limit = -1;
 static int unpack_limit = 100;
@@ -109,6 +110,14 @@ static int receive_pack_config(const char *var, const char 
*value, void *cb)
return 0;
}
 
+   if (starts_with(var, receive.fsck.)) {
+   if (fsck_strict_mode.len)
+   strbuf_addch(fsck_strict_mode, ',');
+   strbuf_addf(fsck_strict_mode,
+   %s=%s, var + 13, value ? value : error);
+   return 0;
+   }
+
if (strcmp(var, receive.fsckobjects) == 0) {
receive_fsck_objects = git_config_bool(var, value);
return 0;
@@ -1266,8 +1275,13 @@ static const char *unpack(int err_fd, struct 
shallow_info *si)
argv_array_pushl(child.args, unpack-objects, hdr_arg, NULL);
if (quiet)
argv_array_push(child.args, -q);
-   if (fsck_objects)
-   argv_array_push(child.args, --strict);
+   if (fsck_objects) {
+   if (fsck_strict_mode.len)
+   argv_array_pushf(child.args, --strict=%s,
+   fsck_strict_mode.buf);
+   else
+   argv_array_push(child.args, --strict);
+   }
child.no_stdout = 1;
child.err = err_fd;
child.git_cmd = 1;
@@ -1284,8 +1298,13 @@ static const char *unpack(int err_fd, struct 
shallow_info *si)
 
argv_array_pushl(child.args, index-pack,
 --stdin, hdr_arg, keep_arg, NULL);
-   if (fsck_objects)
-   argv_array_push(child.args, --strict);
+   if (fsck_objects) {
+   if (fsck_strict_mode.len)
+   argv_array_pushf(child.args, --strict=%s,
+   fsck_strict_mode.buf);
+   else
+   argv_array_push(child.args, --strict);
+   }
if (fix_thin)
argv_array_push(child.args, --fix-thin);
child.out = -1;
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index e9e8bec..916616f 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -530,6 +530,11 @@ int cmd_unpack_objects(int argc, const char **argv, const 
char *prefix)
strict = 1;
continue;
}
+   if (starts_with(arg, --strict=)) {
+   strict = 1;
+   fsck_strict_mode(fsck_options, arg + 9);
+   continue;
+   }
if (starts_with(arg, --pack_header=)) {
struct pack_header *hdr;
char *c;
-- 
2.0.0.rc3.9669.g840d1f9

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to