]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
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 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 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 agosparse-index: update do_read_index to ensure correct sparsity
Victoria Dye [Tue, 23 Nov 2021 00:20:33 +0000 (00:20 +0000)] 
sparse-index: update do_read_index to ensure correct sparsity

Unless `command_requires_full_index` forces index expansion, ensure in-core
index sparsity matches config settings on read by calling
`ensure_correct_sparsity`. This makes the behavior of the in-core index more
consistent between different methods of updating sparsity: manually changing
the `index.sparse` config setting vs. executing
`git sparse-checkout --[no-]sparse-index init`

Although index sparsity is normally updated with `git sparse-checkout init`,
ensuring correct sparsity after a manual `index.sparse` change has some
practical benefits:

1. It allows for command-by-command sparsity toggling with
   `-c index.sparse=<true|false>`, e.g. when troubleshooting issues with the
   sparse index.
2. It prevents users from experiencing abnormal slowness after setting
   `index.sparse` to `true` due to use of a full index in all commands until
   the on-disk index is updated.

Helped-by: Junio C Hamano <gitster@pobox.com>
Co-authored-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosparse-index: add ensure_correct_sparsity function
Victoria Dye [Tue, 23 Nov 2021 00:20:32 +0000 (00:20 +0000)] 
sparse-index: add ensure_correct_sparsity function

The `ensure_correct_sparsity` function is intended to provide a means of
aligning the in-core index with the sparsity required by the repository
settings and other properties of the index. The function first checks
whether a sparse index is allowed (per repository & sparse checkout pattern
settings). If the sparse index may be used, the index is converted to
sparse; otherwise, it is explicitly expanded with `ensure_full_index`.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosparse-index: avoid unnecessary cache tree clearing
Victoria Dye [Tue, 23 Nov 2021 00:20:31 +0000 (00:20 +0000)] 
sparse-index: avoid unnecessary cache tree clearing

When converting a full index to sparse, clear and recreate the cache tree
only if the cache tree is not fully valid. The convert_to_sparse operation
should exit silently if a cache tree update cannot be successfully completed
(e.g., due to a conflicted entry state). However, because this failure
scenario only occurs when at least a portion of the cache tree is invalid,
we can save ourselves the cost of clearing and recreating the cache tree by
skipping the check when the cache tree is fully valid.

Helped-by: Derrick Stolee <dstolee@microsoft.com>
Co-authored-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-read-cache.c: prepare_repo_settings after config init
Victoria Dye [Tue, 23 Nov 2021 00:20:30 +0000 (00:20 +0000)] 
test-read-cache.c: prepare_repo_settings after config init

Move `prepare_repo_settings` after the git directory has been set up in
`test-read-cache.c`. The git directory settings must be initialized to
properly assign repo settings using the worktree-level git config.

Signed-off-by: Victoria Dye <vdye@github.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoSync with 2.34.1
Junio C Hamano [Wed, 24 Nov 2021 18:56:26 +0000 (10:56 -0800)] 
Sync with 2.34.1

2 years agoGit 2.34.1 v2.34.1
Junio C Hamano [Wed, 24 Nov 2021 18:55:13 +0000 (10:55 -0800)] 
Git 2.34.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jc/save-restore-terminal-revert' into maint
Junio C Hamano [Tue, 23 Nov 2021 22:48:15 +0000 (14:48 -0800)] 
Merge branch 'jc/save-restore-terminal-revert' into maint

Regression fix for 2.34

* jc/save-restore-terminal-revert:
  Revert "editor: save and reset terminal after calling EDITOR"

2 years agoMerge branch 'ds/add-rm-with-sparse-index' into maint
Junio C Hamano [Tue, 23 Nov 2021 22:48:11 +0000 (14:48 -0800)] 
Merge branch 'ds/add-rm-with-sparse-index' into maint

Regression fix for 2.34

* ds/add-rm-with-sparse-index:
  dir: revert "dir: select directories correctly"

2 years agoMerge branch 'ab/update-submitting-patches' into maint
Junio C Hamano [Tue, 23 Nov 2021 22:48:08 +0000 (14:48 -0800)] 
Merge branch 'ab/update-submitting-patches' into maint

Doc fix.

* ab/update-submitting-patches:
  SubmittingPatches: fix Asciidoc syntax in "GitHub CI" section

2 years agoMerge branch 'ev/pull-already-up-to-date-is-noop' into maint
Junio C Hamano [Tue, 23 Nov 2021 22:48:04 +0000 (14:48 -0800)] 
Merge branch 'ev/pull-already-up-to-date-is-noop' into maint

"git pull" with any strategy when the other side is behind us
should succeed as it is a no-op, but doesn't.

* ev/pull-already-up-to-date-is-noop:
  pull: should be noop when already-up-to-date

2 years agoMerge branch 'hm/paint-hits-in-log-grep' into maint
Junio C Hamano [Tue, 23 Nov 2021 22:48:00 +0000 (14:48 -0800)] 
Merge branch 'hm/paint-hits-in-log-grep' into maint

"git grep" looking in a blob that has non-UTF8 payload was
completely broken when linked with versions of PCREv2 library older
than 10.34 in the latest release.

* hm/paint-hits-in-log-grep:
  Revert "grep/pcre2: fix an edge case concerning ascii patterns and UTF-8 data"

2 years agoA bit more regression fixes
Junio C Hamano [Tue, 23 Nov 2021 02:39:53 +0000 (18:39 -0800)] 
A bit more regression fixes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jc/save-restore-terminal-revert'
Junio C Hamano [Tue, 23 Nov 2021 02:40:11 +0000 (18:40 -0800)] 
Merge branch 'jc/save-restore-terminal-revert'

Regression fix for 2.34

* jc/save-restore-terminal-revert:
  Revert "editor: save and reset terminal after calling EDITOR"

2 years agoMerge branch 'ds/add-rm-with-sparse-index'
Junio C Hamano [Tue, 23 Nov 2021 02:40:10 +0000 (18:40 -0800)] 
Merge branch 'ds/add-rm-with-sparse-index'

Regression fix for 2.34

* ds/add-rm-with-sparse-index:
  dir: revert "dir: select directories correctly"

2 years agoRevert "editor: save and reset terminal after calling EDITOR"
Junio C Hamano [Mon, 22 Nov 2021 23:04:20 +0000 (15:04 -0800)] 
Revert "editor: save and reset terminal after calling EDITOR"

This reverts commit 3d411afabc9a96f41d47c07d6af6edda3d29ec92,
blindly opening /dev/tty and calling tcsetattr() seems to be causing
problems.

cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=577358
cf. https://lore.kernel.org/git/04ab7301-ea34-476c-eae4-4044fef74b91@gmail.com/

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodir: revert "dir: select directories correctly"
Derrick Stolee [Fri, 19 Nov 2021 14:13:49 +0000 (09:13 -0500)] 
dir: revert "dir: select directories correctly"

This reverts commit f6526728f950cacfd5b5e42bcc65f2c47f3da654.

The change in f652672 (dir: select directories correctly, 2021-09-24)
caused a regression in directory-based matches with non-cone-mode
patterns, especially for .gitignore patterns. A test is included to
prevent this regression in the future.

The commit ed495847 (dir: fix pattern matching on dirs, 2021-09-24) was
reverted in 5ceb663 (dir: fix directory-matching bug, 2021-11-02) for
similar reasons. Neither commit changed tests, and tests added later in
the series continue to pass when these commits are reverted.

Reported-by: Danial Alihosseini <danial.alihosseini@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years ago0th batch for early fixes
Junio C Hamano [Mon, 22 Nov 2021 05:55:56 +0000 (21:55 -0800)] 
0th batch for early fixes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ab/update-submitting-patches'
Junio C Hamano [Mon, 22 Nov 2021 05:57:04 +0000 (21:57 -0800)] 
Merge branch 'ab/update-submitting-patches'

Doc fix.

* ab/update-submitting-patches:
  SubmittingPatches: fix Asciidoc syntax in "GitHub CI" section

2 years agoMerge branch 'ev/pull-already-up-to-date-is-noop'
Junio C Hamano [Mon, 22 Nov 2021 05:57:04 +0000 (21:57 -0800)] 
Merge branch 'ev/pull-already-up-to-date-is-noop'

"git pull" with any strategy when the other side is behind us
should succeed as it is a no-op, but doesn't.

* ev/pull-already-up-to-date-is-noop:
  pull: should be noop when already-up-to-date

2 years agoMerge branch 'hm/paint-hits-in-log-grep'
Junio C Hamano [Mon, 22 Nov 2021 05:57:03 +0000 (21:57 -0800)] 
Merge branch 'hm/paint-hits-in-log-grep'

"git grep" looking in a blob that has non-UTF8 payload was
completely broken when linked with certain versions of PCREv2
library in the latest release.

* hm/paint-hits-in-log-grep:
  Revert "grep/pcre2: fix an edge case concerning ascii patterns and UTF-8 data"

2 years agopull: don't say that merge is "the default strategy"
Alex Henrie [Thu, 18 Nov 2021 15:43:17 +0000 (08:43 -0700)] 
pull: don't say that merge is "the default strategy"

Git no longer has a default strategy for reconciling divergent branches,
because there's no way for Git to know which strategy is appropriate in
any particular situation.

The initially proposed version in [*], that eventually became
031e2f7a (pull: abort by default when fast-forwarding is not
possible, 2021-07-22), dropped this phrase from the message, but
it was left in the final version by accident.

* https://lore.kernel.org/git/20210627000855.530985-1-alexhenrie24@gmail.com/

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoRevert "grep/pcre2: fix an edge case concerning ascii patterns and UTF-8 data"
Junio C Hamano [Fri, 19 Nov 2021 17:06:36 +0000 (09:06 -0800)] 
Revert "grep/pcre2: fix an edge case concerning ascii patterns and UTF-8 data"

This reverts commit ae39ba431ab861548eb60b4bd2e1d8b8813db76f, as it
breaks "grep" when looking for a string in non UTF-8 haystack, when
linked with certain versions of PCREv2 library.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2: disable tr2_dst before warning on write errors
Josh Steadmon [Thu, 18 Nov 2021 22:01:41 +0000 (14:01 -0800)] 
trace2: disable tr2_dst before warning on write errors

If writing a trace2 message fails, we optionally warn the user of this
fact. However, in 0ee10fd (usage: add trace2 entry upon warning(),
2020-11-23), we added a trace entry to the warning() function. This
means that we can enter an infinite loop of failing trace2 writes and
warnings. Fix this by disabling the failing trace2 destination before
issuing the warning.

Additionally, trace2 sets a default SIGPIPE handler
(tr2main_signal_handler) when it is initialized. This handler generates
its own trace2 messages when a signal is received. If a trace2 write
fails due to a broken pipe, this handler will run and then cause another
failed write. Fix this by temporarily ignoring SIGPIPE while writing
trace2 messages. This is safe because the write will still fail, and we
will disable the failing destination.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoremote: die if branch is not found in repository
Glen Choo [Thu, 18 Nov 2021 00:53:25 +0000 (16:53 -0800)] 
remote: die if branch is not found in repository

In a subsequent commit, we would like external-facing functions to be
able to accept "struct repository" and "struct branch" as a pair. This
is useful for functions like pushremote_for_branch(), which need to take
values from the remote_state and branch, even if branch == NULL.
However, a caller may supply an unrelated repository and branch, which
is not supported behavior.

To prevent misuse, add a die_on_missing_branch() helper function that
dies if a given branch is not from a given repository. Speed up the
existence check by replacing the branches list with a branches_hash
hashmap.

Like read_config(), die_on_missing_branch() is only called from
non-static functions; static functions are less prone to misuse because
they have strong conventions for keeping remote_state and branch in
sync.

Signed-off-by: Glen Choo <chooglen@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoremote: remove the_repository->remote_state from static methods
Glen Choo [Thu, 18 Nov 2021 00:53:24 +0000 (16:53 -0800)] 
remote: remove the_repository->remote_state from static methods

Replace all remaining references of the_repository->remote_state in
static functions with a struct remote_state parameter.

To do so, move read_config() calls to non-static functions and create a
family of static functions, "remotes_*", that behave like "repo_*", but
accept struct remote_state instead of struct repository. In the case
where a static function calls a non-static function, replace the
non-static function with its "remotes_*" equivalent.

Signed-off-by: Glen Choo <chooglen@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoremote: use remote_state parameter internally
Glen Choo [Thu, 18 Nov 2021 00:53:23 +0000 (16:53 -0800)] 
remote: use remote_state parameter internally

Without changing external-facing functions, replace
the_repository->remote_state internally by adding a struct remote_state
parameter.

As a result, external-facing functions are still tied to the_repository,
but most static functions no longer reference
the_repository->remote_state. The exceptions are those that are used in
a way that depends on external-facing functions e.g. the callbacks to
remote_get_1().

Signed-off-by: Glen Choo <chooglen@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoremote: move static variables into per-repository struct
Glen Choo [Thu, 18 Nov 2021 00:53:22 +0000 (16:53 -0800)] 
remote: move static variables into per-repository struct

remote.c does not works with non-the_repository because it stores its
state as static variables. To support non-the_repository, we can use a
per-repository struct for the remotes subsystem.

Prepare for this change by defining a struct remote_state that holds
the remotes subsystem state and move the static variables of remote.c
into the_repository->remote_state.

This introduces no behavioral or API changes.

Signed-off-by: Glen Choo <chooglen@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5516: add test case for pushing remote refspecs
Glen Choo [Thu, 18 Nov 2021 00:53:21 +0000 (16:53 -0800)] 
t5516: add test case for pushing remote refspecs

"git push remote-name" (that is, with no refspec given on the command
line) should push the refspecs in remote.remote-name.push. There is no
test case that checks this behavior in detached HEAD, so add one.

Signed-off-by: Glen Choo <chooglen@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopull: should be noop when already-up-to-date
Erwin Villejo [Wed, 17 Nov 2021 07:55:50 +0000 (07:55 +0000)] 
pull: should be noop when already-up-to-date

The already-up-to-date pull bug was fixed for --ff-only but it did not
include the case where --ff or --ff-only are not specified. This updates
the --ff-only fix to include the case where --ff or --ff-only are not
specified in command line flags or config.

Signed-off-by: Erwin Villejo <erwin.villejo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5319: corrupt more bytes of the midx checksum
Jeff King [Tue, 16 Nov 2021 21:38:50 +0000 (16:38 -0500)] 
t5319: corrupt more bytes of the midx checksum

One of the tests in t5319 corrupts the checksum of the midx file by
writing a single 0xff over the final byte, and then confirms that we
detect the problem. This usually works fine, but would break if the
actual checksum ended with that same byte already.

It seems like this should happen in 1 out of 256 test runs, but it turns
out to be less often in practice. The contents of the midx are mostly
deterministic because it's based on the objects, and we remove most
sources of randomness by setting GIT_COMMITTER_DATE, etc.  However,
there's still some randomness: some objects are duplicated between
packs, and the midx must decide which to use, which can be based on
timing.

So very occasionally we can end up with a real 0xff byte, and the test
fails. The most robust fix would be to read out the final byte and then
change it to something else (e.g., adding 1 mod 256). But that's awkward
to do in shell. Let's just blindly corrupt 10 bytes instead of 1, which
reduces our chances of an accidental noop to 1 in 2^80.

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocheckout: fix "branch info" memory leaks
Ævar Arnfjörð Bjarmason [Tue, 16 Nov 2021 18:27:38 +0000 (19:27 +0100)] 
checkout: fix "branch info" memory leaks

The "checkout" command is one of the main sources of leaks in the test
suite, let's fix the common ones by not leaking from the "struct
branch_info".

Doing this is rather straightforward, albeit verbose, we need to
xstrdup() constant strings going into the struct, and free() the ones
we clobber as we go along.

This also means that we can delete previous partial leak fixes in this
area, i.e. the "path_to_free" accounting added by 96ec7b1e708 (Convert
resolve_ref+xstrdup to new resolve_refdup function, 2011-12-13).

There was some discussion about whether "we should retain the "const
char *" here and cast at free() time, or have it be a "char *". Since
this is not a public API with any sort of API boundary let's use
"char *", as is already being done for the "refname" member of the
same struct.

The tests to mark as passing were found with:

    rm .prove; GIT_SKIP_TESTS=t0027 prove -j8 --state=save t[0-9]*.sh :: --immediate
    # apply & compile this change
    prove -j8 --state=failed :: --immediate

I.e. the ones that were newly passing when the --state=failed command
was run. I left out "t3040-subprojects-basic.sh" and
"t4131-apply-fake-ancestor.sh" to to optimization-level related
differences similar to the ones noted in[1], except that these would
be something the current 'linux-leaks' job would run into.

1. https://lore.kernel.org/git/cover-v3-0.6-00000000000-20211022T175227Z-avarab@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomergesort: avoid left shift overflow
René Scharfe [Mon, 15 Nov 2021 23:19:38 +0000 (00:19 +0100)] 
mergesort: avoid left shift overflow

Use size_t to match n when building the bitmask for checking whether a
rank is occupied, instead of the default signed int.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomidx: fix a formatting issue in "multi-pack-index.txt"
Teng Long [Thu, 18 Nov 2021 07:11:14 +0000 (15:11 +0800)] 
midx: fix a formatting issue in "multi-pack-index.txt"

There is a formatting issue  in "multi-pack-index.html", corresponding
to the nesting bulleted list of a wrong usage in "multi-pack-index.txt"
and this commit fix the problem.

In ASCIIDOC, it doesn't treat an indented character as the
beginning of a sub-list. If we want to write a nested bulleted list, we
could just use ASTERISK without any DASH like:

      "
      * Level 1 list item
      ** Level 2 list item
      *** Level 3 list item
      ** Level 2 list item
      * Level 1 list item
      ** Level 2 list item
      * Level 1 list item
      "

The DASH can be used for bulleted list too, But the DASH is suggested
only to be used as the marker for the first level because the DASH
doesn’t work well or a best practice for nested lists,
like (dash is as level 2 below):

      "
      * Level 1 list item
      - Level 2 list item
      * Level 1 list item
      "

ASTERISK is recommanded to use because it works intuitively and clearly
("marker length = nesting level") in nested lists, but the DASH can't.
However, when you want to write a non-nested bulleted lists, DASH works
too, like:

      "
      - Level 1 list item
      - Level 1 list item
      - Level 1 list item
      "

Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.34 v2.34.0
Junio C Hamano [Mon, 15 Nov 2021 06:50:52 +0000 (22:50 -0800)] 
Git 2.34

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge tag 'l10n-2.34.0-rnd3.1' of git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 15 Nov 2021 05:45:40 +0000 (21:45 -0800)] 
Merge tag 'l10n-2.34.0-rnd3.1' of git://github.com/git-l10n/git-po

l10n-2.34.0-rnd3.1

* tag 'l10n-2.34.0-rnd3.1' of git://github.com/git-l10n/git-po: (38 commits)
  l10n: pl: 2.34.0 round 3
  l10n: it: fix typos found by git-po-helper
  l10n: ko: fix typos found by git-po-helper
  l10n: Update Catalan translation
  l10n: po-id for 2.34 (round 3)
  l10n: bg.po: Updated Bulgarian translation (5211t)
  l10n: de.po: Update German translation for Git v2.34.0
  l10n: sv.po: Update Swedish translation (5211t0f0)
  l10n: vi(5211t): Translation for v2.34.0 rd3
  l10n: zh_TW.po: v2.34.0 round 3 (0 untranslated)
  l10n: fr: v2.34.0 rnd 3
  l10n: tr: v2.34.0 round 3
  l10n: zh_CN: v2.34.0 round 3
  l10n: git.pot: v2.34.0 round 3 (1 new)
  l10n: pl: 2.34.0 round 2
  l10n: vi(5210t): Translation for v2.34.0 rd2
  l10n: es: 2.34.0 round 2
  l10n: Update Catalan translation
  l10n: bg.po: Updated Bulgarian translation (5210t)
  l10n: fr: v2.34.0 round 2
  ...

2 years agol10n: pl: 2.34.0 round 3
Arusekk [Sun, 14 Nov 2021 14:19:13 +0000 (15:19 +0100)] 
l10n: pl: 2.34.0 round 3

Signed-off-by: Arusekk <arek_koz@o2.pl>
2 years agol10n: it: fix typos found by git-po-helper
Jiang Xin [Sun, 14 Nov 2021 11:40:41 +0000 (19:40 +0800)] 
l10n: it: fix typos found by git-po-helper

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 years agoSubmittingPatches: fix Asciidoc syntax in "GitHub CI" section
Philippe Blain [Sat, 13 Nov 2021 20:38:05 +0000 (20:38 +0000)] 
SubmittingPatches: fix Asciidoc syntax in "GitHub CI" section

A superfluous ']' was added to the title of the GitHub CI section in
f003a91f5c (SubmittingPatches: replace discussion of Travis with GitHub
Actions, 2021-07-22). Remove it.

While at it, format the URL for a GitHub user's workflow runs of Git
between backticks, since if not Asciidoc formats only the first part,
"https://github.com/<Your", as a link, which is not very useful.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: ko: fix typos found by git-po-helper
Jiang Xin [Thu, 11 Nov 2021 00:54:16 +0000 (08:54 +0800)] 
l10n: ko: fix typos found by git-po-helper

When checking typos in file "po/ko.po", "git-po-helper" reports lots of
false positives because there are no spaces between ASCII and Korean
characters. After applied commit adee197 "(dict: add smudge table for
Korean language, 2021-11-11)" of "git-l10n/git-po-helper" to suppress
these false positives, some easy-to-fix typos are found and fixed.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 years agol10n: Update Catalan translation
Jordi Mas [Sat, 13 Nov 2021 15:35:53 +0000 (16:35 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
2 years agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Sat, 13 Nov 2021 06:42:30 +0000 (14:42 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.34 (round 3)

2 years agol10n: po-id for 2.34 (round 3)
Bagas Sanjaya [Thu, 11 Nov 2021 07:43:22 +0000 (14:43 +0700)] 
l10n: po-id for 2.34 (round 3)

  - Translate following new components:
    * merge.c
    * rebase-interactive.c
    * rebase.c
    * midx.c
  - Clean up obsolete translations

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
2 years agoMerge branch 'master' of github.com:ruester/git-po-de
Jiang Xin [Sat, 13 Nov 2021 01:27:58 +0000 (09:27 +0800)] 
Merge branch 'master' of github.com:ruester/git-po-de

* 'master' of github.com:ruester/git-po-de:
  l10n: de.po: Update German translation for Git v2.34.0

2 years agoMerge branch 'js/trace2-raise-format-version'
Junio C Hamano [Fri, 12 Nov 2021 23:29:25 +0000 (15:29 -0800)] 
Merge branch 'js/trace2-raise-format-version'

When we added a new event type to trace2 event stream, we forgot to
raise the format version number, which has been corrected.

* js/trace2-raise-format-version:
  trace2: increment event format version

2 years agoMerge branch 'ab/fsck-unexpected-type'
Junio C Hamano [Fri, 12 Nov 2021 23:29:25 +0000 (15:29 -0800)] 
Merge branch 'ab/fsck-unexpected-type'

Regression fix.

* ab/fsck-unexpected-type:
  object-file: free(*contents) only in read_loose_object() caller
  object-file: fix SEGV on free() regression in v2.34.0-rc2

2 years agoMerge branch 'ps/connectivity-optim'
Junio C Hamano [Fri, 12 Nov 2021 23:29:24 +0000 (15:29 -0800)] 
Merge branch 'ps/connectivity-optim'

Regression fix.

* ps/connectivity-optim:
  Revert "connected: do not sort input revisions"

2 years agol10n: bg.po: Updated Bulgarian translation (5211t)
Alexander Shopov [Fri, 12 Nov 2021 07:00:54 +0000 (08:00 +0100)] 
l10n: bg.po: Updated Bulgarian translation (5211t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2 years agol10n: de.po: Update German translation for Git v2.34.0
Matthias Rüster [Sun, 7 Nov 2021 17:07:34 +0000 (18:07 +0100)] 
l10n: de.po: Update German translation for Git v2.34.0

Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
Reviewed-by: Phillip Szelat <phillip.szelat@gmail.com>
2 years agotrace2: increment event format version
Josh Steadmon [Thu, 11 Nov 2021 22:34:25 +0000 (14:34 -0800)] 
trace2: increment event format version

In 64bc752 (trace2: add trace2_child_ready() to report on background
children, 2021-09-20), we added a new "child_ready" event. In
Documentation/technical/api-trace2.txt, we promise that adding a new
event type will result in incrementing the trace2 event format version
number, but this was not done. Correct this in code & docs.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoprotocol-v2.txt: align delim-pkt spec with usage
Calvin Wan [Thu, 11 Nov 2021 22:00:48 +0000 (22:00 +0000)] 
protocol-v2.txt: align delim-pkt spec with usage

The current protocol EBNF allows command-request to end with the
capability list, if no command specific arguments follow, but the
protocol requires that after the capability list, there must be a
delim-pkt regardless of the number of command specific arguments.  Fixed
the EBNF to match. Both JGit and libgit2's implementation has the
delim-pkt as mandatory. JGit's code is not publicly linkable, but
libgit2 is linked below[1]. As for currently implemented commands on v2
(ls-ref and fetch), the delim packet is already being passed through

[1]: https://github.com/libgit2/libgit2/blob/main/src/transports/git.c

Reported-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Calvin Wan <calvinwan@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: sv.po: Update Swedish translation (5211t0f0)
Peter Krefting [Thu, 11 Nov 2021 22:22:48 +0000 (23:22 +0100)] 
l10n: sv.po: Update Swedish translation (5211t0f0)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2 years agoobject-file: free(*contents) only in read_loose_object() caller
Ævar Arnfjörð Bjarmason [Thu, 11 Nov 2021 05:18:56 +0000 (06:18 +0100)] 
object-file: free(*contents) only in read_loose_object() caller

In the preceding commit a free() of uninitialized memory regression in
96e41f58fe1 (fsck: report invalid object type-path combinations,
2021-10-01) was fixed, but we'd still have an issue with leaking
memory from fsck_loose(). Let's fix that issue too.

That issue was introduced in my 31deb28f5e0 (fsck: don't hard die on
invalid object types, 2021-10-01). It can be reproduced under
SANITIZE=leak with the test I added in 093fffdfbec (fsck tests: add
test for fsck-ing an unknown type, 2021-10-01):

    ./t1450-fsck.sh --run=84 -vixd

In some sense it's not a problem, we lost the same amount of memory in
terms of things malloc'd and not free'd. It just moved from the "still
reachable" to "definitely lost" column in valgrind(1) nomenclature[1],
since we'd have die()'d before.

But now that we don't hard die() anymore in the library let's properly
free() it. Doing so makes this code much easier to follow, since we'll
now have one function owning the freeing of the "contents" variable,
not two.

For context on that memory management pattern the read_loose_object()
function was added in f6371f92104 (sha1_file: add read_loose_object()
function, 2017-01-13) and subsequently used in c68b489e564 (fsck:
parse loose object paths directly, 2017-01-13). The pattern of it
being the task of both sides to free() the memory has been there in
this form since its inception.

1. https://valgrind.org/docs/manual/mc-manual.html#mc-manual.leaks

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoRevert "connected: do not sort input revisions"
Junio C Hamano [Thu, 11 Nov 2021 20:34:41 +0000 (12:34 -0800)] 
Revert "connected: do not sort input revisions"

This reverts commit f45022dc2fd692fd024f2eb41a86a66f19013d43,
as this is like breakage in the traversal more likely.  In a
history with 10 single strand of pearls,

   1-->2-->3--...->7-->8-->9-->10

asking "rev-list --unsorted-input 1 10 --not 9 8 7 6 5 4" fails to
paint the bottom 1 uninteresting as the traversal stops, without
completing the propagation of uninteresting bit starting at 4 down
through 3 and 2 to 1.

2 years agoobject-file: fix SEGV on free() regression in v2.34.0-rc2
Ævar Arnfjörð Bjarmason [Thu, 11 Nov 2021 05:18:55 +0000 (06:18 +0100)] 
object-file: fix SEGV on free() regression in v2.34.0-rc2

Fix a regression introduced in my 96e41f58fe1 (fsck: report invalid
object type-path combinations, 2021-10-01). When fsck-ing blobs larger
than core.bigFileThreshold, we'd free() a pointer to uninitialized
memory.

This issue would have been caught by SANITIZE=address, but since it
involves core.bigFileThreshold, none of the existing tests in our test
suite covered it.

Running them with the "big_file_threshold" in "environment.c" changed
to say "6" would have shown this failure, but let's add a dedicated
test for this scenario based on Han Xin's report[1].

The bug was introduced between v9 and v10[2] of the fsck series merged
in 061a21d36d8 (Merge branch 'ab/fsck-unexpected-type', 2021-10-25).

1. https://lore.kernel.org/git/20211111030302.75694-1-hanxin.hx@alibaba-inc.com/
2. https://lore.kernel.org/git/cover-v10-00.17-00000000000-20211001T091051Z-avarab@gmail.com/

Reported-by: Han Xin <chiyutianyi@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohttp-fetch: redact url on die() message
Ivan Frade [Wed, 10 Nov 2021 23:51:29 +0000 (23:51 +0000)] 
http-fetch: redact url on die() message

http-fetch prints the URL after failing to fetch it. This can be
confusing to users (they cannot really do anything with it), and they
can share by accident a sensitive URL (e.g. with credentials) while
looking for help.

Redact the URL unless the GIT_TRACE_REDACT variable is set to false. This
mimics the redaction of other sensitive information in git, like the
Authorization header in HTTP.

Fix also capitalization of previous die() message (must start in
lowercase).

Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofetch-pack: redact packfile urls in traces
Ivan Frade [Wed, 10 Nov 2021 23:51:28 +0000 (23:51 +0000)] 
fetch-pack: redact packfile urls in traces

In some setups, packfile uris act as bearer token. It is not
recommended to expose them plainly in logs, although in special
circunstances (e.g. debug) it makes sense to write them.

Redact the packfile URL paths by default, unless the GIT_TRACE_REDACT
variable is set to false. This mimics the redacting of the Authorization
header in HTTP.

Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopackfile: avoid overflowing shift during decode
Jonathan Tan [Wed, 10 Nov 2021 23:40:33 +0000 (15:40 -0800)] 
packfile: avoid overflowing shift during decode

unpack_object_header_buffer() attempts to protect against overflowing
left shifts, but the limit of the shift amount should not be the size of
the variable being shifted. It should be the size minus the size of its
contents. Fix that accordingly.

This was noticed at $DAYJOB by a fuzzer running internally.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: vi(5211t): Translation for v2.34.0 rd3
Tran Ngoc Quan [Thu, 11 Nov 2021 06:19:34 +0000 (13:19 +0700)] 
l10n: vi(5211t): Translation for v2.34.0 rd3

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2 years agoMerge branch 'l10n/zh_TW/211111' of github.com:l10n-tw/git-po
Jiang Xin [Thu, 11 Nov 2021 00:28:26 +0000 (08:28 +0800)] 
Merge branch 'l10n/zh_TW/211111' of github.com:l10n-tw/git-po

* 'l10n/zh_TW/211111' of github.com:l10n-tw/git-po:
  l10n: zh_TW.po: v2.34.0 round 3 (0 untranslated)

2 years agoMerge branch 'fr_v2.34.0_rnd3' of github.com:jnavila/git
Jiang Xin [Thu, 11 Nov 2021 00:27:49 +0000 (08:27 +0800)] 
Merge branch 'fr_v2.34.0_rnd3' of github.com:jnavila/git

* 'fr_v2.34.0_rnd3' of github.com:jnavila/git:
  l10n: fr: v2.34.0 rnd 3

2 years agoMerge branch 'tr-2-34-r3' of github.com:bitigchi/git-po
Jiang Xin [Thu, 11 Nov 2021 00:26:54 +0000 (08:26 +0800)] 
Merge branch 'tr-2-34-r3' of github.com:bitigchi/git-po

* 'tr-2-34-r3' of github.com:bitigchi/git-po:
  l10n: tr: v2.34.0 round 3

2 years agoA few hotfixes
Junio C Hamano [Wed, 10 Nov 2021 22:59:51 +0000 (14:59 -0800)] 
A few hotfixes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jk/ssh-signing-fix'
Junio C Hamano [Wed, 10 Nov 2021 23:01:21 +0000 (15:01 -0800)] 
Merge branch 'jk/ssh-signing-fix'

Reject OpenSSH 8.7 whose "ssh-keygen -Y find-principals" is
unusable from running the ssh signature tests.

* jk/ssh-signing-fix:
  t/lib-gpg: avoid broken versions of ssh-keygen

2 years agoMerge branch 'js/simple-ipc-cygwin-socket-fix'
Junio C Hamano [Wed, 10 Nov 2021 23:01:20 +0000 (15:01 -0800)] 
Merge branch 'js/simple-ipc-cygwin-socket-fix'

The way Cygwin emulates a unix-domain socket, on top of which the
simple-ipc mechanism is implemented, can race with the program on
the other side that wants to use the socket, and briefly make it
appear as a regular file before lstat(2) starts reporting it as a
socket.  We now have a workaround on the side that connects to a
unix domain socket.

* js/simple-ipc-cygwin-socket-fix:
  simple-ipc: work around issues with Cygwin's Unix socket emulation

2 years agoMerge branch 'ds/no-usable-cron-on-macos'
Junio C Hamano [Wed, 10 Nov 2021 23:01:20 +0000 (15:01 -0800)] 
Merge branch 'ds/no-usable-cron-on-macos'

"git maintenance run" learned to use system supplied scheduler
backend, but cron on macOS turns out to be unusable for this
purpose.

* ds/no-usable-cron-on-macos:
  maintenance: disable cron on macOS