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>
Tay Ray Chuan committed
May 11, 2010 at 01:17 UTC
8c6bdfdf8ba9a3d7a03d64b7a98305a460921130
2 files changed
+10
-4
builtin.h
+1
@@ -16,6 +16,7 @@ extern const char *help_unknown_cmd(const char *cmd);
16
extern void prune_packed_objects(int);
17
extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
18
struct strbuf *out);
19
+extern int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out);
20
extern int commit_tree(const char *msg, unsigned char *tree,
21
struct commit_list *parents, unsigned char *ret,
22
const char *author);
builtin/fmt-merge-msg.c
+9
-4
@@ -255,8 +255,8 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
255
strbuf_addf(out, " into %s\n", current_branch);
256
}
257
258
-static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
259
- struct strbuf *out) {
258
+static int do_fmt_merge_msg(int merge_title, int merge_summary,
259
+ struct strbuf *in, struct strbuf *out) {
260
int limit = 20, i = 0, pos = 0;
261
unsigned char head_sha1[20];
262
const char *current_branch;
@@ -285,7 +285,8 @@ static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
285
if (!srcs.nr)
286
return 0;
287
288
- do_fmt_merge_msg_title(out, current_branch);
288
+ if (merge_title)
289
+ do_fmt_merge_msg_title(out, current_branch);
290
291
if (merge_summary) {
292
struct commit *head;
@@ -305,7 +306,11 @@ static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
306
}
307
308
int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {
308
- return do_fmt_merge_msg(merge_summary, in, out);
309
+ return do_fmt_merge_msg(1, merge_summary, in, out);
310
+}
311
+
312
+int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {
313
+ return do_fmt_merge_msg(0, 1, in, out);
314
}
315
316
int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)