[PATCH 12/12] merge-file: run setup_git_directory_gently() sooner
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 6, 2010, 03:27 UTC
- Message-ID
- <20100806032742.GP22369@burratino>
- In-Reply-To
- <20100806023529.GB22369@burratino>
From: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
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> --- As before (except the commit message).
Well, that’s it. There’s also a separate fix for "check-ref-format --branch", which I’ll send under separate cover.
Still to be considered are various commands that currently do not do an unconditional repository search, especially low-level commands that are not about the current repository: verify-pack, mailinfo, hash-object, archive --remote, check-ref-format, diff --no-index, help, and all the others. Let’s bite off one thing at a time. :)
Thanks for reading; I hope the patches were not too dull. Thoughts (especially improvements) welcome, as always.
builtin/merge-file.c | 4 +--- git.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/builtin/merge-file.c b/builtin/merge-file.c index b8e9e5b..b6664d4 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -28,7 +28,6 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) xmparam_t xmp = {{0}}; int ret = 0, i = 0, to_stdout = 0; int quiet = 0; - int nongit; struct option options[] = { OPT_BOOLEAN('p', "stdout", &to_stdout, "send results to standard output"), OPT_SET_INT(0, "diff3", &xmp.style, "use a diff3 based merge", XDL_MERGE_DIFF3), @@ -50,8 +49,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) xmp.style = 0; xmp.favor = 0; - prefix = setup_git_directory_gently(&nongit); - if (!nongit) { + if (startup_info->have_repository) { /* Read the configuration file */ git_config(git_xmerge_config, NULL); if (0 <= git_xmerge_style) diff --git a/git.c b/git.c index 84bef76..5433875 100644 --- a/git.c +++ b/git.c @@ -350,7 +350,7 @@ static void handle_internal_command(int argc, const char **argv) { "mailsplit", cmd_mailsplit }, { "merge", cmd_merge, RUN_SETUP | NEED_WORK_TREE }, { "merge-base", cmd_merge_base, RUN_SETUP }, - { "merge-file", cmd_merge_file }, + { "merge-file", cmd_merge_file, RUN_SETUP_GENTLY }, { "merge-index", cmd_merge_index, RUN_SETUP }, { "merge-ours", cmd_merge_ours, RUN_SETUP }, { "merge-recursive", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
-- 1.7.2.1.544.ga752d.dirty