sequencer: rename a few functions

Rename functions to make them more descriptive and while at it, remove unnecessary 'inline' of the skip_fixupish() function. Mentored-by: Christian Couder <chriscool@tuxfamily.org> Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Charvi Mendiratta <charvi077@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Charvi Mendiratta committed Feb 9, 2021 at 00:55 UTC 1f9696019aee1539ce2fe025b659702926d7ceed
1 file changed +9 -9
sequencer.c
+9 -9
@@ -1744,7 +1744,7 @@ static const char skip_first_commit_msg_str[] = N_("The 1st commit message will
1744 static const char skip_nth_commit_msg_fmt[] = N_("The commit message #%d will be skipped:");
1745 static const char combined_commit_msg_fmt[] = N_("This is a combination of %d commits.");
1746
1747 -static int check_fixup_flag(enum todo_command command, unsigned flag)
1747 +static int is_fixup_flag(enum todo_command command, unsigned flag)
1748 {
1749 return command == TODO_FIXUP && ((flag & TODO_REPLACE_FIXUP_MSG) ||
1750 (flag & TODO_EDIT_FIXUP_MSG));
@@ -1873,7 +1873,7 @@ static int append_squash_message(struct strbuf *buf, const char *body,
1873 strbuf_addstr(buf, body + commented_len);
1874
1875 /* fixup -C after squash behaves like squash */
1876 - if (check_fixup_flag(command, flag) && !seen_squash(opts)) {
1876 + if (is_fixup_flag(command, flag) && !seen_squash(opts)) {
1877 /*
1878 * We're replacing the commit message so we need to
1879 * append the Signed-off-by: trailer if the user
@@ -1928,7 +1928,7 @@ static int update_squash_messages(struct repository *r,
1928 opts->current_fixup_count + 2);
1929 strbuf_splice(&buf, 0, eol - buf.buf, header.buf, header.len);
1930 strbuf_release(&header);
1931 - if (check_fixup_flag(command, flag) && !seen_squash(opts))
1931 + if (is_fixup_flag(command, flag) && !seen_squash(opts))
1932 update_squash_message_for_fixup(&buf);
1933 } else {
1934 struct object_id head;
@@ -1951,11 +1951,11 @@ static int update_squash_messages(struct repository *r,
1951 strbuf_addf(&buf, "%c ", comment_line_char);
1952 strbuf_addf(&buf, _(combined_commit_msg_fmt), 2);
1953 strbuf_addf(&buf, "\n%c ", comment_line_char);
1954 - strbuf_addstr(&buf, check_fixup_flag(command, flag) ?
1954 + strbuf_addstr(&buf, is_fixup_flag(command, flag) ?
1955 _(skip_first_commit_msg_str) :
1956 _(first_commit_msg_str));
1957 strbuf_addstr(&buf, "\n\n");
1958 - if (check_fixup_flag(command, flag))
1958 + if (is_fixup_flag(command, flag))
1959 strbuf_add_commented_lines(&buf, body, strlen(body));
1960 else
1961 strbuf_addstr(&buf, body);
@@ -1968,7 +1968,7 @@ static int update_squash_messages(struct repository *r,
1968 oid_to_hex(&commit->object.oid));
1969 find_commit_subject(message, &body);
1970
1971 - if (command == TODO_SQUASH || check_fixup_flag(command, flag)) {
1971 + if (command == TODO_SQUASH || is_fixup_flag(command, flag)) {
1972 res = append_squash_message(&buf, body, command, opts, flag);
1973 } else if (command == TODO_FIXUP) {
1974 strbuf_addf(&buf, "\n%c ", comment_line_char);
@@ -5661,7 +5661,7 @@ static int subject2item_cmp(const void *fndata,
5661
5662 define_commit_slab(commit_todo_item, struct todo_item *);
5663
5664 -static inline int skip_fixup_amend_squash(const char *subject, const char **p) {
5664 +static int skip_fixupish(const char *subject, const char **p) {
5665 return skip_prefix(subject, "fixup! ", p) ||
5666 skip_prefix(subject, "amend! ", p) ||
5667 skip_prefix(subject, "squash! ", p);
@@ -5725,13 +5725,13 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
5725 format_subject(&buf, subject, " ");
5726 subject = subjects[i] = strbuf_detach(&buf, &subject_len);
5727 unuse_commit_buffer(item->commit, commit_buffer);
5728 - if (skip_fixup_amend_squash(subject, &p)) {
5728 + if (skip_fixupish(subject, &p)) {
5729 struct commit *commit2;
5730
5731 for (;;) {
5732 while (isspace(*p))
5733 p++;
5734 - if (!skip_fixup_amend_squash(p, &p))
5734 + if (!skip_fixupish(p, &p))
5735 break;
5736 }
5737