Skip to content

Commit

Permalink
var: run setup_git_directory_gently() sooner
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Aug 16, 2010
1 parent f0ef6a6 commit 2bc8c1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions builtin/var.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
const char *val;
int nongit;
if (argc != 2) {
const char *val = NULL;
if (argc != 2)
usage(var_usage);
}

setup_git_directory_gently(&nongit);
val = NULL;

if (strcmp(argv[1], "-l") == 0) {
git_config(show_config, NULL);
Expand Down
2 changes: 1 addition & 1 deletion git.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "update-ref", cmd_update_ref, RUN_SETUP },
{ "update-server-info", cmd_update_server_info, RUN_SETUP },
{ "upload-archive", cmd_upload_archive },
{ "var", cmd_var },
{ "var", cmd_var, RUN_SETUP_GENTLY },
{ "verify-tag", cmd_verify_tag, RUN_SETUP },
{ "version", cmd_version },
{ "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER },
Expand Down

0 comments on commit 2bc8c1a

Please sign in to comment.