Merge branch 'ja/fetch-doc'
[gitweb.git] / builtin-config.c
index d8da72cf20fa01600b4ad9e6e7a78240b4b4c290..a2d656edb383da47fb3622f1f7c2d1524285ac00 100644 (file)
@@ -316,7 +316,8 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
 
        config_exclusive_filename = getenv(CONFIG_ENVIRONMENT);
 
-       argc = parse_options(argc, argv, builtin_config_options, builtin_config_usage,
+       argc = parse_options(argc, argv, prefix, builtin_config_options,
+                            builtin_config_usage,
                             PARSE_OPT_STOP_AT_NON_OPTION);
 
        if (use_global_config + use_system_config + !!given_config_file > 1) {
@@ -382,14 +383,16 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
                check_argc(argc, 0, 0);
                if (git_config(show_all_config, NULL) < 0) {
                        if (config_exclusive_filename)
-                               die("unable to read config file %s: %s",
-                                   config_exclusive_filename, strerror(errno));
+                               die_errno("unable to read config file '%s'",
+                                         config_exclusive_filename);
                        else
                                die("error processing config file(s)");
                }
        }
        else if (actions == ACTION_EDIT) {
                check_argc(argc, 0, 0);
+               if (!config_exclusive_filename && nongit)
+                       die("not in a git directory");
                git_config(git_default_config, NULL);
                launch_editor(config_exclusive_filename ?
                              config_exclusive_filename : git_path("config"),