Skip to content

Commit 468d356

Browse files
committed
Merge tag 'v2.24.0-rc1' of github.com:git/git into master
Git 2.24-rc1 * tag 'v2.24.0-rc1' of github.com:git/git: Git 2.24-rc1 repo-settings: read an int for index.version ci: fix GCC install in the Travis CI GCC OSX job Eleventh batch ci(osx): use new location of the `perforce` cask t7419: change test_must_fail to ! for grep t4014: make output-directory tests self-contained ci(visual-studio): actually run the tests in parallel ci(visual-studio): use strict compile flags, and optimization userdiff: fix some corner cases in dts regex test-progress: fix test failures on big-endian systems completion: clarify installation instruction for zsh grep: avoid leak of chartables in PCRE2 grep: make PCRE2 aware of custom allocator grep: make PCRE1 aware of custom allocator remote-curl: pass on atomic capability to remote side diff-highlight: fix a whitespace nit fsmonitor: don't fill bitmap with entries to be removed
2 parents 370784e + 566a143 commit 468d356

27 files changed

+247
-29
lines changed

Documentation/RelNotes/2.24.0.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ UI, Workflows & Features
7575
submodules, but this did not apply to "git fetch --multiple" that
7676
fetches from multiple remote repositories. It now does.
7777

78+
* The installation instruction for zsh completion script (in
79+
contrib/) has been a bit improved.
80+
7881

7982
Performance, Internal Implementation, Development Support etc.
8083

@@ -337,6 +340,10 @@ Fixes since v2.23
337340
corrected.
338341
(merge 556895d0c8 jj/stash-reset-only-toplevel later to maint).
339342

343+
* The atomic push over smart HTTP transport did not work, which has
344+
been corrected.
345+
(merge 6f1194246a bc/smart-http-atomic-push later to maint).
346+
340347
* Other code cleanup, docfix, build fix, etc.
341348
(merge d1387d3895 en/fast-import-merge-doc later to maint).
342349
(merge 1c24a54ea4 bm/repository-layout-typofix later to maint).
@@ -385,3 +392,6 @@ Fixes since v2.23
385392
(merge 5cc6a4be11 rs/http-push-simplify later to maint).
386393
(merge a81e42d235 rs/column-use-utf8-strnwidth later to maint).
387394
(merge 062a309d36 rs/remote-curl-use-argv-array later to maint).
395+
(merge 3b3c79f6c9 nr/diff-highlight-indent-fix later to maint).
396+
(merge 3444ec2eb2 wb/fsmonitor-bitmap-fix later to maint).
397+
(merge 10da030ab7 cb/pcre2-chartables-leakfix later to maint).

Documentation/gitremote-helpers.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,11 @@ set by Git if the remote helper has the 'option' capability.
509509
Indicate that only the objects wanted need to be fetched, not
510510
their dependents.
511511

512+
'option atomic' {'true'|'false'}::
513+
When pushing, request the remote server to update refs in a single atomic
514+
transaction. If successful, all refs will be updated, or none will. If the
515+
remote side does not support this capability, the push will fail.
516+
512517
SEE ALSO
513518
--------
514519
linkgit:git-remote[1]

GIT-VERSION-GEN

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4-
DEF_VER=v2.24.0-rc0
4+
DEF_VER=v2.24.0-rc1
55

66
LF='
77
'

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ jobs:
157157
displayName: 'Download git-sdk-64-minimal'
158158
- powershell: |
159159
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
160-
make vcxproj
160+
make NDEBUG=1 DEVELOPER=1 vcxproj
161161
"@
162162
if (!$?) { exit(1) }
163163
displayName: Generate Visual Studio Solution
@@ -255,7 +255,7 @@ jobs:
255255
256256
cd t &&
257257
PATH=\"`$PWD/helper:`$PATH\" &&
258-
test-tool.exe run-command testsuite -V -x --write-junit-xml \
258+
test-tool.exe run-command testsuite --jobs=10 -V -x --write-junit-xml \
259259
`$(test-tool.exe path-utils slice-tests \
260260
`$SYSTEM_JOBPOSITIONINPHASE `$SYSTEM_TOTALJOBSINPHASE t[0-9]*.sh)
261261
"@

builtin/grep.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,5 +1147,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
11471147
run_pager(&opt, prefix);
11481148
clear_pathspec(&pathspec);
11491149
free_grep_patterns(&opt);
1150+
grep_destroy();
11501151
return !hit;
11511152
}

ci/install-dependencies.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@ osx-clang|osx-gcc)
4040
test -z "$BREW_INSTALL_PACKAGES" ||
4141
brew install $BREW_INSTALL_PACKAGES
4242
brew link --force gettext
43+
brew cask install perforce || {
44+
# Update the definitions and try again
45+
git -C "$(brew --repository)"/Library/Taps/homebrew/homebrew-cask pull &&
46+
brew cask install perforce
47+
} ||
4348
brew install caskroom/cask/perforce
4449
case "$jobname" in
4550
osx-gcc)
51+
brew link gcc ||
4652
brew link gcc@8
4753
;;
4854
esac

contrib/completion/git-completion.zsh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
#
1212
# zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh
1313
#
14-
# The recommended way to install this script is to copy to '~/.zsh/_git', and
15-
# then add the following to your ~/.zshrc file:
14+
# The recommended way to install this script is to make a copy of it in
15+
# ~/.zsh/ directory as ~/.zsh/git-completion.zsh and then add the following
16+
# to your ~/.zshrc file:
1617
#
1718
# fpath=(~/.zsh $fpath)
1819

contrib/diff-highlight/DiffHighlight.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ sub handle_line {
7272
(?:$COLOR?\|$COLOR?[ ])* # zero or more trailing "|"
7373
[ ]* # trailing whitespace for merges
7474
/x) {
75-
my $graph_prefix = $&;
75+
my $graph_prefix = $&;
7676

7777
# We must flush before setting graph indent, since the
7878
# new commit may be indented differently from what we

fsmonitor.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ struct trace_key trace_fsmonitor = TRACE_KEY_INIT(FSMONITOR);
1414
static void fsmonitor_ewah_callback(size_t pos, void *is)
1515
{
1616
struct index_state *istate = (struct index_state *)is;
17-
struct cache_entry *ce = istate->cache[pos];
17+
struct cache_entry *ce;
1818

19+
if (pos >= istate->cache_nr)
20+
BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" >= %u)",
21+
(uintmax_t)pos, istate->cache_nr);
22+
23+
ce = istate->cache[pos];
1924
ce->ce_flags &= ~CE_FSMONITOR_VALID;
2025
}
2126

@@ -50,17 +55,24 @@ int read_fsmonitor_extension(struct index_state *istate, const void *data,
5055
}
5156
istate->fsmonitor_dirty = fsmonitor_dirty;
5257

58+
if (istate->fsmonitor_dirty->bit_size > istate->cache_nr)
59+
BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
60+
(uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
61+
5362
trace_printf_key(&trace_fsmonitor, "read fsmonitor extension successful");
5463
return 0;
5564
}
5665

5766
void fill_fsmonitor_bitmap(struct index_state *istate)
5867
{
59-
unsigned int i;
68+
unsigned int i, skipped = 0;
6069
istate->fsmonitor_dirty = ewah_new();
61-
for (i = 0; i < istate->cache_nr; i++)
62-
if (!(istate->cache[i]->ce_flags & CE_FSMONITOR_VALID))
63-
ewah_set(istate->fsmonitor_dirty, i);
70+
for (i = 0; i < istate->cache_nr; i++) {
71+
if (istate->cache[i]->ce_flags & CE_REMOVE)
72+
skipped++;
73+
else if (!(istate->cache[i]->ce_flags & CE_FSMONITOR_VALID))
74+
ewah_set(istate->fsmonitor_dirty, i - skipped);
75+
}
6476
}
6577

6678
void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate)
@@ -71,6 +83,10 @@ void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate)
7183
uint32_t ewah_size = 0;
7284
int fixup = 0;
7385

86+
if (istate->fsmonitor_dirty->bit_size > istate->cache_nr)
87+
BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
88+
(uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
89+
7490
put_be32(&hdr_version, INDEX_EXTENSION_VERSION);
7591
strbuf_add(sb, &hdr_version, sizeof(uint32_t));
7692

@@ -236,6 +252,9 @@ void tweak_fsmonitor(struct index_state *istate)
236252
}
237253

238254
/* Mark all previously saved entries as dirty */
255+
if (istate->fsmonitor_dirty->bit_size > istate->cache_nr)
256+
BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
257+
(uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
239258
ewah_each_bit(istate->fsmonitor_dirty, fsmonitor_ewah_callback, istate);
240259

241260
/* Now mark the untracked cache for fsmonitor usage */

grep.c

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ static int grep_source_is_binary(struct grep_source *gs,
1616

1717
static struct grep_opt grep_defaults;
1818

19+
#ifdef USE_LIBPCRE2
20+
static pcre2_general_context *pcre2_global_context;
21+
22+
static void *pcre2_malloc(PCRE2_SIZE size, MAYBE_UNUSED void *memory_data)
23+
{
24+
return malloc(size);
25+
}
26+
27+
static void pcre2_free(void *pointer, MAYBE_UNUSED void *memory_data)
28+
{
29+
return free(pointer);
30+
}
31+
#endif
32+
1933
static const char *color_grep_slots[] = {
2034
[GREP_COLOR_CONTEXT] = "context",
2135
[GREP_COLOR_FILENAME] = "filename",
@@ -150,12 +164,28 @@ int grep_config(const char *var, const char *value, void *cb)
150164
* Initialize one instance of grep_opt and copy the
151165
* default values from the template we read the configuration
152166
* information in an earlier call to git_config(grep_config).
167+
*
168+
* If using PCRE, make sure that the library is configured
169+
* to use the same allocator as Git (e.g. nedmalloc on Windows).
170+
*
171+
* Any allocated memory needs to be released in grep_destroy().
153172
*/
154173
void grep_init(struct grep_opt *opt, struct repository *repo, const char *prefix)
155174
{
156175
struct grep_opt *def = &grep_defaults;
157176
int i;
158177

178+
#if defined(USE_LIBPCRE2)
179+
if (!pcre2_global_context)
180+
pcre2_global_context = pcre2_general_context_create(
181+
pcre2_malloc, pcre2_free, NULL);
182+
#endif
183+
184+
#ifdef USE_LIBPCRE1
185+
pcre_malloc = malloc;
186+
pcre_free = free;
187+
#endif
188+
159189
memset(opt, 0, sizeof(*opt));
160190
opt->repo = repo;
161191
opt->prefix = prefix;
@@ -178,6 +208,13 @@ void grep_init(struct grep_opt *opt, struct repository *repo, const char *prefix
178208
color_set(opt->colors[i], def->colors[i]);
179209
}
180210

211+
void grep_destroy(void)
212+
{
213+
#ifdef USE_LIBPCRE2
214+
pcre2_general_context_free(pcre2_global_context);
215+
#endif
216+
}
217+
181218
static void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, struct grep_opt *opt)
182219
{
183220
/*
@@ -461,7 +498,6 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
461498
PCRE2_UCHAR errbuf[256];
462499
PCRE2_SIZE erroffset;
463500
int options = PCRE2_MULTILINE;
464-
const uint8_t *character_tables = NULL;
465501
int jitret;
466502
int patinforet;
467503
size_t jitsizearg;
@@ -470,11 +506,15 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
470506

471507
p->pcre2_compile_context = NULL;
472508

509+
/* pcre2_global_context is initialized in append_grep_pattern */
473510
if (opt->ignore_case) {
474511
if (!opt->ignore_locale && has_non_ascii(p->pattern)) {
475-
character_tables = pcre2_maketables(NULL);
512+
if (!pcre2_global_context)
513+
BUG("pcre2_global_context uninitialized");
514+
p->pcre2_tables = pcre2_maketables(pcre2_global_context);
476515
p->pcre2_compile_context = pcre2_compile_context_create(NULL);
477-
pcre2_set_character_tables(p->pcre2_compile_context, character_tables);
516+
pcre2_set_character_tables(p->pcre2_compile_context,
517+
p->pcre2_tables);
478518
}
479519
options |= PCRE2_CASELESS;
480520
}
@@ -571,6 +611,7 @@ static void free_pcre2_pattern(struct grep_pat *p)
571611
pcre2_compile_context_free(p->pcre2_compile_context);
572612
pcre2_code_free(p->pcre2_pattern);
573613
pcre2_match_data_free(p->pcre2_match_data);
614+
free((void *)p->pcre2_tables);
574615
}
575616
#else /* !USE_LIBPCRE2 */
576617
static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt)

0 commit comments

Comments
 (0)