Browse Source

var: run setup_git_directory_gently() sooner

Part of a campaign to make repository-local configuration
available early (simplifying the startup sequence for
built-in commands).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Nguyễn Thái Ngọc Duy 15 years ago committed by Junio C Hamano
parent
commit
2bc8c1a8a6
  1. 9
      builtin/var.c
  2. 2
      git.c

9
builtin/var.c

@ -74,14 +74,9 @@ static int show_config(const char *var, const char *value, void *cb)


int cmd_var(int argc, const char **argv, const char *prefix) int cmd_var(int argc, const char **argv, const char *prefix)
{ {
const char *val; const char *val = NULL;
int nongit; if (argc != 2)
if (argc != 2) {
usage(var_usage); usage(var_usage);
}

setup_git_directory_gently(&nongit);
val = NULL;


if (strcmp(argv[1], "-l") == 0) { if (strcmp(argv[1], "-l") == 0) {
git_config(show_config, NULL); git_config(show_config, NULL);

2
git.c

@ -398,7 +398,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "update-ref", cmd_update_ref, RUN_SETUP }, { "update-ref", cmd_update_ref, RUN_SETUP },
{ "update-server-info", cmd_update_server_info, RUN_SETUP }, { "update-server-info", cmd_update_server_info, RUN_SETUP },
{ "upload-archive", cmd_upload_archive }, { "upload-archive", cmd_upload_archive },
{ "var", cmd_var }, { "var", cmd_var, RUN_SETUP_GENTLY },
{ "verify-tag", cmd_verify_tag, RUN_SETUP }, { "verify-tag", cmd_verify_tag, RUN_SETUP },
{ "version", cmd_version }, { "version", cmd_version },
{ "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER }, { "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER },

Loading…
Cancel
Save