From: Elia Pinto <gitter.spiros@gmail.com>
To: git@vger.kernel.org
Cc: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Elia Pinto" <gitter.spiros@gmail.com>,
"Patrick Steinhardt" <ps@pks.im>,
"Neeraj Singh" <neerajsi@microsoft.com>,
"brian m. carlson" <sandals@crustytoothpaste.net>,
"Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
"Michael Montalbo" <mmontalbo@gmail.com>,
"Torsten Bögershausen" <tboegi@web.de>,
"Alexander Meshcheryakov" <alexander.s.m@gmail.com>,
"Elijah Newren" <newren@gmail.com>,
"Phillip Wood" <phillip.wood@dunelm.org.uk>
Subject: [PATCH v2 0/4] widen a few sizes and counts that are 32 bits everywhere
Date: Tue, 17 Nov 2026 11:37:52 +0100 [thread overview]
Message-ID: <cover.1794909894.git.gitter.spiros@gmail.com> (raw)
In-Reply-To: <cover.1793546752.git.gitter.spiros@gmail.com>
This is v2 of the series that widens a few sizes and line counts held
in 32-bit types even on 64-bit platforms.
Changes since v1:
- 2/4 is rewritten after Phillip's review [1]. v1 only made the size
parameter of count_lines() a size_t; as Phillip pointed out, that
removes the bound that kept the "int" line counter from overflowing.
The patch now uses size_t for the sizes and line counts along the
whole complete-rewrite path of "git diff -B". This includes
emit_rewrite_lines(), which with v1 still truncated the size, so
that "git diff -B -p" printed a correct hunk header above an empty
body. It also adds two EXPENSIVE tests to t4022.
- 4/4 is new. It was found by looking at the totals of "--stat" after
2/4: they are added up in "int" and overflow past INT_MAX lines,
which 2/4 makes possible with a single file. The same code also
showed that scale_linear() overflows for a small file when the graph
is wide enough; a cheap test in t4052 covers that case.
- 1/4 and 3/4 are unchanged. As in v1, they need objects of 4GiB or
more and were verified by simulating the truncation at 16 bits.
2/4 and 4/4 come with tests instead.
2/4 now also changes count_trailing_blank(), whose size is also
changed by patch 6/6 of my series "loose object size checks and a few
size truncations" [2]. That patch will be dropped from v2 of that
series, so the two series will not conflict.
The series is based on master at 50fe5cc63f (The 12th batch).
[1] https://lore.kernel.org/git/0cb42395-3e62-42e0-bfd3-a4265ed7cc33@gmail.com/
[2] https://lore.kernel.org/git/cover.1793355390.git.gitter.spiros@gmail.com/
Elia Pinto (4):
csum-file: use size_t for the count passed to hashwrite()
diff: use size_t for sizes and line counts of complete rewrites
diffcore-delta: use size_t for the size of the buffer to hash
diff: use uintmax_t for diffstat totals and graph scaling
csum-file.c | 2 +-
csum-file.h | 2 +-
diff.c | 90 +++++++++++++++++++++++------------------
diff.h | 2 +-
diffcore-delta.c | 2 +-
t/t4022-diff-rewrite.sh | 51 ++++++++++++++++++++++-
t/t4052-stat-output.sh | 10 +++++
7 files changed, 114 insertions(+), 45 deletions(-)
Range-diff against v1:
1: 07baad46b1 = 1: 07baad46b1 csum-file: use size_t for the count passed to hashwrite()
2: 2011b90d80 < -: ---------- diff: use size_t for the size passed to count_lines()
-: ---------- > 2: e63ed0c49c diff: use size_t for sizes and line counts of complete rewrites
3: 0c5442280c = 3: 3427c3d2c8 diffcore-delta: use size_t for the size of the buffer to hash
-: ---------- > 4: 692c503e97 diff: use uintmax_t for diffstat totals and graph scaling
--
2.53.0
next prev parent reply other threads:[~2026-11-17 10:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 15:36 [PATCH 0/3] use size_t for a few sizes that are 32 bits everywhere Elia Pinto
2026-11-01 15:36 ` [PATCH 1/3] csum-file: use size_t for the count passed to hashwrite() Elia Pinto
2026-11-01 15:36 ` [PATCH 2/3] diff: use size_t for the size passed to count_lines() Elia Pinto
2026-11-04 13:58 ` Phillip Wood
2026-11-04 15:45 ` Phillip Wood
2026-11-01 15:36 ` [PATCH 3/3] diffcore-delta: use size_t for the size of the buffer to hash Elia Pinto
2026-11-17 10:37 ` Elia Pinto [this message]
2026-11-17 10:37 ` [PATCH v2 1/4] csum-file: use size_t for the count passed to hashwrite() Elia Pinto
2026-11-17 17:52 ` Junio C Hamano
2026-11-17 23:50 ` brian m. carlson
2026-11-17 10:37 ` [PATCH v2 2/4] diff: use size_t for sizes and line counts of complete rewrites Elia Pinto
2026-11-17 10:37 ` [PATCH v2 3/4] diffcore-delta: use size_t for the size of the buffer to hash Elia Pinto
2026-11-17 23:21 ` Junio C Hamano
2026-11-17 10:37 ` [PATCH v2 4/4] diff: use uintmax_t for diffstat totals and graph scaling Elia Pinto
2026-11-17 16:36 ` Torsten Bögershausen
2026-11-17 23:13 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1794909894.git.gitter.spiros@gmail.com \
--to=gitter.spiros@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=alexander.s.m@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mmontalbo@gmail.com \
--cc=neerajsi@microsoft.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
--cc=sandals@crustytoothpaste.net \
--cc=tboegi@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.