]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 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>
2 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>
2 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>
2 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>
2 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>
2 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

2 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

2 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

2 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

2 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

2 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

2 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

2 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"

2 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'

2 years agoMerge branch 'jc/c99-var-decl-in-for-loop'
Junio C Hamano [Tue, 21 Dec 2021 23:03:15 +0000 (15:03 -0800)] 
Merge branch 'jc/c99-var-decl-in-for-loop'

Weather balloon to find compilers that do not grok variable
declaration in the for() loop.

* jc/c99-var-decl-in-for-loop:
  revision: use C99 declaration of variable in for() loop

2 years agoMerge branch 'pw/xdiff-classify-record-in-histogram'
Junio C Hamano [Tue, 21 Dec 2021 23:03:14 +0000 (15:03 -0800)] 
Merge branch 'pw/xdiff-classify-record-in-histogram'

"diff --histogram" optimization.

* pw/xdiff-classify-record-in-histogram:
  xdiff: drop unused flags parameter from recs_match
  xdiff: drop xpparam_t parameter from histogram cmp_recs()
  xdiff: drop CMP_ENV macro from xhistogram
  xdiff: simplify comparison
  xdiff: avoid unnecessary memory allocations
  diff histogram: intern strings

2 years agoThe third batch
Junio C Hamano [Wed, 15 Dec 2021 17:40:11 +0000 (09:40 -0800)] 
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ab/die-with-bug'
Junio C Hamano [Wed, 15 Dec 2021 17:39:55 +0000 (09:39 -0800)] 
Merge branch 'ab/die-with-bug'

Code clean-up.

* ab/die-with-bug:
  object.c: use BUG(...) no die("BUG: ...") in lookup_object_by_type()
  pathspec: use BUG(...) not die("BUG:%s:%d....", <file>, <line>)
  strbuf.h: use BUG(...) not die("BUG: ...")
  pack-objects: use BUG(...) not die("BUG: ...")

2 years agoMerge branch 'hn/allow-bogus-oid-in-ref-tests'
Junio C Hamano [Wed, 15 Dec 2021 17:39:54 +0000 (09:39 -0800)] 
Merge branch 'hn/allow-bogus-oid-in-ref-tests'

The test helper for refs subsystem learned to write bogus and/or
nonexistent object name to refs to simulate error situations we
want to test Git in.

* hn/allow-bogus-oid-in-ref-tests:
  t1430: create valid symrefs using test-helper
  t1430: remove refs using test-tool
  refs: introduce REF_SKIP_REFNAME_VERIFICATION flag
  refs: introduce REF_SKIP_OID_VERIFICATION flag
  refs: update comment.
  test-ref-store: plug memory leak in cmd_delete_refs
  test-ref-store: parse symbolic flag constants
  test-ref-store: remove force-create argument for create-reflog

2 years agoMerge branch 'ab/parse-options-cleanup'
Junio C Hamano [Wed, 15 Dec 2021 17:39:54 +0000 (09:39 -0800)] 
Merge branch 'ab/parse-options-cleanup'

Change the type of an internal function to return an enum (instead
of int) and replace -2 that was used to signal an error with -1.

* ab/parse-options-cleanup:
  parse-options.c: use "enum parse_opt_result" for parse_nodash_opt()

2 years agoMerge branch 're/color-default-reset'
Junio C Hamano [Wed, 15 Dec 2021 17:39:53 +0000 (09:39 -0800)] 
Merge branch 're/color-default-reset'

"default" and "reset" colors have been added to our palette.

* re/color-default-reset:
  color: allow colors to be prefixed with "reset"
  color: support "default" to restore fg/bg color
  color: add missing GIT_COLOR_* white/black constants

2 years agoMerge branch 'jc/reflog-iterator-callback-doc'
Junio C Hamano [Wed, 15 Dec 2021 17:39:52 +0000 (09:39 -0800)] 
Merge branch 'jc/reflog-iterator-callback-doc'

Document the parameters given to the reflog entry iterator callback
functions.

* jc/reflog-iterator-callback-doc:
  refs: document callback for reflog-ent iterators

2 years agoMerge branch 'ew/test-wo-fsync'
Junio C Hamano [Wed, 15 Dec 2021 17:39:51 +0000 (09:39 -0800)] 
Merge branch 'ew/test-wo-fsync'

Allow running our tests while disabling fsync.

* ew/test-wo-fsync:
  tests: disable fsync everywhere

2 years agoMerge branch 'ew/cbtree-remove-unused-and-broken-cb-unlink'
Junio C Hamano [Wed, 15 Dec 2021 17:39:51 +0000 (09:39 -0800)] 
Merge branch 'ew/cbtree-remove-unused-and-broken-cb-unlink'

Code clean-up.

* ew/cbtree-remove-unused-and-broken-cb-unlink:
  cbtree: remove broken and unused cb_unlink

2 years agoMerge branch 'ds/sparse-deep-pattern-checkout-fix'
Junio C Hamano [Wed, 15 Dec 2021 17:39:50 +0000 (09:39 -0800)] 
Merge branch 'ds/sparse-deep-pattern-checkout-fix'

The sparse-index/sparse-checkout feature had a bug in its use of
the matching code to determine which path is in or outside the
sparse checkout patterns.

* ds/sparse-deep-pattern-checkout-fix:
  unpack-trees: use traverse_path instead of name
  t1092: add deeper changes during a checkout

2 years agoMerge branch 'tb/pack-revindex-on-disk-cleanup'
Junio C Hamano [Wed, 15 Dec 2021 17:39:50 +0000 (09:39 -0800)] 
Merge branch 'tb/pack-revindex-on-disk-cleanup'

Code clean-up.

* tb/pack-revindex-on-disk-cleanup:
  packfile: make `close_pack_revindex()` static

2 years agoMerge branch 'es/doc-stdout-vs-stderr'
Junio C Hamano [Wed, 15 Dec 2021 17:39:49 +0000 (09:39 -0800)] 
Merge branch 'es/doc-stdout-vs-stderr'

Coding guideline document has been updated to clarify what goes to
standard error in our system.

* es/doc-stdout-vs-stderr:
  CodingGuidelines: document which output goes to stdout vs. stderr

2 years agoMerge branch 'js/test-initial-branch-override-cleanup'
Junio C Hamano [Wed, 15 Dec 2021 17:39:49 +0000 (09:39 -0800)] 
Merge branch 'js/test-initial-branch-override-cleanup'

Many tests that used to need GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
mechanism to force "git" to use 'master' as the default name for
the initial branch no longer need it; the use of the mechanism from
them have been removed.

* js/test-initial-branch-override-cleanup:
  tests: set GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME only when needed

2 years agoMerge branch 'es/worktree-chatty-to-stderr'
Junio C Hamano [Wed, 15 Dec 2021 17:39:49 +0000 (09:39 -0800)] 
Merge branch 'es/worktree-chatty-to-stderr'

"git worktree add" showed "Preparing worktree" message to the
standard output stream, but when it failed, the message from die()
went to the standard error stream.  Depending on the order the
stdio streams are flushed at the program end, this resulted in
confusing output.  It has been corrected by sending all the chatty
messages to the standard error stream.

* es/worktree-chatty-to-stderr:
  git-worktree.txt: add missing `-v` to synopsis for `worktree list`
  worktree: send "chatty" messages to stderr

2 years agoMerge branch 'ab/ci-updates'
Junio C Hamano [Wed, 15 Dec 2021 17:39:49 +0000 (09:39 -0800)] 
Merge branch 'ab/ci-updates'

Drop support for TravisCI and update test workflows at GitHub.

* ab/ci-updates:
  CI: don't run "make test" twice in one job
  CI: use "$runs_on_pool", not "$jobname" to select packages & config
  CI: rename the "Linux32" job to lower-case "linux32"
  CI: use shorter names that fit in UX tooltips
  CI: remove Travis CI support

2 years agoMerge branch 'hn/reflog-tests'
Junio C Hamano [Wed, 15 Dec 2021 17:39:48 +0000 (09:39 -0800)] 
Merge branch 'hn/reflog-tests'

Prepare tests on ref API to help testing reftable backends.

* hn/reflog-tests:
  refs/debug: trim trailing LF from reflog message
  test-ref-store: tweaks to for-each-reflog-ent format
  t1405: check for_each_reflog_ent_reverse() more thoroughly
  test-ref-store: don't add newline to reflog message
  show-branch: show reflog message

2 years agoMerge branch 'rj/receive-pack-avoid-sigpipe-during-status-reporting'
Junio C Hamano [Wed, 15 Dec 2021 17:39:48 +0000 (09:39 -0800)] 
Merge branch 'rj/receive-pack-avoid-sigpipe-during-status-reporting'

When the "git push" command is killed while the receiving end is
trying to report what happened to the ref update proposals, the
latter used to die, due to SIGPIPE.  The code now ignores SIGPIPE
to increase our chances to run the post-receive hook after it
happens.

* rj/receive-pack-avoid-sigpipe-during-status-reporting:
  receive-pack: ignore SIGPIPE while reporting status to client

2 years agoMerge branch 'es/pretty-describe-more'
Junio C Hamano [Wed, 15 Dec 2021 17:39:48 +0000 (09:39 -0800)] 
Merge branch 'es/pretty-describe-more'

Extend "git log --format=%(describe)" placeholder to allow passing
selected command-line options to the underlying "git describe"
command.

* es/pretty-describe-more:
  pretty: add abbrev option to %(describe)
  pretty: add tag option to %(describe)
  pretty.c: rework describe options parsing for better extensibility

2 years agoMerge branch 'ab/run-command'
Junio C Hamano [Wed, 15 Dec 2021 17:39:47 +0000 (09:39 -0800)] 
Merge branch 'ab/run-command'

API clean-up.

* ab/run-command:
  run-command API: remove "env" member, always use "env_array"
  difftool: use "env_array" to simplify memory management
  run-command API: remove "argv" member, always use "args"
  run-command API users: use strvec_push(), not argv construction
  run-command API users: use strvec_pushl(), not argv construction
  run-command tests: use strvec_pushv(), not argv assignment
  run-command API users: use strvec_pushv(), not argv assignment
  upload-archive: use regular "struct child_process" pattern
  worktree: stop being overly intimate with run_command() internals

2 years agoMerge branch 'hn/t1404-df-limitation-is-ref-files-only'
Junio C Hamano [Wed, 15 Dec 2021 17:39:47 +0000 (09:39 -0800)] 
Merge branch 'hn/t1404-df-limitation-is-ref-files-only'

Test update.

* hn/t1404-df-limitation-is-ref-files-only:
  t1404: mark directory/file conflict tests with REFFILES

2 years agoMerge branch 'en/zdiff3'
Junio C Hamano [Wed, 15 Dec 2021 17:39:47 +0000 (09:39 -0800)] 
Merge branch 'en/zdiff3'

"Zealous diff3" style of merge conflict presentation has been added.

* en/zdiff3:
  update documentation for new zdiff3 conflictStyle
  xdiff: implement a zealous diff3, or "zdiff3"

2 years agoMerge branch 'ds/trace2-regions-in-tests'
Junio C Hamano [Wed, 15 Dec 2021 17:39:46 +0000 (09:39 -0800)] 
Merge branch 'ds/trace2-regions-in-tests'

The default setting for trace2 event nesting was too low to cause
test failures, which is worked around by bumping it up in the test
framework.

* ds/trace2-regions-in-tests:
  t/t*: remove custom GIT_TRACE2_EVENT_NESTING
  test-lib.sh: set GIT_TRACE2_EVENT_NESTING

2 years agoMerge branch 'fs/test-prereq'
Junio C Hamano [Wed, 15 Dec 2021 17:39:46 +0000 (09:39 -0800)] 
Merge branch 'fs/test-prereq'

The test framework learns to list unsatisfied test prerequisites,
and optionally error out when prerequisites that are expected to be
satisfied are not.

* fs/test-prereq:
  test-lib: make BAIL_OUT() work in tests and prereq
  test-lib: introduce required prereq for test runs
  test-lib: show missing prereq summary

2 years agoMerge branch 'ab/mark-leak-free-tests-even-more'
Junio C Hamano [Wed, 15 Dec 2021 17:39:46 +0000 (09:39 -0800)] 
Merge branch 'ab/mark-leak-free-tests-even-more'

More tests are marked as leak-free.

* ab/mark-leak-free-tests-even-more:
  leak tests: mark some fast-import tests as passing with SANITIZE=leak
  leak tests: mark some config tests as passing with SANITIZE=leak
  leak tests: mark some status tests as passing with SANITIZE=leak
  leak tests: mark some clone tests as passing with SANITIZE=leak
  leak tests: mark some add tests as passing with SANITIZE=leak
  leak tests: mark some diff tests as passing with SANITIZE=leak
  leak tests: mark some apply tests as passing with SANITIZE=leak
  leak tests: mark some notes tests as passing with SANITIZE=leak
  leak tests: mark some update-index tests as passing with SANITIZE=leak
  leak tests: mark some rev-parse tests as passing with SANITIZE=leak
  leak tests: mark some rev-list tests as passing with SANITIZE=leak
  leak tests: mark some misc tests as passing with SANITIZE=leak
  leak tests: mark most gettext tests as passing with SANITIZE=leak
  leak tests: mark "sort" test as passing SANITIZE=leak
  leak tests: mark a read-tree test as passing SANITIZE=leak

2 years agoMerge branch 'hn/reftable'
Junio C Hamano [Wed, 15 Dec 2021 17:39:45 +0000 (09:39 -0800)] 
Merge branch 'hn/reftable'

The "reftable" backend for the refs API, without integrating into
the refs subsystem, has been added.

* hn/reftable:
  Add "test-tool dump-reftable" command.
  reftable: add dump utility
  reftable: implement stack, a mutable database of reftable files.
  reftable: implement refname validation
  reftable: add merged table view
  reftable: add a heap-based priority queue for reftable records
  reftable: reftable file level tests
  reftable: read reftable files
  reftable: generic interface to tables
  reftable: write reftable files
  reftable: a generic binary tree implementation
  reftable: reading/writing blocks
  Provide zlib's uncompress2 from compat/zlib-compat.c
  reftable: (de)serialization for the polymorphic record type.
  reftable: add blocksource, an abstraction for random access reads
  reftable: utility functions
  reftable: add error related functionality
  reftable: add LICENSE
  hash.h: provide constants for the hash IDs

2 years agoThe second batch
Junio C Hamano [Fri, 10 Dec 2021 22:28:28 +0000 (14:28 -0800)] 
The second batch

2 years agoMerge branch 'en/rebase-x-fix'
Junio C Hamano [Fri, 10 Dec 2021 22:35:16 +0000 (14:35 -0800)] 
Merge branch 'en/rebase-x-fix'

"git rebase -x" added an unnecessary 'exec' instructions before
'noop', which has been corrected.

* en/rebase-x-fix:
  sequencer: avoid adding exec commands for non-commit creating commands

2 years agoMerge branch 'cb/add-p-single-key-fix'
Junio C Hamano [Fri, 10 Dec 2021 22:35:16 +0000 (14:35 -0800)] 
Merge branch 'cb/add-p-single-key-fix'

The single-key-input mode in "git add -p" had some code to handle
keys that generate a sequence of input via ReadKey(), which did not
handle end-of-file correctly, which has been fixed.

* cb/add-p-single-key-fix:
  add -p: avoid use of undefined $key when ReadKey -> EOF

2 years agoMerge branch 'cb/mingw-gmtime-r'
Junio C Hamano [Fri, 10 Dec 2021 22:35:15 +0000 (14:35 -0800)] 
Merge branch 'cb/mingw-gmtime-r'

Build fix on Windows.

* cb/mingw-gmtime-r:
  mingw: avoid fallback for {local,gm}time_r()

2 years agoMerge branch 'yn/complete-date-format-options'
Junio C Hamano [Fri, 10 Dec 2021 22:35:15 +0000 (14:35 -0800)] 
Merge branch 'yn/complete-date-format-options'

The completion script (in contrib/) learns that the "--date"
option of commands from the "git log" family takes "human" and
"auto" as valid values.

* yn/complete-date-format-options:
  completion: add human and auto: date format

2 years agoMerge branch 'em/missing-pager'
Junio C Hamano [Fri, 10 Dec 2021 22:35:15 +0000 (14:35 -0800)] 
Merge branch 'em/missing-pager'

When a non-existent program is given as the pager, we tried to
reuse an uninitialized child_process structure and crashed, which
has been fixed.

* em/missing-pager:
  pager: fix crash when pager program doesn't exist

2 years agoMerge branch 'mp/absorb-submodule-git-dir-upon-deinit'
Junio C Hamano [Fri, 10 Dec 2021 22:35:15 +0000 (14:35 -0800)] 
Merge branch 'mp/absorb-submodule-git-dir-upon-deinit'

"git submodule deinit" for a submodule whose .git metadata
directory is embedded in its working tree refused to work, until
the submodule gets converted to use the "absorbed" form where the
metadata directory is stored in superproject, and a gitfile at the
top-level of the working tree of the submodule points at it.  The
command is taught to convert such submodules to the absorbed form
as needed.

* mp/absorb-submodule-git-dir-upon-deinit:
  submodule: absorb git dir instead of dying on deinit

2 years agoMerge branch 'bc/require-c99'
Junio C Hamano [Fri, 10 Dec 2021 22:35:14 +0000 (14:35 -0800)] 
Merge branch 'bc/require-c99'

Weather balloon to break people with compilers that do not support
C99.

* bc/require-c99:
  git-compat-util: add a test balloon for C99 support

2 years agoMerge branch 'hn/create-reflog-simplify'
Junio C Hamano [Fri, 10 Dec 2021 22:35:13 +0000 (14:35 -0800)] 
Merge branch 'hn/create-reflog-simplify'

A small simplification of API.

* hn/create-reflog-simplify:
  refs: drop force_create argument of create_reflog API

2 years agoMerge branch 'jt/midx-doc-fix'
Junio C Hamano [Fri, 10 Dec 2021 22:35:13 +0000 (14:35 -0800)] 
Merge branch 'jt/midx-doc-fix'

Docfix.

* jt/midx-doc-fix:
  Doc: no midx and partial clone relation

2 years agoMerge branch 'jk/t7006-sigpipe-tests-fix'
Junio C Hamano [Fri, 10 Dec 2021 22:35:13 +0000 (14:35 -0800)] 
Merge branch 'jk/t7006-sigpipe-tests-fix'

The function to cull a child process and determine the exit status
had two separate code paths for normal callers and callers in a
signal handler, and the latter did not yield correct value when the
child has caught a signal.  The handling of the exit status has
been unified for these two code paths.  An existing test with
flakiness has also been corrected.

* jk/t7006-sigpipe-tests-fix:
  t7006: simplify exit-code checks for sigpipe tests
  t7006: clean up SIGPIPE handling in trace2 tests
  run-command: unify signal and regular logic for wait_or_whine()

2 years agoMerge branch 'jk/refs-g11-workaround'
Junio C Hamano [Fri, 10 Dec 2021 22:35:12 +0000 (14:35 -0800)] 
Merge branch 'jk/refs-g11-workaround'

Workaround for a false-alarm by gcc-11

* jk/refs-g11-workaround:
  refs: work around gcc-11 warning with REF_HAVE_NEW

2 years agoMerge branch 'jk/fetch-pack-avoid-sigpipe-to-index-pack'
Junio C Hamano [Fri, 10 Dec 2021 22:35:12 +0000 (14:35 -0800)] 
Merge branch 'jk/fetch-pack-avoid-sigpipe-to-index-pack'

"git fetch", when received a bad packfile, can fail with SIGPIPE.
This wasn't wrong per-se, but we now detect the situation and fail
in a more predictable way.

* jk/fetch-pack-avoid-sigpipe-to-index-pack:
  fetch-pack: ignore SIGPIPE when writing to index-pack

2 years agoMerge branch 'hk/ci-checkwhitespace-commentfix'
Junio C Hamano [Fri, 10 Dec 2021 22:35:12 +0000 (14:35 -0800)] 
Merge branch 'hk/ci-checkwhitespace-commentfix'

Comment fix.

* hk/ci-checkwhitespace-commentfix:
  ci(check-whitespace): update stale file top comments

2 years agoMerge branch 'vd/sparse-reset'
Junio C Hamano [Fri, 10 Dec 2021 22:35:12 +0000 (14:35 -0800)] 
Merge branch 'vd/sparse-reset'

Various operating modes of "git reset" have been made to work
better with the sparse index.

* vd/sparse-reset:
  unpack-trees: improve performance of next_cache_entry
  reset: make --mixed sparse-aware
  reset: make sparse-aware (except --mixed)
  reset: integrate with sparse index
  reset: expand test coverage for sparse checkouts
  sparse-index: update command for expand/collapse test
  reset: preserve skip-worktree bit in mixed reset
  reset: rename is_missing to !is_in_reset_tree

2 years agoMerge branch 'tl/midx-docfix'
Junio C Hamano [Fri, 10 Dec 2021 22:35:11 +0000 (14:35 -0800)] 
Merge branch 'tl/midx-docfix'

Doc mark-up fix.

* tl/midx-docfix:
  midx: fix a formatting issue in "multi-pack-index.txt"

2 years agoMerge branch 'po/size-t-for-vs'
Junio C Hamano [Fri, 10 Dec 2021 22:35:10 +0000 (14:35 -0800)] 
Merge branch 'po/size-t-for-vs'

On platforms where ulong is shorter than size_t, code paths that
shifted 1 or 1U to the left lacked the necessary cast to size_t,
which have been corrected.

* po/size-t-for-vs:
  object-file.c: LLP64 compatibility, upcast unity for left shift
  diffcore-delta.c: LLP64 compatibility, upcast unity for left shift
  repack.c: LLP64 compatibility, upcast unity for left shift

2 years agoMerge branch 'rs/mergesort'
Junio C Hamano [Fri, 10 Dec 2021 22:35:10 +0000 (14:35 -0800)] 
Merge branch 'rs/mergesort'

Bitop fix for platforms whose "long" is 32-bit.

* rs/mergesort:
  mergesort: avoid left shift overflow

2 years agoMerge branch 'ah/advice-pull-has-no-preference-between-rebase-and-merge'
Junio C Hamano [Fri, 10 Dec 2021 22:35:09 +0000 (14:35 -0800)] 
Merge branch 'ah/advice-pull-has-no-preference-between-rebase-and-merge'

The advice message given by "git pull" when the user hasn't made a
choice between merge and rebase still said that the merge is the
default, which no longer is the case.  This has been corrected.

* ah/advice-pull-has-no-preference-between-rebase-and-merge:
  pull: don't say that merge is "the default strategy"

2 years agoMerge branch 'ab/checkout-branch-info-leakfix'
Junio C Hamano [Fri, 10 Dec 2021 22:35:09 +0000 (14:35 -0800)] 
Merge branch 'ab/checkout-branch-info-leakfix'

Leakfix.

* ab/checkout-branch-info-leakfix:
  checkout: fix "branch info" memory leaks

2 years agoMerge branch 'jk/t5319-midx-corruption-test-deflake'
Junio C Hamano [Fri, 10 Dec 2021 22:35:08 +0000 (14:35 -0800)] 
Merge branch 'jk/t5319-midx-corruption-test-deflake'

Test fix.

* jk/t5319-midx-corruption-test-deflake:
  t5319: corrupt more bytes of the midx checksum

2 years agoMerge branch 'js/trace2-avoid-recursive-errors'
Junio C Hamano [Fri, 10 Dec 2021 22:35:08 +0000 (14:35 -0800)] 
Merge branch 'js/trace2-avoid-recursive-errors'

trace2 error code path fix.

* js/trace2-avoid-recursive-errors:
  trace2: disable tr2_dst before warning on write errors

2 years agoMerge branch 'jt/pack-header-lshift-overflow'
Junio C Hamano [Fri, 10 Dec 2021 22:35:08 +0000 (14:35 -0800)] 
Merge branch 'jt/pack-header-lshift-overflow'

The code to decode the length of packed object size has been
corrected.

* jt/pack-header-lshift-overflow:
  packfile: avoid overflowing shift during decode

2 years agoMerge branch 'jk/jump-merge-with-pathspec'
Junio C Hamano [Fri, 10 Dec 2021 22:35:08 +0000 (14:35 -0800)] 
Merge branch 'jk/jump-merge-with-pathspec'

The "merge" subcommand of "git jump" (in contrib/) silently ignored
pathspec and other parameters.

* jk/jump-merge-with-pathspec:
  git-jump: pass "merge" arguments to ls-files

2 years agoMerge branch 'jk/test-bitmap-fix'
Junio C Hamano [Fri, 10 Dec 2021 22:35:08 +0000 (14:35 -0800)] 
Merge branch 'jk/test-bitmap-fix'

Tighten code for testing pack-bitmap.

* jk/test-bitmap-fix:
  test_bitmap_hashes(): handle repository without bitmaps

2 years agoMerge branch 'ab/generate-command-list'
Junio C Hamano [Fri, 10 Dec 2021 22:35:08 +0000 (14:35 -0800)] 
Merge branch 'ab/generate-command-list'

Build optimization.

* ab/generate-command-list:
  generate-cmdlist.sh: don't parse command-list.txt thrice
  generate-cmdlist.sh: replace "grep' invocation with a shell version
  generate-cmdlist.sh: do not shell out to "sed"
  generate-cmdlist.sh: stop sorting category lines
  generate-cmdlist.sh: replace for loop by printf's auto-repeat feature
  generate-cmdlist.sh: run "grep | sort", not "sort | grep"
  generate-cmdlist.sh: don't call get_categories() from category_list()
  generate-cmdlist.sh: spawn fewer processes
  generate-cmdlist.sh: trivial whitespace change
  command-list.txt: sort with "LC_ALL=C sort"

2 years agoMerge branch 'tw/var-default-branch'
Junio C Hamano [Fri, 10 Dec 2021 22:35:07 +0000 (14:35 -0800)] 
Merge branch 'tw/var-default-branch'

"git var GIT_DEFAULT_BRANCH" is a way to see what name is used for
the newly created branch if "git init" is run.

* tw/var-default-branch:
  var: add GIT_DEFAULT_BRANCH variable

2 years agoMerge branch 'jk/strbuf-addftime-seconds-since-epoch'
Junio C Hamano [Fri, 10 Dec 2021 22:35:07 +0000 (14:35 -0800)] 
Merge branch 'jk/strbuf-addftime-seconds-since-epoch'

The "--date=format:<strftime>" gained a workaround for the lack of
system support for a non-local timezone to handle "%s" placeholder.

* jk/strbuf-addftime-seconds-since-epoch:
  strbuf_addftime(): handle "%s" manually

2 years agoMerge branch 'js/ci-no-directional-formatting'
Junio C Hamano [Fri, 10 Dec 2021 22:35:06 +0000 (14:35 -0800)] 
Merge branch 'js/ci-no-directional-formatting'

CI has been taught to catch some Unicode directional formatting
sequence that can be used in certain mischief.

* js/ci-no-directional-formatting:
  ci: disallow directional formatting

2 years agoMerge branch 'jc/fix-first-object-walk'
Junio C Hamano [Fri, 10 Dec 2021 22:35:05 +0000 (14:35 -0800)] 
Merge branch 'jc/fix-first-object-walk'

Doc update.

* jc/fix-first-object-walk:
  docs: add headers in MyFirstObjectWalk
  docs: fix places that break compilation in MyFirstObjectWalk

2 years agoMerge branch 'if/redact-packfile-uri'
Junio C Hamano [Fri, 10 Dec 2021 22:35:04 +0000 (14:35 -0800)] 
Merge branch 'if/redact-packfile-uri'

Redact the path part of packfile URI that appears in the trace output.

* if/redact-packfile-uri:
  http-fetch: redact url on die() message
  fetch-pack: redact packfile urls in traces

2 years agoMerge branch 'ja/doc-cleanup'
Junio C Hamano [Fri, 10 Dec 2021 22:35:03 +0000 (14:35 -0800)] 
Merge branch 'ja/doc-cleanup'

Doc update.

* ja/doc-cleanup:
  init doc: --shared=0xxx does not give umask but perm bits
  doc: git-init: clarify file modes in octal.
  doc: git-http-push: describe the refs as pattern pairs
  doc: uniformize <URL> placeholders' case
  doc: use three dots for indicating repetition instead of star
  doc: git-ls-files: express options as optional alternatives
  doc: use only hyphens as word separators in placeholders
  doc: express grammar placeholders between angle brackets
  doc: split placeholders as individual tokens
  doc: fix git credential synopsis

2 years agoMerge branch 'gc/remote-with-fewer-static-global-variables'
Junio C Hamano [Fri, 10 Dec 2021 22:35:02 +0000 (14:35 -0800)] 
Merge branch 'gc/remote-with-fewer-static-global-variables'

Code clean-up to eventually allow information on remotes defined
for an arbitrary repository to be read.

* gc/remote-with-fewer-static-global-variables:
  remote: die if branch is not found in repository
  remote: remove the_repository->remote_state from static methods
  remote: use remote_state parameter internally
  remote: move static variables into per-repository struct
  t5516: add test case for pushing remote refspecs

2 years agoMerge branch 'vd/sparse-sparsity-fix-on-read'
Junio C Hamano [Fri, 10 Dec 2021 22:35:01 +0000 (14:35 -0800)] 
Merge branch 'vd/sparse-sparsity-fix-on-read'

Ensure that the sparseness of the in-core index matches the
index.sparse configuration specified by the repository immediately
after the on-disk index file is read.

* vd/sparse-sparsity-fix-on-read:
  sparse-index: update do_read_index to ensure correct sparsity
  sparse-index: add ensure_correct_sparsity function
  sparse-index: avoid unnecessary cache tree clearing
  test-read-cache.c: prepare_repo_settings after config init

2 years agoMerge branch 'cw/protocol-v2-doc-fix'
Junio C Hamano [Fri, 10 Dec 2021 22:35:00 +0000 (14:35 -0800)] 
Merge branch 'cw/protocol-v2-doc-fix'

Doc update.

* cw/protocol-v2-doc-fix:
  protocol-v2.txt: align delim-pkt spec with usage

2 years agossh signing: verify ssh-keygen in test prereq
Fabian Stelzer [Thu, 9 Dec 2021 08:52:49 +0000 (09:52 +0100)] 
ssh signing: verify ssh-keygen in test prereq

Do a full ssh signing, find-principals and verify operation in the test
prereq's to make sure ssh-keygen works as expected. Only generating the
keys and verifying its presence is not sufficient in some situations.
One example was ssh-keygen creating unusable ssh keys in cygwin because
of unsafe default permissions for the key files. The other a broken
openssh 8.7 that segfaulted on any find-principals operation. This
extended prereq check avoids future test breakages in case ssh-keygen or
any environment behaviour changes.

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agossh signing: make fmt-merge-msg consider key lifetime
Fabian Stelzer [Thu, 9 Dec 2021 08:52:48 +0000 (09:52 +0100)] 
ssh signing: make fmt-merge-msg consider key lifetime

Set the payload_type for check_signature() when generating merge messages to
verify merged tags signatures key lifetimes.
Implements the same tests as for verify-commit.

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agossh signing: make verify-tag consider key lifetime
Fabian Stelzer [Thu, 9 Dec 2021 08:52:47 +0000 (09:52 +0100)] 
ssh signing: make verify-tag consider key lifetime

Set the payload_type for check_signature() when calling verify-tag.
Implements the same tests as for verify-commit.

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agossh signing: make git log verify key lifetime
Fabian Stelzer [Thu, 9 Dec 2021 08:52:46 +0000 (09:52 +0100)] 
ssh signing: make git log verify key lifetime

Set the payload_type for check_signature() when calling git log.
Implements the same tests as for verify-commit.

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agossh signing: make verify-commit consider key lifetime
Fabian Stelzer [Thu, 9 Dec 2021 08:52:45 +0000 (09:52 +0100)] 
ssh signing: make verify-commit consider key lifetime

If valid-before/after dates are configured for this signatures key in the
allowedSigners file then the verification should check if the key was valid at
the time the commit was made. This allows for graceful key rollover and
revoking keys without invalidating all previous commits.
This feature needs openssh > 8.8. Older ssh-keygen versions will simply
ignore this flag and use the current time.
Strictly speaking this feature is available in 8.7, but since 8.7 has a
bug that makes it unusable in another needed call we require 8.8.

Timestamp information is present on most invocations of check_signature.
However signer ident is not. We will need the signer email / name to be able
to implement "Trust on first use" functionality later.
Since the payload contains all necessary information we can parse it
from there. The caller only needs to provide us some info about the
payload by setting payload_type in the signature_check struct.

 - Add payload_type field & enum and payload_timestamp to struct
   signature_check
 - Populate the timestamp when not already set if we know about the
   payload type
 - Pass -Overify-time={payload_timestamp} in the users timezone to all
   ssh-keygen verification calls
 - Set the payload type when verifying commits
 - Add tests for expired, not yet valid and keys having a commit date
   outside of key validity as well as within

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agossh signing: add key lifetime test prereqs
Fabian Stelzer [Thu, 9 Dec 2021 08:52:44 +0000 (09:52 +0100)] 
ssh signing: add key lifetime test prereqs

if ssh-keygen supports -Overify-time, add test keys marked as expired,
not yet valid and valid both within the test_tick timeframe and outside of it.

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agossh signing: use sigc struct to pass payload
Fabian Stelzer [Thu, 9 Dec 2021 08:52:43 +0000 (09:52 +0100)] 
ssh signing: use sigc struct to pass payload

To be able to extend the payload metadata with things like its creation
timestamp or the creators ident we remove the payload parameters to
check_signature() and use the already existing sigc->payload field
instead, only adding the length field to the struct. This also allows
us to get rid of the xmemdupz() calls in the verify functions. Since
sigc is now used to input data as well as output the result move it to
the front of the function list.

 - Add payload_length to struct signature_check
 - Populate sigc.payload/payload_len on all call sites
 - Remove payload parameters to check_signature()
 - Remove payload parameters to internal verify_* functions and use sigc
   instead
 - Remove xmemdupz() used for verbose output since payload is now already
   populated.

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/fmt-merge-msg: make gpgssh tests more specific
Fabian Stelzer [Thu, 9 Dec 2021 08:52:42 +0000 (09:52 +0100)] 
t/fmt-merge-msg: make gpgssh tests more specific

Some GPGSSH fmt-merge-msg tests were only grepping for failed/successful
signature validation and not checking for the tag in the resulting merge
message. Add the missing grep for it.

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/fmt-merge-msg: do not redirect stderr
Fabian Stelzer [Thu, 9 Dec 2021 08:52:41 +0000 (09:52 +0100)] 
t/fmt-merge-msg: do not redirect stderr

All the GPG and GPGSSH tests are redirecing stdout as well as stderr
to `actual` and grep for success/failure over the resulting file.
However, no output is printed on stderr and we do not need to
include it in the grep.

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocbtree: remove broken and unused cb_unlink
Eric Wong [Tue, 7 Dec 2021 18:38:10 +0000 (18:38 +0000)] 
cbtree: remove broken and unused cb_unlink

cb_unlink is broken once a node is no longer self-referential
due to subsequent insertions.  This is a consequence of an
intrusive implementation and I'm not sure if it's easily fixable
while retaining our cache-friendly intrusive property (I've
tried for several hours in another project).

In any case, we're not using cb_unlink anywhere in our codebase,
just get rid of it to avoid misleading future readers.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot1430: create valid symrefs using test-helper
Han-Wen Nienhuys [Tue, 7 Dec 2021 13:38:20 +0000 (13:38 +0000)] 
t1430: create valid symrefs using test-helper

This still leaves some other direct filesystem access. Currently, the files
backend does not allow invalidly named symrefs. Fixes for this are currently in
the 'seen' branch

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot1430: remove refs using test-tool
Han-Wen Nienhuys [Tue, 7 Dec 2021 13:38:19 +0000 (13:38 +0000)] 
t1430: remove refs using test-tool

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorefs: introduce REF_SKIP_REFNAME_VERIFICATION flag
Han-Wen Nienhuys [Tue, 7 Dec 2021 13:38:18 +0000 (13:38 +0000)] 
refs: introduce REF_SKIP_REFNAME_VERIFICATION flag

Use this flag with the test-helper in t1430, to avoid direct writes to the ref
database.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorefs: introduce REF_SKIP_OID_VERIFICATION flag
Han-Wen Nienhuys [Tue, 7 Dec 2021 13:38:17 +0000 (13:38 +0000)] 
refs: introduce REF_SKIP_OID_VERIFICATION flag

This lets the ref-store test helper write non-existent or unparsable objects
into the ref storage.

Use this to make t1006 and t3800 independent of the files storage backend.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorefs: update comment.
Han-Wen Nienhuys [Tue, 7 Dec 2021 13:38:16 +0000 (13:38 +0000)] 
refs: update comment.

REF_IS_PRUNING is right below this comment, so it clearly does not belong in
this comment. This was apparently introduced in commit 5ac95fee (Nov 5, 2017
"refs: tidy up and adjust visibility of the `ref_update` flags").

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-ref-store: plug memory leak in cmd_delete_refs
Han-Wen Nienhuys [Tue, 7 Dec 2021 13:38:15 +0000 (13:38 +0000)] 
test-ref-store: plug memory leak in cmd_delete_refs

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-ref-store: parse symbolic flag constants
Han-Wen Nienhuys [Tue, 7 Dec 2021 13:38:14 +0000 (13:38 +0000)] 
test-ref-store: parse symbolic flag constants

This lets tests use REF_XXXX constants instead of hardcoded integers. The flag
names should be separated by a ','.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-ref-store: remove force-create argument for create-reflog
Han-Wen Nienhuys [Tue, 7 Dec 2021 13:38:13 +0000 (13:38 +0000)] 
test-ref-store: remove force-create argument for create-reflog

Nobody uses force_create=0, so this flag is unnecessary.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoobject.c: use BUG(...) no die("BUG: ...") in lookup_object_by_type()
Ævar Arnfjörð Bjarmason [Tue, 7 Dec 2021 11:05:54 +0000 (12:05 +0100)] 
object.c: use BUG(...) no die("BUG: ...") in lookup_object_by_type()

Adjust code added in 7463064b280 (object.h: add
lookup_object_by_type() function, 2021-06-22) to use the BUG()
function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopathspec: use BUG(...) not die("BUG:%s:%d....", <file>, <line>)
Ævar Arnfjörð Bjarmason [Tue, 7 Dec 2021 11:05:53 +0000 (12:05 +0100)] 
pathspec: use BUG(...) not die("BUG:%s:%d....", <file>, <line>)

Change code that was added in 8f4f8f4579f (guard against new pathspec
magic in pathspec matching code, 2013-07-14) to use the BUG() macro
instead of emitting a "fatal" message with the "__FILE__"-name and
"__LINE__"-numbers.

The original code predated the existence of the BUG() function, which
was added in d8193743e08 (usage.c: add BUG() function, 2017-05-12).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agostrbuf.h: use BUG(...) not die("BUG: ...")
Ævar Arnfjörð Bjarmason [Tue, 7 Dec 2021 11:05:52 +0000 (12:05 +0100)] 
strbuf.h: use BUG(...) not die("BUG: ...")

In 7141efab248 (strbuf: clarify assertion in strbuf_setlen(),
2011-04-27) this 'die("BUG: "' invocation was added with the rationale
that strbuf.c had existing users doing the same, but those users were
later changed to use BUG() in 033abf97fcb (Replace all die("BUG: ...")
calls by BUG() ones, 2018-05-02). Let's do the same here.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopack-objects: use BUG(...) not die("BUG: ...")
Ævar Arnfjörð Bjarmason [Tue, 7 Dec 2021 11:05:51 +0000 (12:05 +0100)] 
pack-objects: use BUG(...) not die("BUG: ...")

Change this code added in da93d12b004 (pack-objects: be incredibly
anal about stdio semantics, 2006-04-02) to use BUG() instead.

See 1a07e59c3e2 (Update messages in preparation for i18n, 2018-07-21)
for when the "BUG: " prefix was added, and [1] for background on the
Solaris behavior that prompted the exhaustive error checking in this
fgets() loop.

1. https://lore.kernel.org/git/824.1144007555@lotus.CS.Berkeley.EDU/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoblame: enable and test the sparse index
Lessley Dennington [Mon, 6 Dec 2021 15:56:01 +0000 (15:56 +0000)] 
blame: enable and test the sparse index

Enable the sparse index for the 'git blame' command. The index was already
not expanded with this command, so the most interesting thing to do is to
add tests that verify that 'git blame' behaves correctly when the sparse
index is enabled and that its performance improves. More specifically, these
cases are:

1. The index is not expanded for 'blame' when given paths in the sparse
checkout cone at multiple levels.

2. Performance measurably improves for 'blame' with sparse index when given
paths in the sparse checkout cone at multiple levels.

The `p2000` tests demonstrate a ~60% execution time reduction when running
'blame' for a file two levels deep and and a ~30% execution time reduction
for a file three levels deep.

Test                                         before  after
----------------------------------------------------------------
2000.62: git blame f2/f4/a (full-v3)         0.31    0.32 +3.2%
2000.63: git blame f2/f4/a (full-v4)         0.29    0.31 +6.9%
2000.64: git blame f2/f4/a (sparse-v3)       0.55    0.23 -58.2%
2000.65: git blame f2/f4/a (sparse-v4)       0.57    0.23 -59.6%
2000.66: git blame f2/f4/f3/a (full-v3)      0.77    0.85 +10.4%
2000.67: git blame f2/f4/f3/a (full-v4)      0.78    0.81 +3.8%
2000.68: git blame f2/f4/f3/a (sparse-v3)    1.07    0.72 -32.7%
2000.99: git blame f2/f4/f3/a (sparse-v4)    1.05    0.73 -30.5%

We do not include paths outside the sparse checkout cone because blame
does not support blaming files that are not present in the working
directory. This is true in both sparse and full checkouts.

Signed-off-by: Lessley Dennington <lessleydennington@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff: enable and test the sparse index
Lessley Dennington [Mon, 6 Dec 2021 15:56:00 +0000 (15:56 +0000)] 
diff: enable and test the sparse index

Enable the sparse index within the 'git diff' command. Its implementation
already safely integrates with the sparse index because it shares code
with the 'git status' and 'git checkout' commands that were already
integrated.  For more details see:

d76723ee53 (status: use sparse-index throughout, 2021-07-14)
1ba5f45132 (checkout: stop expanding sparse indexes, 2021-06-29)

The most interesting thing to do is to add tests that verify that 'git
diff' behaves correctly when the sparse index is enabled. These cases are:

1. The index is not expanded for 'diff' and 'diff --staged'
2. 'diff' and 'diff --staged' behave the same in full checkout, sparse
checkout, and sparse index repositories in the following partially-staged
scenarios (i.e. the index, HEAD, and working directory differ at a given
path):
    1. Path is within sparse-checkout cone
    2. Path is outside sparse-checkout cone
    3. A merge conflict exists for paths outside sparse-checkout cone

The `p2000` tests demonstrate a ~44% execution time reduction for 'git
diff' and a ~86% execution time reduction for 'git diff --staged' using a
sparse index:

Test                                      before  after
-------------------------------------------------------------
2000.30: git diff (full-v3)               0.33    0.34 +3.0%
2000.31: git diff (full-v4)               0.33    0.35 +6.1%
2000.32: git diff (sparse-v3)             0.53    0.31 -41.5%
2000.33: git diff (sparse-v4)             0.54    0.29 -46.3%
2000.34: git diff --cached (full-v3)      0.07    0.07 +0.0%
2000.35: git diff --cached (full-v4)      0.07    0.08 +14.3%
2000.36: git diff --cached (sparse-v3)    0.28    0.04 -85.7%
2000.37: git diff --cached (sparse-v4)    0.23    0.03 -87.0%

Co-authored-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Lessley Dennington <lessleydennington@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff: replace --staged with --cached in t1092 tests
Lessley Dennington [Mon, 6 Dec 2021 15:55:59 +0000 (15:55 +0000)] 
diff: replace --staged with --cached in t1092 tests

Replace uses of the synonym --staged in t1092 tests with --cached (which
is the real and preferred option). This will allow consistency in the new
tests to be added with the upcoming change to enable the sparse index for
diff.

Signed-off-by: Lessley Dennington <lessleydennington@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>