From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>, Jon Loeliger <jdl@freescale.com>
Subject: [PATCH 2/4] merge-recursive: use strbuf_expand() instead of interpolate()
Date: Sun, 23 Nov 2008 00:13:00 +0100 [thread overview]
Message-ID: <492891FC.6000908@lsrfire.ath.cx> (raw)
In-Reply-To: <4928912A.5050307@lsrfire.ath.cx>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
ll-merge.c | 21 +++++++++------------
merge-recursive.c | 1 -
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/ll-merge.c b/ll-merge.c
index 4a71614..fa2ca52 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 7472d3e..0e988f2 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"
--
1.6.0.4.755.g6e139
next prev parent reply other threads:[~2008-11-22 23:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-22 23:09 [PATCH 1/4] add strbuf_expand_dict_cb(), a helper for simple cases René Scharfe
2008-11-22 23:13 ` René Scharfe [this message]
2008-11-22 23:15 ` [PATCH 3/4] daemon: use strbuf_expand() instead of interpolate() René Scharfe
2008-11-22 23:16 ` [PATCH 4/4] remove the unused files interpolate.c and interpolate.h René Scharfe
2008-11-22 23:19 ` [PATCH 3.1/4] daemon: inline fill_in_extra_table_entries() René Scharfe
2008-11-22 23:21 ` [PATCH 3.2/4] daemon: deglobalize variable 'directory' René Scharfe
2008-12-04 20:30 ` [PATCH 1/4] add strbuf_expand_dict_cb(), a helper for simple cases Jon Loeliger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=492891FC.6000908@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jdl@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.