link_alt_odb_entries(): take (char *, len) rather than two pointers
[gitweb.git] / attr.c
diff --git a/attr.c b/attr.c
index e7caee4ddd94f4c82f136b89d3f66afe328e7497..179886cc4b94a2c9260285b892eb200f6575453b 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -307,7 +307,7 @@ static void free_attr_elem(struct attr_stack *e)
 }
 
 static const char *builtin_attr[] = {
-       "[attr]binary -diff -text",
+       "[attr]binary -diff -merge -text",
        NULL,
 };
 
@@ -353,8 +353,11 @@ static struct attr_stack *read_attr_from_file(const char *path, int macro_ok)
        char buf[2048];
        int lineno = 0;
 
-       if (!fp)
+       if (!fp) {
+               if (errno != ENOENT && errno != ENOTDIR)
+                       warn_on_inaccessible(path);
                return NULL;
+       }
        res = xcalloc(1, sizeof(*res));
        while (fgets(buf, sizeof(buf), fp))
                handle_attr_line(res, buf, path, ++lineno, macro_ok);
@@ -498,6 +501,7 @@ static int git_attr_system(void)
 static void bootstrap_attr_stack(void)
 {
        struct attr_stack *elem;
+       char *xdg_attributes_file;
 
        if (attr_stack)
                return;
@@ -516,6 +520,10 @@ static void bootstrap_attr_stack(void)
                }
        }
 
+       if (!git_attributes_file) {
+               home_config_paths(NULL, &xdg_attributes_file, "attributes");
+               git_attributes_file = xdg_attributes_file;
+       }
        if (git_attributes_file) {
                elem = read_attr_from_file(git_attributes_file, 1);
                if (elem) {