diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-03-05 13:13:10 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-05 13:13:11 -0800 |
commit | 33367575b85a115900deac600cc4f8f03ec4754b (patch) | |
tree | 1bf8567d605c6265bd5d1f43d9bafcf80aac54d4 | |
parent | 3630be2749819b79de917a77c6627e3f84c00a11 (diff) | |
parent | 204a8ffe67d2b789a34a14a06618a24756f7d9a9 (diff) | |
download | git-33367575b85a115900deac600cc4f8f03ec4754b.tar.gz git-33367575b85a115900deac600cc4f8f03ec4754b.tar.xz |
Merge branch 'ab/merge-file-prefix' into maint
"git merge-file" did not work correctly in a subdirectory.
* ab/merge-file-prefix:
merge-file: correctly open files when in a subdir
-rw-r--r-- | builtin/merge-file.c | 3 | ||||
-rwxr-xr-x | t/t6023-merge-file.sh | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/builtin/merge-file.c b/builtin/merge-file.c index 844f84f40..232b76857 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -90,7 +90,8 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) if (ret >= 0) { const char *filename = argv[0]; - FILE *f = to_stdout ? stdout : fopen(filename, "wb"); + const char *fpath = prefix_filename(prefix, prefixlen, argv[0]); + FILE *f = to_stdout ? stdout : fopen(fpath, "wb"); if (!f) ret = error("Could not open %s for writing", filename); diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index 375896176..190ee903c 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -69,7 +69,8 @@ test_expect_success 'works in subdirectory' ' cp new1.txt dir/a.txt && cp orig.txt dir/o.txt && cp new2.txt dir/b.txt && - ( cd dir && git merge-file a.txt o.txt b.txt ) + ( cd dir && git merge-file a.txt o.txt b.txt ) && + test_path_is_missing a.txt ' cp new1.txt test.txt |