]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/commit.c
environment: store comment_line_char as a string
[thirdparty/git.git] / builtin / commit.c
index 781af2e206c1060213f16dd7cacb5ca68884f6b8..d8abbe48b17b9b63f47b59013ed61bcfcde4ddd4 100644 (file)
 #include "editor.h"
 #include "environment.h"
 #include "diff.h"
-#include "diffcore.h"
 #include "commit.h"
 #include "gettext.h"
 #include "revision.h"
 #include "wt-status.h"
 #include "run-command.h"
-#include "hook.h"
-#include "refs.h"
-#include "log-tree.h"
 #include "strbuf.h"
-#include "utf8.h"
 #include "object-name.h"
 #include "parse-options.h"
 #include "path.h"
@@ -35,9 +30,6 @@
 #include "string-list.h"
 #include "rerere.h"
 #include "unpack-trees.h"
-#include "quote.h"
-#include "submodule.h"
-#include "gpg-interface.h"
 #include "column.h"
 #include "sequencer.h"
 #include "sparse-index.h"
@@ -692,9 +684,10 @@ static void adjust_comment_line_char(const struct strbuf *sb)
        char *candidate;
        const char *p;
 
-       comment_line_char = candidates[0];
-       if (!memchr(sb->buf, comment_line_char, sb->len))
+       if (!memchr(sb->buf, candidates[0], sb->len)) {
+               comment_line_str = xstrfmt("%c", candidates[0]);
                return;
+       }
 
        p = sb->buf;
        candidate = strchr(candidates, *p);
@@ -713,7 +706,7 @@ static void adjust_comment_line_char(const struct strbuf *sb)
        if (!*p)
                die(_("unable to select a comment character that is not used\n"
                      "in the current commit message"));
-       comment_line_char = *p;
+       comment_line_str = xstrfmt("%c", *p);
 }
 
 static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,
@@ -900,7 +893,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                strbuf_stripspace(&sb, '\0');
 
        if (signoff)
-               append_signoff(&sb, ignore_non_trailer(sb.buf, sb.len), 0);
+               append_signoff(&sb, ignored_log_message_bytes(sb.buf, sb.len), 0);
 
        if (fwrite(sb.buf, 1, sb.len, s->fp) < sb.len)
                die_errno(_("could not write commit template"));
@@ -1885,7 +1878,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                                     &oid, flags);
        }
 
-       apply_autostash(git_path_merge_autostash(the_repository));
+       apply_autostash_ref(the_repository, "MERGE_AUTOSTASH");
 
 cleanup:
        strbuf_release(&author_ident);