@@ -62,6 +62,13 @@ static int list_cmds(const char *spec)
{
struct string_list list = STRING_LIST_INIT_DUP;
int i;
+ int nongit;
+
+ /*
+ * Set up the repository so we can pick up any repo-level config (like
+ * completion.commands).
+ */
+ setup_git_directory_gently(&nongit);
while (*spec) {
const char *sep = strchrnul(spec, ',');
@@ -375,13 +375,6 @@ void list_cmds_by_config(struct string_list *list)
{
const char *cmd_list;
- /*
- * There's no actual repository setup at this point (and even
- * if there is, we don't really care; only global config
- * matters). If we accidentally set up a repository, it's ok
- * too since the caller (git --list-cmds=) should exit shortly
- * anyway.
- */
if (git_config_get_string_const("completion.commands", &cmd_list))
return;