]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoMerge branch 'en/merge-ort-renorm-with-rename-delete-conflict-fix'
Junio C Hamano [Mon, 10 Jan 2022 19:52:55 +0000 (11:52 -0800)] 
Merge branch 'en/merge-ort-renorm-with-rename-delete-conflict-fix'

A corner case bug in the ort merge strategy has been corrected.

* en/merge-ort-renorm-with-rename-delete-conflict-fix:
  merge-ort: fix bug with renormalization and rename/delete conflicts

3 years agoMerge branch 'jc/doc-submitting-patches-choice-of-base'
Junio C Hamano [Mon, 10 Jan 2022 19:52:55 +0000 (11:52 -0800)] 
Merge branch 'jc/doc-submitting-patches-choice-of-base'

Extend the guidance to choose the base commit to build your work
on, and hint/nudge contributors to read others' changes.

* jc/doc-submitting-patches-choice-of-base:
  SubmittingPatchs: clarify choice of base and testing

3 years agoMerge branch 'jl/subtree-check-parents-argument-passing-fix'
Junio C Hamano [Mon, 10 Jan 2022 19:52:54 +0000 (11:52 -0800)] 
Merge branch 'jl/subtree-check-parents-argument-passing-fix'

Fix performance-releated bug in "git subtree" (in contrib/).

* jl/subtree-check-parents-argument-passing-fix:
  subtree: fix argument handling in check_parents

3 years agoMerge branch 'lh/use-gnu-color-in-grep'
Junio C Hamano [Mon, 10 Jan 2022 19:52:54 +0000 (11:52 -0800)] 
Merge branch 'lh/use-gnu-color-in-grep'

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

3 years agoMerge branch 'js/branch-track-inherit'
Junio C Hamano [Mon, 10 Jan 2022 19:52:54 +0000 (11:52 -0800)] 
Merge branch 'js/branch-track-inherit'

"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

3 years agoMerge branch 'ab/usage-die-message'
Junio C Hamano [Mon, 10 Jan 2022 19:52:53 +0000 (11:52 -0800)] 
Merge branch 'ab/usage-die-message'

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

3 years agoMerge branch 'jz/apply-3-corner-cases'
Junio C Hamano [Mon, 10 Jan 2022 19:52:53 +0000 (11:52 -0800)] 
Merge branch 'jz/apply-3-corner-cases'

"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

3 years agoMerge branch 'hn/reftable-fixes'
Junio C Hamano [Mon, 10 Jan 2022 19:52:52 +0000 (11:52 -0800)] 
Merge branch 'hn/reftable-fixes'

Assorted fixlets in reftable code.

* hn/reftable-fixes:
  reftable: support preset file mode for writing
  reftable: signal overflow
  reftable: fix typo in header

3 years agoMerge branch 'ab/reflog-prep'
Junio C Hamano [Mon, 10 Jan 2022 19:52:52 +0000 (11:52 -0800)] 
Merge branch 'ab/reflog-prep'

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()

3 years agoMerge branch 'ab/do-not-limit-stash-help-to-push'
Junio C Hamano [Mon, 10 Jan 2022 19:52:52 +0000 (11:52 -0800)] 
Merge branch 'ab/do-not-limit-stash-help-to-push'

"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

3 years agoMerge branch 'ab/makefile-hook-list-dependency-fix'
Junio C Hamano [Mon, 10 Jan 2022 19:52:52 +0000 (11:52 -0800)] 
Merge branch 'ab/makefile-hook-list-dependency-fix'

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

3 years agoMerge branch 'ab/makefile-pager-env-is-used-only-by-pager.c'
Junio C Hamano [Mon, 10 Jan 2022 19:52:51 +0000 (11:52 -0800)] 
Merge branch 'ab/makefile-pager-env-is-used-only-by-pager.c'

* ab/makefile-pager-env-is-used-only-by-pager.c:
  Makefile: move -DPAGER_ENV from BASIC_CFLAGS to EXTRA_CPPFLAGS

3 years agoMerge branch 'ab/makefile-msgfmt-wo-stats'
Junio C Hamano [Mon, 10 Jan 2022 19:52:51 +0000 (11:52 -0800)] 
Merge branch 'ab/makefile-msgfmt-wo-stats'

Make the recipe that runs msgfmt less noisy.

* ab/makefile-msgfmt-wo-stats:
  Makefile: don't invoke msgfmt with --statistics

3 years agoMerge branch 'hn/refs-debug-update'
Junio C Hamano [Mon, 10 Jan 2022 19:52:51 +0000 (11:52 -0800)] 
Merge branch 'hn/refs-debug-update'

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

3 years agoMerge branch 'ds/fetch-pull-with-sparse-index'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'ds/fetch-pull-with-sparse-index'

"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

3 years agoMerge branch 'hn/ref-api-tests-update'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'hn/ref-api-tests-update'

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

3 years agoMerge branch 'jh/p4-remove-unused'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'jh/p4-remove-unused'

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

3 years agoMerge branch 'ja/perf-use-specified-shell'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'ja/perf-use-specified-shell'

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

3 years agoMerge branch 'hn/test-ref-store-show-hash-algo'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'hn/test-ref-store-show-hash-algo'

Debugging support for refs API.

* hn/test-ref-store-show-hash-algo:
  test-ref-store: print hash algorithm

3 years agoMerge branch 'ws/fast-export-with-revision-options'
Junio C Hamano [Mon, 10 Jan 2022 19:52:50 +0000 (11:52 -0800)] 
Merge branch 'ws/fast-export-with-revision-options'

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

3 years agoMerge branch 'js/l10n-mention-ngettext-early-in-readme'
Junio C Hamano [Mon, 10 Jan 2022 19:52:49 +0000 (11:52 -0800)] 
Merge branch 'js/l10n-mention-ngettext-early-in-readme'

Localization doc update.

* js/l10n-mention-ngettext-early-in-readme:
  l10n: README: call more attention to plural strings

3 years agoMerge branch 'jh/p4-human-unit-numbers'
Junio C Hamano [Mon, 10 Jan 2022 19:52:49 +0000 (11:52 -0800)] 
Merge branch 'jh/p4-human-unit-numbers'

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

3 years agoMerge branch 'ds/sparse-checkout-malformed-pattern-fix'
Junio C Hamano [Mon, 10 Jan 2022 19:52:49 +0000 (11:52 -0800)] 
Merge branch 'ds/sparse-checkout-malformed-pattern-fix'

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:
  sparse-checkout: refuse to add to bad patterns
  sparse-checkout: fix OOM error with mixed patterns
  sparse-checkout: fix segfault on malformed patterns

3 years agoThe seventh batch
Junio C Hamano [Wed, 5 Jan 2022 21:56:49 +0000 (13:56 -0800)] 
The seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'rs/daemon-plug-leak'
Junio C Hamano [Wed, 5 Jan 2022 22:01:31 +0000 (14:01 -0800)] 
Merge branch 'rs/daemon-plug-leak'

Plug a memory leak.

* rs/daemon-plug-leak:
  daemon: plug memory leak on overlong path

3 years agoMerge branch 'rs/pcre2-utf'
Junio C Hamano [Wed, 5 Jan 2022 22:01:31 +0000 (14:01 -0800)] 
Merge branch 'rs/pcre2-utf'

"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

3 years agoMerge branch 'jc/t4204-do-not-write-git-on-upstream-of-pipe'
Junio C Hamano [Wed, 5 Jan 2022 22:01:31 +0000 (14:01 -0800)] 
Merge branch 'jc/t4204-do-not-write-git-on-upstream-of-pipe'

Test fixes.

* jc/t4204-do-not-write-git-on-upstream-of-pipe:
  t4204 is not sanitizer clean at all

3 years agoMerge branch 'rs/log-invert-grep-with-headers'
Junio C Hamano [Wed, 5 Jan 2022 22:01:30 +0000 (14:01 -0800)] 
Merge branch 'rs/log-invert-grep-with-headers'

"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

3 years agoMerge branch 'gh/gpg-doc-markup-fix'
Junio C Hamano [Wed, 5 Jan 2022 22:01:30 +0000 (14:01 -0800)] 
Merge branch 'gh/gpg-doc-markup-fix'

Doc markup fix.

* gh/gpg-doc-markup-fix:
  docs: add missing colon to Documentation/config/gpg.txt

3 years agoMerge branch 'rs/t4202-invert-grep-test-fix'
Junio C Hamano [Wed, 5 Jan 2022 22:01:30 +0000 (14:01 -0800)] 
Merge branch 'rs/t4202-invert-grep-test-fix'

Test fix.

* rs/t4202-invert-grep-test-fix:
  t4202: fix patternType setting in --invert-grep test

3 years agoMerge branch 'ds/repack-fixlets'
Junio C Hamano [Wed, 5 Jan 2022 22:01:30 +0000 (14:01 -0800)] 
Merge branch 'ds/repack-fixlets'

Two fixes around "git repack".

* ds/repack-fixlets:
  repack: make '--quiet' disable progress
  repack: respect kept objects with '--write-midx -b'

3 years agoMerge branch 'jc/merge-detached-head-name'
Junio C Hamano [Wed, 5 Jan 2022 22:01:29 +0000 (14:01 -0800)] 
Merge branch 'jc/merge-detached-head-name'

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

3 years agoMerge branch 'km/help-prompt-fix'
Junio C Hamano [Wed, 5 Jan 2022 22:01:29 +0000 (14:01 -0800)] 
Merge branch 'km/help-prompt-fix'

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

3 years agoMerge branch 'jv/use-larger-buffer-in-upload-pack'
Junio C Hamano [Wed, 5 Jan 2022 22:01:29 +0000 (14:01 -0800)] 
Merge branch 'jv/use-larger-buffer-in-upload-pack'

"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

3 years agoMerge branch 'jk/ssh-signing-doc-markup-fix'
Junio C Hamano [Wed, 5 Jan 2022 22:01:29 +0000 (14:01 -0800)] 
Merge branch 'jk/ssh-signing-doc-markup-fix'

Docfix.

* jk/ssh-signing-doc-markup-fix:
  doc/config: mark ssh allowedSigners example as literal

3 years agoMerge branch 'pw/diff-color-moved-fix'
Junio C Hamano [Wed, 5 Jan 2022 22:01:29 +0000 (14:01 -0800)] 
Merge branch 'pw/diff-color-moved-fix'

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

3 years agoMerge branch 'xw/am-empty'
Junio C Hamano [Wed, 5 Jan 2022 22:01:28 +0000 (14:01 -0800)] 
Merge branch 'xw/am-empty'

"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

3 years agoMerge branch 'en/keep-cwd'
Junio C Hamano [Wed, 5 Jan 2022 22:01:28 +0000 (14:01 -0800)] 
Merge branch 'en/keep-cwd'

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

3 years agoMerge branch 'jc/flex-array-definition'
Junio C Hamano [Wed, 5 Jan 2022 22:01:27 +0000 (14:01 -0800)] 
Merge branch 'jc/flex-array-definition'

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

3 years agoMerge branch 'jh/p4-rcs-expansion-in-bytestring'
Junio C Hamano [Wed, 5 Jan 2022 22:01:27 +0000 (14:01 -0800)] 
Merge branch 'jh/p4-rcs-expansion-in-bytestring'

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

3 years agogrep: align default colors with GNU grep ones
Lénaïc Huard [Wed, 5 Jan 2022 08:18:35 +0000 (09:18 +0100)] 
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>
3 years agosubtree: fix argument handling in check_parents
James Limbouris [Wed, 8 Dec 2021 02:11:58 +0000 (02:11 +0000)] 
subtree: fix argument handling in check_parents

315a84f9aa0 (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 e9525a8a029 (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>
3 years agoThe sixth batch
Junio C Hamano [Tue, 4 Jan 2022 00:23:32 +0000 (16:23 -0800)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'en/sparse-checkout-set'
Junio C Hamano [Tue, 4 Jan 2022 00:24:15 +0000 (16:24 -0800)] 
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

3 years agoMerge branch 'es/test-chain-lint'
Junio C Hamano [Tue, 4 Jan 2022 00:24:15 +0000 (16:24 -0800)] 
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

3 years agoMerge branch 'ns/tmp-objdir'
Junio C Hamano [Tue, 4 Jan 2022 00:24:14 +0000 (16:24 -0800)] 
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

3 years agoMerge branch 'jc/unleak-log'
Junio C Hamano [Tue, 4 Jan 2022 00:24:14 +0000 (16:24 -0800)] 
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

3 years agosparse-checkout: refuse to add to bad patterns
Derrick Stolee [Thu, 16 Dec 2021 16:13:42 +0000 (16:13 +0000)] 
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>
3 years agosparse-checkout: fix OOM error with mixed patterns
Derrick Stolee [Thu, 16 Dec 2021 16:13:41 +0000 (16:13 +0000)] 
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>
3 years agosparse-checkout: fix segfault on malformed patterns
Derrick Stolee [Thu, 16 Dec 2021 16:13:40 +0000 (16:13 +0000)] 
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>
3 years agoSubmittingPatchs: clarify choice of base and testing
Junio C Hamano [Thu, 30 Dec 2021 20:18:35 +0000 (12:18 -0800)] 
SubmittingPatchs: clarify choice of base and testing

We encourage identifying what, among many topics on `next`, exact
topics a new work depends on, instead of building directly on
`next`.  Let's clarify this in the documentation.

Developers should know what they are building on top of, and be
aware of which part of the system is currently being worked on.
Encouraging them to make trial merges to `next` and `seen`
themselves will incentivize them to read others' changes and
understand them, eventually helping the developers to coordinate
among themselves and reviewing each others' changes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomerge-ort: fix bug with renormalization and rename/delete conflicts
Elijah Newren [Tue, 28 Dec 2021 00:20:46 +0000 (00:20 +0000)] 
merge-ort: fix bug with renormalization and rename/delete conflicts

Ever since commit a492d5331c ("merge-ort: ensure we consult df_conflict
and path_conflicts", 2021-06-30), when renormalization is active AND a
file is involved in a rename/delete conflict BUT the file is unmodified
(either before or after renormalization), merge-ort was running into an
assertion failure.  Prior to that commit (or if assertions were compiled
out), merge-ort would mis-merge instead, ignoring the rename/delete
conflict and just deleting the file.

Remove the assertions, fix the code appropriately, leave some good
comments in the code, and add a testcase for this situation.

Reported-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMakefile: don't invoke msgfmt with --statistics
Ævar Arnfjörð Bjarmason [Fri, 17 Dec 2021 00:10:00 +0000 (01:10 +0100)] 
Makefile: don't invoke msgfmt with --statistics

Remove the --statistics flag that I added in 5e9637c6297 (i18n: add
infrastructure for translating Git with gettext, 2011-11-18). Our
Makefile output is good about reducing verbosity by default, except in
this case:

    $ rm -rf po/build/locale/e*; time make -j $(nproc) all
        SUBDIR templates
        MKDIR -p po/build/locale/el/LC_MESSAGES
        MSGFMT po/build/locale/el/LC_MESSAGES/git.mo
        MKDIR -p po/build/locale/es/LC_MESSAGES
        MSGFMT po/build/locale/es/LC_MESSAGES/git.mo
    1038 translated messages, 3325 untranslated messages.
    5230 translated messages.

I didn't have any good reason for using --statistics at the time other
than ad-hoc eyeballing of the output. We don't need to spew out
exactly how many messages we've got translated every time. Now we'll
instead emit:

    $ rm -rf po/build/locale/e*; time make -j $(nproc) all
        SUBDIR templates
        MKDIR -p po/build/locale/el/LC_MESSAGES
        MSGFMT po/build/locale/el/LC_MESSAGES/git.mo
        MKDIR -p po/build/locale/es/LC_MESSAGES
        MSGFMT po/build/locale/es/LC_MESSAGES/git.mo

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMakefile: move -DPAGER_ENV from BASIC_CFLAGS to EXTRA_CPPFLAGS
Ævar Arnfjörð Bjarmason [Fri, 17 Dec 2021 00:19:15 +0000 (01:19 +0100)] 
Makefile: move -DPAGER_ENV from BASIC_CFLAGS to EXTRA_CPPFLAGS

Remove -DPAGER_ENV from the BASIC_CFLAGS and instead have it passed
via the EXTRA_CPPFLAGS passed when compiling pager.c.

This doesn't change anything except to make it clear that only pager.c
needs this, as it's the only user of this define. See
995bc22d7f8 (pager: move pager-specific setup into the build,
2016-08-04) for the commit that originally added this.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMakefile: correct the dependency graph of hook-list.h
Ævar Arnfjörð Bjarmason [Fri, 17 Dec 2021 00:13:01 +0000 (01:13 +0100)] 
Makefile: correct the dependency graph of hook-list.h

Fix an issue in my cfe853e66be (hook-list.h: add a generated list of
hooks, like config-list.h, 2021-09-26), the builtin/help.c was
inadvertently made to depend on hook-list.h, but it's used by
builtin/bugreport.c.

The hook.c also does not depend on hook-list.h. It did in an earlier
version of the greater series cfe853e66be was extracted from, but not
anymore. We might end up needing that line again, but let's remove it
for now.

Reported-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot/perf: do not run tests in user's $SHELL
Johannes Altmanninger [Sat, 25 Dec 2021 08:16:58 +0000 (09:16 +0100)] 
t/perf: do not run tests in user's $SHELL

The environment variable $SHELL is usually set to the user's
interactive shell. Our build and test scripts never use $SHELL because
there are no guarantees about its input language.  Instead, we use
/bin/sh which should be a POSIX shell.

For systems with a broken /bin/sh, we allow to override that path via
SHELL_PATH.  To run tests in yet another shell we allow to override
SHELL_PATH with TEST_SHELL_PATH.

Perf tests run in $SHELL via a wrapper defined in t/perf/perf-lib.sh,
so they break with e.g. SHELL=python.  Use TEST_SHELL_PATH like
in other tests.  TEST_SHELL_PATH is always defined because
t/perf/perf-lib.sh includes t/test-lib.sh, which includes
GIT-BUILD-OPTIONS.

Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Johannes Altmanninger <aclopte@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoreftable: support preset file mode for writing
Han-Wen Nienhuys [Thu, 23 Dec 2021 19:29:50 +0000 (19:29 +0000)] 
reftable: support preset file mode for writing

Create files with mode 0666, so umask works as intended. Provides an override,
which is useful to support shared repos (test t1301-shared-repo.sh).

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoreftable: signal overflow
Han-Wen Nienhuys [Thu, 23 Dec 2021 19:29:49 +0000 (19:29 +0000)] 
reftable: signal overflow

reflog entries have unbounded size. In theory, each log ('g') block in reftable
can have an arbitrary size, so the format allows for arbitrarily sized reflog
messages. However, in the implementation, we are not scaling the log blocks up
with the message, and writing a large message fails.

This triggers a failure for reftable in t7006-pager.sh.

Until this is fixed more structurally, report an error from within the reftable
library for easier debugging.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoreftable: fix typo in header
Han-Wen Nienhuys [Thu, 23 Dec 2021 19:29:48 +0000 (19:29 +0000)] 
reftable: fix typo in header

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosparse-checkout: remove stray trailing space
Elijah Newren [Thu, 23 Dec 2021 17:07:03 +0000 (17:07 +0000)] 
sparse-checkout: remove stray trailing space

Reported-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe fifth batch
Junio C Hamano [Thu, 23 Dec 2021 02:00:04 +0000 (18:00 -0800)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'es/chainlint'
Junio C Hamano [Thu, 23 Dec 2021 06:48:11 +0000 (22:48 -0800)] 
Merge branch 'es/chainlint'

The chainlint test script linter in the test suite has been updated.

* es/chainlint:
  chainlint.sed: stop splitting "(..." into separate lines "(" and "..."
  chainlint.sed: swallow comments consistently
  chainlint.sed: stop throwing away here-doc tags
  chainlint.sed: don't mistake `<< word` in string as here-doc operator
  chainlint.sed: make here-doc "<<-" operator recognition more POSIX-like
  chainlint.sed: drop subshell-closing ">" annotation
  chainlint.sed: drop unnecessary distinction between ?!AMP?! and ?!SEMI?!
  chainlint.sed: tolerate harmless ";" at end of last line in block
  chainlint.sed: improve ?!SEMI?! placement accuracy
  chainlint.sed: improve ?!AMP?! placement accuracy
  t/Makefile: optimize chainlint self-test
  t/chainlint/one-liner: avoid overly intimate chainlint.sed knowledge
  t/chainlint/*.test: generalize self-test commentary
  t/chainlint/*.test: fix invalid test cases due to mixing quote types
  t/chainlint/*.test: don't use invalid shell syntax

3 years agoMerge branch 'jz/apply-quiet-and-allow-empty'
Junio C Hamano [Thu, 23 Dec 2021 06:48:11 +0000 (22:48 -0800)] 
Merge branch 'jz/apply-quiet-and-allow-empty'

"git apply" has been taught to ignore a message without a patch
with the "--allow-empty" option.  It also learned to honor the
"--quiet" option given from the command line.

* jz/apply-quiet-and-allow-empty:
  git-apply: add --allow-empty flag
  git-apply: add --quiet flag

3 years agoMerge branch 'jk/limit-developers-to-gnu99'
Junio C Hamano [Thu, 23 Dec 2021 06:48:11 +0000 (22:48 -0800)] 
Merge branch 'jk/limit-developers-to-gnu99'

Enable -std=gnu99 option in DEVELOPER builds.

* jk/limit-developers-to-gnu99:
  config.mak.dev: specify -std=gnu99 for gcc/clang

3 years agoMerge branch 'ab/common-main-cleanup'
Junio C Hamano [Thu, 23 Dec 2021 06:48:11 +0000 (22:48 -0800)] 
Merge branch 'ab/common-main-cleanup'

Code clean-up.

* ab/common-main-cleanup:
  common-main.c: call exit(), don't return

3 years agoMerge branch 'ab/fetch-set-upstream-while-detached'
Junio C Hamano [Thu, 23 Dec 2021 06:48:10 +0000 (22:48 -0800)] 
Merge branch 'ab/fetch-set-upstream-while-detached'

"git fetch --set-upstream" did not check if there is a current
branch, leading to a segfault when it is run on a detached HEAD,
which has been corrected.

* ab/fetch-set-upstream-while-detached:
  pull, fetch: fix segfault in --set-upstream option

3 years agoreflog + refs-backend: move "verbose" out of the backend
Ævar Arnfjörð Bjarmason [Wed, 22 Dec 2021 04:06:48 +0000 (05:06 +0100)] 
reflog + refs-backend: move "verbose" out of the backend

Move the handling of the "verbose" flag entirely out of
"refs/files-backend.c" and into "builtin/reflog.c". This allows the
backend to stop knowing about the EXPIRE_REFLOGS_VERBOSE flag.

The expire_reflog_ent() function shouldn't need to deal with the
implementation detail of whether or not we're emitting verbose output,
by doing this the --verbose output becomes backend-agnostic, so
reftable will get the same output.

I think the output is rather bad currently, and should e.g. be
implemented with some better future mode of progress.[ch], but that's
a topic for another improvement.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs files-backend: assume cb->newlog if !EXPIRE_REFLOGS_DRY_RUN
Ævar Arnfjörð Bjarmason [Wed, 22 Dec 2021 04:06:47 +0000 (05:06 +0100)] 
refs files-backend: assume cb->newlog if !EXPIRE_REFLOGS_DRY_RUN

It's not possible for "cb->newlog" to be NULL if
!EXPIRE_REFLOGS_DRY_RUN, since files_reflog_expire() would have
error()'d and taken the "goto failure" branch if it couldn't open the
file. By not using the "newlog" field private to "file-backend.c"'s
"struct expire_reflog_cb", we can move this verbosity logging to
"builtin/reflog.c" in a subsequent commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoreflog: reduce scope of "struct rev_info"
Ævar Arnfjörð Bjarmason [Wed, 22 Dec 2021 04:06:46 +0000 (05:06 +0100)] 
reflog: reduce scope of "struct rev_info"

Change the "cmd.stalefix" handling added in 1389d9ddaa6 (reflog expire
--fix-stale, 2007-01-06) to use a locally scoped "struct
rev_info". This code relies on mark_reachable_objects() twiddling
flags in the walked objects.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoreflog expire: don't use lookup_commit_reference_gently()
Ævar Arnfjörð Bjarmason [Wed, 22 Dec 2021 04:06:45 +0000 (05:06 +0100)] 
reflog expire: don't use lookup_commit_reference_gently()

In the initial implementation of "git reflog" in 4264dc15e19 (git
reflog expire, 2006-12-19) we had this
lookup_commit_reference_gently().

I don't think we've ever found tags that we need to recursively
dereference in reflogs, so this should at least be changed to a
"lookup commit" as I'm doing here, although I can't think of a way
where it mattered in practice.

I also think we'd probably like to just die here if we have a NULL
object, but as this code needs to handle potentially broken
repositories let's just show an "error" but continue, the non-quiet
lookup_commit() will do for us. None of our tests cover the case where
"commit" is NULL after this lookup.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoreflog expire: refactor & use "tip_commit" only for UE_NORMAL
Ævar Arnfjörð Bjarmason [Wed, 22 Dec 2021 04:06:44 +0000 (05:06 +0100)] 
reflog expire: refactor & use "tip_commit" only for UE_NORMAL

Add an intermediate variable for "tip_commit" in
reflog_expiry_prepare(), and only add it to the struct if we're
handling the UE_NORMAL case.

The code behaves the same way as before, but this makes the control
flow clearer, and the shorter name allows us to fold a 4-line i/else
into a one-line ternary instead.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoreflog expire: use "switch" over enum values
Ævar Arnfjörð Bjarmason [Wed, 22 Dec 2021 04:06:43 +0000 (05:06 +0100)] 
reflog expire: use "switch" over enum values

Change code added in 03cb91b18cc (reflog --expire-unreachable: special
case entries in "HEAD" reflog, 2010-04-09) to use a "switch" statement
with an exhaustive list of "case" statements instead of doing numeric
comparisons against the enum labels.

Now we won't assume that "x != UE_ALWAYS" means "(x == UE_HEAD || x ||
UE_NORMAL)". That assumption is true now, but we'd introduce subtle
bugs here if that were to change, now the compiler will notice and
error out on such errors.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoreflog: change one->many worktree->refnames to use a string_list
Ævar Arnfjörð Bjarmason [Wed, 22 Dec 2021 04:06:42 +0000 (05:06 +0100)] 
reflog: change one->many worktree->refnames to use a string_list

Change the FLEX_ARRAY pattern added in bda3a31cc79 (reflog-expire:
Avoid creating new files in a directory inside readdir(3) loop,
2008-01-25) the string-list API instead.

This does not change any behavior, allows us to delete much of this
code as it's replaced by things we get from the string-list API for
free, as a result we need just one struct to keep track of this data,
instead of two.

The "DUP" -> "string_list_append_nodup(..., strbuf_detach(...))"
pattern here is the same as that used in a recent memory leak fix in
b202e51b154 (grep: fix a "path_list" memory leak, 2021-10-22).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoreflog expire: narrow scope of "cb" in cmd_reflog_expire()
Ævar Arnfjörð Bjarmason [Wed, 22 Dec 2021 04:06:41 +0000 (05:06 +0100)] 
reflog expire: narrow scope of "cb" in cmd_reflog_expire()

As with the preceding change for "reflog delete", change the "cb_data"
we pass to callbacks to be &cb.cmd itself, instead of passing &cb and
having the callback lookup cb->cmd.

This makes it clear that the "cb" itself is the same memzero'd
structure on each iteration of the for-loops that use &cb, except for
the "cmd" member.

The "struct expire_reflog_policy_cb" we pass to reflog_expire() will
have the members that aren't "cmd" modified by the callbacks, but
before we invoke them everything except "cmd" is zero'd out.

This included the "tip_commit", "mark_list" and "tips". It might have
looked as though we were re-using those between iterations, but the
first thing we did in reflog_expiry_prepare() was to either NULL them,
or clobber them with another value.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoreflog delete: narrow scope of "cmd" passed to count_reflog_ent()
Ævar Arnfjörð Bjarmason [Wed, 22 Dec 2021 04:06:40 +0000 (05:06 +0100)] 
reflog delete: narrow scope of "cmd" passed to count_reflog_ent()

Change the "cb_data" we pass to the count_reflog_ent() to be the
&cb.cmd itself, instead of passing &cb and having the callback lookup
cb->cmd.

This makes it clear that the "cb" itself is the same memzero'd
structure on each iteration of the for-loop that uses &cb, except for
the "cmd" member.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs: centralize initialization of the base ref_store.
Han-Wen Nienhuys [Wed, 22 Dec 2021 18:11:54 +0000 (18:11 +0000)] 
refs: centralize initialization of the base ref_store.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs: print error message in debug output
Han-Wen Nienhuys [Wed, 22 Dec 2021 18:11:53 +0000 (18:11 +0000)] 
refs: print error message in debug output

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs: pass gitdir to packed_ref_store_create
Han-Wen Nienhuys [Wed, 22 Dec 2021 18:11:52 +0000 (18:11 +0000)] 
refs: pass gitdir to packed_ref_store_create

This is consistent with the calling convention for ref backend creation, and
avoids storing ".git/packed-refs" (the name of a regular file) in a variable called
ref_store::gitdir.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-p4: remove "rollback" verb
Joel Holdsworth [Wed, 22 Dec 2021 14:55:52 +0000 (14:55 +0000)] 
git-p4: remove "rollback" verb

The "rollback" verb implements a simple algorithm which takes the set of
remote perforce tracker branches, or optionally, the complete collection
of local branches in a git repository, and deletes commits from these
branches until there are no commits left with a perforce change number
greater than than a user-specified change number. If the base of a git
branch has a newer change number than the user-specified maximum, then
the branch is deleted.

In future, there might be an argument for the addition of some kind of
"reset this branch back to a given perforce change number" verb for
git-p4. However, in its current form it is unlikely to be useful to
users for the following reasons:

  * The verb is completely undocumented. The only description provided
    contains the following text: "A tool to debug the multi-branch
    import. Don't use :)".

  * The verb has a very narrow purpose in that it applies the rollback
    operation to fixed sets of branches - either all remote p4 branches,
    or all local branches. There is no way for users to specify branches
    with more granularity, for example, allowing users to specify a
    single branch or a set of branches. The utility of the current
    implementation is therefore a niche within a niche.

Given these shortcomings, this patch removes the verb from git-p4.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-p4: remove "debug" verb
Joel Holdsworth [Wed, 22 Dec 2021 14:55:51 +0000 (14:55 +0000)] 
git-p4: remove "debug" verb

The git-p4 "debug" verb is described as "A tool to debug the output of
p4 -G".

The verb is not documented in any detail, but implements a function
which executes an arbitrary p4 command with the -G flag, which causes
perforce to format all output as marshalled Python dictionary objects.

The verb was implemented early in the history of git-p4, and may once
have served a useful purpose to the authors in the early stages of
development. However, the "debug" verb is no longer being used by the
current developers (and users) of git-p4, and whatever purpose the verb
previously offered is easily replaced by invoking p4 directly.

This patch therefore removes the verb from git-p4.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7004: use "test-tool ref-store" for reflog inspection
Han-Wen Nienhuys [Wed, 22 Dec 2021 10:59:44 +0000 (10:59 +0000)] 
t7004: use "test-tool ref-store" for reflog inspection

This makes the test work with reftable.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7004: create separate tags for different tests
Han-Wen Nienhuys [Wed, 22 Dec 2021 10:59:43 +0000 (10:59 +0000)] 
t7004: create separate tags for different tests

Reftable intentionally keeps reflog data for deleted refs.

This breaks tests that delete and recreate "refs/tags/tag_with_reflog" as traces
of the deletion are left in reflog. To resolve this, use a differently named ref
for each test case.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5550: require REFFILES
Han-Wen Nienhuys [Wed, 22 Dec 2021 10:59:42 +0000 (10:59 +0000)] 
t5550: require REFFILES

The dumb HTTP protocol exposes ref storage details as part of the protocol,
so it only works with the FILES refstorage backend

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5540: require REFFILES
Han-Wen Nienhuys [Wed, 22 Dec 2021 10:59:41 +0000 (10:59 +0000)] 
t5540: require REFFILES

The dumb HTTP protocol exposes ref storage details as part of the protocol,
so it only works with the FILES refstorage backend

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotest-read-cache: remove --table, --expand options
Derrick Stolee [Wed, 22 Dec 2021 14:20:56 +0000 (14:20 +0000)] 
test-read-cache: remove --table, --expand options

This commit effectively reverts 2782db3 (test-tool: don't force full
index, 2021-03-30) and e2df6c3 (test-read-cache: print cache entries
with --table, 2021-03-30) to remove the --table and --expand options
from 'test-tool read-cache'. The previous changes already removed these
options from the test suite in favor of 'git ls-files --sparse'.

The initial thought of creating these options was to allow for tests to
see additional information with every cache entry. In particular, the
object type is still not mirrored in 'git ls-files'. Since sparse
directory entries always end with a slash, the object type is not
critical to verify the sparse index is enabled. It was thought that it
would be helpful to have additional information, such as flags, but that
was not needed for the FS Monitor integration and hasn't been needed
since.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1091/t3705: remove 'test-tool read-cache --table'
Derrick Stolee [Wed, 22 Dec 2021 14:20:55 +0000 (14:20 +0000)] 
t1091/t3705: remove 'test-tool read-cache --table'

Now that 'git ls-files --sparse' exists, we can use it to verify the
state of a sparse index instead of 'test-tool read-cache table'. Replace
these usages within t1091-sparse-checkout-builtin.sh and
t3705-add-sparse-checkout.sh.

The important changes are due to the different output format. In t3705,
we need to use the '--stage' output to get a file mode and OID, but
it also includes a stage value and drops the object type. This leads
to some differences in how we handle looking for specific entries.

In t1091, the test focuses on enabling the sparse index, so we do not
need the --stage flag to demonstrate how the index changes, and instead
can use a diff.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1092: replace 'read-cache --table' with 'ls-files --sparse'
Derrick Stolee [Wed, 22 Dec 2021 14:20:54 +0000 (14:20 +0000)] 
t1092: replace 'read-cache --table' with 'ls-files --sparse'

Now that 'git ls-files --sparse' exists, we can use it to verify the
state of a sparse index instead of 'test-tool read-cache table'. Replace
these usages within t1092-sparse-checkout-compatibility.sh.

The important changes are due to the different output format. We need to
use the '--stage' output to get a file mode and OID, but it also
includes a stage value and drops the object type. This leads to some
differences in how we handle looking for specific entries.

Some places where we previously looked for no 'tree' entries, we can
instead directly compare the output across the repository with a sparse
index and the one without.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agols-files: add --sparse option
Derrick Stolee [Wed, 22 Dec 2021 14:20:53 +0000 (14:20 +0000)] 
ls-files: add --sparse option

Existing callers to 'git ls-files' are expecting file names, not
directories. It is best to expand a sparse index to show all of the
contained files in this case.

However, expert users may want to inspect the contents of the index
itself including which directories are sparse. Add a --sparse option to
allow users to request this information.

During testing, I noticed that options such as --modified did not affect
the output when the files in question were outside the sparse-checkout
definition. Tests are added to document this preexisting behavior and
how it remains unchanged with the sparse index and the --sparse option.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofetch/pull: use the sparse index
Derrick Stolee [Wed, 22 Dec 2021 14:20:52 +0000 (14:20 +0000)] 
fetch/pull: use the sparse index

The 'git fetch' and 'git pull' commands parse the index in order to
determine if submodules exist. Without command_requires_full_index=0,
this will expand a sparse index, causing slow performance even when
there is no new data to fetch.

The .gitmodules file will never be inside a sparse directory entry, and
even if it was, the index_name_pos() method would expand the sparse
index if needed as we search for the path by name. These commands do not
iterate over the index, which is the typical thing we are careful about
when integrating with the sparse index.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotest-ref-store: print hash algorithm
Han-Wen Nienhuys [Tue, 21 Dec 2021 13:15:00 +0000 (13:15 +0000)] 
test-ref-store: print hash algorithm

This provides a better error message in case SHA256 was inadvertently switched
on through the environment.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe fourth batch
Junio C Hamano [Tue, 21 Dec 2021 23:03:23 +0000 (15:03 -0800)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/scalar'
Junio C Hamano [Tue, 21 Dec 2021 23:03:17 +0000 (15:03 -0800)] 
Merge branch 'js/scalar'

Add pieces from "scalar" to contrib/.

* js/scalar:
  scalar: implement the `version` command
  scalar: implement the `delete` command
  scalar: teach 'reconfigure' to optionally handle all registered enlistments
  scalar: allow reconfiguring an existing enlistment
  scalar: implement the `run` command
  scalar: teach 'clone' to support the --single-branch option
  scalar: implement the `clone` subcommand
  scalar: implement 'scalar list'
  scalar: let 'unregister' handle a deleted enlistment directory gracefully
  scalar: 'unregister' stops background maintenance
  scalar: 'register' sets recommended config and starts maintenance
  scalar: create test infrastructure
  scalar: start documenting the command
  scalar: create a rudimentary executable
  scalar: add a README with a roadmap

3 years agoMerge branch 'ld/sparse-diff-blame'
Junio C Hamano [Tue, 21 Dec 2021 23:03:17 +0000 (15:03 -0800)] 
Merge branch 'ld/sparse-diff-blame'

Teach diff and blame to work well with sparse index.

* ld/sparse-diff-blame:
  blame: enable and test the sparse index
  diff: enable and test the sparse index
  diff: replace --staged with --cached in t1092 tests
  repo-settings: prepare_repo_settings only in git repos
  test-read-cache: set up repo after git directory
  commit-graph: return if there is no git directory
  git: ensure correct git directory setup with -h

3 years agoMerge branch 'en/name-rev-shorter-output'
Junio C Hamano [Tue, 21 Dec 2021 23:03:16 +0000 (15:03 -0800)] 
Merge branch 'en/name-rev-shorter-output'

"git name-rev" has been tweaked to give output that is shorter and
easier to understand.

* en/name-rev-shorter-output:
  name-rev: prefer shorter names over following merges

3 years agoMerge branch 'ak/protect-any-current-branch'
Junio C Hamano [Tue, 21 Dec 2021 23:03:16 +0000 (15:03 -0800)] 
Merge branch 'ak/protect-any-current-branch'

"git fetch" without the "--update-head-ok" option ought to protect
a checked out branch from getting updated, to prevent the working
tree that checks it out to go out of sync.  The code was written
before the use of "git worktree" got widespread, and only checked
the branch that was checked out in the current worktree, which has
been updated.
(originally called ak/fetch-not-overwrite-any-current-branch)

* ak/protect-any-current-branch:
  branch: protect branches checked out in all worktrees
  receive-pack: protect current branch for bare repository worktree
  receive-pack: clean dead code from update_worktree()
  fetch: protect branches checked out in all worktrees
  worktree: simplify find_shared_symref() memory ownership model
  branch: lowercase error messages
  receive-pack: lowercase error messages
  fetch: lowercase error messages

3 years agoMerge branch 'fs/ssh-signing-other-keytypes'
Junio C Hamano [Tue, 21 Dec 2021 23:03:16 +0000 (15:03 -0800)] 
Merge branch 'fs/ssh-signing-other-keytypes'

The cryptographic signing using ssh keys can specify literal keys
for keytypes whose name do not begin with the "ssh-" prefix by
using the "key::" prefix mechanism (e.g. "key::ecdsa-sha2-nistp256").

* fs/ssh-signing-other-keytypes:
  ssh signing: make sign/amend test more resilient
  ssh signing: support non ssh-* keytypes

3 years agoMerge branch 'fs/ssh-signing-key-lifetime'
Junio C Hamano [Tue, 21 Dec 2021 23:03:15 +0000 (15:03 -0800)] 
Merge branch 'fs/ssh-signing-key-lifetime'

Extend the signing of objects with SSH keys and learn to pay
attention to the key validity time range when verifying.

* fs/ssh-signing-key-lifetime:
  ssh signing: verify ssh-keygen in test prereq
  ssh signing: make fmt-merge-msg consider key lifetime
  ssh signing: make verify-tag consider key lifetime
  ssh signing: make git log verify key lifetime
  ssh signing: make verify-commit consider key lifetime
  ssh signing: add key lifetime test prereqs
  ssh signing: use sigc struct to pass payload
  t/fmt-merge-msg: make gpgssh tests more specific
  t/fmt-merge-msg: do not redirect stderr

3 years agoMerge branch 'jc/grep-patterntype-default-doc'
Junio C Hamano [Tue, 21 Dec 2021 23:03:15 +0000 (15:03 -0800)] 
Merge branch 'jc/grep-patterntype-default-doc'

Doc update.

* jc/grep-patterntype-default-doc:
  grep: clarify what `grep.patternType=default` means

3 years agoMerge branch 'jk/log-decorate-opts-with-implicit-decorate'
Junio C Hamano [Tue, 21 Dec 2021 23:03:15 +0000 (15:03 -0800)] 
Merge branch 'jk/log-decorate-opts-with-implicit-decorate'

When "git log" implicitly enabled the "decoration" processing
without being explicitly asked with "--decorate" option, it failed
to read and honor the settings given by the "--decorate-refs"
option.

* jk/log-decorate-opts-with-implicit-decorate:
  log: load decorations with --simplify-by-decoration
  log: handle --decorate-refs with userformat "%d"

3 years agoMerge branch 'en/rebase-x-wo-git-dir-env'
Junio C Hamano [Tue, 21 Dec 2021 23:03:15 +0000 (15:03 -0800)] 
Merge branch 'en/rebase-x-wo-git-dir-env'

"git rebase -x" by mistake started exporting the GIT_DIR and
GIT_WORK_TREE environment variables when the command was rewritten
in C, which has been corrected.

* en/rebase-x-wo-git-dir-env:
  sequencer: do not export GIT_DIR and GIT_WORK_TREE for 'exec'