aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-11-17 15:00:56 -0800
committerJunio C Hamano <gitster@pobox.com>2010-11-17 15:00:56 -0800
commitba0254cb32537b7a7e92854a51256475ee83cdda (patch)
tree6e8bcfa99201c20d8647600e74b78e580cfd23cf /builtin
parente2110c8d881eb61db581b6b9ddd9568f20cf24c7 (diff)
parent55846b9abd128185388418e025651cfd6a299a0e (diff)
downloadgit-ba0254cb32537b7a7e92854a51256475ee83cdda.tar.gz
git-ba0254cb32537b7a7e92854a51256475ee83cdda.tar.xz
Merge branch 'tr/maint-merge-file-subdir'
* tr/maint-merge-file-subdir: merge-file: correctly find files when called in subdir prefix_filename(): safely handle the case where pfx_len=0
Diffstat (limited to 'builtin')
-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 b6664d49b..6c4afb5a3 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",