git-fmt-merge-msg: make it usable from other builtins

Move all functionality (except config and option parsing) from
cmd_fmt_merge_msg() to fmt_merge_msg(), so that other builtins can use
it without a child process.

All functions have been changed to use strbufs, and now only
cmd_fmt_merge_msg() reads directly from a file / writes anything to
stdout.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Miklos Vajna
2008-06-27 18:21:59 +02:00
committed by Junio C Hamano
parent e46bbcf6e8
commit 0b9a969e0f
2 changed files with 117 additions and 91 deletions

View File

@ -2,6 +2,7 @@
#define BUILTIN_H
#include "git-compat-util.h"
#include "strbuf.h"
extern const char git_version_string[];
extern const char git_usage_string[];
@ -11,6 +12,8 @@ extern void list_common_cmds_help(void);
extern void help_unknown_cmd(const char *cmd);
extern void prune_packed_objects(int);
extern int read_line_with_nul(char *buf, int size, FILE *file);
extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
struct strbuf *out);
extern int cmd_add(int argc, const char **argv, const char *prefix);
extern int cmd_annotate(int argc, const char **argv, const char *prefix);