Skip to content

Commit 8c6bdfd

Browse files
rctaygitster
authored andcommitted
fmt-merge-msg: add function to append shortlog only
Signed-off-by: Tay Ray Chuan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 403994e commit 8c6bdfd

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extern const char *help_unknown_cmd(const char *cmd);
1616
extern void prune_packed_objects(int);
1717
extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
1818
struct strbuf *out);
19+
extern int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out);
1920
extern int commit_tree(const char *msg, unsigned char *tree,
2021
struct commit_list *parents, unsigned char *ret,
2122
const char *author);

builtin/fmt-merge-msg.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
255255
strbuf_addf(out, " into %s\n", current_branch);
256256
}
257257

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) {
260260
int limit = 20, i = 0, pos = 0;
261261
unsigned char head_sha1[20];
262262
const char *current_branch;
@@ -285,7 +285,8 @@ static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
285285
if (!srcs.nr)
286286
return 0;
287287

288-
do_fmt_merge_msg_title(out, current_branch);
288+
if (merge_title)
289+
do_fmt_merge_msg_title(out, current_branch);
289290

290291
if (merge_summary) {
291292
struct commit *head;
@@ -305,7 +306,11 @@ static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
305306
}
306307

307308
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);
309314
}
310315

311316
int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)

0 commit comments

Comments
 (0)