summaryrefslogtreecommitdiff
path: root/builtin/merge-file.c
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2010-10-17 19:23:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-10-18 23:10:57 (GMT)
commit55846b9abd128185388418e025651cfd6a299a0e (patch)
treeca0457d27b1e5d57c8c5c3a5f47c50a355c69f81 /builtin/merge-file.c
parent9e5f5d4cfea5bb7706f1f8bb07795d52d37a59fe (diff)
downloadgit-55846b9abd128185388418e025651cfd6a299a0e.zip
git-55846b9abd128185388418e025651cfd6a299a0e.tar.gz
git-55846b9abd128185388418e025651cfd6a299a0e.tar.bz2
merge-file: correctly find files when called in subdir
Since b541248 (merge.conflictstyle: choose between "merge" and "diff3 -m" styles, 2008-08-29), git-merge-file uses setup_directory_gently(), thus cd'ing around to find any possible config files to use. This broke merge-file when it is called from within a subdirectory of a repository, and the arguments are all relative paths. Fix by prepending the prefix, as passed down from the main git setup code, if there is any. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge-file.c')
-rw-r--r--builtin/merge-file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/merge-file.c b/builtin/merge-file.c
index b6664d4..6c4afb5 100644
--- a/builtin/merge-file.c
+++ b/builtin/merge-file.c
@@ -28,6 +28,7 @@ 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 prefixlen = 0;
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),
@@ -65,10 +66,14 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
"%s\n", strerror(errno));
}
+ if (prefix)
+ prefixlen = strlen(prefix);
+
for (i = 0; i < 3; i++) {
+ const char *fname = prefix_filename(prefix, prefixlen, argv[i]);
if (!names[i])
names[i] = argv[i];
- if (read_mmfile(mmfs + i, argv[i]))
+ if (read_mmfile(mmfs + i, fname))
return -1;
if (buffer_is_binary(mmfs[i].ptr, mmfs[i].size))
return error("Cannot merge binary files: %s\n",