Commit Graph

65664 Commits

Author SHA1 Message Date
Junio C Hamano
7dc995f026 Merge branch 'jl/subtree-check-parents-argument-passing-fix' into next
Fix performance-releated bug in "git subtree" (in contrib/).

* jl/subtree-check-parents-argument-passing-fix:
  subtree: fix argument handling in check_parents
2022-01-05 14:05:32 -08:00
Junio C Hamano
a0e2068cb7 Merge branch 'lh/use-gnu-color-in-grep' into next
The color palette used by "git grep" has been updated to match that
of GNU grep.

* lh/use-gnu-color-in-grep:
  grep: align default colors with GNU grep ones
2022-01-05 14:05:32 -08:00
Lénaïc Huard
b83f99c399 grep: align default colors with GNU grep ones
git-grep shares a lot of options with the standard grep tool.
Like GNU grep, it has coloring options to highlight the matching text.
And like it, it has options to customize the various colored parts.

This patch updates the default git-grep colors to make them match the
GNU grep default ones [1].

It was possible to get the same result by setting the various `color.grep.<slot>`
options, but this patch makes `git grep --color` share the same color scheme as
`grep --color` by default without any user configuration.

[1] https://www.man7.org/linux/man-pages/man1/grep.1.html#ENVIRONMENT

Signed-off-by: Lénaïc Huard <lenaic@lhuard.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-01-05 12:42:54 -08:00
James Limbouris
3ce8888fb4 subtree: fix argument handling in check_parents
315a84f9aa (subtree: use commits before rejoins for splits, 2018-09-28)
changed the signature of check_parents from 'check_parents [REV...]'
to 'check_parents PARENTS_EXPR INDENT'. In other words the variable list
of parent revisions became a list embedded in a string. However it
neglected to unpack the list again before sending it to cache_miss,
leading to incorrect calls whenever more than one parent was present.
This is the case whenever a merge commit is processed, with the end
result being a loss of performance from unecessary rechecks.

The indent parameter was subsequently removed in e9525a8a02 (subtree:
have $indent actually affect indentation, 2021-04-27), but the argument
handling bug remained.

For consistency, take multiple arguments in check_parents,
and pass all of them to cache_miss separately.

Signed-off-by: James Limbouris <james@digitalmatter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-01-04 11:38:19 -08:00
Junio C Hamano
194610f4cf Sync with master 2022-01-03 16:26:04 -08:00
Junio C Hamano
ab5fb34db3 Merge branch 'js/branch-track-inherit' into next
"git -c branch.autosetupmerge=inherit branch new old" makes "new"
to have the same upstream as the "old" branch, instead of marking
"old" itself as its upstream.

* js/branch-track-inherit:
  config: require lowercase for branch.*.autosetupmerge
  branch: add flags and config to inherit tracking
  branch: accept multiple upstream branches for tracking
2022-01-03 16:25:37 -08:00
Junio C Hamano
0ef3860099 Merge branch 'ab/usage-die-message' into next
Code clean-up to hide vreportf() from public API.

* ab/usage-die-message:
  config API: use get_error_routine(), not vreportf()
  usage.c + gc: add and use a die_message_errno()
  gc: return from cmd_gc(), don't call exit()
  usage.c API users: use die_message() for error() + exit 128
  usage.c API users: use die_message() for "fatal :" + exit 128
  usage.c: add a die_message() routine
2022-01-03 16:25:36 -08:00
Junio C Hamano
cb8e19c304 Merge branch 'jz/apply-3-corner-cases' into next
"git apply --3way" bypasses the attempt to do a three-way
application in more cases to address the regression caused by the
recent change to use direct application as a fallback.

* jz/apply-3-corner-cases:
  git-apply: skip threeway in add / rename cases
2022-01-03 16:25:36 -08:00
Junio C Hamano
532f9bbb27 Merge branch 'hn/reftable-fixes' into next
Assorted fixlets in reftable code.

* hn/reftable-fixes:
  reftable: support preset file mode for writing
  reftable: signal overflow
  reftable: fix typo in header
2022-01-03 16:25:35 -08:00
Junio C Hamano
07d2d78d86 Merge branch 'ab/reflog-prep' into next
Code refactoring in the reflog part of refs API.

* ab/reflog-prep:
  reflog + refs-backend: move "verbose" out of the backend
  refs files-backend: assume cb->newlog if !EXPIRE_REFLOGS_DRY_RUN
  reflog: reduce scope of "struct rev_info"
  reflog expire: don't use lookup_commit_reference_gently()
  reflog expire: refactor & use "tip_commit" only for UE_NORMAL
  reflog expire: use "switch" over enum values
  reflog: change one->many worktree->refnames to use a string_list
  reflog expire: narrow scope of "cb" in cmd_reflog_expire()
  reflog delete: narrow scope of "cmd" passed to count_reflog_ent()
2022-01-03 16:25:35 -08:00
Junio C Hamano
adfc0c1f17 Merge branch 'ab/do-not-limit-stash-help-to-push' into next
"git stash" by default triggers its "push" action, but its
implementation also made "git stash -h" to show short help only for
"git stash push", which has been corrected.

* ab/do-not-limit-stash-help-to-push:
  stash: don't show "git stash push" usage on bad "git stash" usage
2022-01-03 16:25:35 -08:00
Junio C Hamano
8c8ca0cbce Merge branch 'ab/makefile-hook-list-dependency-fix' into next
Fix dependency rules to generate hook-list.h header file.

* ab/makefile-hook-list-dependency-fix:
  Makefile: correct the dependency graph of hook-list.h
2022-01-03 16:25:35 -08:00
Junio C Hamano
7ab1e1c5c4 Merge branch 'ab/makefile-pager-env-is-used-only-by-pager.c' into next
* ab/makefile-pager-env-is-used-only-by-pager.c:
  Makefile: move -DPAGER_ENV from BASIC_CFLAGS to EXTRA_CPPFLAGS
2022-01-03 16:25:34 -08:00
Junio C Hamano
2e2097c310 Merge branch 'ab/makefile-msgfmt-wo-stats' into next
Make the recipe that runs msgfmt less noisy.

* ab/makefile-msgfmt-wo-stats:
  Makefile: don't invoke msgfmt with --statistics
2022-01-03 16:25:34 -08:00
Junio C Hamano
1cd451c66c Merge branch 'hn/refs-debug-update' into next
Debugging support for refs API.

* hn/refs-debug-update:
  refs: centralize initialization of the base ref_store.
  refs: print error message in debug output
  refs: pass gitdir to packed_ref_store_create
2022-01-03 16:25:34 -08:00
Junio C Hamano
f58da4a878 Merge branch 'ds/fetch-pull-with-sparse-index' into next
"git fetch" and "git pull" are now declared sparse-index clean.
Also "git ls-files" learns the "--sparse" option to help debugging.

* ds/fetch-pull-with-sparse-index:
  test-read-cache: remove --table, --expand options
  t1091/t3705: remove 'test-tool read-cache --table'
  t1092: replace 'read-cache --table' with 'ls-files --sparse'
  ls-files: add --sparse option
  fetch/pull: use the sparse index
2022-01-03 16:25:33 -08:00
Junio C Hamano
6815d4d8c1 Merge branch 'hn/ref-api-tests-update' into next
Test updates.

* hn/ref-api-tests-update:
  t7004: use "test-tool ref-store" for reflog inspection
  t7004: create separate tags for different tests
  t5550: require REFFILES
  t5540: require REFFILES
2022-01-03 16:25:33 -08:00
Junio C Hamano
43f61b2fef Merge branch 'jh/p4-remove-unused' into next
Remove a few commands from "git p4" that aren't very useful.

* jh/p4-remove-unused:
  git-p4: remove "rollback" verb
  git-p4: remove "debug" verb
2022-01-03 16:25:33 -08:00
Junio C Hamano
8ca35ee3d0 Merge branch 'ja/perf-use-specified-shell' into next
Perf tests were run with end-user's shell, but it has been
corrected to use the shell specified by $TEST_SHELL_PATH.

* ja/perf-use-specified-shell:
  t/perf: do not run tests in user's $SHELL
2022-01-03 16:25:33 -08:00
Junio C Hamano
3cdbfeeaf1 Merge branch 'hn/test-ref-store-show-hash-algo' into next
Debugging support for refs API.

* hn/test-ref-store-show-hash-algo:
  test-ref-store: print hash algorithm
2022-01-03 16:25:33 -08:00
Junio C Hamano
f94f7f70b6 Merge branch 'ws/fast-export-with-revision-options' into next
Use of certain "git rev-list" options with "git fast-export"
created nonsense results (the worst two of which being "--reverse"
and "--invert-grep --grep=<foo>").  The use of "--first-parent" is
made to behave a bit more sensible than before.

* ws/fast-export-with-revision-options:
  fast-export: fix surprising behavior with --first-parent
2022-01-03 16:25:33 -08:00
Junio C Hamano
a644f898ce Merge branch 'js/l10n-mention-ngettext-early-in-readme' into next
Localization doc update.

* js/l10n-mention-ngettext-early-in-readme:
  l10n: README: call more attention to plural strings
2022-01-03 16:25:32 -08:00
Junio C Hamano
c385766ff4 Merge branch 'jh/p4-human-unit-numbers' into next
The way "git p4" shows file sizes in its output has been updated to
use human-readable units.

* jh/p4-human-unit-numbers:
  git-p4: show progress as an integer
  git-p4: print size values in appropriate units
2022-01-03 16:25:32 -08:00
Junio C Hamano
dcc0cd074f The sixth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-01-03 16:24:15 -08:00
Junio C Hamano
2dc94da374 Merge branch 'en/sparse-checkout-set'
The "init" and "set" subcommands in "git sparse-checkout" have been
unified for a better user experience and performance.

* en/sparse-checkout-set:
  sparse-checkout: remove stray trailing space
  clone: avoid using deprecated `sparse-checkout init`
  Documentation: clarify/correct a few sparsity related statements
  git-sparse-checkout.txt: update to document init/set/reapply changes
  sparse-checkout: enable reapply to take --[no-]{cone,sparse-index}
  sparse-checkout: enable `set` to initialize sparse-checkout mode
  sparse-checkout: split out code for tweaking settings config
  sparse-checkout: disallow --no-stdin as an argument to set
  sparse-checkout: add sanity-checks on initial sparsity state
  sparse-checkout: break apart functions for sparse_checkout_(set|add)
  sparse-checkout: pass use_stdin as a parameter instead of as a global
2022-01-03 16:24:15 -08:00
Junio C Hamano
4f4b18497a Merge branch 'es/test-chain-lint'
Broken &&-chains in the test scripts have been corrected.

* es/test-chain-lint:
  t6000-t9999: detect and signal failure within loop
  t5000-t5999: detect and signal failure within loop
  t4000-t4999: detect and signal failure within loop
  t0000-t3999: detect and signal failure within loop
  tests: simplify by dropping unnecessary `for` loops
  tests: apply modern idiom for exiting loop upon failure
  tests: apply modern idiom for signaling test failure
  tests: fix broken &&-chains in `{...}` groups
  tests: fix broken &&-chains in `$(...)` command substitutions
  tests: fix broken &&-chains in compound statements
  tests: use test_write_lines() to generate line-oriented output
  tests: simplify construction of large blocks of text
  t9107: use shell parameter expansion to avoid breaking &&-chain
  t6300: make `%(raw:size) --shell` test more robust
  t5516: drop unnecessary subshell and command invocation
  t4202: clarify intent by creating expected content less cleverly
  t1020: avoid aborting entire test script when one test fails
  t1010: fix unnoticed failure on Windows
  t/lib-pager: use sane_unset() to avoid breaking &&-chain
2022-01-03 16:24:15 -08:00
Junio C Hamano
0dc90d954d Merge branch 'ns/tmp-objdir'
New interface into the tmp-objdir API to help in-core use of the
quarantine feature.

* ns/tmp-objdir:
  tmp-objdir: disable ref updates when replacing the primary odb
  tmp-objdir: new API for creating temporary writable databases
2022-01-03 16:24:15 -08:00
Junio C Hamano
8bb565d375 Merge branch 'jc/unleak-log'
"git format-patch" uses a single rev_info instance and then exits.
Mark the structure with UNLEAK() macro to squelch leak sanitizer.

* jc/unleak-log:
  format-patch: mark rev_info with UNLEAK
2022-01-03 16:24:14 -08:00
Junio C Hamano
c8b2ade48c Merge branch 'ds/sparse-checkout-malformed-pattern-fix' into next
* ds/sparse-checkout-malformed-pattern-fix:
  sparse-checkout: refuse to add to bad patterns
  sparse-checkout: fix OOM error with mixed patterns
  sparse-checkout: fix segfault on malformed patterns
2021-12-30 14:40:30 -08:00
Derrick Stolee
a3eca58445 sparse-checkout: refuse to add to bad patterns
When in cone mode sparse-checkout, it is unclear how 'git
sparse-checkout add <dir1> ...' should behave if the existing
sparse-checkout file does not match the cone mode patterns. Change the
behavior to fail with an error message about the existing patterns.

Also, all cone mode patterns start with a '/' character, so add that
restriction. This is necessary for our example test 'cone mode: warn on
bad pattern', but also requires modifying the example sparse-checkout
file we use to test the warnings related to recognizing cone mode
patterns.

This error checking would cause a failure further down the test script
because of a test that adds non-cone mode patterns without cleaning them
up. Perform that cleanup as part of the test now.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-30 14:39:57 -08:00
Derrick Stolee
391c3a1020 sparse-checkout: fix OOM error with mixed patterns
Add a test to t1091-sparse-checkout-builtin.sh that would result in an
infinite loop and out-of-memory error before this change. The issue
relies on having non-cone-mode patterns while trying to modify the
patterns in cone-mode.

The fix is simple, allowing us to break from the loop when the input
path does not contain a slash, as the "dir" pattern we added does not.

This is only a fix to the critical out-of-memory error. A better
response to such a strange state will follow in a later change.

Reported-by: Calbabreaker <calbabreaker@gmail.com>
Helped-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-30 14:39:57 -08:00
Derrick Stolee
a481d4378c sparse-checkout: fix segfault on malformed patterns
Then core.sparseCheckoutCone is enabled, the sparse-checkout patterns are
used to populate two hashsets that accelerate pattern matching. If the user
modifies the sparse-checkout file outside of the 'sparse-checkout' builtin,
then strange patterns can happen, triggering some error checks.

One of these error checks is possible to hit when some special characters
exist in a line. A warning message is correctly written to stderr, but then
there is additional logic that attempts to remove the line from the hashset
and free the data. This leads to a segfault in the 'git sparse-checkout
list' command because it iterates over the contents of the hashset, which is
now invalid.

The fix here is to stop trying to remove from the hashset. In addition,
we disable cone mode sparse-checkout because of the malformed data. This
results in the pattern-matching working with a possibly-slower
algorithm, but using the patterns as they are in the sparse-checkout
file.

This also changes the behavior of commands such as 'git sparse-checkout
list' because the output patterns will be the contents of the
sparse-checkout file instead of the list of directories. This is an
existing behavior for other types of bad patterns.

Add a test that triggers the segfault without the code change.

Reported-by: John Burnett <johnburnett@johnburnett.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-30 14:39:57 -08:00
Junio C Hamano
027d9e1b94 Revert "fixup! sparse-checkout: fix OOM error with mixed patterns"
This reverts commit d33146878e, which
will not be needed with the updated version of another topic that
the test was having trouble with.
2021-12-30 13:55:31 -08:00
Junio C Hamano
55b058a8bb Merge branch 'rs/daemon-plug-leak' into next
Plug a memory leak.

* rs/daemon-plug-leak:
  daemon: plug memory leak on overlong path
2021-12-27 15:31:37 -08:00
Junio C Hamano
5dc740c331 Merge branch 'rs/pcre2-utf' into next
"git grep --perl-regexp" failed to match UTF-8 characters with
wildcard when the pattern consists only of ASCII letters, which has
been corrected.

* rs/pcre2-utf:
  grep/pcre2: factor out literal variable
  grep/pcre2: use PCRE2_UTF even with ASCII patterns
2021-12-27 15:31:37 -08:00
Junio C Hamano
dc2c5db807 Merge branch 'jc/t4204-do-not-write-git-on-upstream-of-pipe' into next
Test fixes.

* jc/t4204-do-not-write-git-on-upstream-of-pipe:
  t4204 is not sanitizer clean at all
2021-12-27 15:31:36 -08:00
Junio C Hamano
861648fe8c Merge branch 'rs/log-invert-grep-with-headers' into next
"git log --invert-grep --author=<name>" used to exclude commits
written by the given author, but now "--invert-grep" only affects
the matches made by the "--grep=<pattern>" option.

* rs/log-invert-grep-with-headers:
  log: let --invert-grep only invert --grep
2021-12-27 15:31:36 -08:00
Junio C Hamano
7988d71a27 Merge branch 'gh/gpg-doc-markup-fix' into next
Doc markup fix.

* gh/gpg-doc-markup-fix:
  docs: add missing colon to Documentation/config/gpg.txt
2021-12-27 15:31:36 -08:00
Junio C Hamano
b09cee1626 Merge branch 'rs/t4202-invert-grep-test-fix' into next
Test fix.

* rs/t4202-invert-grep-test-fix:
  t4202: fix patternType setting in --invert-grep test
2021-12-27 15:31:36 -08:00
Junio C Hamano
8f8474ae84 Merge branch 'ds/repack-fixlets' into next
Two fixes around "git repack".

* ds/repack-fixlets:
  repack: make '--quiet' disable progress
  repack: respect kept objects with '--write-midx -b'
2021-12-27 15:31:36 -08:00
Junio C Hamano
01f9fe17b9 Merge branch 'jc/merge-detached-head-name' into next
The default merge message prepared by "git merge" records the name
of the current branch; the name can be overridden with a new option
to allow users to pretend a merge is made on a different branch.

* jc/merge-detached-head-name:
  merge: allow to pretend a merge is made into a different branch
2021-12-27 15:31:35 -08:00
Junio C Hamano
c410caf527 Merge branch 'ds/sparse-checkout-malformed-pattern-fix' into next
Certain sparse-checkout patterns that are valid in non-cone mode
led to segfault in cone mode, which has been corrected.

* ds/sparse-checkout-malformed-pattern-fix:
  fixup! sparse-checkout: fix OOM error with mixed patterns
  sparse-checkout: refuse to add to bad patterns
  sparse-checkout: fix OOM error with mixed patterns
  sparse-checkout: fix segfault on malformed patterns
2021-12-27 15:31:35 -08:00
Junio C Hamano
a16d8fa62a Merge branch 'km/help-prompt-fix' into next
Among some code paths that ask an yes/no question, only one place
gave a prompt that looked different from the others, which has been
updated to match what the others create.

* km/help-prompt-fix:
  help: make auto-correction prompt more consistent
2021-12-27 15:31:35 -08:00
Junio C Hamano
3a1afc1ef8 Merge branch 'jv/use-larger-buffer-in-upload-pack' into next
"git upload-pack" (the other side of "git fetch") used a 8kB buffer
but most of its payload came on 64kB "packets".  The buffer size
has been enlarged so that such a packet fits.

* jv/use-larger-buffer-in-upload-pack:
  upload-pack.c: increase output buffer size
2021-12-27 15:31:35 -08:00
Junio C Hamano
2188dc2023 Merge branch 'jk/ssh-signing-doc-markup-fix' into next
Docfix.

* jk/ssh-signing-doc-markup-fix:
  doc/config: mark ssh allowedSigners example as literal
2021-12-27 15:31:35 -08:00
Junio C Hamano
443dd9f97f Merge branch 'pw/diff-color-moved-fix' into next
Correctness and performance update to "diff --color-moved" feature.

* pw/diff-color-moved-fix:
  diff --color-moved: intern strings
  diff: use designated initializers for emitted_diff_symbol
  diff --color-moved-ws=allow-indentation-change: improve hash lookups
  diff --color-moved: stop clearing potential moved blocks
  diff --color-moved: shrink potential moved blocks as we go
  diff --color-moved: unify moved block growth functions
  diff --color-moved: call comparison function directly
  diff --color-moved-ws=allow-indentation-change: simplify and optimize
  diff: simplify allow-indentation-change delta calculation
  diff --color-moved: avoid false short line matches and bad zebra coloring
  diff --color-moved=zebra: fix alternate coloring
  diff --color-moved: rewind when discarding pmb
  diff --color-moved: factor out function
  diff --color-moved: clear all flags on blocks that are too short
  diff --color-moved: add perf tests
2021-12-27 15:31:34 -08:00
Junio C Hamano
562e1552f6 Merge branch 'xw/am-empty' into next
"git am" learns "--empty=(stop|drop|keep)" option to tweak what is
done to a piece of e-mail without a patch in it.

* xw/am-empty:
  am: support --allow-empty to record specific empty patches
  am: support --empty=<option> to handle empty patches
  doc: git-format-patch: describe the option --always
2021-12-27 15:31:34 -08:00
Junio C Hamano
7cd8f7fdc0 Merge branch 'en/keep-cwd' into next
Many git commands that deal with working tree files try to remove a
directory that becomes empty (i.e. "git switch" from a branch that
has the directory to another branch that does not would attempt
remove all files in the directory and the directory itself).  This
drops users into an unfamiliar situation if the command was run in
a subdirectory that becomes subject to removal due to the command.
The commands have been taught to keep an empty directory if it is
the directory they were started in to avoid surprising users.

* en/keep-cwd:
  t2501: simplify the tests since we can now assume desired behavior
  dir: new flag to remove_dir_recurse() to spare the original_cwd
  dir: avoid incidentally removing the original_cwd in remove_path()
  stash: do not attempt to remove startup_info->original_cwd
  rebase: do not attempt to remove startup_info->original_cwd
  clean: do not attempt to remove startup_info->original_cwd
  symlinks: do not include startup_info->original_cwd in dir removal
  unpack-trees: add special cwd handling
  unpack-trees: refuse to remove startup_info->original_cwd
  setup: introduce startup_info->original_cwd
  t2501: add various tests for removing the current working directory
2021-12-27 15:31:33 -08:00
Junio C Hamano
9db6a814b7 Merge branch 'jc/flex-array-definition' into next
The conditions to choose different definitions of the FLEX_ARRAY
macro for vendor compilers has been simplified to make it easier to
maintain.

* jc/flex-array-definition:
  flex-array: simplify compiler-specific workaround
2021-12-27 15:31:33 -08:00
Junio C Hamano
650cb248ea Merge branch 'jh/p4-rcs-expansion-in-bytestring' into next
The RCS keyword substitution in "git p4" used to be done assuming
that the contents are UTF-8 text, which can trigger decoding
errors.  We now treat the contents as a bytestring for robustness
and correctness.

* jh/p4-rcs-expansion-in-bytestring:
  git-p4: resolve RCS keywords in bytes not utf-8
  git-p4: open temporary patch file for write only
  git-p4: add raw option to read_pipelines
  git-p4: pre-compile RCS keyword regexes
  git-p4: use with statements to close files after use in patchRCSKeywords
2021-12-27 15:31:33 -08:00