]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'pw/rebase-m-signoff-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 30 Apr 2024 21:49:41 +0000 (14:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Apr 2024 21:49:41 +0000 (14:49 -0700)
"git rebase --signoff" used to forget that it needs to add a
sign-off to the resulting commit when told to continue after a
conflict stops its operation.

* pw/rebase-m-signoff-fix:
  rebase -m: fix --signoff with conflicts
  sequencer: store commit message in private context
  sequencer: move current fixups to private context
  sequencer: start removing private fields from public API
  sequencer: always free "struct replay_opts"

1  2 
sequencer.c
sequencer.h

diff --cc sequencer.c
index 2c19846385baa1df3240e865752087db827ba36e,e29a01944be826aacfb28406100980f9aa122397..88de4dc20fbb8cb0e813afc79486cca04484aba5
@@@ -1969,11 -1998,11 +2021,11 @@@ static int append_squash_message(struc
             (starts_with(body, "squash!") || starts_with(body, "fixup!"))))
                commented_len = commit_subject_length(body);
  
 -      strbuf_addf(buf, "\n%c ", comment_line_char);
 +      strbuf_addf(buf, "\n%s ", comment_line_str);
        strbuf_addf(buf, _(nth_commit_msg_fmt),
-                   ++opts->current_fixup_count + 1);
+                   ++ctx->current_fixup_count + 1);
        strbuf_addstr(buf, "\n\n");
 -      strbuf_add_commented_lines(buf, body, commented_len, comment_line_char);
 +      strbuf_add_commented_lines(buf, body, commented_len, comment_line_str);
        /* buf->buf may be reallocated so store an offset into the buffer */
        fixup_off = buf->len;
        strbuf_addstr(buf, body + commented_len);
@@@ -2026,15 -2056,15 +2079,15 @@@ static int update_squash_messages(struc
                        return error(_("could not read '%s'"),
                                rebase_path_squash_msg());
  
 -              eol = buf.buf[0] != comment_line_char ?
 +              eol = !starts_with(buf.buf, comment_line_str) ?
                        buf.buf : strchrnul(buf.buf, '\n');
  
 -              strbuf_addf(&header, "%c ", comment_line_char);
 +              strbuf_addf(&header, "%s ", comment_line_str);
                strbuf_addf(&header, _(combined_commit_msg_fmt),
-                           opts->current_fixup_count + 2);
+                           ctx->current_fixup_count + 2);
                strbuf_splice(&buf, 0, eol - buf.buf, header.buf, header.len);
                strbuf_release(&header);
-               if (is_fixup_flag(command, flag) && !seen_squash(opts))
+               if (is_fixup_flag(command, flag) && !seen_squash(ctx))
                        update_squash_message_for_fixup(&buf);
        } else {
                struct object_id head;
        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);
 +              strbuf_addf(&buf, "\n%s ", comment_line_str);
                strbuf_addf(&buf, _(skip_nth_commit_msg_fmt),
-                           ++opts->current_fixup_count + 1);
+                           ++ctx->current_fixup_count + 1);
                strbuf_addstr(&buf, "\n\n");
                strbuf_add_commented_lines(&buf, body, strlen(body),
 -                                         comment_line_char);
 +                                         comment_line_str);
        } else
                return error(_("unknown command: %d"), command);
        repo_unuse_commit_buffer(r, commit, message);
diff --cc sequencer.h
Simple merge