diff --git a/.b4-cover-template b/.b4-cover-template index ab864933b5c846..8168d8a10b3a9e 100644 --- a/.b4-cover-template +++ b/.b4-cover-template @@ -8,4 +8,5 @@ ${diffstat} ${range_diff} --- base-commit: ${base_commit} +change-id: ${change_id} ${prerequisites} diff --git a/Documentation/RelNotes/2.56.0.adoc b/Documentation/RelNotes/2.56.0.adoc index 5c6bfe1fd86a5b..9e3bf38f5e5a74 100644 --- a/Documentation/RelNotes/2.56.0.adoc +++ b/Documentation/RelNotes/2.56.0.adoc @@ -163,6 +163,10 @@ Performance, Internal Implementation, Development Support etc. dereferences and invalid file descriptor accesses flagged by Coverity. + * The in-tree 'b4' cover letter template has been updated to include the + 'change-id' trailer, ensuring that sent tags generated by 'b4' contain + the required tracking information for subsequent runs. + Fixes since v2.55 ----------------- @@ -298,3 +302,7 @@ Fixes since v2.55 split commit-graph chain, causing topological levels for commits in base layers to be recomputed during incremental writes. This has been corrected. + + * The stream-based object signature verification path has been + corrected to avoid double-closing the stream on read errors. + (merge cfd52a74a0 ps/odb-stream-double-close-fix later to maint). diff --git a/object-file.c b/object-file.c index 93602f8c50a858..2d84f0871363e6 100644 --- a/object-file.c +++ b/object-file.c @@ -129,11 +129,8 @@ int stream_object_signature(struct repository *r, for (;;) { char buf[1024 * 16]; ssize_t readlen = odb_read_stream_read(st, buf, sizeof(buf)); - - if (readlen < 0) { - odb_read_stream_close(st); + if (readlen < 0) return -1; - } if (!readlen) break; git_hash_update(&c, buf, readlen); diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 47d460a69959ea..77cd96de78eced 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -538,6 +538,23 @@ test_expect_success 'rev-list --verify-objects with bad sha1' ' test_grep -q "error: hash mismatch $(dirname $new)$(test_oid ff_2)" out ' +test_expect_success 'rev-list --verify-objects with truncated loose blob' ' + git init truncated-blob && + ( + cd truncated-blob && + blob=$(test-tool genrandom one 5k | git hash-object -t blob -w --stdin) && + obj=.git/objects/$(test_oid_to_path $blob) && + + # Truncate the loose blob such that its header can still be + # parsed, but reading the object data fails mid-stream. + test_copy_bytes 64 <"$obj" >obj.tmp && + mv obj.tmp "$obj" && + + test_must_fail git rev-list --verify-objects "$blob" 2>err && + test_grep "hash mismatch" err + ) +' + # An actual bit corruption is more likely than swapped commits, but # this provides an easy way to have commits which don't match their purported # hashes, but which aren't so broken we can't read them at all.