for-each-ref: add '--points-at' option
[gitweb.git] / credential-store.c
index c519f8025ee8e90322eb5af609ebb3e2c3ad87d7..f6925096ffa7e036b4e63f65ce372c596c9e1b70 100644 (file)
@@ -145,7 +145,7 @@ static void lookup_credential(const struct string_list *fns, struct credential *
 int main(int argc, char **argv)
 {
        const char * const usage[] = {
-               "git credential-store [options] <action>",
+               "git credential-store [<options>] <action>",
                NULL
        };
        const char *op;
@@ -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);
+               file = xdg_config_home("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)