1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-07 23:36:32 +02:00
Commit Graph

56443 Commits

Author SHA1 Message Date
Carlo Marcelo Arenas Belón 513f2b0bbd grep: make PCRE2 aware of custom allocator
94da9193a6 (grep: add support for PCRE v2, 2017-06-01) didn't include
a way to override the system allocator, and so it is incompatible with
custom allocators (e.g. nedmalloc). This problem became obvious when we
tried to plug a memory leak by `free()`ing a data structure allocated by
PCRE2, triggering a segfault in Windows (where we use nedmalloc by
default).

PCRE2 requires the use of a general context to override the allocator
and therefore, there is a lot more code needed than in PCRE1, including
a couple of wrapper functions.

Extend the grep API with a "destructor" that could be called to cleanup
any objects that were created and used globally.

Update `builtin/grep.c` to use that new API, but any other future users
should make sure to have matching `grep_init()`/`grep_destroy()` calls
if they are using the pattern matching functionality.

Move some of the logic that was before done per thread (in the workers)
into an earlier phase to avoid degrading performance, but as the use of
PCRE2 with custom allocators is better understood it is expected more of
its functions will be instructed to use the custom allocator as well as
was done in the original code[1] this work was based on.

[1] https://public-inbox.org/git/3397e6797f872aedd18c6d795f4976e1c579514b.1565005867.git.gitgitgadget@gmail.com/

Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-10-18 10:33:18 +09:00
Carlo Marcelo Arenas Belón 57d4660468 grep: make PCRE1 aware of custom allocator
63e7e9d8b6 ("git-grep: Learn PCRE", 2011-05-09) didn't include a way
to override the system alocator, and so it is incompatible with
USE_NED_ALLOCATOR as reported by Dscho[1] (in similar code from PCRE2)

Note that nedmalloc, as well as other custom allocators like jemalloc
and mi-malloc, can be configured at runtime (via `LD_PRELOAD`),
therefore we cannot know at compile time whether a custom allocator is
used or not.

Make the minimum change possible to ensure this combination is supported
by extending `grep_init()` to set the PCRE1 specific functions to Git's
idea of `malloc()` and `free()` and therefore making sure all
allocations are done inside PCRE1 with the same allocator than the rest
of Git.

This change has negligible performance impact: PCRE needs to allocate
memory once per program run for the character table and for each pattern
compilation. These are both rare events compared to matching patterns
against lines. Actual measurements[2] show that the impact is lost in
the noise.

[1] https://public-inbox.org/git/pull.306.git.gitgitgadget@gmail.com
[2] https://public-inbox.org/git/7f42007f-911b-c570-17f6-1c6af0429586@web.de

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-10-18 10:33:16 +09:00
Junio C Hamano 51cf315870 Merge branch 'jk/repack-silence-auto-bitmap-warning'
Squelch unneeded and misleading warnings from "repack" when the
command attempts to generate pack bitmaps without explicitly asked
for by the user.

* jk/repack-silence-auto-bitmap-warning:
  repack: simplify handling of auto-bitmaps and .keep files
  repack: silence warnings when auto-enabled bitmaps cannot be built
  t7700: clean up .keep file in bitmap-writing test
2019-08-01 09:10:50 -07:00
Junio C Hamano 49541dbb36 Merge branch 'jk/sort-iter-test-output'
* jk/sort-iter-test-output:
  t: sort output of hashmap iteration
2019-08-01 09:10:50 -07:00
Junio C Hamano cc2a7403fe Merge branch 'jc/dir-iterator-test-fix'
* jc/dir-iterator-test-fix:
  test-dir-iterator: do not assume errno values
2019-08-01 09:10:50 -07:00
Junio C Hamano a7b27d9e6d Merge branch 'bc/hash-independent-tests-part-4'
Update to the tests to help SHA-256 transition continues.

* bc/hash-independent-tests-part-4:
  t2203: avoid hard-coded object ID values
  t1710: make hash independent
  t1007: remove SHA1 prerequisites
  t0090: make test pass with SHA-256
  t0027: make hash size independent
  t6030: make test work with SHA-256
  t5000: make hash independent
  t1450: make hash size independent
  t1410: make hash size independent
  t: add helper to convert object IDs to paths
2019-08-01 09:10:49 -07:00
Martin Ågren a45f531471 RelNotes/2.23.0: fix a few typos and other minor issues
Fix the spelling of the new "--no-show-forced-updates" option that "git
fetch/pull" learned. Similarly, spell "--function-context" correctly and
fix a few typos, grammos and minor mistakes.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-01 09:01:35 -07:00
Junio C Hamano a9a63afe46 Sync with maint
* maint:
  RelNotes/2.21.1: typofix
2019-08-01 09:00:46 -07:00
Martin Ågren 4d8ec15c66 RelNotes/2.21.1: typofix
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-01 09:00:13 -07:00
Junio C Hamano f36d08d72e A few more last-minute fixes
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-31 14:45:42 -07:00
Junio C Hamano d163b6ae6b Merge branch 'cb/xdiff-no-system-includes-in-dot-c'
Compilation fix.

* cb/xdiff-no-system-includes-in-dot-c:
  xdiff: remove duplicate headers from xpatience.c
  xdiff: remove duplicate headers from xhistogram.c
  xdiff: drop system includes in xutils.c
2019-07-31 14:38:56 -07:00
Junio C Hamano 0bdce88004 Merge branch 'jk/no-system-includes-in-dot-c'
Compilation fix.

* jk/no-system-includes-in-dot-c:
  wt-status.h: drop stdio.h include
  verify-tag: drop signal.h include
2019-07-31 14:38:56 -07:00
Jeff King 7ff024e7b3 repack: simplify handling of auto-bitmaps and .keep files
Commit 7328482253 (repack: disable bitmaps-by-default if .keep files
exist, 2019-06-29) taught repack to prefer disabling bitmaps to
duplicating objects (unless bitmaps were asked for explicitly).

But there's an easier way to do this: if we keep passing the
--honor-pack-keep flag to pack-objects when auto-enabling bitmaps, then
pack-objects already makes the same decision (it will disable bitmaps
rather than duplicate). Better still, pack-objects can actually decide
to do so based not just on the presence of a .keep file, but on whether
that .keep file actually impacts the new pack we're making (so if we're
racing with a push or fetch, for example, their temporary .keep file
will not block us from generating bitmaps if they haven't yet updated
their refs).

And because repack uses the --write-bitmap-index-quiet flag, we don't
have to worry about pack-objects generating confusing warnings when it
does see a .keep file. We can confirm this by tweaking the .keep test to
check repack's stderr.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-31 13:26:25 -07:00
Jeff King 25575015ca repack: silence warnings when auto-enabled bitmaps cannot be built
Depending on various config options, a full repack may not be able to
build a reachability bitmap index (e.g., if pack.packSizeLimit forces us
to write multiple packs). In these cases pack-objects may write a
warning to stderr.

Since 36eba0323d (repack: enable bitmaps by default on bare repos,
2019-03-14), we may generate these warnings even when the user did not
explicitly ask for bitmaps. This has two downsides:

  - it can be confusing, if they don't know what bitmaps are

  - a daemonized auto-gc will write this to its log file, and the
    presence of the warning may suppress further auto-gc (until
    gc.logExpiry has elapsed)

Let's have repack communicate to pack-objects that the choice to turn on
bitmaps was not made explicitly by the user, which in turn allows
pack-objects to suppress these warnings.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-31 13:15:51 -07:00
Jeff King cc2649ae2d t7700: clean up .keep file in bitmap-writing test
After our test snippet finishes, the .keep file is left in place, making
it hard to do further tests of the auto-bitmap-writing code (since it
suppresses the feature completely). Let's clean it up.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-31 13:14:04 -07:00
Jeff King e1e7a77141 t: sort output of hashmap iteration
The iteration order of a hashmap is undefined, and may depend on things
like the exact set of items added, or the table has been grown or
shrunk. In the case of an oidmap, it even depends on endianness, because
we take the oid hash by casting sha1 bytes directly into an unsigned
int.

Let's sort the test-tool output from any hash iterators. In the case of
t0011, this is just future-proofing. But for t0016, it actually fixes a
reported failure on the big-endian s390 and nonstop ports.

I didn't bother to teach the helper functions to optionally sort output.
They are short enough that it's simpler to just repeat them inline for
the iteration tests than it is to add a --sort option.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-31 10:00:34 -07:00
Junio C Hamano 9042140097 test-dir-iterator: do not assume errno values
A few tests printed 'errno' as an integer and compared with
hardcoded integers; this is obviously not portable.

A two things to note are:

 - the string obtained by strerror() is not portable, and cannot be
   used for the purpose of these tests.

 - there unfortunately isn't a portable way to map error numbers to
   error names.

As we only care about a few selected errors, just map the error
number to the name before emitting for comparison.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-30 10:45:48 -07:00
Junio C Hamano 026dd738a6 Git 2.23-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-29 12:51:24 -07:00
Junio C Hamano 8b79343fc0 Sync with maint
* maint:
  Merge fixes made on the 'master' front
2019-07-29 12:40:42 -07:00
Junio C Hamano 38dac334d7 Merge branch 'js/rebase-cleanup'
A few leftover cleanup to "git rebase" in C.

* js/rebase-cleanup:
  git: mark cmd_rebase as requiring a worktree
  rebase: fix white-space
2019-07-29 12:39:14 -07:00
Junio C Hamano c3d4c20c7d Merge branch 'jk/xdiff-clamp-funcname-context-index'
The internal diff machinery can be made to read out of bounds while
looking for --funcion-context line in a corner case, which has been
corrected.

* jk/xdiff-clamp-funcname-context-index:
  xdiff: clamp function context indices in post-image
2019-07-29 12:39:13 -07:00
Junio C Hamano 995ec8a18f Merge branch 'sg/travis-gcc-4.8'
Add a job to build with a tad older GCC to make sure we are still
buildable.

* sg/travis-gcc-4.8:
  travis-ci: build with GCC 4.8 as well
2019-07-29 12:39:13 -07:00
Junio C Hamano 7b70d46ca4 Merge branch 'bb/grep-pcre2-bug-message-fix'
BUG() message fix.

The codepath may want to just simply be removed, though.

* bb/grep-pcre2-bug-message-fix:
  grep: print the pcre2_jit_on value
2019-07-29 12:39:13 -07:00
Junio C Hamano 1feeaaf26b Merge fixes made on the 'master' front
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-29 12:38:23 -07:00
Junio C Hamano f91dbd8b49 Merge branch 'jc/post-c89-rules-doc' into maint
We have been trying out a few language features outside c89; the
coding guidelines document did not talk about them and instead had
a blanket ban against them.

* jc/post-c89-rules-doc:
  CodingGuidelines: spell out post-C89 rules
2019-07-29 12:38:23 -07:00
Junio C Hamano 7011ce12b8 Merge branch 'fc/fetch-with-import-fix' into maint
Code restructuring during 2.20 period broke fetching tags via
"import" based transports.

* fc/fetch-with-import-fix:
  fetch: fix regression with transport helpers
  fetch: make the code more understandable
  fetch: trivial cleanup
  t5801 (remote-helpers): add test to fetch tags
  t5801 (remote-helpers): cleanup refspec stuff
2019-07-29 12:38:23 -07:00
Junio C Hamano dea6737bb7 Merge branch 'ds/close-object-store' into maint
The commit-graph file is now part of the "files that the runtime
may keep open file descriptors on, all of which would need to be
closed when done with the object store", and the file descriptor to
an existing commit-graph file now is closed before "gc" finalizes a
new instance to replace it.

* ds/close-object-store:
  packfile: rename close_all_packs to close_object_store
  packfile: close commit-graph in close_all_packs
  commit-graph: use raw_object_store when closing
  commit-graph: extract write_commit_graph_file()
  commit-graph: extract copy_oids_to_commits()
  commit-graph: extract count_distinct_commits()
  commit-graph: extract fill_oids_from_all_packs()
  commit-graph: extract fill_oids_from_commit_hex()
  commit-graph: extract fill_oids_from_packs()
  commit-graph: create write_commit_graph_context
  commit-graph: remove Future Work section
  commit-graph: collapse parameters into flags
  commit-graph: return with errors during write
  commit-graph: fix the_repository reference
2019-07-29 12:38:22 -07:00
Junio C Hamano 689204ca88 Merge branch 'pw/add-p-recount' into maint
"git checkout -p" needs to selectively apply a patch in reverse,
which did not work well.

* pw/add-p-recount:
  add -p: fix checkout -p with pathological context
2019-07-29 12:38:22 -07:00
Junio C Hamano 0324b6f035 Merge branch 'rs/avoid-overflow-in-midpoint-computation' into maint
Code clean-up to avoid signed integer overlaps during binary search.

* rs/avoid-overflow-in-midpoint-computation:
  cleanup: fix possible overflow errors in binary search, part 2
2019-07-29 12:38:21 -07:00
Junio C Hamano 0100103d8e Merge branch 'jk/trailers-use-config' into maint
"git interpret-trailers" always treated '#' as the comment
character, regardless of core.commentChar setting, which has been
corrected.

* jk/trailers-use-config:
  interpret-trailers: load default config
2019-07-29 12:38:21 -07:00
Junio C Hamano 05ed24dc51 Merge branch 'tg/stash-ref-by-index-fix' into maint
"git stash show 23" used to work, but no more after getting
rewritten in C; this regression has been corrected.

* tg/stash-ref-by-index-fix:
  stash: fix show referencing stash index
2019-07-29 12:38:20 -07:00
Junio C Hamano 649cae69bc Merge branch 'pw/rebase-abort-clean-rewritten' into maint
"git rebase --abort" used to leave refs/rewritten/ when concluding
"git rebase -r", which has been corrected.

* pw/rebase-abort-clean-rewritten:
  rebase --abort/--quit: cleanup refs/rewritten
  sequencer: return errors from sequencer_remove_state()
  rebase: warn if state directory cannot be removed
  rebase: fix a memory leak
2019-07-29 12:38:20 -07:00
Junio C Hamano 39521d07be Merge branch 'nd/completion-no-cache-failure' into maint
An incorrect list of options was cached after command line
completion failed (e.g. trying to complete a command that requires
a repository outside one), which has been corrected.

* nd/completion-no-cache-failure:
  completion: do not cache if --git-completion-helper fails
2019-07-29 12:38:20 -07:00
Junio C Hamano 97cb523f00 Merge branch 'rs/config-unit-parsing' into maint
The code to parse scaled numbers out of configuration files has
been made more robust and also easier to follow.

* rs/config-unit-parsing:
  config: simplify parsing of unit factors
  config: don't multiply in parse_unit_factor()
  config: use unsigned_mult_overflows to check for overflows
2019-07-29 12:38:19 -07:00
Junio C Hamano e59150199c Merge branch 'jk/delta-islands-progress-fix' into maint
The codepath to compute delta islands used to spew progress output
without giving the callers any way to squelch it, which has been
fixed.

* jk/delta-islands-progress-fix:
  delta-islands: respect progress flag
2019-07-29 12:38:19 -07:00
Junio C Hamano 3e06e74e4c Merge branch 'sg/rebase-progress' into maint
Use "Erase in Line" CSI sequence that is already used in the editor
support to clear cruft in the progress output.

* sg/rebase-progress:
  progress: use term_clear_line()
  rebase: fix garbled progress display with '-x'
  pager: add a helper function to clear the last line in the terminal
  t3404: make the 'rebase.missingCommitsCheck=ignore' test more focused
  t3404: modernize here doc style
2019-07-29 12:38:19 -07:00
Junio C Hamano 292a0de998 Merge branch 'ms/submodule-foreach-fix' into maint
"git submodule foreach" did not protect command line options passed
to the command to be run in each submodule correctly, when the
"--recursive" option was in use.

* ms/submodule-foreach-fix:
  submodule foreach: fix recursion of options
2019-07-29 12:38:18 -07:00
Junio C Hamano 8eb5097bea Merge branch 'js/rebase-reschedule-applies-only-to-interactive' into maint
The configuration variable rebase.rescheduleFailedExec should be
effective only while running an interactive rebase and should not
affect anything when running an non-interactive one, which was not
the case.  This has been corrected.

* js/rebase-reschedule-applies-only-to-interactive:
  rebase --am: ignore rebase.rescheduleFailedExec
2019-07-29 12:38:18 -07:00
Junio C Hamano 1cf76b7010 Merge branch 'qn/clone-doc-use-long-form' into maint
The "git clone" documentation refers to command line options in its
description in the short form; they have been replaced with long
forms to make them more recognisable.

* qn/clone-doc-use-long-form:
  docs: git-clone: list short form of options first
  docs: git-clone: refer to long form of options
2019-07-29 12:38:18 -07:00
Junio C Hamano 9c65991abd Merge branch 'jc/denoise-rm-to-resolve' into maint
"git rm" to resolve a conflicted path leaked an internal message
"needs merge" before actually removing the path, which was
confusing.  This has been corrected.

* jc/denoise-rm-to-resolve:
  rm: resolving by removal is not a warning-worthy event
2019-07-29 12:38:17 -07:00
Junio C Hamano 2f72ebfcd0 Merge branch 'js/mingw-spawn-with-spaces-in-path' into maint
Window 7 update ;-)

* js/mingw-spawn-with-spaces-in-path:
  mingw: support spawning programs containing spaces in their names
2019-07-29 12:38:17 -07:00
Junio C Hamano c5d81d7f59 Merge branch 'sr/gpg-interface-stop-at-the-end' into maint
A codepath that reads from GPG for signed object verification read
past the end of allocated buffer, which has been fixed.

* sr/gpg-interface-stop-at-the-end:
  gpg-interface: do not scan past the end of buffer
2019-07-29 12:38:17 -07:00
Junio C Hamano 17952bd1bf Merge branch 'js/clean-report-too-long-a-path' into maint
"git clean" silently skipped a path when it cannot lstat() it; now
it gives a warning.

* js/clean-report-too-long-a-path:
  clean: show an error message when the path is too long
2019-07-29 12:38:16 -07:00
Junio C Hamano 1a27b78e34 Merge branch 'es/local-atomic-push-failure-with-http' into maint
"git push --atomic" that goes over the transport-helper (namely,
the smart http transport) failed to prevent refs to be pushed when
it can locally tell that one of the ref update will fail without
having to consult the other end, which has been corrected.

* es/local-atomic-push-failure-with-http:
  transport-helper: avoid var decl in for () loop control
  transport-helper: enforce atomic in push_refs_with_push
2019-07-29 12:38:16 -07:00
Junio C Hamano 0c47e8ddf5 Merge branch 'po/doc-branch' into maint
Doc update.

* po/doc-branch:
  doc branch: provide examples for listing remote tracking branches
2019-07-29 12:38:16 -07:00
Junio C Hamano 747201d0c8 Merge branch 'dl/config-alias-doc' into maint
Doc update.

* dl/config-alias-doc:
  config/alias.txt: document alias accepting non-command first word
  config/alias.txt: change " and ' to `
2019-07-29 12:38:15 -07:00
Junio C Hamano ea219657a3 Merge branch 'cb/fsmonitor-intfix' into maint
Variable type fix.

* cb/fsmonitor-intfix:
  fsmonitor: avoid signed integer overflow / infinite loop
2019-07-29 12:38:15 -07:00
Junio C Hamano 90334a8497 Merge branch 'rs/copy-array' into maint
Code clean-up.

* rs/copy-array:
  use COPY_ARRAY for copying arrays
  coccinelle: use COPY_ARRAY for copying arrays
2019-07-29 12:38:15 -07:00
Junio C Hamano 0726f13074 Merge branch 'js/t3404-typofix' into maint
Typofix.

* js/t3404-typofix:
  t3404: fix a typo
2019-07-29 12:38:14 -07:00
Junio C Hamano 82ac2fbaf9 Merge branch 'cb/mkstemps-uint-type-fix' into maint
Variable type fix.

* cb/mkstemps-uint-type-fix:
  wrapper: avoid undefined behaviour in macOS
2019-07-29 12:38:14 -07:00