From: Junio C Hamano Date: Wed, 8 Apr 2026 17:20:51 +0000 (-0700) Subject: Merge branch 'jt/index-fd-wo-repo-regression-fix-maint' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe4ab2e698d544a082862a14120efc6b49047382;p=thirdparty%2Fgit.git Merge branch 'jt/index-fd-wo-repo-regression-fix-maint' During Git 2.52 timeframe, we broke streaming computation of object hash outside a repository, which has been corrected. * jt/index-fd-wo-repo-regression-fix-maint: object-file: avoid ODB transaction when not writing objects --- fe4ab2e698d544a082862a14120efc6b49047382 diff --cc object-file.c index c353176206,5d72e65bde..2acc9522df --- a/object-file.c +++ b/object-file.c @@@ -1663,18 -1648,19 +1691,23 @@@ int index_fd(struct index_state *istate ret = index_core(istate, oid, fd, xsize_t(st->st_size), type, path, flags); } else { - struct object_database *odb = the_repository->objects; - struct odb_transaction_files *files_transaction; - struct odb_transaction *transaction; - - transaction = odb_transaction_begin(odb); - files_transaction = container_of(odb->transaction, - struct odb_transaction_files, - base); - ret = index_blob_packfile_transaction(files_transaction, oid, fd, - xsize_t(st->st_size), - path, flags); - odb_transaction_commit(transaction); + if (flags & INDEX_WRITE_OBJECT) { ++ struct object_database *odb = the_repository->objects; ++ struct odb_transaction_files *files_transaction; + struct odb_transaction *transaction; + - transaction = odb_transaction_begin(the_repository->objects); - ret = index_blob_packfile_transaction(the_repository->objects->transaction, - oid, fd, ++ transaction = odb_transaction_begin(odb); ++ files_transaction = container_of(odb->transaction, ++ struct odb_transaction_files, ++ base); ++ ret = index_blob_packfile_transaction(files_transaction, oid, fd, + xsize_t(st->st_size), + path, flags); + odb_transaction_commit(transaction); + } else { + ret = hash_blob_stream(the_repository->hash_algo, oid, + fd, xsize_t(st->st_size)); + } } close(fd);