2006-08-02 21:52:00 +00:00
|
|
|
#include "builtin.h"
|
2006-07-03 15:18:43 +00:00
|
|
|
#include "cache.h"
|
2015-06-22 14:03:05 +00:00
|
|
|
#include "refs.h"
|
2006-07-03 15:18:43 +00:00
|
|
|
#include "commit.h"
|
|
|
|
#include "diff.h"
|
|
|
|
#include "revision.h"
|
|
|
|
#include "tag.h"
|
2010-03-24 07:16:03 +00:00
|
|
|
#include "string-list.h"
|
2011-10-07 06:12:09 +00:00
|
|
|
#include "branch.h"
|
|
|
|
#include "fmt-merge-msg.h"
|
2011-11-05 04:06:30 +00:00
|
|
|
#include "gpg-interface.h"
|
2006-07-03 15:18:43 +00:00
|
|
|
|
2008-10-02 12:59:18 +00:00
|
|
|
static const char * const fmt_merge_msg_usage[] = {
|
2015-01-13 07:44:47 +00:00
|
|
|
N_("git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]"),
|
2008-10-02 12:59:18 +00:00
|
|
|
NULL
|
|
|
|
};
|
2006-07-03 15:18:43 +00:00
|
|
|
|
2011-10-07 06:12:09 +00:00
|
|
|
static int use_branch_desc;
|
2006-07-03 15:18:43 +00:00
|
|
|
|
2011-10-07 06:12:09 +00:00
|
|
|
int fmt_merge_msg_config(const char *key, const char *value, void *cb)
|
2006-07-03 15:18:43 +00:00
|
|
|
{
|
2010-09-08 17:59:55 +00:00
|
|
|
if (!strcmp(key, "merge.log") || !strcmp(key, "merge.summary")) {
|
|
|
|
int is_bool;
|
2011-10-07 06:12:09 +00:00
|
|
|
merge_log_config = git_config_bool_or_int(key, value, &is_bool);
|
|
|
|
if (!is_bool && merge_log_config < 0)
|
2010-09-08 17:59:55 +00:00
|
|
|
return error("%s: negative length %s", key, value);
|
2011-10-07 06:12:09 +00:00
|
|
|
if (is_bool && merge_log_config)
|
|
|
|
merge_log_config = DEFAULT_MERGE_LOG_LEN;
|
|
|
|
} else if (!strcmp(key, "merge.branchdesc")) {
|
|
|
|
use_branch_desc = git_config_bool(key, value);
|
2012-03-13 17:00:00 +00:00
|
|
|
} else {
|
|
|
|
return git_default_config(key, value, cb);
|
2008-04-06 01:23:45 +00:00
|
|
|
}
|
2006-07-03 15:18:43 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-11-05 00:00:03 +00:00
|
|
|
/* merge data per repository where the merged tips came from */
|
2010-03-24 07:16:03 +00:00
|
|
|
struct src_data {
|
|
|
|
struct string_list branch, tag, r_branch, generic;
|
|
|
|
int head_status;
|
2006-07-03 15:18:43 +00:00
|
|
|
};
|
|
|
|
|
2011-10-07 06:12:09 +00:00
|
|
|
struct origin_data {
|
|
|
|
unsigned char sha1[20];
|
2011-10-15 17:46:59 +00:00
|
|
|
unsigned is_local_branch:1;
|
2011-10-07 06:12:09 +00:00
|
|
|
};
|
|
|
|
|
Fix sparse warnings
Fix warnings from 'make check'.
- These files don't include 'builtin.h' causing sparse to complain that
cmd_* isn't declared:
builtin/clone.c:364, builtin/fetch-pack.c:797,
builtin/fmt-merge-msg.c:34, builtin/hash-object.c:78,
builtin/merge-index.c:69, builtin/merge-recursive.c:22
builtin/merge-tree.c:341, builtin/mktag.c:156, builtin/notes.c:426
builtin/notes.c:822, builtin/pack-redundant.c:596,
builtin/pack-refs.c:10, builtin/patch-id.c:60, builtin/patch-id.c:149,
builtin/remote.c:1512, builtin/remote-ext.c:240,
builtin/remote-fd.c:53, builtin/reset.c:236, builtin/send-pack.c:384,
builtin/unpack-file.c:25, builtin/var.c:75
- These files have symbols which should be marked static since they're
only file scope:
submodule.c:12, diff.c:631, replace_object.c:92, submodule.c:13,
submodule.c:14, trace.c:78, transport.c:195, transport-helper.c:79,
unpack-trees.c:19, url.c:3, url.c:18, url.c:104, url.c:117, url.c:123,
url.c:129, url.c:136, thread-utils.c:21, thread-utils.c:48
- These files redeclare symbols to be different types:
builtin/index-pack.c:210, parse-options.c:564, parse-options.c:571,
usage.c:49, usage.c:58, usage.c:63, usage.c:72
- These files use a literal integer 0 when they really should use a NULL
pointer:
daemon.c:663, fast-import.c:2942, imap-send.c:1072, notes-merge.c:362
While we're in the area, clean up some unused #includes in builtin files
(mostly exec_cmd.h).
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-22 07:51:05 +00:00
|
|
|
static void init_src_data(struct src_data *data)
|
2006-07-03 15:18:43 +00:00
|
|
|
{
|
2010-03-24 07:16:03 +00:00
|
|
|
data->branch.strdup_strings = 1;
|
|
|
|
data->tag.strdup_strings = 1;
|
|
|
|
data->r_branch.strdup_strings = 1;
|
|
|
|
data->generic.strdup_strings = 1;
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
|
|
|
|
2010-07-04 19:46:19 +00:00
|
|
|
static struct string_list srcs = STRING_LIST_INIT_DUP;
|
|
|
|
static struct string_list origins = STRING_LIST_INIT_DUP;
|
2006-07-03 15:18:43 +00:00
|
|
|
|
2012-04-19 02:49:08 +00:00
|
|
|
struct merge_parents {
|
|
|
|
int alloc, nr;
|
|
|
|
struct merge_parent {
|
|
|
|
unsigned char given[20];
|
|
|
|
unsigned char commit[20];
|
|
|
|
unsigned char used;
|
|
|
|
} *item;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* I know, I know, this is inefficient, but you won't be pulling and merging
|
|
|
|
* hundreds of heads at a time anyway.
|
|
|
|
*/
|
|
|
|
static struct merge_parent *find_merge_parent(struct merge_parents *table,
|
|
|
|
unsigned char *given,
|
|
|
|
unsigned char *commit)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < table->nr; i++) {
|
|
|
|
if (given && hashcmp(table->item[i].given, given))
|
|
|
|
continue;
|
|
|
|
if (commit && hashcmp(table->item[i].commit, commit))
|
|
|
|
continue;
|
|
|
|
return &table->item[i];
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_merge_parent(struct merge_parents *table,
|
|
|
|
unsigned char *given,
|
|
|
|
unsigned char *commit)
|
|
|
|
{
|
|
|
|
if (table->nr && find_merge_parent(table, given, commit))
|
|
|
|
return;
|
|
|
|
ALLOC_GROW(table->item, table->nr + 1, table->alloc);
|
|
|
|
hashcpy(table->item[table->nr].given, given);
|
|
|
|
hashcpy(table->item[table->nr].commit, commit);
|
|
|
|
table->item[table->nr].used = 0;
|
|
|
|
table->nr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int handle_line(char *line, struct merge_parents *merge_parents)
|
2006-07-03 15:18:43 +00:00
|
|
|
{
|
|
|
|
int i, len = strlen(line);
|
2011-10-07 06:12:09 +00:00
|
|
|
struct origin_data *origin_data;
|
2014-06-18 19:48:29 +00:00
|
|
|
char *src;
|
|
|
|
const char *origin;
|
2006-07-03 15:18:43 +00:00
|
|
|
struct src_data *src_data;
|
2010-03-24 07:16:03 +00:00
|
|
|
struct string_list_item *item;
|
2006-07-13 05:21:05 +00:00
|
|
|
int pulling_head = 0;
|
2012-04-19 02:49:08 +00:00
|
|
|
unsigned char sha1[20];
|
2006-07-03 15:18:43 +00:00
|
|
|
|
|
|
|
if (len < 43 || line[40] != '\t')
|
|
|
|
return 1;
|
|
|
|
|
2013-11-30 20:55:40 +00:00
|
|
|
if (starts_with(line + 41, "not-for-merge"))
|
2006-07-03 15:18:43 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (line[41] != '\t')
|
|
|
|
return 2;
|
|
|
|
|
2012-04-19 02:49:08 +00:00
|
|
|
i = get_sha1_hex(line, sha1);
|
|
|
|
if (i)
|
2006-07-03 15:18:43 +00:00
|
|
|
return 3;
|
2012-04-19 02:49:08 +00:00
|
|
|
|
|
|
|
if (!find_merge_parent(merge_parents, sha1, NULL))
|
|
|
|
return 0; /* subsumed by other parents */
|
|
|
|
|
|
|
|
origin_data = xcalloc(1, sizeof(struct origin_data));
|
|
|
|
hashcpy(origin_data->sha1, sha1);
|
2006-07-03 15:18:43 +00:00
|
|
|
|
|
|
|
if (line[len - 1] == '\n')
|
|
|
|
line[len - 1] = 0;
|
|
|
|
line += 42;
|
|
|
|
|
2011-11-05 00:00:03 +00:00
|
|
|
/*
|
|
|
|
* At this point, line points at the beginning of comment e.g.
|
|
|
|
* "branch 'frotz' of git://that/repository.git".
|
|
|
|
* Find the repository name and point it with src.
|
|
|
|
*/
|
2006-07-03 15:18:43 +00:00
|
|
|
src = strstr(line, " of ");
|
|
|
|
if (src) {
|
|
|
|
*src = 0;
|
|
|
|
src += 4;
|
2006-07-13 05:21:05 +00:00
|
|
|
pulling_head = 0;
|
|
|
|
} else {
|
|
|
|
src = line;
|
|
|
|
pulling_head = 1;
|
|
|
|
}
|
2006-07-03 15:18:43 +00:00
|
|
|
|
2010-03-24 07:16:03 +00:00
|
|
|
item = unsorted_string_list_lookup(&srcs, src);
|
|
|
|
if (!item) {
|
2010-06-25 23:41:38 +00:00
|
|
|
item = string_list_append(&srcs, src);
|
2010-03-24 07:16:03 +00:00
|
|
|
item->util = xcalloc(1, sizeof(struct src_data));
|
|
|
|
init_src_data(item->util);
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
2010-03-24 07:16:03 +00:00
|
|
|
src_data = item->util;
|
2006-07-03 15:18:43 +00:00
|
|
|
|
2006-07-13 05:21:05 +00:00
|
|
|
if (pulling_head) {
|
2010-03-24 07:16:03 +00:00
|
|
|
origin = src;
|
2006-07-13 05:21:05 +00:00
|
|
|
src_data->head_status |= 1;
|
2013-11-30 20:55:40 +00:00
|
|
|
} else if (starts_with(line, "branch ")) {
|
2011-10-07 06:12:09 +00:00
|
|
|
origin_data->is_local_branch = 1;
|
2010-03-24 07:16:03 +00:00
|
|
|
origin = line + 7;
|
2010-06-25 23:41:38 +00:00
|
|
|
string_list_append(&src_data->branch, origin);
|
2006-07-03 15:18:43 +00:00
|
|
|
src_data->head_status |= 2;
|
2013-11-30 20:55:40 +00:00
|
|
|
} else if (starts_with(line, "tag ")) {
|
2006-07-03 15:18:43 +00:00
|
|
|
origin = line;
|
2010-06-25 23:41:38 +00:00
|
|
|
string_list_append(&src_data->tag, origin + 4);
|
2006-07-03 15:18:43 +00:00
|
|
|
src_data->head_status |= 2;
|
2014-06-18 19:48:29 +00:00
|
|
|
} else if (skip_prefix(line, "remote-tracking branch ", &origin)) {
|
2010-06-25 23:41:38 +00:00
|
|
|
string_list_append(&src_data->r_branch, origin);
|
2006-07-03 15:18:43 +00:00
|
|
|
src_data->head_status |= 2;
|
|
|
|
} else {
|
2010-03-24 07:16:03 +00:00
|
|
|
origin = src;
|
2010-06-25 23:41:38 +00:00
|
|
|
string_list_append(&src_data->generic, line);
|
2006-07-03 15:18:43 +00:00
|
|
|
src_data->head_status |= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp(".", src) || !strcmp(src, origin)) {
|
|
|
|
int len = strlen(origin);
|
2010-03-24 07:16:03 +00:00
|
|
|
if (origin[0] == '\'' && origin[len - 1] == '\'')
|
2007-09-15 22:32:36 +00:00
|
|
|
origin = xmemdupz(origin + 1, len - 2);
|
2014-06-19 21:24:33 +00:00
|
|
|
} else
|
|
|
|
origin = xstrfmt("%s of %s", origin, src);
|
2011-10-07 06:12:09 +00:00
|
|
|
if (strcmp(".", src))
|
|
|
|
origin_data->is_local_branch = 0;
|
|
|
|
string_list_append(&origins, origin)->util = origin_data;
|
2006-07-03 15:18:43 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void print_joined(const char *singular, const char *plural,
|
2010-03-24 07:16:03 +00:00
|
|
|
struct string_list *list, struct strbuf *out)
|
2006-07-03 15:18:43 +00:00
|
|
|
{
|
|
|
|
if (list->nr == 0)
|
|
|
|
return;
|
|
|
|
if (list->nr == 1) {
|
2010-03-24 07:16:03 +00:00
|
|
|
strbuf_addf(out, "%s%s", singular, list->items[0].string);
|
2006-07-03 15:18:43 +00:00
|
|
|
} else {
|
|
|
|
int i;
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addstr(out, plural);
|
2006-07-03 15:18:43 +00:00
|
|
|
for (i = 0; i < list->nr - 1; i++)
|
2010-03-24 07:16:03 +00:00
|
|
|
strbuf_addf(out, "%s%s", i > 0 ? ", " : "",
|
|
|
|
list->items[i].string);
|
|
|
|
strbuf_addf(out, " and %s", list->items[list->nr - 1].string);
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-07 06:12:09 +00:00
|
|
|
static void add_branch_desc(struct strbuf *out, const char *name)
|
|
|
|
{
|
|
|
|
struct strbuf desc = STRBUF_INIT;
|
|
|
|
|
|
|
|
if (!read_branch_desc(&desc, name)) {
|
|
|
|
const char *bp = desc.buf;
|
|
|
|
while (*bp) {
|
|
|
|
const char *ep = strchrnul(bp, '\n');
|
|
|
|
if (*ep)
|
|
|
|
ep++;
|
|
|
|
strbuf_addf(out, " : %.*s", (int)(ep - bp), bp);
|
|
|
|
bp = ep;
|
|
|
|
}
|
2014-12-12 19:16:38 +00:00
|
|
|
strbuf_complete_line(out);
|
2011-10-07 06:12:09 +00:00
|
|
|
}
|
|
|
|
strbuf_release(&desc);
|
|
|
|
}
|
|
|
|
|
2012-03-13 17:00:00 +00:00
|
|
|
#define util_as_integral(elem) ((intptr_t)((elem)->util))
|
|
|
|
|
2015-04-15 21:18:37 +00:00
|
|
|
static void record_person_from_buf(int which, struct string_list *people,
|
|
|
|
const char *buffer)
|
2012-03-13 17:00:00 +00:00
|
|
|
{
|
2012-05-21 23:09:51 +00:00
|
|
|
char *name_buf, *name, *name_end;
|
2012-03-13 17:00:00 +00:00
|
|
|
struct string_list_item *elem;
|
2012-12-28 23:29:31 +00:00
|
|
|
const char *field;
|
2012-03-13 17:00:00 +00:00
|
|
|
|
2012-12-28 23:29:31 +00:00
|
|
|
field = (which == 'a') ? "\nauthor " : "\ncommitter ";
|
2014-06-10 21:41:51 +00:00
|
|
|
name = strstr(buffer, field);
|
2012-03-13 17:00:00 +00:00
|
|
|
if (!name)
|
|
|
|
return;
|
|
|
|
name += strlen(field);
|
|
|
|
name_end = strchrnul(name, '<');
|
|
|
|
if (*name_end)
|
|
|
|
name_end--;
|
|
|
|
while (isspace(*name_end) && name <= name_end)
|
|
|
|
name_end--;
|
2012-05-21 23:09:51 +00:00
|
|
|
if (name_end < name)
|
2012-03-13 17:00:00 +00:00
|
|
|
return;
|
2012-05-21 23:09:51 +00:00
|
|
|
name_buf = xmemdupz(name, name_end - name + 1);
|
2012-03-13 17:00:00 +00:00
|
|
|
|
|
|
|
elem = string_list_lookup(people, name_buf);
|
|
|
|
if (!elem) {
|
|
|
|
elem = string_list_insert(people, name_buf);
|
|
|
|
elem->util = (void *)0;
|
|
|
|
}
|
|
|
|
elem->util = (void*)(util_as_integral(elem) + 1);
|
2012-05-21 23:09:51 +00:00
|
|
|
free(name_buf);
|
2012-03-13 17:00:00 +00:00
|
|
|
}
|
|
|
|
|
2015-04-15 21:18:37 +00:00
|
|
|
|
|
|
|
static void record_person(int which, struct string_list *people,
|
|
|
|
struct commit *commit)
|
|
|
|
{
|
2015-05-11 21:23:45 +00:00
|
|
|
const char *buffer = get_commit_buffer(commit, NULL);
|
2015-04-15 21:18:37 +00:00
|
|
|
record_person_from_buf(which, people, buffer);
|
|
|
|
unuse_commit_buffer(commit, buffer);
|
|
|
|
}
|
|
|
|
|
2012-03-13 17:00:00 +00:00
|
|
|
static int cmp_string_list_util_as_integral(const void *a_, const void *b_)
|
|
|
|
{
|
|
|
|
const struct string_list_item *a = a_, *b = b_;
|
|
|
|
return util_as_integral(b) - util_as_integral(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_people_count(struct strbuf *out, struct string_list *people)
|
|
|
|
{
|
|
|
|
if (people->nr == 1)
|
2016-08-05 20:37:11 +00:00
|
|
|
strbuf_addstr(out, people->items[0].string);
|
2012-03-13 17:00:00 +00:00
|
|
|
else if (people->nr == 2)
|
|
|
|
strbuf_addf(out, "%s (%d) and %s (%d)",
|
|
|
|
people->items[0].string,
|
|
|
|
(int)util_as_integral(&people->items[0]),
|
|
|
|
people->items[1].string,
|
|
|
|
(int)util_as_integral(&people->items[1]));
|
|
|
|
else if (people->nr)
|
|
|
|
strbuf_addf(out, "%s (%d) and others",
|
|
|
|
people->items[0].string,
|
|
|
|
(int)util_as_integral(&people->items[0]));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void credit_people(struct strbuf *out,
|
|
|
|
struct string_list *them,
|
|
|
|
int kind)
|
|
|
|
{
|
|
|
|
const char *label;
|
|
|
|
const char *me;
|
|
|
|
|
|
|
|
if (kind == 'a') {
|
2013-04-07 15:25:43 +00:00
|
|
|
label = "By";
|
2012-03-13 17:00:00 +00:00
|
|
|
me = git_author_info(IDENT_NO_DATE);
|
|
|
|
} else {
|
2013-04-07 15:25:43 +00:00
|
|
|
label = "Via";
|
2012-03-13 17:00:00 +00:00
|
|
|
me = git_committer_info(IDENT_NO_DATE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!them->nr ||
|
|
|
|
(them->nr == 1 &&
|
|
|
|
me &&
|
refactor skip_prefix to return a boolean
The skip_prefix() function returns a pointer to the content
past the prefix, or NULL if the prefix was not found. While
this is nice and simple, in practice it makes it hard to use
for two reasons:
1. When you want to conditionally skip or keep the string
as-is, you have to introduce a temporary variable.
For example:
tmp = skip_prefix(buf, "foo");
if (tmp)
buf = tmp;
2. It is verbose to check the outcome in a conditional, as
you need extra parentheses to silence compiler
warnings. For example:
if ((cp = skip_prefix(buf, "foo"))
/* do something with cp */
Both of these make it harder to use for long if-chains, and
we tend to use starts_with() instead. However, the first line
of "do something" is often to then skip forward in buf past
the prefix, either using a magic constant or with an extra
strlen(3) (which is generally computed at compile time, but
means we are repeating ourselves).
This patch refactors skip_prefix() to return a simple boolean,
and to provide the pointer value as an out-parameter. If the
prefix is not found, the out-parameter is untouched. This
lets you write:
if (skip_prefix(arg, "foo ", &arg))
do_foo(arg);
else if (skip_prefix(arg, "bar ", &arg))
do_bar(arg);
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-18 19:44:19 +00:00
|
|
|
skip_prefix(me, them->items->string, &me) &&
|
2014-06-18 19:42:14 +00:00
|
|
|
starts_with(me, " <")))
|
2012-03-13 17:00:00 +00:00
|
|
|
return;
|
2013-04-07 15:25:43 +00:00
|
|
|
strbuf_addf(out, "\n%c %s ", comment_line_char, label);
|
2012-03-13 17:00:00 +00:00
|
|
|
add_people_count(out, them);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_people_info(struct strbuf *out,
|
|
|
|
struct string_list *authors,
|
|
|
|
struct string_list *committers)
|
|
|
|
{
|
|
|
|
if (authors->nr)
|
|
|
|
qsort(authors->items,
|
|
|
|
authors->nr, sizeof(authors->items[0]),
|
|
|
|
cmp_string_list_util_as_integral);
|
|
|
|
if (committers->nr)
|
|
|
|
qsort(committers->items,
|
|
|
|
committers->nr, sizeof(committers->items[0]),
|
|
|
|
cmp_string_list_util_as_integral);
|
|
|
|
|
|
|
|
credit_people(out, authors, 'a');
|
|
|
|
credit_people(out, committers, 'c');
|
|
|
|
}
|
|
|
|
|
2011-10-07 06:12:09 +00:00
|
|
|
static void shortlog(const char *name,
|
|
|
|
struct origin_data *origin_data,
|
|
|
|
struct commit *head,
|
2012-12-28 23:29:31 +00:00
|
|
|
struct rev_info *rev,
|
|
|
|
struct fmt_merge_msg_opts *opts,
|
2011-10-07 06:12:09 +00:00
|
|
|
struct strbuf *out)
|
2006-07-03 15:18:43 +00:00
|
|
|
{
|
|
|
|
int i, count = 0;
|
|
|
|
struct commit *commit;
|
|
|
|
struct object *branch;
|
2010-07-04 19:46:19 +00:00
|
|
|
struct string_list subjects = STRING_LIST_INIT_DUP;
|
2012-03-13 17:00:00 +00:00
|
|
|
struct string_list authors = STRING_LIST_INIT_DUP;
|
|
|
|
struct string_list committers = STRING_LIST_INIT_DUP;
|
2007-11-13 07:16:08 +00:00
|
|
|
int flags = UNINTERESTING | TREESAME | SEEN | SHOWN | ADDED;
|
2010-03-24 07:16:01 +00:00
|
|
|
struct strbuf sb = STRBUF_INIT;
|
2011-10-07 06:12:09 +00:00
|
|
|
const unsigned char *sha1 = origin_data->sha1;
|
2012-12-28 23:29:31 +00:00
|
|
|
int limit = opts->shortlog_len;
|
2006-07-03 15:18:43 +00:00
|
|
|
|
|
|
|
branch = deref_tag(parse_object(sha1), sha1_to_hex(sha1), 40);
|
2006-07-12 03:45:31 +00:00
|
|
|
if (!branch || branch->type != OBJ_COMMIT)
|
2006-07-03 15:18:43 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
setup_revisions(0, NULL, rev, NULL);
|
|
|
|
add_pending_object(rev, branch, name);
|
|
|
|
add_pending_object(rev, &head->object, "^HEAD");
|
|
|
|
head->object.flags |= UNINTERESTING;
|
2008-02-18 07:31:56 +00:00
|
|
|
if (prepare_revision_walk(rev))
|
|
|
|
die("revision walk setup failed");
|
2006-07-03 15:18:43 +00:00
|
|
|
while ((commit = get_revision(rev)) != NULL) {
|
2010-03-24 07:16:01 +00:00
|
|
|
struct pretty_print_context ctx = {0};
|
2006-07-03 15:18:43 +00:00
|
|
|
|
2012-03-13 17:00:00 +00:00
|
|
|
if (commit->parents && commit->parents->next) {
|
|
|
|
/* do not list a merge but count committer */
|
2012-12-28 23:29:31 +00:00
|
|
|
if (opts->credit_people)
|
|
|
|
record_person('c', &committers, commit);
|
2006-07-03 15:18:43 +00:00
|
|
|
continue;
|
2012-03-13 17:00:00 +00:00
|
|
|
}
|
2012-12-28 23:29:31 +00:00
|
|
|
if (!count && opts->credit_people)
|
2012-03-13 17:00:00 +00:00
|
|
|
/* the 'tip' committer */
|
|
|
|
record_person('c', &committers, commit);
|
2012-12-28 23:29:31 +00:00
|
|
|
if (opts->credit_people)
|
|
|
|
record_person('a', &authors, commit);
|
2006-07-03 15:18:43 +00:00
|
|
|
count++;
|
|
|
|
if (subjects.nr > limit)
|
|
|
|
continue;
|
|
|
|
|
2010-03-24 07:16:01 +00:00
|
|
|
format_commit_message(commit, "%s", &sb, &ctx);
|
|
|
|
strbuf_ltrim(&sb);
|
2008-04-15 18:01:36 +00:00
|
|
|
|
2010-03-24 07:16:01 +00:00
|
|
|
if (!sb.len)
|
2010-06-25 23:41:38 +00:00
|
|
|
string_list_append(&subjects,
|
2015-11-10 02:22:28 +00:00
|
|
|
oid_to_hex(&commit->object.oid));
|
2010-03-24 07:16:01 +00:00
|
|
|
else
|
2010-06-25 23:41:38 +00:00
|
|
|
string_list_append(&subjects, strbuf_detach(&sb, NULL));
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
|
|
|
|
2012-12-28 23:29:31 +00:00
|
|
|
if (opts->credit_people)
|
|
|
|
add_people_info(out, &authors, &committers);
|
2006-07-03 15:18:43 +00:00
|
|
|
if (count > limit)
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addf(out, "\n* %s: (%d commits)\n", name, count);
|
2006-07-03 15:18:43 +00:00
|
|
|
else
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addf(out, "\n* %s:\n", name);
|
2006-07-03 15:18:43 +00:00
|
|
|
|
2011-10-07 06:12:09 +00:00
|
|
|
if (origin_data->is_local_branch && use_branch_desc)
|
|
|
|
add_branch_desc(out, name);
|
|
|
|
|
2006-07-03 15:18:43 +00:00
|
|
|
for (i = 0; i < subjects.nr; i++)
|
|
|
|
if (i >= limit)
|
2016-09-15 18:31:00 +00:00
|
|
|
strbuf_addstr(out, " ...\n");
|
2006-07-03 15:18:43 +00:00
|
|
|
else
|
2010-03-24 07:16:03 +00:00
|
|
|
strbuf_addf(out, " %s\n", subjects.items[i].string);
|
2006-07-03 15:18:43 +00:00
|
|
|
|
|
|
|
clear_commit_marks((struct commit *)branch, flags);
|
|
|
|
clear_commit_marks(head, flags);
|
|
|
|
free_commit_list(rev->commits);
|
|
|
|
rev->commits = NULL;
|
|
|
|
rev->pending.nr = 0;
|
|
|
|
|
2012-03-13 17:00:00 +00:00
|
|
|
string_list_clear(&authors, 0);
|
|
|
|
string_list_clear(&committers, 0);
|
2010-03-24 07:16:03 +00:00
|
|
|
string_list_clear(&subjects, 0);
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
|
|
|
|
2011-11-05 00:35:42 +00:00
|
|
|
static void fmt_merge_msg_title(struct strbuf *out,
|
2010-05-10 17:17:50 +00:00
|
|
|
const char *current_branch) {
|
|
|
|
int i = 0;
|
2009-03-07 20:02:26 +00:00
|
|
|
char *sep = "";
|
2010-03-24 07:15:58 +00:00
|
|
|
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addstr(out, "Merge ");
|
2006-07-03 15:18:43 +00:00
|
|
|
for (i = 0; i < srcs.nr; i++) {
|
2010-03-24 07:16:03 +00:00
|
|
|
struct src_data *src_data = srcs.items[i].util;
|
2006-07-03 15:18:43 +00:00
|
|
|
const char *subsep = "";
|
|
|
|
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addstr(out, sep);
|
2006-07-03 15:18:43 +00:00
|
|
|
sep = "; ";
|
|
|
|
|
|
|
|
if (src_data->head_status == 1) {
|
2010-03-24 07:16:03 +00:00
|
|
|
strbuf_addstr(out, srcs.items[i].string);
|
2006-07-03 15:18:43 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (src_data->head_status == 3) {
|
|
|
|
subsep = ", ";
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addstr(out, "HEAD");
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
|
|
|
if (src_data->branch.nr) {
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addstr(out, subsep);
|
2006-07-03 15:18:43 +00:00
|
|
|
subsep = ", ";
|
2008-06-27 16:21:59 +00:00
|
|
|
print_joined("branch ", "branches ", &src_data->branch,
|
|
|
|
out);
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
|
|
|
if (src_data->r_branch.nr) {
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addstr(out, subsep);
|
2006-07-03 15:18:43 +00:00
|
|
|
subsep = ", ";
|
2010-11-02 15:31:25 +00:00
|
|
|
print_joined("remote-tracking branch ", "remote-tracking branches ",
|
2008-06-27 16:21:59 +00:00
|
|
|
&src_data->r_branch, out);
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
|
|
|
if (src_data->tag.nr) {
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addstr(out, subsep);
|
2006-07-03 15:18:43 +00:00
|
|
|
subsep = ", ";
|
2008-06-27 16:21:59 +00:00
|
|
|
print_joined("tag ", "tags ", &src_data->tag, out);
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
|
|
|
if (src_data->generic.nr) {
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addstr(out, subsep);
|
|
|
|
print_joined("commit ", "commits ", &src_data->generic,
|
|
|
|
out);
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
2010-03-24 07:16:03 +00:00
|
|
|
if (strcmp(".", srcs.items[i].string))
|
|
|
|
strbuf_addf(out, " of %s", srcs.items[i].string);
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp("master", current_branch))
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addch(out, '\n');
|
2006-07-03 15:18:43 +00:00
|
|
|
else
|
2008-06-27 16:21:59 +00:00
|
|
|
strbuf_addf(out, " into %s\n", current_branch);
|
2010-05-10 17:17:50 +00:00
|
|
|
}
|
|
|
|
|
2011-11-05 04:06:30 +00:00
|
|
|
static void fmt_tag_signature(struct strbuf *tagbuf,
|
|
|
|
struct strbuf *sig,
|
|
|
|
const char *buf,
|
|
|
|
unsigned long len)
|
|
|
|
{
|
|
|
|
const char *tag_body = strstr(buf, "\n\n");
|
|
|
|
if (tag_body) {
|
|
|
|
tag_body += 2;
|
|
|
|
strbuf_add(tagbuf, tag_body, buf + len - tag_body);
|
|
|
|
}
|
|
|
|
strbuf_complete_line(tagbuf);
|
2012-05-25 16:02:03 +00:00
|
|
|
if (sig->len) {
|
|
|
|
strbuf_addch(tagbuf, '\n');
|
2013-01-16 19:18:48 +00:00
|
|
|
strbuf_add_commented_lines(tagbuf, sig->buf, sig->len);
|
2012-05-25 16:02:03 +00:00
|
|
|
}
|
2011-11-05 04:06:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void fmt_merge_msg_sigs(struct strbuf *out)
|
|
|
|
{
|
|
|
|
int i, tag_number = 0, first_tag = 0;
|
|
|
|
struct strbuf tagbuf = STRBUF_INIT;
|
|
|
|
|
|
|
|
for (i = 0; i < origins.nr; i++) {
|
|
|
|
unsigned char *sha1 = origins.items[i].util;
|
|
|
|
enum object_type type;
|
|
|
|
unsigned long size, len;
|
|
|
|
char *buf = read_sha1_file(sha1, &type, &size);
|
|
|
|
struct strbuf sig = STRBUF_INIT;
|
|
|
|
|
|
|
|
if (!buf || type != OBJ_TAG)
|
|
|
|
goto next;
|
|
|
|
len = parse_signature(buf, size);
|
|
|
|
|
|
|
|
if (size == len)
|
|
|
|
; /* merely annotated */
|
2013-02-14 16:04:44 +00:00
|
|
|
else if (verify_signed_buffer(buf, len, buf + len, size - len, &sig, NULL)) {
|
2011-11-05 04:06:30 +00:00
|
|
|
if (!sig.len)
|
|
|
|
strbuf_addstr(&sig, "gpg verification failed.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!tag_number++) {
|
|
|
|
fmt_tag_signature(&tagbuf, &sig, buf, len);
|
|
|
|
first_tag = i;
|
|
|
|
} else {
|
|
|
|
if (tag_number == 2) {
|
|
|
|
struct strbuf tagline = STRBUF_INIT;
|
2013-04-07 15:25:44 +00:00
|
|
|
strbuf_addch(&tagline, '\n');
|
|
|
|
strbuf_add_commented_lines(&tagline,
|
|
|
|
origins.items[first_tag].string,
|
|
|
|
strlen(origins.items[first_tag].string));
|
2011-11-05 04:06:30 +00:00
|
|
|
strbuf_insert(&tagbuf, 0, tagline.buf,
|
|
|
|
tagline.len);
|
|
|
|
strbuf_release(&tagline);
|
|
|
|
}
|
2013-04-07 15:25:44 +00:00
|
|
|
strbuf_addch(&tagbuf, '\n');
|
|
|
|
strbuf_add_commented_lines(&tagbuf,
|
|
|
|
origins.items[i].string,
|
|
|
|
strlen(origins.items[i].string));
|
2011-11-05 04:06:30 +00:00
|
|
|
fmt_tag_signature(&tagbuf, &sig, buf, len);
|
|
|
|
}
|
|
|
|
strbuf_release(&sig);
|
|
|
|
next:
|
|
|
|
free(buf);
|
|
|
|
}
|
|
|
|
if (tagbuf.len) {
|
|
|
|
strbuf_addch(out, '\n');
|
|
|
|
strbuf_addbuf(out, &tagbuf);
|
|
|
|
}
|
|
|
|
strbuf_release(&tagbuf);
|
|
|
|
}
|
|
|
|
|
2012-04-19 02:49:08 +00:00
|
|
|
static void find_merge_parents(struct merge_parents *result,
|
|
|
|
struct strbuf *in, unsigned char *head)
|
|
|
|
{
|
2015-10-24 16:21:31 +00:00
|
|
|
struct commit_list *parents;
|
2012-04-19 02:49:08 +00:00
|
|
|
struct commit *head_commit;
|
|
|
|
int pos = 0, i, j;
|
|
|
|
|
|
|
|
parents = NULL;
|
|
|
|
while (pos < in->len) {
|
|
|
|
int len;
|
|
|
|
char *p = in->buf + pos;
|
|
|
|
char *newline = strchr(p, '\n');
|
|
|
|
unsigned char sha1[20];
|
|
|
|
struct commit *parent;
|
|
|
|
struct object *obj;
|
|
|
|
|
|
|
|
len = newline ? newline - p : strlen(p);
|
|
|
|
pos += len + !!newline;
|
|
|
|
|
|
|
|
if (len < 43 ||
|
|
|
|
get_sha1_hex(p, sha1) ||
|
|
|
|
p[40] != '\t' ||
|
|
|
|
p[41] != '\t')
|
|
|
|
continue; /* skip not-for-merge */
|
|
|
|
/*
|
|
|
|
* Do not use get_merge_parent() here; we do not have
|
|
|
|
* "name" here and we do not want to contaminate its
|
|
|
|
* util field yet.
|
|
|
|
*/
|
|
|
|
obj = parse_object(sha1);
|
|
|
|
parent = (struct commit *)peel_to_type(NULL, 0, obj, OBJ_COMMIT);
|
|
|
|
if (!parent)
|
|
|
|
continue;
|
|
|
|
commit_list_insert(parent, &parents);
|
2015-11-10 02:22:29 +00:00
|
|
|
add_merge_parent(result, obj->oid.hash, parent->object.oid.hash);
|
2012-04-19 02:49:08 +00:00
|
|
|
}
|
|
|
|
head_commit = lookup_commit(head);
|
|
|
|
if (head_commit)
|
|
|
|
commit_list_insert(head_commit, &parents);
|
|
|
|
parents = reduce_heads(parents);
|
|
|
|
|
|
|
|
while (parents) {
|
2015-10-24 16:21:31 +00:00
|
|
|
struct commit *cmit = pop_commit(&parents);
|
2012-04-19 02:49:08 +00:00
|
|
|
for (i = 0; i < result->nr; i++)
|
2015-11-10 02:22:29 +00:00
|
|
|
if (!hashcmp(result->item[i].commit, cmit->object.oid.hash))
|
2012-04-19 02:49:08 +00:00
|
|
|
result->item[i].used = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = j = 0; i < result->nr; i++) {
|
|
|
|
if (result->item[i].used) {
|
|
|
|
if (i != j)
|
|
|
|
result->item[j] = result->item[i];
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
result->nr = j;
|
|
|
|
}
|
|
|
|
|
2011-11-05 00:35:42 +00:00
|
|
|
int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
|
|
|
|
struct fmt_merge_msg_opts *opts)
|
|
|
|
{
|
2010-09-08 17:59:53 +00:00
|
|
|
int i = 0, pos = 0;
|
2010-05-10 17:17:50 +00:00
|
|
|
unsigned char head_sha1[20];
|
|
|
|
const char *current_branch;
|
2011-12-13 14:17:48 +00:00
|
|
|
void *current_branch_to_free;
|
2012-04-19 02:49:08 +00:00
|
|
|
struct merge_parents merge_parents;
|
|
|
|
|
|
|
|
memset(&merge_parents, 0, sizeof(merge_parents));
|
2010-05-10 17:17:50 +00:00
|
|
|
|
|
|
|
/* get current branch */
|
2011-12-13 14:17:48 +00:00
|
|
|
current_branch = current_branch_to_free =
|
2014-07-15 19:59:36 +00:00
|
|
|
resolve_refdup("HEAD", RESOLVE_REF_READING, head_sha1, NULL);
|
2010-05-10 17:17:50 +00:00
|
|
|
if (!current_branch)
|
|
|
|
die("No current branch");
|
2013-11-30 20:55:40 +00:00
|
|
|
if (starts_with(current_branch, "refs/heads/"))
|
2010-05-10 17:17:50 +00:00
|
|
|
current_branch += 11;
|
|
|
|
|
2012-04-19 02:49:08 +00:00
|
|
|
find_merge_parents(&merge_parents, in, head_sha1);
|
|
|
|
|
2010-05-10 17:17:50 +00:00
|
|
|
/* get a line */
|
|
|
|
while (pos < in->len) {
|
|
|
|
int len;
|
|
|
|
char *newline, *p = in->buf + pos;
|
|
|
|
|
|
|
|
newline = strchr(p, '\n');
|
|
|
|
len = newline ? newline - p : strlen(p);
|
|
|
|
pos += len + !!newline;
|
|
|
|
i++;
|
|
|
|
p[len] = 0;
|
2012-04-19 02:49:08 +00:00
|
|
|
if (handle_line(p, &merge_parents))
|
2010-05-10 17:17:50 +00:00
|
|
|
die ("Error in line %d: %.*s", i, len, p);
|
|
|
|
}
|
|
|
|
|
2011-11-05 00:35:42 +00:00
|
|
|
if (opts->add_title && srcs.nr)
|
|
|
|
fmt_merge_msg_title(out, current_branch);
|
2010-05-10 17:17:50 +00:00
|
|
|
|
2011-11-05 04:06:30 +00:00
|
|
|
if (origins.nr)
|
|
|
|
fmt_merge_msg_sigs(out);
|
2006-07-03 15:18:43 +00:00
|
|
|
|
2011-11-05 00:35:42 +00:00
|
|
|
if (opts->shortlog_len) {
|
2006-07-03 15:18:43 +00:00
|
|
|
struct commit *head;
|
|
|
|
struct rev_info rev;
|
|
|
|
|
2011-09-17 11:57:45 +00:00
|
|
|
head = lookup_commit_or_die(head_sha1, "HEAD");
|
2008-06-27 16:21:59 +00:00
|
|
|
init_revisions(&rev, NULL);
|
2006-07-03 15:18:43 +00:00
|
|
|
rev.commit_format = CMIT_FMT_ONELINE;
|
|
|
|
rev.ignore_merges = 1;
|
|
|
|
rev.limited = 1;
|
|
|
|
|
2012-05-25 16:02:03 +00:00
|
|
|
strbuf_complete_line(out);
|
2010-05-10 17:17:52 +00:00
|
|
|
|
2006-07-03 15:18:43 +00:00
|
|
|
for (i = 0; i < origins.nr; i++)
|
2011-10-07 06:12:09 +00:00
|
|
|
shortlog(origins.items[i].string,
|
|
|
|
origins.items[i].util,
|
2012-12-28 23:29:31 +00:00
|
|
|
head, &rev, opts, out);
|
2006-07-03 15:18:43 +00:00
|
|
|
}
|
2008-06-27 16:21:59 +00:00
|
|
|
|
2011-11-05 04:06:30 +00:00
|
|
|
strbuf_complete_line(out);
|
2011-12-13 14:17:48 +00:00
|
|
|
free(current_branch_to_free);
|
2012-04-19 02:49:08 +00:00
|
|
|
free(merge_parents.item);
|
2008-06-27 16:21:59 +00:00
|
|
|
return 0;
|
2010-05-10 17:17:49 +00:00
|
|
|
}
|
|
|
|
|
2008-06-27 16:21:59 +00:00
|
|
|
int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
|
|
|
|
{
|
2008-10-02 12:59:18 +00:00
|
|
|
const char *inpath = NULL;
|
2010-08-17 23:00:34 +00:00
|
|
|
const char *message = NULL;
|
2011-10-07 06:12:09 +00:00
|
|
|
int shortlog_len = -1;
|
2008-10-02 12:59:18 +00:00
|
|
|
struct option options[] = {
|
2012-08-20 12:32:10 +00:00
|
|
|
{ OPTION_INTEGER, 0, "log", &shortlog_len, N_("n"),
|
|
|
|
N_("populate log with at most <n> entries from shortlog"),
|
2010-09-08 17:59:54 +00:00
|
|
|
PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },
|
2012-08-20 12:32:10 +00:00
|
|
|
{ OPTION_INTEGER, 0, "summary", &shortlog_len, N_("n"),
|
|
|
|
N_("alias for --log (deprecated)"),
|
2010-09-08 17:59:54 +00:00
|
|
|
PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL,
|
|
|
|
DEFAULT_MERGE_LOG_LEN },
|
2012-08-20 12:32:10 +00:00
|
|
|
OPT_STRING('m', "message", &message, N_("text"),
|
|
|
|
N_("use <text> as start of message")),
|
|
|
|
OPT_FILENAME('F', "file", &inpath, N_("file to read from")),
|
2008-10-02 12:59:18 +00:00
|
|
|
OPT_END()
|
|
|
|
};
|
|
|
|
|
2008-06-27 16:21:59 +00:00
|
|
|
FILE *in = stdin;
|
2008-10-09 19:12:12 +00:00
|
|
|
struct strbuf input = STRBUF_INIT, output = STRBUF_INIT;
|
2008-06-27 16:21:59 +00:00
|
|
|
int ret;
|
2011-11-05 00:35:42 +00:00
|
|
|
struct fmt_merge_msg_opts opts;
|
2008-06-27 16:21:59 +00:00
|
|
|
|
|
|
|
git_config(fmt_merge_msg_config, NULL);
|
2009-05-23 18:53:12 +00:00
|
|
|
argc = parse_options(argc, argv, prefix, options, fmt_merge_msg_usage,
|
|
|
|
0);
|
2008-10-02 12:59:18 +00:00
|
|
|
if (argc > 0)
|
|
|
|
usage_with_options(fmt_merge_msg_usage, options);
|
2011-10-07 06:12:09 +00:00
|
|
|
if (shortlog_len < 0)
|
|
|
|
shortlog_len = (merge_log_config > 0) ? merge_log_config : 0;
|
2008-10-02 12:59:18 +00:00
|
|
|
|
|
|
|
if (inpath && strcmp(inpath, "-")) {
|
|
|
|
in = fopen(inpath, "r");
|
|
|
|
if (!in)
|
2009-06-27 15:58:47 +00:00
|
|
|
die_errno("cannot open '%s'", inpath);
|
2008-06-27 16:21:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (strbuf_read(&input, fileno(in), 0) < 0)
|
2009-06-27 15:58:46 +00:00
|
|
|
die_errno("could not read input file");
|
2010-09-08 17:59:53 +00:00
|
|
|
|
|
|
|
if (message)
|
2010-08-17 23:00:34 +00:00
|
|
|
strbuf_addstr(&output, message);
|
2010-09-08 17:59:53 +00:00
|
|
|
|
2011-11-05 00:35:42 +00:00
|
|
|
memset(&opts, 0, sizeof(opts));
|
|
|
|
opts.add_title = !message;
|
2012-12-28 23:29:31 +00:00
|
|
|
opts.credit_people = 1;
|
2011-11-05 00:35:42 +00:00
|
|
|
opts.shortlog_len = shortlog_len;
|
|
|
|
|
|
|
|
ret = fmt_merge_msg(&input, &output, &opts);
|
2008-06-27 16:21:59 +00:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
2008-10-02 12:59:18 +00:00
|
|
|
write_in_full(STDOUT_FILENO, output.buf, output.len);
|
2006-07-03 15:18:43 +00:00
|
|
|
return 0;
|
|
|
|
}
|