aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2008-11-23 00:13:00 +0100
committerJunio C Hamano <gitster@pobox.com>2008-11-23 19:55:52 -0800
commitced621b2c15c3d3dd65dd1d7eec984f8546a4673 (patch)
tree332d3af816ed077b58c81a5beb459655008fb740
parent9b864e730bda0e028a85387fa568429724582f22 (diff)
downloadgit-ced621b2c15c3d3dd65dd1d7eec984f8546a4673.tar.gz
git-ced621b2c15c3d3dd65dd1d7eec984f8546a4673.tar.xz
merge-recursive: use strbuf_expand() instead of interpolate()
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--ll-merge.c21
-rw-r--r--merge-recursive.c1
2 files changed, 9 insertions, 13 deletions
diff --git a/ll-merge.c b/ll-merge.c
index 4a716146f..fa2ca5250 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -8,7 +8,6 @@
#include "attr.h"
#include "xdiff-interface.h"
#include "run-command.h"
-#include "interpolate.h"
#include "ll-merge.h"
struct ll_merge_driver;
@@ -169,11 +168,12 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
int virtual_ancestor)
{
char temp[3][50];
- char cmdbuf[2048];
- struct interp table[] = {
- { "%O" },
- { "%A" },
- { "%B" },
+ struct strbuf cmd = STRBUF_INIT;
+ struct strbuf_expand_dict_entry dict[] = {
+ { "O", temp[0] },
+ { "A", temp[1] },
+ { "B", temp[2] },
+ { NULL }
};
struct child_process child;
const char *args[20];
@@ -189,17 +189,13 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
create_temp(src1, temp[1]);
create_temp(src2, temp[2]);
- interp_set_entry(table, 0, temp[0]);
- interp_set_entry(table, 1, temp[1]);
- interp_set_entry(table, 2, temp[2]);
-
- interpolate(cmdbuf, sizeof(cmdbuf), fn->cmdline, table, 3);
+ strbuf_expand(&cmd, fn->cmdline, strbuf_expand_dict_cb, &dict);
memset(&child, 0, sizeof(child));
child.argv = args;
args[0] = "sh";
args[1] = "-c";
- args[2] = cmdbuf;
+ args[2] = cmd.buf;
args[3] = NULL;
status = run_command(&child);
@@ -224,6 +220,7 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
bad:
for (i = 0; i < 3; i++)
unlink(temp[i]);
+ strbuf_release(&cmd);
return status;
}
diff --git a/merge-recursive.c b/merge-recursive.c
index 7472d3ecc..0e988f2a0 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -16,7 +16,6 @@
#include "string-list.h"
#include "xdiff-interface.h"
#include "ll-merge.h"
-#include "interpolate.h"
#include "attr.h"
#include "merge-recursive.h"
#include "dir.h"