Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for v2.33.1 #2707

Open
wants to merge 46 commits into
base: origin-v2.33.1-1733723654
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bc97b0b
commit patch 27631507
Dec 9, 2024
34f355a
commit patch 27884989
Dec 9, 2024
206feab
commit patch 23508418
Dec 9, 2024
b8153b1
commit patch 25960635
Dec 9, 2024
63e1dc0
commit patch 21078727
Dec 9, 2024
c94ccc3
commit patch 22030255
Dec 9, 2024
8e18b77
commit patch 25326066
Dec 9, 2024
c2dc1e2
commit patch 27779548
Dec 9, 2024
77aebbf
commit patch 17868760
Dec 9, 2024
4e0bf08
commit patch 27822013
Dec 9, 2024
f58a6c1
commit patch 20148812
Dec 9, 2024
675555d
commit patch 18650951
Dec 9, 2024
d6f74c7
commit patch 21713427
Dec 9, 2024
f1a5e33
commit patch 24374707
Dec 9, 2024
232da33
commit patch 22642993
Dec 9, 2024
2284d00
commit patch 20296967
Dec 9, 2024
ccd62ad
commit patch 25770250
Dec 9, 2024
b3d15c8
commit patch 26383458
Dec 9, 2024
5856de4
commit patch 17762939
Dec 9, 2024
9fdb161
commit patch 20339254
Dec 9, 2024
889e8b6
commit patch 18143963
Dec 9, 2024
b69b231
commit patch 20000927
Dec 9, 2024
eb2e8c8
commit patch 21205922
Dec 9, 2024
b9c2865
commit patch 18523800
Dec 9, 2024
2ac063b
commit patch 27969490
Dec 9, 2024
562f9a9
commit patch 19009335
Dec 9, 2024
065197f
commit patch 23212544
Dec 9, 2024
012381f
commit patch 18924865
Dec 9, 2024
e1cf270
commit patch 17762940
Dec 9, 2024
6547b27
commit patch 26488952
Dec 9, 2024
f692260
commit patch 20127499
Dec 9, 2024
64b40df
commit patch 18840572
Dec 9, 2024
f8a348d
commit patch 27631506
Dec 9, 2024
c5d8b39
commit patch 21671320
Dec 9, 2024
ba88bd9
commit patch 19473983
Dec 9, 2024
bc77a0a
commit patch 19853051
Dec 9, 2024
3d52b04
commit patch 18545330
Dec 9, 2024
b8e0575
commit patch 25283639
Dec 9, 2024
1dd902e
commit patch 20106254
Dec 9, 2024
0744bfc
commit patch 18079911
Dec 9, 2024
ca0861e
commit patch 23423717
Dec 9, 2024
fda68fa
commit patch 26278139
Dec 9, 2024
e235f77
commit patch 22051366
Dec 9, 2024
ce0d26e
commit patch 19853049
Dec 9, 2024
b998ce7
commit patch 19662982
Dec 9, 2024
603521c
commit patch 18798515
Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
commit patch 19473983
  • Loading branch information
turly221 committed Dec 9, 2024
commit ba88bd966fcd80863d2f989e94a294b3838fae3a
7 changes: 7 additions & 0 deletions t/t4205-log-pretty-formats.sh
Original file line number Diff line number Diff line change
@@ -1040,6 +1040,13 @@ test_expect_success 'log --pretty with padding and preceding control chars' '
test_cmp expect actual
'

test_expect_success 'log --pretty truncation with control chars' '
test_commit "$(printf "\20\20\20\20xxxx")" file contents commit-with-control-chars &&
printf "\20\20\20\20x.." >expect &&
git log -1 --pretty="format:%<(3,trunc)%s" commit-with-control-chars >actual &&
test_cmp expect actual
'

test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
# We only assert that this command does not crash. This needs to be
# executed with the address sanitizer to demonstrate failure.
8 changes: 8 additions & 0 deletions t/t4205-log-pretty-formats.sh.orig
Original file line number Diff line number Diff line change
@@ -1057,4 +1057,12 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit mes
test_cmp expect actual
'

test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message does not cause allocation failure' '
test_must_fail git log -1 --format="%<(1)%B" $huge_commit 2>error &&
cat >expect <<-EOF &&
fatal: number too large to represent as int on this platform: 2147483649
EOF
test_cmp expect error
'

test_done
19 changes: 14 additions & 5 deletions utf8.c
Original file line number Diff line number Diff line change
@@ -377,6 +377,7 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
dst = sb_dst.buf;

while (src < end) {
int glyph_width;
char *old;
size_t n;

@@ -390,21 +391,29 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
break;

old = src;
n = utf8_width((const char**)&src, NULL);
if (!src) /* broken utf-8, do nothing */
glyph_width = utf8_width((const char**)&src, NULL);
if (!src) /* broken utf-8, do nothing */
goto out;
if (n && w >= pos && w < pos + width) {

/*
* In case we see a control character we copy it into the
* buffer, but don't add it to the width.
*/
if (glyph_width < 0)
glyph_width = 0;

if (glyph_width && w >= pos && w < pos + width) {
if (subst) {
memcpy(dst, subst, subst_len);
dst += subst_len;
subst = NULL;
}
w += n;
w += glyph_width;
continue;
}
memcpy(dst, old, src - old);
dst += src - old;
w += n;
w += glyph_width;
}
strbuf_setlen(&sb_dst, dst - sb_dst.buf);
strbuf_swap(sb_src, &sb_dst);