summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-03-26 21:59:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-26 21:59:03 (GMT)
commit89519f662c9e2b1c406fa72ba7923fcf5c028e89 (patch)
tree377d0feee3a6b52752c135c8d8457c898539768b /sequencer.c
parentfde07fc356783bd05695cd3826844f1590ac2e45 (diff)
parent00ea64ed7a0ee5ef0901b1eeb5add6954925590f (diff)
downloadgit-89519f662c9e2b1c406fa72ba7923fcf5c028e89.zip
git-89519f662c9e2b1c406fa72ba7923fcf5c028e89.tar.gz
git-89519f662c9e2b1c406fa72ba7923fcf5c028e89.tar.bz2
Merge branch 'cm/rebase-i-fixup-amend-reword'
"git commit --fixup=<commit>", which was to tweak the changes made to the contents while keeping the original log message intact, learned "--fixup=(amend|reword):<commit>", that can be used to tweak both the message and the contents, and only the message, respectively. * cm/rebase-i-fixup-amend-reword: doc/git-commit: add documentation for fixup=[amend|reword] options t3437: use --fixup with options to create amend! commit t7500: add tests for --fixup=[amend|reword] options commit: add a reword suboption to --fixup commit: add amend suboption to --fixup to create amend! commit sequencer: export and rename subject_length()
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/sequencer.c b/sequencer.c
index aedca2d..b4c63ae 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1732,20 +1732,6 @@ enum todo_item_flags {
TODO_EDIT_FIXUP_MSG = (1 << 2),
};
-static size_t subject_length(const char *body)
-{
- const char *p = body;
- while (*p) {
- const char *next = skip_blank_lines(p);
- if (next != p)
- break;
- p = strchrnul(p, '\n');
- if (*p)
- p++;
- }
- return p - body;
-}
-
static const char first_commit_msg_str[] = N_("This is the 1st commit message:");
static const char nth_commit_msg_fmt[] = N_("This is the commit message #%d:");
static const char skip_first_commit_msg_str[] = N_("The 1st commit message will be skipped:");
@@ -1869,7 +1855,7 @@ static int append_squash_message(struct strbuf *buf, const char *body,
if (starts_with(body, "amend!") ||
((command == TODO_SQUASH || seen_squash(opts)) &&
(starts_with(body, "squash!") || starts_with(body, "fixup!"))))
- commented_len = subject_length(body);
+ commented_len = commit_subject_length(body);
strbuf_addf(buf, "\n%c ", comment_line_char);
strbuf_addf(buf, _(nth_commit_msg_fmt),