зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
a25314c1ec
Коммит
1f9696019a
18
sequencer.c
18
sequencer.c
|
@ -1744,7 +1744,7 @@ static const char skip_first_commit_msg_str[] = N_("The 1st commit message will
|
|||
static const char skip_nth_commit_msg_fmt[] = N_("The commit message #%d will be skipped:");
|
||||
static const char combined_commit_msg_fmt[] = N_("This is a combination of %d commits.");
|
||||
|
||||
static int check_fixup_flag(enum todo_command command, unsigned flag)
|
||||
static int is_fixup_flag(enum todo_command command, unsigned flag)
|
||||
{
|
||||
return command == TODO_FIXUP && ((flag & TODO_REPLACE_FIXUP_MSG) ||
|
||||
(flag & TODO_EDIT_FIXUP_MSG));
|
||||
|
@ -1873,7 +1873,7 @@ static int append_squash_message(struct strbuf *buf, const char *body,
|
|||
strbuf_addstr(buf, body + commented_len);
|
||||
|
||||
/* fixup -C after squash behaves like squash */
|
||||
if (check_fixup_flag(command, flag) && !seen_squash(opts)) {
|
||||
if (is_fixup_flag(command, flag) && !seen_squash(opts)) {
|
||||
/*
|
||||
* We're replacing the commit message so we need to
|
||||
* append the Signed-off-by: trailer if the user
|
||||
|
@ -1928,7 +1928,7 @@ static int update_squash_messages(struct repository *r,
|
|||
opts->current_fixup_count + 2);
|
||||
strbuf_splice(&buf, 0, eol - buf.buf, header.buf, header.len);
|
||||
strbuf_release(&header);
|
||||
if (check_fixup_flag(command, flag) && !seen_squash(opts))
|
||||
if (is_fixup_flag(command, flag) && !seen_squash(opts))
|
||||
update_squash_message_for_fixup(&buf);
|
||||
} else {
|
||||
struct object_id head;
|
||||
|
@ -1951,11 +1951,11 @@ static int update_squash_messages(struct repository *r,
|
|||
strbuf_addf(&buf, "%c ", comment_line_char);
|
||||
strbuf_addf(&buf, _(combined_commit_msg_fmt), 2);
|
||||
strbuf_addf(&buf, "\n%c ", comment_line_char);
|
||||
strbuf_addstr(&buf, check_fixup_flag(command, flag) ?
|
||||
strbuf_addstr(&buf, is_fixup_flag(command, flag) ?
|
||||
_(skip_first_commit_msg_str) :
|
||||
_(first_commit_msg_str));
|
||||
strbuf_addstr(&buf, "\n\n");
|
||||
if (check_fixup_flag(command, flag))
|
||||
if (is_fixup_flag(command, flag))
|
||||
strbuf_add_commented_lines(&buf, body, strlen(body));
|
||||
else
|
||||
strbuf_addstr(&buf, body);
|
||||
|
@ -1968,7 +1968,7 @@ static int update_squash_messages(struct repository *r,
|
|||
oid_to_hex(&commit->object.oid));
|
||||
find_commit_subject(message, &body);
|
||||
|
||||
if (command == TODO_SQUASH || check_fixup_flag(command, flag)) {
|
||||
if (command == TODO_SQUASH || is_fixup_flag(command, flag)) {
|
||||
res = append_squash_message(&buf, body, command, opts, flag);
|
||||
} else if (command == TODO_FIXUP) {
|
||||
strbuf_addf(&buf, "\n%c ", comment_line_char);
|
||||
|
@ -5661,7 +5661,7 @@ static int subject2item_cmp(const void *fndata,
|
|||
|
||||
define_commit_slab(commit_todo_item, struct todo_item *);
|
||||
|
||||
static inline int skip_fixup_amend_squash(const char *subject, const char **p) {
|
||||
static int skip_fixupish(const char *subject, const char **p) {
|
||||
return skip_prefix(subject, "fixup! ", p) ||
|
||||
skip_prefix(subject, "amend! ", p) ||
|
||||
skip_prefix(subject, "squash! ", p);
|
||||
|
@ -5725,13 +5725,13 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
|
|||
format_subject(&buf, subject, " ");
|
||||
subject = subjects[i] = strbuf_detach(&buf, &subject_len);
|
||||
unuse_commit_buffer(item->commit, commit_buffer);
|
||||
if (skip_fixup_amend_squash(subject, &p)) {
|
||||
if (skip_fixupish(subject, &p)) {
|
||||
struct commit *commit2;
|
||||
|
||||
for (;;) {
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
if (!skip_fixup_amend_squash(p, &p))
|
||||
if (!skip_fixupish(p, &p))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче