]> git.ipfire.org Git - thirdparty/git.git/blobdiff - sequencer.c
Merge branch 'pb/ref-filter-with-crlf'
[thirdparty/git.git] / sequencer.c
index e8676e965fca6813d49cb4b30cc4fab5b8da3390..a65d7a6b7cd94652436b3d14256464ffbbc224a5 100644 (file)
@@ -120,7 +120,7 @@ static GIT_PATH_FUNC(rebase_path_author_script, "rebase-merge/author-script")
 static GIT_PATH_FUNC(rebase_path_amend, "rebase-merge/amend")
 /*
  * When we stop at a given patch via the "edit" command, this file contains
- * the abbreviated commit name of the corresponding patch.
+ * the commit object name of the corresponding patch.
  */
 static GIT_PATH_FUNC(rebase_path_stopped_sha, "rebase-merge/stopped-sha")
 /*
@@ -249,11 +249,20 @@ static int has_conforming_footer(struct strbuf *sb, struct strbuf *sob,
        struct trailer_info info;
        size_t i;
        int found_sob = 0, found_sob_last = 0;
+       char saved_char;
 
        opts.no_divider = 1;
 
+       if (ignore_footer) {
+               saved_char = sb->buf[sb->len - ignore_footer];
+               sb->buf[sb->len - ignore_footer] = '\0';
+       }
+
        trailer_info_get(&info, sb->buf, &opts);
 
+       if (ignore_footer)
+               sb->buf[sb->len - ignore_footer] = saved_char;
+
        if (info.trailer_start == info.trailer_end)
                return 0;
 
@@ -934,8 +943,7 @@ static int run_command_silent_on_success(struct child_process *cmd)
  * interactive rebase: in that case, we will want to retain the
  * author metadata.
  */
-static int run_git_commit(struct repository *r,
-                         const char *defmsg,
+static int run_git_commit(const char *defmsg,
                          struct replay_opts *opts,
                          unsigned int flags)
 {
@@ -1545,7 +1553,7 @@ static int do_commit(struct repository *r,
                if (is_rebase_i(opts) && oid)
                        if (write_rebase_head(oid))
                            return -1;
-               return run_git_commit(r, msg_file, opts, flags);
+               return run_git_commit(msg_file, opts, flags);
        }
 
        return res;
@@ -2060,7 +2068,7 @@ static int do_pick_commit(struct repository *r,
                *check_todo = !!(flags & EDIT_MSG);
                if (!res && reword) {
 fast_forward_edit:
-                       res = run_git_commit(r, NULL, opts, EDIT_MSG |
+                       res = run_git_commit(NULL, opts, EDIT_MSG |
                                             VERIFY_MSG | AMEND_MSG |
                                             (flags & ALLOW_EMPTY));
                        *check_todo = 1;
@@ -3111,11 +3119,12 @@ static int make_patch(struct repository *r,
 {
        struct strbuf buf = STRBUF_INIT;
        struct rev_info log_tree_opt;
-       const char *subject, *p;
+       const char *subject;
+       char hex[GIT_MAX_HEXSZ + 1];
        int res = 0;
 
-       p = short_commit_name(commit);
-       if (write_message(p, strlen(p), rebase_path_stopped_sha(), 1) < 0)
+       oid_to_hex_r(hex, &commit->object.oid);
+       if (write_message(hex, strlen(hex), rebase_path_stopped_sha(), 1) < 0)
                return -1;
        res |= write_rebase_head(&commit->object.oid);
 
@@ -3668,7 +3677,9 @@ static int do_merge(struct repository *r,
                strvec_push(&cmd.args, "-F");
                strvec_push(&cmd.args, git_path_merge_msg(r));
                if (opts->gpg_sign)
-                       strvec_push(&cmd.args, opts->gpg_sign);
+                       strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
+               else
+                       strvec_push(&cmd.args, "--no-gpg-sign");
 
                /* Add the tips to be merged */
                for (j = to_merge; j; j = j->next)
@@ -3680,7 +3691,6 @@ static int do_merge(struct repository *r,
                                NULL, 0);
                rollback_lock_file(&lock);
 
-               rollback_lock_file(&lock);
                ret = run_command(&cmd);
 
                /* force re-reading of the cache */
@@ -3748,7 +3758,7 @@ static int do_merge(struct repository *r,
                 * command needs to be rescheduled).
                 */
        fast_forward_edit:
-               ret = !!run_git_commit(r, git_path_merge_msg(r), opts,
+               ret = !!run_git_commit(git_path_merge_msg(r), opts,
                                       run_commit_flags);
 
 leave_merge:
@@ -4437,7 +4447,7 @@ static int commit_staged_changes(struct repository *r,
                        return 0;
        }
 
-       if (run_git_commit(r, final_fixup ? NULL : rebase_path_message(),
+       if (run_git_commit(final_fixup ? NULL : rebase_path_message(),
                           opts, flags))
                return error(_("could not commit staged changes."));
        unlink(rebase_path_amend());
@@ -4469,7 +4479,7 @@ static int init_committer(struct replay_opts *opts)
        opts->committer_name =
                xmemdupz(id.name_begin, id.name_end - id.name_begin);
        opts->committer_email =
-               xmemdupz(id.mail_begin, id.mail_end - id.mail_end);
+               xmemdupz(id.mail_begin, id.mail_end - id.mail_begin);
 
        return 0;
 }
@@ -4527,7 +4537,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
 
                if (read_oneliner(&buf, rebase_path_stopped_sha(),
                                  READ_ONELINER_SKIP_IF_EMPTY) &&
-                   !get_oid_committish(buf.buf, &oid))
+                   !get_oid_hex(buf.buf, &oid))
                        record_in_rewritten(&oid, peek_command(&todo_list, 0));
                strbuf_release(&buf);
        }