]> git.ipfire.org Git - thirdparty/git.git/blobdiff - commit.c
Sync with 2.34.8
[thirdparty/git.git] / commit.c
index 42f8117b51e2b680d1e323741fe503fc4299682e..a348f085b2b853d2f14d6848f3ff57edf85601b8 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -25,6 +25,7 @@
 static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
 
 int save_commit_buffer = 1;
+int no_graft_file_deprecated_advice;
 
 const char *commit_type = "commit";
 
@@ -190,7 +191,8 @@ static int read_graft_file(struct repository *r, const char *graft_file)
        struct strbuf buf = STRBUF_INIT;
        if (!fp)
                return -1;
-       if (advice_graft_file_deprecated)
+       if (!no_graft_file_deprecated_advice &&
+           advice_enabled(ADVICE_GRAFT_FILE_DEPRECATED))
                advise(_("Support for <GIT_DIR>/info/grafts is deprecated\n"
                         "and will be removed in a future Git version.\n"
                         "\n"
@@ -535,6 +537,20 @@ int find_commit_subject(const char *commit_buffer, const char **subject)
        return eol - p;
 }
 
+size_t commit_subject_length(const char *body)
+{
+       const char *p = body;
+       while (*p) {
+               const char *next = skip_blank_lines(p);
+               if (next != p)
+                       break;
+               p = strchrnul(p, '\n');
+               if (*p)
+                       p++;
+       }
+       return p - body;
+}
+
 struct commit_list *commit_list_insert(struct commit *item, struct commit_list **list_p)
 {
        struct commit_list *new_list = xmalloc(sizeof(struct commit_list));
@@ -1164,7 +1180,7 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
        /*
         * We could verify this signature and either omit the tag when
         * it does not validate, but the integrator may not have the
-        * public key of the signer of the tag he is merging, while a
+        * public key of the signer of the tag being merged, while a
         * later auditor may have it while auditing, so let's not run
         * verify-signed-buffer here for now...
         *
@@ -1196,8 +1212,10 @@ int check_commit_signature(const struct commit *commit, struct signature_check *
 
        if (parse_signed_commit(commit, &payload, &signature, the_hash_algo) <= 0)
                goto out;
-       ret = check_signature(payload.buf, payload.len, signature.buf,
-               signature.len, sigc);
+
+       sigc->payload_type = SIGNATURE_PAYLOAD_COMMIT;
+       sigc->payload = strbuf_detach(&payload, &sigc->payload_len);
+       ret = check_signature(sigc, signature.buf, signature.len);
 
  out:
        strbuf_release(&payload);