]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
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 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 agounpack-trees: use traverse_path instead of name
Derrick Stolee [Mon, 6 Dec 2021 14:10:37 +0000 (14:10 +0000)] 
unpack-trees: use traverse_path instead of name

The sparse_dir_matches_path() method compares a cache entry that is a
sparse directory entry against a 'struct traverse_info *info' and a
'struct name_entry *p' to see if the cache entry has exactly the right
name for those other inputs.

This method was introduced in 523506d (unpack-trees: unpack sparse
directory entries, 2021-07-14), but included a significant mistake. The
path comparisons used 'info->name' instead of 'info->traverse_path'.
Since 'info->name' only stores a single tree entry name while
'info->traverse_path' stores the full path from root, this method does
not work when 'info' is in a subdirectory of a directory. Replacing the
right strings and their corresponding lengths make the method work
properly.

The previous change included a failing test that exposes this issue.
That test now passes. The critical detail is that as we go deep into
unpack_trees(), the logic for merging a sparse directory entry with a
tree entry during 'git checkout' relies on this
sparse_dir_matches_path() in order to avoid calling
traverse_trees_recursive() during unpack_callback() in this hunk:

if (!is_sparse_directory_entry(src[0], names, info) &&
    traverse_trees_recursive(n, dirmask, mask & ~dirmask,
    names, info) < 0) {
return -1;
}

For deep paths, the short-circuit never occurred and
traverse_trees_recursive() was being called incorrectly and that was
causing other strange issues. Specifically, the error message from the
now-passing test previously included this:

      error: Your local changes to the following files would be overwritten by checkout:
              deep/deeper1/deepest2/a
              deep/deeper1/deepest3/a
      Please commit your changes or stash them before you switch branches.
      Aborting

These messages occurred because the 'current' cache entry in
twoway_merge() was showing as NULL because the index did not contain
entries for the paths contained within the sparse directory entries. We
instead had 'oldtree' given as the entry at HEAD and 'newtree' as the
entry in the target tree. This led to reject_merge() listing these
paths.

Now that sparse_dir_matches_path() works the same for deep paths as it
does for shallow depths, the rest of the logic kicks in to properly
handle modifying the sparse directory entries as designed.

Reported-by: Gustave Granroth <gus.gran@gmail.com>
Reported-by: Mike Marcelais <michmarc@exchange.microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot1092: add deeper changes during a checkout
Derrick Stolee [Mon, 6 Dec 2021 14:10:36 +0000 (14:10 +0000)] 
t1092: add deeper changes during a checkout

Extend the repository data in the setup of t1092 to include more
directories within two parent directories. This reproduces a bug found
by users of the sparse index feature with suitably-complicated
sparse-checkout definitions.

Add a failing test that fails in its first 'git checkout deepest' run in
the sparse index case with this error:

  error: Your local changes to the following files would be overwritten by checkout:
          deep/deeper1/deepest2/a
          deep/deeper1/deepest3/a
  Please commit your changes or stash them before you switch branches.
  Aborting

The next change will fix this error, and that fix will make it clear why
the extra depth is necessary for revealing this bug. The assignment of
the sparse-checkout definition to include deep/deeper1/deepest as a
sibling directory is important to ensure that deep/deeper1 is not a
sparse directory entry, but deep/deeper1/deepest2 is.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotests: set GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME only when needed
Johannes Schindelin [Fri, 3 Dec 2021 09:39:13 +0000 (09:39 +0000)] 
tests: set GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME only when needed

A couple of test scripts have actually been adapted to accommodate for a
configurable default branch name, but they still overrode it via the
`GIT_TEST_*` variable. Let's drop that override where possible.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-worktree.txt: add missing `-v` to synopsis for `worktree list`
Eric Sunshine [Fri, 3 Dec 2021 03:44:20 +0000 (22:44 -0500)] 
git-worktree.txt: add missing `-v` to synopsis for `worktree list`

When verbose mode was added to `git worktree list` by 076b444a62
(worktree: teach `list` verbose mode, 2021-01-27), although the
documentation was updated to reflect the new functionality, the
synopsis was overlooked. Correct this minor oversight.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoworktree: send "chatty" messages to stderr
Eric Sunshine [Fri, 3 Dec 2021 03:44:19 +0000 (22:44 -0500)] 
worktree: send "chatty" messages to stderr

The order in which the stdout and stderr streams are flushed is not
guaranteed to be the same across platforms or `libc` implementations.
This lack of determinism can lead to anomalous and potentially confusing
output if normal (stdout) output is flushed after error (stderr) output.
For instance, the following output which clearly indicates a failure due
to a fatal error:

    % git worktree add ../foo bar
    Preparing worktree (checking out 'bar')
    fatal: 'bar' is already checked out at '.../wherever'

has been reported[1] on Microsoft Windows to appear as:

    % git worktree add ../foo bar
    fatal: 'bar' is already checked out at '.../wherever'
    Preparing worktree (checking out 'bar')

which may confuse the reader into thinking that the command somehow
recovered and ran to completion despite the error.

This problem crops up because the "chatty" status message "Preparing
worktree" is sent to stdout, whereas the "fatal" error message is sent
to stderr. One way to fix this would be to flush stdout manually before
git-worktree reports any errors to stderr.

However, common practice in Git is for "chatty" messages to be sent to
stderr. Therefore, a more appropriate fix is to adjust git-worktree to
conform to that practice by sending its "chatty" messages to stderr
rather than stdout as is currently the case.

There may be concern that relocating messages from stdout to stderr
could break existing tooling, however, these messages are already
internationalized, thus are unstable. And, indeed, the "Preparing
worktree" message has already been the subject of somewhat significant
changes in 2c27002a0a (worktree: improve message when creating a new
worktree, 2018-04-24). Moreover, there is existing precedent, such as
68b939b2f0 (clone: send diagnostic messages to stderr, 2013-09-18) which
likewise relocated "chatty" messages from stdout to stderr for
git-clone.

[1]: https://lore.kernel.org/git/CA+34VNLj6VB1kCkA=MfM7TZR+6HgqNi5-UaziAoCXacSVkch4A@mail.gmail.com/T/

Reported-by: Baruch Burstein <bmburstein@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopackfile: make `close_pack_revindex()` static
Taylor Blau [Sat, 4 Dec 2021 22:51:38 +0000 (17:51 -0500)] 
packfile: make `close_pack_revindex()` static

Since its definition in 2f4ba2a867 (packfile: prepare for the existence
of '*.rev' files, 2021-01-25), the only caller of
`close_pack_revindex()` was within packfile.c.

Thus there is no need for this to be exposed via packfile.h, and instead
can remain static within packfile.c's compilation unit. While we're
here, move the function's opening brace onto its own line.

Noticed-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoCodingGuidelines: document which output goes to stdout vs. stderr
Eric Sunshine [Thu, 2 Dec 2021 22:31:10 +0000 (17:31 -0500)] 
CodingGuidelines: document which output goes to stdout vs. stderr

It has long been practice on this project for a command to emit its
primary output to stdout so that it can be captured to a file or sent
down a pipe, and to emit "chatty" messages (such as those reporting
progress) to stderr so that they don't interfere with the primary
output. However, this practice is not necessarily universal; another
common practice is to send only error messages to stderr, and all other
messages to stdout. Therefore, help newcomers out by documenting how
stdout and stderr are used on this project.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorefs/debug: trim trailing LF from reflog message
Han-Wen Nienhuys [Thu, 2 Dec 2021 17:36:33 +0000 (17:36 +0000)] 
refs/debug: trim trailing LF from reflog message

On iteration, the reflog message is always terminated by a newline. Trim it to
avoid clobbering the console with is this extra newline.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-ref-store: tweaks to for-each-reflog-ent format
Han-Wen Nienhuys [Thu, 2 Dec 2021 17:36:32 +0000 (17:36 +0000)] 
test-ref-store: tweaks to for-each-reflog-ent format

We have some tests that read from files in .git/logs/ hierarchy
when checking if correct reflog entries are created, but that is
too specific to the files backend.  Other backends like reftable
may not store its reflog entries in such a "one line per entry"
format.

Update for-each-reflog-ent test helper to produce output that
is identical to lines in a reflog file files backend uses.
That way, (1) the current tests can be updated to use the test
helper to read the reflog entries instead of (parts of) reflog
files, and perform the same inspection for correctness, and (2)
when the ref backend is swapped to another backend, the updated
test can be used as-is to check the correctness.

Adapt t1400 to use the for-each-reflog-ent test helper.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot1405: check for_each_reflog_ent_reverse() more thoroughly
Han-Wen Nienhuys [Thu, 2 Dec 2021 17:36:31 +0000 (17:36 +0000)] 
t1405: check for_each_reflog_ent_reverse() more thoroughly

If we are checking for a certain ordering, we should check that there are two
entries. Do this by mirroring the preceding test.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-ref-store: don't add newline to reflog message
Han-Wen Nienhuys [Thu, 2 Dec 2021 17:36:30 +0000 (17:36 +0000)] 
test-ref-store: don't add newline to reflog message

By convention, reflog messages always end in '\n', so
before we would print blank lines between entries.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoshow-branch: show reflog message
Han-Wen Nienhuys [Thu, 2 Dec 2021 17:36:29 +0000 (17:36 +0000)] 
show-branch: show reflog message

Before, --reflog option would look for '\t' in the reflog message. As refs.c
already parses the reflog line, the '\t' was never found, and show-branch
--reflog would always say "(none)" as reflog message

Add test.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-lib: make BAIL_OUT() work in tests and prereq
Fabian Stelzer [Wed, 1 Dec 2021 08:53:15 +0000 (09:53 +0100)] 
test-lib: make BAIL_OUT() work in tests and prereq

BAIL_OUT() is meant to abort the whole test run and print a message with
a standard prefix that can be parsed to stdout. Since for every test the
normal fd`s are redirected in test_eval_ this output would not be seen
when used within the context of a test or prereq like we do in
test_have_prereq(). To make this function work in these contexts we move
the setup of the fd aliases a few lines up before the first use of
BAIL_OUT() and then have this function always print to the alias.

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-compat-util: add a test balloon for C99 support
brian m. carlson [Wed, 1 Dec 2021 01:40:50 +0000 (01:40 +0000)] 
git-compat-util: add a test balloon for C99 support

The C99 standard was released in January 1999, now 22 years ago.  It
provides a variety of useful features, including variadic arguments for
macros, declarations after statements, designated initializers, and a
wide variety of other useful features, many of which we already use.

We'd like to take advantage of these features, but we want to be
cautious.  As far as we know, all major compilers now support C99 or a
later C standard, such as C11 or C17.  POSIX has required C99 support as
a requirement for the 2001 revision, so we can safely assume any POSIX
system which we are interested in supporting has C99.

Even MSVC, long a holdout against modern C, now supports both C11 and
C17 with an appropriate update.  Moreover, even if people are using an
older version of MSVC on these systems, they will generally need some
implementation of the standard Unix utilities for the testsuite, and GNU
coreutils, the most common option, has required C99 since 2009.
Therefore, we can safely assume that a suitable version of GCC or clang
is available to users even if their version of MSVC is not sufficiently
capable.

Let's add a test balloon to git-compat-util.h to see if anyone is using
an older compiler.  We'll add a comment telling people how to enable
this functionality on GCC and Clang, even though modern versions of both
will automatically do the right thing, and ask people still experiencing
a problem to report that to us on the list.

Note that C89 compilers don't provide the __STDC_VERSION__ macro, so we
use a well-known hack of using "- 0".  On compilers with this macro, it
doesn't change the value, and on C89 compilers, the macro will be
replaced with nothing, and our value will be 0.

For sparse, we explicitly request the gnu99 style because we've
traditionally taken advantage of some GCC- and clang-specific extensions
when available and we'd like to retain the ability to do that.  sparse
also defaults to C89 without it, so things will fail for us if we don't.

Update the cmake configuration to require C11 for MSVC.  We do this
because this will make MSVC to use C11, since it does not explicitly
support C99.  We do this with a compiler options because setting the
C_STANDARD option does not work in our CI on MSVC and at the moment, we
don't want to require C11 for Unix compilers.

In the Makefile, don't set any compiler flags for the compiler itself,
since on some systems, such as FreeBSD, we actually need C11, and asking
for C99 causes things to fail to compile.  The error message should make
it obvious what's going wrong and allow a user to set the appropriate
option when building in the event they're using a Unix compiler that
doesn't support it by default.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoobject-file.c: LLP64 compatibility, upcast unity for left shift
Philip Oakley [Wed, 1 Dec 2021 00:29:02 +0000 (00:29 +0000)] 
object-file.c: LLP64 compatibility, upcast unity for left shift

Visual Studio reports C4334 "was 64-bit shift intended" warning because
of size miss-match.

Promote unity to the matching type to fit with the assignment.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiffcore-delta.c: LLP64 compatibility, upcast unity for left shift
Philip Oakley [Wed, 1 Dec 2021 00:29:01 +0000 (00:29 +0000)] 
diffcore-delta.c: LLP64 compatibility, upcast unity for left shift

Visual Studio reports C4334 "was 64-bit shift intended" warning
because of size miss-match.

Promote unity to the matching type to fit with its subsequent operation.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorepack.c: LLP64 compatibility, upcast unity for left shift
Philip Oakley [Wed, 1 Dec 2021 00:29:00 +0000 (00:29 +0000)] 
repack.c: LLP64 compatibility, upcast unity for left shift

Visual Studio reports C4334 "was 64-bit shift intended" warning
because of size mismatch.

Promote unity to the matching type to fit with the `&` operator.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoupdate documentation for new zdiff3 conflictStyle
Elijah Newren [Wed, 1 Dec 2021 00:05:07 +0000 (00:05 +0000)] 
update documentation for new zdiff3 conflictStyle

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoxdiff: implement a zealous diff3, or "zdiff3"
Phillip Wood [Wed, 1 Dec 2021 00:05:06 +0000 (00:05 +0000)] 
xdiff: implement a zealous diff3, or "zdiff3"

"zdiff3" is identical to ordinary diff3 except that it allows compaction
of common lines on the two sides of history at the beginning or end of
the conflict hunk.  For example, the following diff3 conflict:

    1
    2
    3
    4
    <<<<<<
    A
    B
    C
    D
    E
    ||||||
    5
    6
    ======
    A
    X
    C
    Y
    E
    >>>>>>
    7
    8
    9

has common lines 'A', 'C', and 'E' on the two sides.  With zdiff3, one
would instead get the following conflict:

    1
    2
    3
    4
    A
    <<<<<<
    B
    C
    D
    ||||||
    5
    6
    ======
    X
    C
    Y
    >>>>>>
    E
    7
    8
    9

Note that the common lines, 'A', and 'E' were moved outside the
conflict.  Unlike with the two-way conflicts from the 'merge'
conflictStyle, the zdiff3 conflict is NOT split into multiple conflict
regions to allow the common 'C' lines to be shown outside a conflict,
because zdiff3 shows the base version too and the base version cannot be
reasonably split.

Note also that the removing of lines common to the two sides might make
the remaining text inside the conflict region match the base text inside
the conflict region (for example, if the diff3 conflict had '5 6 E' on
the right side of the conflict, then the common line 'E' would be moved
outside and both the base and right side's remaining conflict text would
be the lines '5' and '6').  This has the potential to surprise users and
make them think there should not have been a conflict, but there
definitely was a conflict and it should remain.

Based-on-patch-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Co-authored-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosequencer: avoid adding exec commands for non-commit creating commands
Elijah Newren [Tue, 30 Nov 2021 03:58:39 +0000 (03:58 +0000)] 
sequencer: avoid adding exec commands for non-commit creating commands

The `--exec <cmd>` is documented as

    Append "exec <cmd>" after each line creating a commit in the final
    history.
    ...
    If --autosquash is used, "exec" lines will not be appended for the
    intermediate commits, and will only appear at the end of each
    squash/fixup series.

Unfortunately, it would also add exec commands after non-pick
operations, such as 'no-op', which could be seen for example with
    git rebase -i --exec true HEAD

todo_list_add_exec_commands() intent was to insert exec commands after
each logical pick, while trying to consider a chains of fixup and squash
commits to be part of the pick before it.  So it would keep an 'insert'
boolean tracking if it had seen a pick or merge, but not write the exec
command until it saw the next non-fixup/squash command.  Since that
would make it miss the final exec command, it had some code that would
check whether it still needed to insert one at the end, but instead of a
simple

    if (insert)

it had a

    if (insert || <condition that is always true>)

That's buggy; as per the docs, we should only add exec commands for
lines that create commits, i.e. only if insert is true.  Fix the
conditional.

There was one testcase in the testsuite that we tweak for this change;
it was introduced in 54fd3243da ("rebase -i: reread the todo list if
`exec` touched it", 2017-04-26), and was merely testing that after an
exec had fired that the todo list would be re-read.  The test at the
time would have worked given any revision at all, though it would only
work with 'HEAD' as a side-effect of this bug.  Since we're fixing this
bug, choose something other than 'HEAD' for that test.

Finally, add a testcase that verifies when we have no commits to pick,
that we get no exec lines in the generated todo list.

Reported-by: Nikita Bobko <nikitabobko@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe first batch to start the current cycle
Junio C Hamano [Mon, 29 Nov 2021 23:41:16 +0000 (15:41 -0800)] 
The first batch to start the current cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'mc/clean-smudge-with-llp64'
Junio C Hamano [Mon, 29 Nov 2021 23:41:51 +0000 (15:41 -0800)] 
Merge branch 'mc/clean-smudge-with-llp64'

The clean/smudge conversion code path has been prepared to better
work on platforms where ulong is narrower than size_t.

* mc/clean-smudge-with-llp64:
  clean/smudge: allow clean filters to process extremely large files
  odb: guard against data loss checking out a huge file
  git-compat-util: introduce more size_t helpers
  odb: teach read_blob_entry to use size_t
  t1051: introduce a smudge filter test for extremely large files
  test-lib: add prerequisite for 64-bit platforms
  test-tool genzeros: generate large amounts of data more efficiently
  test-genzeros: allow more than 2G zeros in Windows

2 years agoMerge branch 'ab/sh-retire-helper-functions'
Junio C Hamano [Mon, 29 Nov 2021 23:41:50 +0000 (15:41 -0800)] 
Merge branch 'ab/sh-retire-helper-functions'

Make a few helper functions unused and then lose them.

* ab/sh-retire-helper-functions:
  git-sh-setup: remove "sane_grep", it's not needed anymore
  git-sh-setup: remove unused sane_egrep() function
  git-instaweb: unconditionally assume that gitweb is mod_perl capable
  Makefile: remove $(NO_CURL) from $(SCRIPT_DEFINES)
  Makefile: remove $(GIT_VERSION) from $(SCRIPT_DEFINES)
  Makefile: move git-SCRIPT-DEFINES adjacent to $(SCRIPT_DEFINES)

2 years agoMerge branch 'tb/plug-pack-bitmap-leaks'
Junio C Hamano [Mon, 29 Nov 2021 23:41:49 +0000 (15:41 -0800)] 
Merge branch 'tb/plug-pack-bitmap-leaks'

Leakfix.

* tb/plug-pack-bitmap-leaks:
  pack-bitmap.c: more aggressively free in free_bitmap_index()
  pack-bitmap.c: don't leak type-level bitmaps
  midx.c: write MIDX filenames to strbuf
  builtin/multi-pack-index.c: don't leak concatenated options
  builtin/repack.c: avoid leaking child arguments
  builtin/pack-objects.c: don't leak memory via arguments
  t/helper/test-read-midx.c: free MIDX within read_midx_file()
  midx.c: don't leak MIDX from verify_midx_file
  midx.c: clean up chunkfile after reading the MIDX

2 years agoMerge branch 'tp/send-email-completion'
Junio C Hamano [Mon, 29 Nov 2021 23:41:49 +0000 (15:41 -0800)] 
Merge branch 'tp/send-email-completion'

The command line complation for "git send-email" options have been
tweaked to make it easier to keep it in sync with the command itself.

* tp/send-email-completion:
  send-email docs: add format-patch options
  send-email: programmatically generate bash completions

2 years agoMerge branch 'jc/unsetenv-returns-an-int'
Junio C Hamano [Mon, 29 Nov 2021 23:41:48 +0000 (15:41 -0800)] 
Merge branch 'jc/unsetenv-returns-an-int'

The compatibility implementation for unsetenv(3) were written to
mimic ancient, non-POSIX, variant seen in an old glibc; it has been
changed to return an integer to match the more modern era.

* jc/unsetenv-returns-an-int:
  unsetenv(3) returns int, not void

2 years agoMerge branch 'jc/fix-ref-sorting-parse'
Junio C Hamano [Mon, 29 Nov 2021 23:41:47 +0000 (15:41 -0800)] 
Merge branch 'jc/fix-ref-sorting-parse'

Things like "git -c branch.sort=bogus branch new HEAD", i.e. the
operation modes of the "git branch" command that do not need the
sort key information, no longer errors out by seeing a bogus sort
key.

* jc/fix-ref-sorting-parse:
  for-each-ref: delay parsing of --sort=<atom> options

2 years agoMerge branch 'so/stash-staged'
Junio C Hamano [Mon, 29 Nov 2021 23:41:46 +0000 (15:41 -0800)] 
Merge branch 'so/stash-staged'

"git stash" learned the "--staged" option to stash away what has
been added to the index (and nothing else).

* so/stash-staged:
  stash: get rid of unused argument in stash_staged()
  stash: implement '--staged' option for 'push' and 'save'

2 years agoMerge branch 'jc/tutorial-format-patch-base'
Junio C Hamano [Mon, 29 Nov 2021 23:41:46 +0000 (15:41 -0800)] 
Merge branch 'jc/tutorial-format-patch-base'

Teach and encourage first-time contributors to this project to
state the base commit when they submit their topic.

* jc/tutorial-format-patch-base:
  MyFirstContribution: teach to use "format-patch --base=auto"

2 years agoMerge branch 'ab/refs-errno-cleanup'
Junio C Hamano [Mon, 29 Nov 2021 23:41:45 +0000 (15:41 -0800)] 
Merge branch 'ab/refs-errno-cleanup'

The "remainder" of hn/refs-errno-cleanup topic.

* ab/refs-errno-cleanup: (21 commits)
  refs API: post-migration API renaming [2/2]
  refs API: post-migration API renaming [1/2]
  refs API: don't expose "errno" in run_transaction_hook()
  refs API: make expand_ref() & repo_dwim_log() not set errno
  refs API: make resolve_ref_unsafe() not set errno
  refs API: make refs_ref_exists() not set errno
  refs API: make refs_resolve_refdup() not set errno
  refs tests: ignore ignore errno in test-ref-store helper
  refs API: ignore errno in worktree.c's find_shared_symref()
  refs API: ignore errno in worktree.c's add_head_info()
  refs API: make files_copy_or_rename_ref() et al not set errno
  refs API: make loose_fill_ref_dir() not set errno
  refs API: make resolve_gitlink_ref() not set errno
  refs API: remove refs_read_ref_full() wrapper
  refs/files: remove "name exist?" check in lock_ref_oid_basic()
  reflog tests: add --updateref tests
  refs API: make refs_rename_ref_available() static
  refs API: make parse_loose_ref_contents() not set errno
  refs API: make refs_read_raw_ref() not set errno
  refs API: add a version of refs_resolve_ref_unsafe() with "errno"
  ...

2 years agoMerge branch 'ow/stash-count-in-status-porcelain-output'
Junio C Hamano [Mon, 29 Nov 2021 23:41:44 +0000 (15:41 -0800)] 
Merge branch 'ow/stash-count-in-status-porcelain-output'

Allow "git status --porcelain=v2" to show the number of stash
entries with --show-stash like the normal output does.

* ow/stash-count-in-status-porcelain-output:
  status: print stash info with --porcelain=v2 --show-stash
  status: count stash entries in separate function

2 years agoMerge branch 'jk/loosen-urlmatch'
Junio C Hamano [Mon, 29 Nov 2021 23:41:44 +0000 (15:41 -0800)] 
Merge branch 'jk/loosen-urlmatch'

Treat "_" as any other URL-valid characters in an URL when matching
the per-URL configuration variable names.

* jk/loosen-urlmatch:
  urlmatch: add underscore to URL_HOST_CHARS

2 years agot1404: mark directory/file conflict tests with REFFILES
Han-Wen Nienhuys [Mon, 29 Nov 2021 18:20:22 +0000 (18:20 +0000)] 
t1404: mark directory/file conflict tests with REFFILES

The files backend uses file system locking on individual refs, which means a
directory/file conflict can prevent locks being taken. For example, in a repo
with just the ref "foo", an update

    (DELETE "foo") + (ADD "foo/bar")

cannot be executed in the files backend, as one cannot take a lock on foo/bar.

The current reftable proof-of-concept integration supports these tranactions, as
the result is a repo with just "foo/bar", which has no directory/file conflict.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agounpack-trees: improve performance of next_cache_entry
Victoria Dye [Mon, 29 Nov 2021 15:52:43 +0000 (15:52 +0000)] 
unpack-trees: improve performance of next_cache_entry

To find the first non-unpacked cache entry, `next_cache_entry` iterates
through index, starting at `cache_bottom`. The performance of this in full
indexes is helped by `cache_bottom` advancing with each invocation of
`mark_ce_used` (called by `unpack_index_entry`). However, the presence of
sparse directories can prevent the `cache_bottom` from advancing in a sparse
index case, effectively forcing `next_cache_entry` to search from the
beginning of the index each time it is called.

The `cache_bottom` must be preserved for the sparse index (see 17a1bb570b
(unpack-trees: preserve cache_bottom, 2021-07-14)). Therefore, to retain the
benefit `cache_bottom` provides in non-sparse index cases, a separate `hint`
position indicates the first position `next_cache_entry` should search,
updated each execution with a new position.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreset: make --mixed sparse-aware
Victoria Dye [Mon, 29 Nov 2021 15:52:42 +0000 (15:52 +0000)] 
reset: make --mixed sparse-aware

Remove the `ensure_full_index` guard on `read_from_tree` and update `git
reset --mixed` to ensure it can use sparse directory index entries wherever
possible. Sparse directory entries are reset using `diff_tree_oid`, which
requires `change` and `add_remove` functions to process the internal
contents of the sparse directory. The `recursive` diff option handles cases
in which `reset --mixed` must diff/merge files that are nested multiple
levels deep in a sparse directory.

The use of pathspecs with `git reset --mixed` introduces scenarios in which
internal contents of sparse directories may be matched by the pathspec. In
order to reset *all* files in the repo that may match the pathspec, the
following conditions on the pathspec require index expansion before
performing the reset:

* "magic" pathspecs
* wildcard pathspecs that do not match only in-cone files or entire sparse
  directories
* literal pathspecs matching something outside the sparse checkout
  definition

Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreset: make sparse-aware (except --mixed)
Victoria Dye [Mon, 29 Nov 2021 15:52:41 +0000 (15:52 +0000)] 
reset: make sparse-aware (except --mixed)

Remove `ensure_full_index` guard on `prime_cache_tree` and update
`prime_cache_tree_rec` to correctly reconstruct sparse directory entries in
the cache tree. While processing a tree's entries, `prime_cache_tree_rec`
must determine whether a directory entry is sparse or not by searching for
it in the index (*without* expanding the index). If a matching sparse
directory index entry is found, no subtrees are added to the cache tree
entry and the entry count is set to 1 (representing the sparse directory
itself). Otherwise, the tree is assumed to not be sparse and its subtrees
are recursively added to the cache tree.

Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreset: integrate with sparse index
Victoria Dye [Mon, 29 Nov 2021 15:52:40 +0000 (15:52 +0000)] 
reset: integrate with sparse index

Disable `command_requires_full_index` repo setting and add
`ensure_full_index` guards around code paths that cannot yet use sparse
directory index entries. `reset --soft` does not modify the index, so no
compatibility changes are needed for it to function without expanding the
index. For all other reset modes (`--mixed`, `--hard`, `--keep`, `--merge`),
the full index is expanded to prevent cache tree corruption and invalid
variable accesses.

Additionally, the `read_cache()` check verifying an uncorrupted index is
moved after argument parsing and preparing the repo settings. The index is
not used by the preceding argument handling, but `read_cache()` must be run
*after* enabling sparse index for the command (so that the index is not
expanded unnecessarily) and *before* using the index for reset (so that it
is verified as uncorrupted).

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreset: expand test coverage for sparse checkouts
Victoria Dye [Mon, 29 Nov 2021 15:52:39 +0000 (15:52 +0000)] 
reset: expand test coverage for sparse checkouts

Add new tests for `--merge` and `--keep` modes, as well as mixed reset with
pathspecs. New performance test cases exercise various execution paths for
`reset`.

Co-authored-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/t*: remove custom GIT_TRACE2_EVENT_NESTING
Derrick Stolee [Mon, 29 Nov 2021 13:47:46 +0000 (13:47 +0000)] 
t/t*: remove custom GIT_TRACE2_EVENT_NESTING

The previous change modified GIT_TRACE2_EVENT_NESTING by default within
test-lib.sh. These custom assignments throughout the test suite are no
longer necessary.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-lib.sh: set GIT_TRACE2_EVENT_NESTING
Derrick Stolee [Mon, 29 Nov 2021 13:47:45 +0000 (13:47 +0000)] 
test-lib.sh: set GIT_TRACE2_EVENT_NESTING

The GIT_TRACE2_EVENT feed has a limited nesting depth to avoid
overloading the feed when recursing into deep paths while adding more
nested regions.

Some tests use the GIT_TRACE2_EVENT feed to look for internal events,
ensuring that intended behavior is happening.

One such example is in t4216-log-bloom.sh which looks for a statistic
given as a trace2_data_intmax() call. This test started failing under
'-x' with 2ca245f8be5 (csum-file.h: increase hashfile buffer size,
2021-05-18) because the change in stderr triggered the progress API to
create an extra trace2 region, ejecting the statistic.

This change increases the value of GIT_TRACE2_EVENT_NESTING across the
entire test suite to avoid errors like this. Future changes will remove
custom assignments of GIT_TRACE2_EVENT_NESTING from some test scripts
that were aware of this limitation.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoadd -p: avoid use of undefined $key when ReadKey -> EOF
Carlo Marcelo Arenas Belón [Sun, 28 Nov 2021 17:49:03 +0000 (09:49 -0800)] 
add -p: avoid use of undefined $key when ReadKey -> EOF

b5cc003253 (add -i: ignore terminal escape sequences, 2011-05-17)
add an additional check to the original code to better handle keys
for escape sequences, but failed to account for the possibility
the first ReadKey call returned undef (ex: stdin closes) and that
was being handled fine by the original code in ca6ac7f135 (add -p:
prompt for single characters, 2009-02-05)

Add a test for undefined and encapsulate the loop and the original
print that relied on it within it.

After this, the following command (in a suitable repository state)
wouldn't print any error:

  $ git -c interactive.singleKey add -p </dev/null

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorefs: document callback for reflog-ent iterators
Junio C Hamano [Sun, 28 Nov 2021 19:25:35 +0000 (11:25 -0800)] 
refs: document callback for reflog-ent iterators

refs_for_each_reflog_ent() and refs_for_each_reflog_ent_reverse()
functions take a callback function that gets called with the details
of each reflog entry.  Its parameters were not documented beyond
their names.  Elaborate a bit on each of them.

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomingw: avoid fallback for {local,gm}time_r()
Carlo Marcelo Arenas Belón [Sat, 27 Nov 2021 10:15:32 +0000 (10:15 +0000)] 
mingw: avoid fallback for {local,gm}time_r()

mingw-w64's pthread_unistd.h had a bug that mistakenly (because there is
no support for the *lockfile() functions required[1]) defined
_POSIX_THREAD_SAFE_FUNCTIONS and that was being worked around since
3ecd153a3b (compat/mingw: support MSys2-based MinGW build, 2016-01-14).

The bug was fixed in winphtreads, but as a side effect, leaves the
reentrant functions from time.h no longer visible and therefore breaks
the build.

Since the intention all along was to avoid using the fallback functions,
formalize the use of POSIX by setting the corresponding feature flag and
compile out the implementation for the fallback functions.

[1] https://unix.org/whitepapers/reentrant.html

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorun-command API: remove "env" member, always use "env_array"
Ævar Arnfjörð Bjarmason [Thu, 25 Nov 2021 22:52:24 +0000 (23:52 +0100)] 
run-command API: remove "env" member, always use "env_array"

Remove the "env" member from "struct child_process" in favor of always
using the "env_array". As with the preceding removal of "argv" in
favor of "args" this gets rid of current and future oddities around
memory management at the API boundary (see the amended API docs).

For some of the conversions we can replace patterns like:

    child.env = env->v;

With:

    strvec_pushv(&child.env_array, env->v);

But for others we need to guard the strvec_pushv() with a NULL check,
since we're not passing in the "v" member of a "struct strvec",
e.g. in the case of tmp_objdir_env()'s return value.

Ideally we'd rename the "env_array" member to simply "env" as a
follow-up, since it and "args" are now inconsistent in not having an
"_array" suffix, and seemingly without any good reason, unless we look
at the history of how they came to be.

But as we've currently got 122 in-tree hits for a "git grep env_array"
let's leave that for now (and possibly forever). Doing that rename
would be too disruptive.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodifftool: use "env_array" to simplify memory management
Ævar Arnfjörð Bjarmason [Thu, 25 Nov 2021 22:52:23 +0000 (23:52 +0100)] 
difftool: use "env_array" to simplify memory management

Amend code added in 03831ef7b50 (difftool: implement the functionality
in the builtin, 2017-01-19) to use the "env_array" in the
run_command.[ch] API. Now we no longer need to manage our own
"index_env" buffer.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>