Re: [PATCH v3?] Add global and system-wide gitattributes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Štěpán Němec <stepnem@xxxxxxxxx> writes:
>
>> Thanks, Matthieu!
>>
>> Petr's original patch doesn't apply cleanly due to a bogus context line
>> after a recent change in Makefile. For convenience, below is the updated
>> patch including Matthieu's changes applicable to current master.
>>
>> And FWIW (I didn't try to build the documentation, though):
>>
>> Tested-by: Štěpán Němec <stepnem@xxxxxxxxx>
>
> Thanks, but this seems to break t8005 for whatever reason.

The guilty line is

  git_config(git_default_config, NULL);

(t8005 passes if I remove it).

I don't understand why this breaks the test. It seems blame
--encoding=UTF-8 relies on the fact that the i18n section of the
configuration is not loaded.

An obvious fix on our side is to squash the patch below into the
previous ones, to make sure the attributes code loads only the core
configuration. OTOH, it seems to me that the blame code is very
fragile, but I'm not familiar with this code to say whether and how it
should be fixed.

Any other thoughts?

diff --git a/attr.c b/attr.c
index 342791a..793a835 100644
--- a/attr.c
+++ b/attr.c
@@ -500,7 +500,7 @@ static void bootstrap_attr_stack(void)
                        }
                }
 
-               git_config(git_default_config, NULL);
+               git_config(git_core_config, NULL);
                if (git_attr_global() && attributes_file) {
                        elem = read_attr_from_file(attributes_file, 1);
                        if (elem) {
diff --git a/cache.h b/cache.h
index 28d9497..2d0bfa0 100644
--- a/cache.h
+++ b/cache.h
@@ -972,6 +972,7 @@ extern int update_server_info(int);
 
 typedef int (*config_fn_t)(const char *, const char *, void *);
 extern int git_default_config(const char *, const char *, void *);
+extern int git_core_config(const char *, const char *, void *);
 extern int git_config_from_file(config_fn_t fn, const char *, void *);
 extern int git_config_parse_parameter(const char *text);
 extern int git_config_from_parameters(config_fn_t fn, void *data);
diff --git a/config.c b/config.c
index f602cd4..a2d1df9 100644
--- a/config.c
+++ b/config.c
@@ -602,6 +602,14 @@ static int git_default_core_config(const char *var, const char *value)
        return 0;
 }
 
+/* 
+ * Wrapper around git_default_core_config, with type acceptable as
+ * argument to git_config(...)
+ */
+int git_core_config(const char *var, const char *value, void *dummy) {
+       return git_default_core_config(var, value);
+}
+
 static int git_default_user_config(const char *var, const char *value)
 {
        if (!strcmp(var, "user.name")) {


-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]