@matheusbsbs / matheus-bagliano / commits / 3668d42383
Fork 0

merge-file: 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>

Nguyễn Thái Ngọc Duy committed Aug 5, 2010 at 22:27 UTC 3668d4238314dc5db98de3034058f68ff57a6b1e
2 files changed +2 -4
builtin/merge-file.c
+1 -3
@@ -28,7 +28,6 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
28 xmparam_t xmp = {{0}};
29 int ret = 0, i = 0, to_stdout = 0;
30 int quiet = 0;
31 - int nongit;
31 struct option options[] = {
32 OPT_BOOLEAN('p', "stdout", &to_stdout, "send results to standard output"),
33 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)
49 xmp.style = 0;
50 xmp.favor = 0;
51
53 - prefix = setup_git_directory_gently(&nongit);
54 - if (!nongit) {
52 + if (startup_info->have_repository) {
53 /* Read the configuration file */
54 git_config(git_xmerge_config, NULL);
55 if (0 <= git_xmerge_style)
git.c
+1 -1
@@ -350,7 +350,7 @@ static void handle_internal_command(int argc, const char **argv)
350 { "mailsplit", cmd_mailsplit },
351 { "merge", cmd_merge, RUN_SETUP | NEED_WORK_TREE },
352 { "merge-base", cmd_merge_base, RUN_SETUP },
353 - { "merge-file", cmd_merge_file },
353 + { "merge-file", cmd_merge_file, RUN_SETUP_GENTLY },
354 { "merge-index", cmd_merge_index, RUN_SETUP },
355 { "merge-ours", cmd_merge_ours, RUN_SETUP },
356 { "merge-recursive", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },