summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b7fa51d)
raw | patch | inline | side by side (parent: b7fa51d)
author | Miklos Vajna <vmiklos@frugalware.org> | |
Wed, 3 Sep 2008 00:30:03 +0000 (02:30 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 5 Sep 2008 05:50:43 +0000 (22:50 -0700) |
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
merge-recursive.c | patch | blob | history | |
merge-recursive.h | patch | blob | history |
diff --git a/merge-recursive.c b/merge-recursive.c
index c426589d1172ddc6b693e117f9b175ad0e861425..d4f12d0a4d6b19be704c210b994cc97adddbeb5e 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
static struct string_list current_file_set = {NULL, 0, 0, 1};
static struct string_list current_directory_set = {NULL, 0, 0, 1};
-static struct strbuf obuf = STRBUF_INIT;
-
static int show(struct merge_options *o, int v)
{
return (!o->call_depth && o->verbosity >= v) || o->verbosity >= 5;
}
-static void flush_output(void)
+static void flush_output(struct merge_options *o)
{
- if (obuf.len) {
- fputs(obuf.buf, stdout);
- strbuf_reset(&obuf);
+ if (o->obuf.len) {
+ fputs(o->obuf.buf, stdout);
+ strbuf_reset(&o->obuf);
}
}
if (!show(o, v))
return;
- strbuf_grow(&obuf, o->call_depth * 2 + 2);
- memset(obuf.buf + obuf.len, ' ', o->call_depth * 2);
- strbuf_setlen(&obuf, obuf.len + o->call_depth * 2);
+ strbuf_grow(&o->obuf, o->call_depth * 2 + 2);
+ memset(o->obuf.buf + o->obuf.len, ' ', o->call_depth * 2);
+ strbuf_setlen(&o->obuf, o->obuf.len + o->call_depth * 2);
va_start(ap, fmt);
- len = vsnprintf(obuf.buf + obuf.len, strbuf_avail(&obuf), fmt, ap);
+ len = vsnprintf(o->obuf.buf + o->obuf.len, strbuf_avail(&o->obuf), fmt, ap);
va_end(ap);
if (len < 0)
len = 0;
- if (len >= strbuf_avail(&obuf)) {
- strbuf_grow(&obuf, len + 2);
+ if (len >= strbuf_avail(&o->obuf)) {
+ strbuf_grow(&o->obuf, len + 2);
va_start(ap, fmt);
- len = vsnprintf(obuf.buf + obuf.len, strbuf_avail(&obuf), fmt, ap);
+ len = vsnprintf(o->obuf.buf + o->obuf.len, strbuf_avail(&o->obuf), fmt, ap);
va_end(ap);
- if (len >= strbuf_avail(&obuf)) {
+ if (len >= strbuf_avail(&o->obuf)) {
die("this should not happen, your snprintf is broken");
}
}
- strbuf_setlen(&obuf, obuf.len + len);
- strbuf_add(&obuf, "\n", 1);
+ strbuf_setlen(&o->obuf, o->obuf.len + len);
+ strbuf_add(&o->obuf, "\n", 1);
if (!o->buffer_output)
- flush_output();
+ flush_output(o);
}
static void output_commit_title(struct merge_options *o, struct commit *commit)
{
int i;
- flush_output();
+ flush_output(o);
for (i = o->call_depth; i--;)
fputs(" ", stdout);
if (commit->util)
commit_list_insert(h1, &(*result)->parents);
commit_list_insert(h2, &(*result)->parents->next);
}
- flush_output();
+ flush_output(o);
return clean;
}
strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10);
if (o->verbosity >= 5)
o->buffer_output = 0;
+ strbuf_init(&o->obuf, 0);
}
diff --git a/merge-recursive.h b/merge-recursive.h
index 4f5537417e3b290544138edaec9c32469c19e477..be84d9bb32d4bf9e39e7bf2cf42f17383cb8fc5c 100644 (file)
--- a/merge-recursive.h
+++ b/merge-recursive.h
int diff_rename_limit;
int merge_rename_limit;
int call_depth;
+ struct strbuf obuf;
};
/* merge_trees() but with recursive ancestor consolidation */