fmt-merge-msg: add function to append shortlog only

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Tay Ray Chuan
2010-05-11 01:17:51 +08:00
committed by Junio C Hamano
parent 403994e83d
commit 8c6bdfdf8b
2 changed files with 10 additions and 4 deletions

View File

@ -16,6 +16,7 @@ extern const char *help_unknown_cmd(const char *cmd);
extern void prune_packed_objects(int); extern void prune_packed_objects(int);
extern int fmt_merge_msg(int merge_summary, struct strbuf *in, extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
struct strbuf *out); struct strbuf *out);
extern int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out);
extern int commit_tree(const char *msg, unsigned char *tree, extern int commit_tree(const char *msg, unsigned char *tree,
struct commit_list *parents, unsigned char *ret, struct commit_list *parents, unsigned char *ret,
const char *author); const char *author);

View File

@ -255,8 +255,8 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
strbuf_addf(out, " into %s\n", current_branch); strbuf_addf(out, " into %s\n", current_branch);
} }
static int do_fmt_merge_msg(int merge_summary, struct strbuf *in, static int do_fmt_merge_msg(int merge_title, int merge_summary,
struct strbuf *out) { struct strbuf *in, struct strbuf *out) {
int limit = 20, i = 0, pos = 0; int limit = 20, i = 0, pos = 0;
unsigned char head_sha1[20]; unsigned char head_sha1[20];
const char *current_branch; const char *current_branch;
@ -285,6 +285,7 @@ static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
if (!srcs.nr) if (!srcs.nr)
return 0; return 0;
if (merge_title)
do_fmt_merge_msg_title(out, current_branch); do_fmt_merge_msg_title(out, current_branch);
if (merge_summary) { if (merge_summary) {
@ -305,7 +306,11 @@ static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
} }
int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) { int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {
return do_fmt_merge_msg(merge_summary, in, out); return do_fmt_merge_msg(1, merge_summary, in, out);
}
int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {
return do_fmt_merge_msg(0, 1, in, out);
} }
int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)