aboutsummaryrefslogtreecommitdiff
path: root/builtin/merge-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/merge-file.c')
-rw-r--r--builtin/merge-file.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/builtin/merge-file.c b/builtin/merge-file.c
index 46775d0c79..59a9792208 100644
--- a/builtin/merge-file.c
+++ b/builtin/merge-file.c
@@ -60,7 +60,7 @@ static int diff_algorithm_cb(const struct option *opt,
int cmd_merge_file(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
const char *names[3] = { 0 };
mmfile_t mmfs[3] = { 0 };
@@ -95,12 +95,10 @@ int cmd_merge_file(int argc,
xmp.style = 0;
xmp.favor = 0;
- if (startup_info->have_repository) {
- /* Read the configuration file */
- repo_config(the_repository, git_xmerge_config, NULL);
- if (0 <= git_xmerge_style)
- xmp.style = git_xmerge_style;
- }
+ /* Read the configuration file */
+ repo_config(repo, git_xmerge_config, NULL);
+ if (0 <= git_xmerge_style)
+ xmp.style = git_xmerge_style;
argc = parse_options(argc, argv, prefix, options, merge_file_usage, 0);
if (argc != 3)
@@ -110,7 +108,8 @@ int cmd_merge_file(int argc,
return error_errno("failed to redirect stderr to /dev/null");
}
- if (object_id)
+ if (!repo && object_id)
+ /* emit the correct "not a git repo" error in this case */
setup_git_directory();
for (i = 0; i < 3; i++) {
@@ -128,7 +127,7 @@ int cmd_merge_file(int argc,
ret = error(_("object '%s' does not exist"),
argv[i]);
else if (!oideq(&oid, the_hash_algo->empty_blob))
- read_mmblob(mmf, &oid);
+ read_mmblob(mmf, the_repository->objects, &oid);
else
read_mmfile(mmf, "/dev/null");
} else if (read_mmfile(mmf, fname)) {