]> git.ipfire.org Git - thirdparty/git.git/blobdiff - credential-store.c
git-credential-store: support XDG_CONFIG_HOME
[thirdparty/git.git] / credential-store.c
index c519f8025ee8e90322eb5af609ebb3e2c3ad87d7..d62dc29d06570f54c35aa9f55ab11e431ab1c0a9 100644 (file)
@@ -165,11 +165,16 @@ int main(int argc, char **argv)
                usage_with_options(usage, options);
        op = argv[0];
 
-       if (!file)
-               file = expand_user_path("~/.git-credentials");
-       if (file)
+       if (file) {
                string_list_append(&fns, file);
-       else
+       } else {
+               if ((file = expand_user_path("~/.git-credentials")))
+                       string_list_append_nodup(&fns, file);
+               home_config_paths(NULL, &file, "credentials");
+               if (file)
+                       string_list_append_nodup(&fns, file);
+       }
+       if (!fns.nr)
                die("unable to set up default path; use --file");
 
        if (credential_read(&c, stdin) < 0)