]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoMerge branch 'ps/pack-bitmap-optim'
Junio C Hamano [Wed, 7 Apr 2021 23:54:09 +0000 (16:54 -0700)] 
Merge branch 'ps/pack-bitmap-optim'

Optimize "rev-list --use-bitmap-index --objects" corner case that
uses negative tags as the stopping points.

* ps/pack-bitmap-optim:
  pack-bitmap: avoid traversal of objects referenced by uninteresting tag

3 years agoMerge branch 'zh/commit-trailer'
Junio C Hamano [Wed, 7 Apr 2021 23:54:08 +0000 (16:54 -0700)] 
Merge branch 'zh/commit-trailer'

"git commit" learned "--trailer <key>[=<value>]" option; together
with the interpret-trailers command, this will make it easier to
support custom trailers.

* zh/commit-trailer:
  commit: add --trailer option

3 years agoMerge branch 'js/cmake-vsbuild'
Junio C Hamano [Wed, 7 Apr 2021 23:54:08 +0000 (16:54 -0700)] 
Merge branch 'js/cmake-vsbuild'

CMake update for vsbuild.

* js/cmake-vsbuild:
  cmake(install): include vcpkg dlls
  cmake: add a preparatory work-around to accommodate `vcpkg`
  cmake(install): fix double .exe suffixes
  cmake: support SKIP_DASHED_BUILT_INS

3 years agoMerge branch 'ds/clarify-hashwrite'
Junio C Hamano [Wed, 7 Apr 2021 23:54:08 +0000 (16:54 -0700)] 
Merge branch 'ds/clarify-hashwrite'

The hashwrite() API uses a buffering mechanism to avoid calling
write(2) too frequently. This logic has been refactored to be
easier to understand.

* ds/clarify-hashwrite:
  csum-file: make hashwrite() more readable

3 years agoMerge branch 'ah/plugleaks'
Junio C Hamano [Wed, 7 Apr 2021 23:54:08 +0000 (16:54 -0700)] 
Merge branch 'ah/plugleaks'

Plug or annotate remaining leaks that trigger while running the
very basic set of tests.

* ah/plugleaks:
  transport: also free remote_refs in transport_disconnect()
  parse-options: don't leak alias help messages
  parse-options: convert bitfield values to use binary shift
  init-db: silence template_dir leak when converting to absolute path
  init: remove git_init_db_config() while fixing leaks
  worktree: fix leak in dwim_branch()
  clone: free or UNLEAK further pointers when finished
  reset: free instead of leaking unneeded ref
  symbolic-ref: don't leak shortened refname in check_symref()

3 years agoThe sixth batch
Junio C Hamano [Fri, 2 Apr 2021 21:43:31 +0000 (14:43 -0700)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'zh/format-patch-fractional-reroll-count'
Junio C Hamano [Fri, 2 Apr 2021 21:43:14 +0000 (14:43 -0700)] 
Merge branch 'zh/format-patch-fractional-reroll-count'

"git format-patch -v<n>" learned to allow a reroll count that is
not an integer.

* zh/format-patch-fractional-reroll-count:
  format-patch: allow a non-integral version numbers

3 years agoMerge branch 'jh/simple-ipc'
Junio C Hamano [Fri, 2 Apr 2021 21:43:14 +0000 (14:43 -0700)] 
Merge branch 'jh/simple-ipc'

A simple IPC interface gets introduced to build services like
fsmonitor on top.

* jh/simple-ipc:
  t0052: add simple-ipc tests and t/helper/test-simple-ipc tool
  simple-ipc: add Unix domain socket implementation
  unix-stream-server: create unix domain socket under lock
  unix-socket: disallow chdir() when creating unix domain sockets
  unix-socket: add backlog size option to unix_stream_listen()
  unix-socket: eliminate static unix_stream_socket() helper function
  simple-ipc: add win32 implementation
  simple-ipc: design documentation for new IPC mechanism
  pkt-line: add options argument to read_packetized_to_strbuf()
  pkt-line: add PACKET_READ_GENTLE_ON_READ_ERROR option
  pkt-line: do not issue flush packets in write_packetized_*()
  pkt-line: eliminate the need for static buffer in packet_write_gently()

3 years agoMerge branch 'mt/parallel-checkout-part-1'
Junio C Hamano [Fri, 2 Apr 2021 21:43:14 +0000 (14:43 -0700)] 
Merge branch 'mt/parallel-checkout-part-1'

Preparatory API changes for parallel checkout.

* mt/parallel-checkout-part-1:
  entry: add checkout_entry_ca() taking preloaded conv_attrs
  entry: move conv_attrs lookup up to checkout_entry()
  entry: extract update_ce_after_write() from write_entry()
  entry: make fstat_output() and read_blob_entry() public
  entry: extract a header file for entry.c functions
  convert: add classification for conv_attrs struct
  convert: add get_stream_filter_ca() variant
  convert: add [async_]convert_to_working_tree_ca() variants
  convert: make convert_attrs() and convert structs public

3 years agoThe fifth batch
Junio C Hamano [Tue, 30 Mar 2021 21:33:34 +0000 (14:33 -0700)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jc/doc-format-patch-clarify'
Junio C Hamano [Tue, 30 Mar 2021 21:35:38 +0000 (14:35 -0700)] 
Merge branch 'jc/doc-format-patch-clarify'

Explain pieces of the format-patch output upfront before the rest
of the documentation starts referring to them.

* jc/doc-format-patch-clarify:
  format-patch: give an overview of what a "patch" message is

3 years agoMerge branch 'ab/detox-gettext-tests'
Junio C Hamano [Tue, 30 Mar 2021 21:35:38 +0000 (14:35 -0700)] 
Merge branch 'ab/detox-gettext-tests'

Testfix.

* ab/detox-gettext-tests:
  mktag tests: fix broken "&&" chain

3 years agoMerge branch 'hx/pack-objects-chunk-comment'
Junio C Hamano [Tue, 30 Mar 2021 21:35:37 +0000 (14:35 -0700)] 
Merge branch 'hx/pack-objects-chunk-comment'

Comment update.

* hx/pack-objects-chunk-comment:
  pack-objects: fix comment of reused_chunk.difference

3 years agoMerge branch 'rf/send-email-hookspath'
Junio C Hamano [Tue, 30 Mar 2021 21:35:37 +0000 (14:35 -0700)] 
Merge branch 'rf/send-email-hookspath'

"git send-email" learned to honor the core.hooksPath configuration.

* rf/send-email-hookspath:
  git-send-email: Respect core.hooksPath setting

3 years agoMerge branch 'ab/remove-rebase-usebuiltin'
Junio C Hamano [Tue, 30 Mar 2021 21:35:37 +0000 (14:35 -0700)] 
Merge branch 'ab/remove-rebase-usebuiltin'

Remove the final hint that we used to have a scripted "git rebase".

* ab/remove-rebase-usebuiltin:
  rebase: remove transitory rebase.useBuiltin setting & env

3 years agoMerge branch 'cs/http-use-basic-after-failed-negotiate'
Junio C Hamano [Tue, 30 Mar 2021 21:35:37 +0000 (14:35 -0700)] 
Merge branch 'cs/http-use-basic-after-failed-negotiate'

When accessing a server with a URL like https://user:pass@site/, we
did not to fall back to the basic authentication with the
credential material embedded in the URL after the "Negotiate"
authentication failed.  Now we do.

* cs/http-use-basic-after-failed-negotiate:
  remote-curl: fall back to basic auth if Negotiate fails

3 years agoMerge branch 'ab/diff-no-index-tests'
Junio C Hamano [Tue, 30 Mar 2021 21:35:37 +0000 (14:35 -0700)] 
Merge branch 'ab/diff-no-index-tests'

More test coverage over "diff --no-index".

* ab/diff-no-index-tests:
  diff --no-index tests: test mode normalization
  diff --no-index tests: add test for --exit-code

3 years agoMerge branch 'ab/read-tree'
Junio C Hamano [Tue, 30 Mar 2021 21:35:37 +0000 (14:35 -0700)] 
Merge branch 'ab/read-tree'

Code simplification by removing support for a caller that is long gone.

* ab/read-tree:
  tree.h API: simplify read_tree_recursive() signature
  tree.h API: expose read_tree_1() as read_tree_at()
  archive: stop passing "stage" through read_tree_recursive()
  ls-files: refactor away read_tree()
  ls-files: don't needlessly pass around stage variable
  tree.c API: move read_tree() into builtin/ls-files.c
  ls-files tests: add meaningful --with-tree tests
  show tests: add test for "git show <tree>"

3 years agoMerge branch 'bs/asciidoctor-installation-hints'
Junio C Hamano [Tue, 30 Mar 2021 21:35:36 +0000 (14:35 -0700)] 
Merge branch 'bs/asciidoctor-installation-hints'

Doc update.

* bs/asciidoctor-installation-hints:
  INSTALL: note on using Asciidoctor to build doc

3 years agoMerge branch 'mt/checkout-remove-nofollow'
Junio C Hamano [Tue, 30 Mar 2021 21:35:36 +0000 (14:35 -0700)] 
Merge branch 'mt/checkout-remove-nofollow'

When "git checkout" removes a path that does not exist in the
commit it is checking out, it wasn't careful enough not to follow
symbolic links, which has been corrected.

* mt/checkout-remove-nofollow:
  checkout: don't follow symlinks when removing entries
  symlinks: update comment on threaded_check_leading_path()

3 years agocmake(install): include vcpkg dlls
Dennis Ameling [Mon, 29 Mar 2021 12:41:45 +0000 (12:41 +0000)] 
cmake(install): include vcpkg dlls

Our CMake configuration generates not only build definitions, but also
install definitions: After building Git using `msbuild git.sln`, the
built artifacts can be installed via `msbuild INSTALL.vcxproj`.

To specify _where_ the files should be installed, the
`-DCMAKE_INSTALL_PREFIX=<path>` option can be used when running CMake.

However, this process would really only install the files that were just
built. On Windows, we need more than that: We also need the `.dll` files
of the dependencies (such as libcurl). The `vcpkg` ecosystem, which we
use to obtain those dependencies, can be asked to install said `.dll`
files really easily, so let's do that.

This requires more than just the built `vcpkg` artifacts in the CI build
definition; We now clone the `vcpkg` repository so that the relevant
CMake scripts are available, in particular the ones related to defining
the toolchain.

Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocmake: add a preparatory work-around to accommodate `vcpkg`
Johannes Schindelin [Mon, 29 Mar 2021 12:41:44 +0000 (12:41 +0000)] 
cmake: add a preparatory work-around to accommodate `vcpkg`

We are about to add support for installing the `.dll` files of Git's
dependencies (such as libcurl) in the CMake configuration. The `vcpkg`
ecosystem from which we get said dependencies makes that relatively
easy: simply turn on `X_VCPKG_APPLOCAL_DEPS_INSTALL`.

However, current `vcpkg` introduces a limitation if one does that:
While it is totally cool with CMake to specify multiple targets within
one invocation of `install(TARGETS ...) (at least according to
https://cmake.org/cmake/help/latest/command/install.html#command:install),
`vcpkg`'s parser insists on a single target per `install(TARGETS ...)`
invocation.

Well, that's easily accomplished: Let's feed the targets individually to
the `install(TARGETS ...)` function in a `foreach()` look.

This also has the advantage that we do not have to manually cull off the
two entries from the `${PROGRAMS_BUILT}` array before scheduling the
remainder to be installed into `libexec/git-core`. Instead, we iterate
through the array and decide for each entry where it wants to go.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocmake(install): fix double .exe suffixes
Dennis Ameling [Sat, 27 Mar 2021 23:06:23 +0000 (23:06 +0000)] 
cmake(install): fix double .exe suffixes

By mistake, the `.exe` extension is appended _twice_ when installing the
dashed executables into `libexec/git-core/` on Windows (the extension is
already appended when adding items to the `git_links` list in the
`#Creating hardlinks` section).

Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocmake: support SKIP_DASHED_BUILT_INS
Johannes Schindelin [Sat, 27 Mar 2021 23:06:22 +0000 (23:06 +0000)] 
cmake: support SKIP_DASHED_BUILT_INS

Just like the Makefile-based build learned to skip hard-linking the
dashed built-ins in 179227d6e21 (Optionally skip linking/copying the
built-ins, 2020-09-21), this patch teaches the CMake-based build the
same trick.

Note: In contrast to the Makefile-based process, the built-ins would
only be linked during installation, not already when Git is built.
Therefore, the CMake-based build that we use in our CI builds _already_
does not link those built-ins (because the files are not installed
anywhere, they are used to run the test suite in-place).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSync with v2.31.1
Junio C Hamano [Fri, 26 Mar 2021 21:59:47 +0000 (14:59 -0700)] 
Sync with v2.31.1

3 years agoThe fourth batch
Junio C Hamano [Fri, 26 Mar 2021 21:58:49 +0000 (14:58 -0700)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'cm/rebase-i-fixup-amend-reword'
Junio C Hamano [Fri, 26 Mar 2021 21:59:03 +0000 (14:59 -0700)] 
Merge branch 'cm/rebase-i-fixup-amend-reword'

"git commit --fixup=<commit>", which was to tweak the changes made
to the contents while keeping the original log message intact,
learned "--fixup=(amend|reword):<commit>", that can be used to
tweak both the message and the contents, and only the message,
respectively.

* cm/rebase-i-fixup-amend-reword:
  doc/git-commit: add documentation for fixup=[amend|reword] options
  t3437: use --fixup with options to create amend! commit
  t7500: add tests for --fixup=[amend|reword] options
  commit: add a reword suboption to --fixup
  commit: add amend suboption to --fixup to create amend! commit
  sequencer: export and rename subject_length()

3 years agoMerge branch 'cm/rebase-i-updates'
Junio C Hamano [Fri, 26 Mar 2021 21:59:03 +0000 (14:59 -0700)] 
Merge branch 'cm/rebase-i-updates'

Follow-up fixes to "cm/rebase-i" topic.

* cm/rebase-i-updates:
  doc/rebase -i: fix typo in the documentation of 'fixup' command
  t/t3437: fixup the test 'multiple fixup -c opens editor once'
  t/t3437: use named commits in the tests
  t/t3437: simplify and document the test helpers
  t/t3437: check the author date of fixed up commit
  t/t3437: remove the dependency of 'expected-message' file from tests
  t/t3437: fixup here-docs in the 'setup' test
  t/lib-rebase: update the documentation of FAKE_LINES
  rebase -i: clarify and fix 'fixup -c' rebase-todo help
  sequencer: rename a few functions
  sequencer: fixup the datatype of the 'flag' argument

3 years agoMerge branch 'cm/rebase-i'
Junio C Hamano [Fri, 26 Mar 2021 21:59:03 +0000 (14:59 -0700)] 
Merge branch 'cm/rebase-i'

"rebase -i" is getting cleaned up and also enhanced.

* cm/rebase-i:
  doc/git-rebase: add documentation for fixup [-C|-c] options
  rebase -i: teach --autosquash to work with amend!
  t3437: test script for fixup [-C|-c] options in interactive rebase
  rebase -i: add fixup [-C | -c] command
  sequencer: use const variable for commit message comments
  sequencer: pass todo_item to do_pick_commit()
  rebase -i: comment out squash!/fixup! subjects from squash message
  sequencer: factor out code to append squash message
  rebase -i: only write fixup-message when it's needed

3 years agoMerge branch 'js/http-pki-credential-store'
Junio C Hamano [Fri, 26 Mar 2021 21:59:02 +0000 (14:59 -0700)] 
Merge branch 'js/http-pki-credential-store'

The http codepath learned to let the credential layer to cache the
password used to unlock a certificate that has successfully been
used.

* js/http-pki-credential-store:
  http: drop the check for an empty proxy password before approving
  http: store credential when PKI auth is used

3 years agoMerge branch 'ab/make-cleanup'
Junio C Hamano [Fri, 26 Mar 2021 21:59:02 +0000 (14:59 -0700)] 
Merge branch 'ab/make-cleanup'

Reorganize Makefile to allow building git.o and other essential
objects without extra stuff needed only for testing.

* ab/make-cleanup:
  Makefile: add {program,xdiff,test,git,fuzz}-objs & objects targets
  Makefile: split OBJECTS into OBJECTS and GIT_OBJS
  Makefile: sort OBJECTS assignment for subsequent change
  Makefile: split up long OBJECTS line
  Makefile: guard against TEST_OBJS in the environment

3 years agoGit 2.31.1 v2.31.1
Junio C Hamano [Fri, 19 Mar 2021 22:07:58 +0000 (15:07 -0700)] 
Git 2.31.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocsum-file: make hashwrite() more readable
Derrick Stolee [Fri, 26 Mar 2021 12:38:11 +0000 (12:38 +0000)] 
csum-file: make hashwrite() more readable

The hashwrite() method takes an input buffer and updates a hashfile's
hash function while writing the data to a file. To avoid overuse of
flushes, the hashfile has an internal buffer and most writes will use
memcpy() to transfer data from the input 'buf' to the hashfile's buffer
of size 8 * 1024 bytes.

Logic introduced by a8032d12 (sha1write: don't copy full sized buffers,
2008-09-02) reduces the number of memcpy() calls when the input buffer
is sufficiently longer than the hashfile's buffer, causing nr to be the
length of the full buffer. In these cases, the input buffer is used
directly in chunks equal to the hashfile's buffer size.

This method caught my attention while investigating some performance
issues, but it turns out that these performance issues were noise within
the variance of the experiment.

However, during this investigation, I inspected hashwrite() and
misunderstood it, even after looking closely and trying to make it
faster. This change simply reorganizes some parts of the loop within
hashwrite() to make it clear that each batch either uses memcpy() to the
hashfile's buffer or writes directly from the input buffer. The previous
code relied on indirection through local variables and essentially
inlined the implementation of hashflush() to reduce lines of code.

Helped-by: Jeff King <peff@peff.net>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe third patch
Junio C Hamano [Wed, 24 Mar 2021 21:36:01 +0000 (14:36 -0700)] 
The third patch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'nk/diff-index-fsmonitor'
Junio C Hamano [Wed, 24 Mar 2021 21:36:27 +0000 (14:36 -0700)] 
Merge branch 'nk/diff-index-fsmonitor'

"git diff-index" codepath has been taught to trust fsmonitor status
to reduce number of lstat() calls.

* nk/diff-index-fsmonitor:
  fsmonitor: add perf test for git diff HEAD
  fsmonitor: add assertion that fsmonitor is valid to check_removed
  fsmonitor: skip lstat deletion check during git diff-index

3 years agoMerge branch 'jk/fail-prereq-testfix'
Junio C Hamano [Wed, 24 Mar 2021 21:36:27 +0000 (14:36 -0700)] 
Merge branch 'jk/fail-prereq-testfix'

GIT_TEST_FAIL_PREREQS is a mechanism to skip test pieces with
prerequisites to catch broken tests that depend on the side effects
of optional pieces, but did not work at all when negative
prerequisites were involved.

* jk/fail-prereq-testfix:
  t: annotate !PTHREADS tests with !FAIL_PREREQS

3 years agoMerge branch 'tb/geometric-repack'
Junio C Hamano [Wed, 24 Mar 2021 21:36:27 +0000 (14:36 -0700)] 
Merge branch 'tb/geometric-repack'

"git repack" so far has been only capable of repacking everything
under the sun into a single pack (or split by size).  A cleverer
strategy to reduce the cost of repacking a repository has been
introduced.

* tb/geometric-repack:
  builtin/pack-objects.c: ignore missing links with --stdin-packs
  builtin/repack.c: reword comment around pack-objects flags
  builtin/repack.c: be more conservative with unsigned overflows
  builtin/repack.c: assign pack split later
  t7703: test --geometric repack with loose objects
  builtin/repack.c: do not repack single packs with --geometric
  builtin/repack.c: add '--geometric' option
  packfile: add kept-pack cache for find_kept_pack_entry()
  builtin/pack-objects.c: rewrite honor-pack-keep logic
  p5303: measure time to repack with keep
  p5303: add missing &&-chains
  builtin/pack-objects.c: add '--stdin-packs' option
  revision: learn '--no-kept-objects'
  packfile: introduce 'find_kept_pack_entry()'

3 years agoMerge branch 'tb/push-simple-uses-branch-merge-config'
Junio C Hamano [Wed, 24 Mar 2021 21:36:27 +0000 (14:36 -0700)] 
Merge branch 'tb/push-simple-uses-branch-merge-config'

Doc update.

* tb/push-simple-uses-branch-merge-config:
  Documentation/git-push.txt: correct configuration typo

3 years agopack-objects: fix comment of reused_chunk.difference
Han Xin [Tue, 23 Mar 2021 03:20:50 +0000 (11:20 +0800)] 
pack-objects: fix comment of reused_chunk.difference

As record_reused_object(offset, offset - hashfile_total(out)) said,
reused_chunk.difference should be the offset of original packfile minus
the offset of the generated packfile. But the comment presented an opposite way.

Signed-off-by: Han Xin <hanxin.hx@alibaba-inc.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoformat-patch: give an overview of what a "patch" message is
Junio C Hamano [Wed, 24 Mar 2021 17:35:40 +0000 (10:35 -0700)] 
format-patch: give an overview of what a "patch" message is

The text says something called a "patch" is prepared one for each
commit, it is suitable for e-mail submission, and "am" is the
command to use it, but does not say what the "patch" really is.

The description in the page also refers to the "three-dash" line,
but it is unclear what it is, unless the reader is given a more
detailed overview of what the "patch" is.

Add a brief paragraph to give an overview of what the output looks
like.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomktag tests: fix broken "&&" chain
Ævar Arnfjörð Bjarmason [Wed, 24 Mar 2021 02:11:52 +0000 (03:11 +0100)] 
mktag tests: fix broken "&&" chain

Remove a stray "xb" I inadvertently introduced in 780aa0a21e0 (tests:
remove last uses of GIT_TEST_GETTEXT_POISON=false, 2021-02-11).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-send-email: Respect core.hooksPath setting
Robert Foss [Tue, 23 Mar 2021 17:33:27 +0000 (18:33 +0100)] 
git-send-email: Respect core.hooksPath setting

get-send-email currently makes the assumption that the
'sendemail-validate' hook exists inside of the repository.

Since the introduction of 'core.hooksPath' configuration option in
867ad08a261 (hooks: allow customizing where the hook directory is,
2016-05-04), this is no longer true.

Instead of assuming a hardcoded repo relative path, query
git for the actual path of the hooks directory.

Signed-off-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorebase: remove transitory rebase.useBuiltin setting & env
Ævar Arnfjörð Bjarmason [Tue, 23 Mar 2021 15:23:58 +0000 (16:23 +0100)] 
rebase: remove transitory rebase.useBuiltin setting & env

Remove the rebase.useBuiltin setting and the now-obsolete
GIT_TEST_REBASE_USE_BUILTIN test flag.

This was left in place after my d03ebd411c6 (rebase: remove the
rebase.useBuiltin setting, 2019-03-18) to help anyone who'd used the
experimental flag and wanted to know that it was the default, or that
they should transition their test environment to use the builtin
rebase unconditionally.

It's been more than long enough for those users to get a headsup about
this. So remove all the scaffolding that was left inplace after
d03ebd411c6. I'm also removing the documentation entry, if anyone
still has this left in their configuration they can do some source
archaeology to figure out what it used to do, which makes more sense
than exposing every git user reading the documentation to this legacy
configuration switch.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoformat-patch: allow a non-integral version numbers
ZheNing Hu [Tue, 23 Mar 2021 11:12:25 +0000 (11:12 +0000)] 
format-patch: allow a non-integral version numbers

The `-v<n>` option of `format-patch` can give nothing but an
integral iteration number to patches in a series.  Some people,
however, prefer to mark a new iteration with only a small fixup
with a non integral iteration number (e.g. an "oops, that was
wrong" fix-up patch for v4 iteration may be labeled as "v4.1").

Allow `format-patch` to take such a non-integral iteration
number.

`<n>` can be any string, such as '3.1' or '4rev2'. In the case
where it is a non-integral value, the "Range-diff" and "Interdiff"
headers will not include the previous version.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoentry: add checkout_entry_ca() taking preloaded conv_attrs
Matheus Tavares [Tue, 23 Mar 2021 14:19:36 +0000 (11:19 -0300)] 
entry: add checkout_entry_ca() taking preloaded conv_attrs

The parallel checkout machinery will call checkout_entry() for entries
that could not be written in parallel due to path collisions. At this
point, we will already be holding the conversion attributes for each
entry, and it would be wasteful to let checkout_entry() load these
again. Instead, let's add the checkout_entry_ca() variant, which
optionally takes a preloaded conv_attrs struct.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoentry: move conv_attrs lookup up to checkout_entry()
Matheus Tavares [Tue, 23 Mar 2021 14:19:35 +0000 (11:19 -0300)] 
entry: move conv_attrs lookup up to checkout_entry()

In a following patch, checkout_entry() will use conv_attrs to decide
whether an entry should be enqueued for parallel checkout or not. But
the attributes lookup only happens lower in this call stack. To avoid
the unnecessary work of loading the attributes twice, let's move it up
to checkout_entry(), and pass the loaded struct down to write_entry().

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoentry: extract update_ce_after_write() from write_entry()
Matheus Tavares [Tue, 23 Mar 2021 14:19:34 +0000 (11:19 -0300)] 
entry: extract update_ce_after_write() from write_entry()

The code that updates the in-memory index information after an entry is
written currently resides in write_entry(). Extract it to a public
function so that it can be called by the parallel checkout functions,
outside entry.c, in a later patch.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoentry: make fstat_output() and read_blob_entry() public
Matheus Tavares [Tue, 23 Mar 2021 14:19:33 +0000 (11:19 -0300)] 
entry: make fstat_output() and read_blob_entry() public

These two functions will be used by the parallel checkout code, so let's
make them public. Note: fstat_output() is renamed to
fstat_checkout_output(), now that it has become public, seeking to avoid
future name collisions.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoentry: extract a header file for entry.c functions
Matheus Tavares [Tue, 23 Mar 2021 14:19:32 +0000 (11:19 -0300)] 
entry: extract a header file for entry.c functions

The declarations of entry.c's public functions and structures currently
reside in cache.h. Although not many, they contribute to the size of
cache.h and, when changed, cause the unnecessary recompilation of
modules that don't really use these functions. So let's move them to a
new entry.h header. While at it let's also move a comment related to
checkout_entry() from entry.c to entry.h as it's more useful to describe
the function there.

Original-patch-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit: add --trailer option
ZheNing Hu [Tue, 23 Mar 2021 13:55:57 +0000 (13:55 +0000)] 
commit: add --trailer option

Historically, Git has supported the 'Signed-off-by' commit trailer
using the '--signoff' and the '-s' option from the command line.
But users may need to provide other trailer information from the
command line such as "Helped-by", "Reported-by", "Mentored-by",

Now implement a new `--trailer <token>[(=|:)<value>]` option to pass
other trailers to `interpret-trailers` and insert them into commit
messages.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe second batch
Junio C Hamano [Mon, 22 Mar 2021 21:00:00 +0000 (14:00 -0700)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'bc/clone-bare-with-conflicting-config'
Junio C Hamano [Mon, 22 Mar 2021 21:00:25 +0000 (14:00 -0700)] 
Merge branch 'bc/clone-bare-with-conflicting-config'

"git -c core.bare=false clone --bare ..." would have segfaulted,
which has been corrected.

* bc/clone-bare-with-conflicting-config:
  builtin/init-db: handle bare clones when core.bare set to false

3 years agoMerge branch 'jk/filter-branch-sha256'
Junio C Hamano [Mon, 22 Mar 2021 21:00:25 +0000 (14:00 -0700)] 
Merge branch 'jk/filter-branch-sha256'

Code clean-up.

* jk/filter-branch-sha256:
  filter-branch: drop $_x40 glob
  filter-branch: drop multiple-ancestor warning
  t7003: test ref rewriting explicitly

3 years agoMerge branch 'ps/update-ref-trans-hook-doc'
Junio C Hamano [Mon, 22 Mar 2021 21:00:25 +0000 (14:00 -0700)] 
Merge branch 'ps/update-ref-trans-hook-doc'

Doc update.

* ps/update-ref-trans-hook-doc:
  githooks.txt: clarify documentation on reference-transaction hook
  githooks.txt: replace mentions of SHA-1 specific properties

3 years agoMerge branch 'rr/mailmap-entry-self'
Junio C Hamano [Mon, 22 Mar 2021 21:00:25 +0000 (14:00 -0700)] 
Merge branch 'rr/mailmap-entry-self'

* rr/mailmap-entry-self:
  Add entry for Ramkumar Ramachandra

3 years agoMerge branch 'jr/doc-ignore-typofix'
Junio C Hamano [Mon, 22 Mar 2021 21:00:25 +0000 (14:00 -0700)] 
Merge branch 'jr/doc-ignore-typofix'

Doc cleanup.

* jr/doc-ignore-typofix:
  doc: .gitignore documentation typofix

3 years agoMerge branch 'sv/t9801-test-path-is-file-cleanup'
Junio C Hamano [Mon, 22 Mar 2021 21:00:24 +0000 (14:00 -0700)] 
Merge branch 'sv/t9801-test-path-is-file-cleanup'

Test cleanup.

* sv/t9801-test-path-is-file-cleanup:
  t9801: replace test -f with test_path_is_file

3 years agoMerge branch 'dl/cat-file-doc-cleanup'
Junio C Hamano [Mon, 22 Mar 2021 21:00:24 +0000 (14:00 -0700)] 
Merge branch 'dl/cat-file-doc-cleanup'

Doc cleanup.

* dl/cat-file-doc-cleanup:
  git-cat-file.txt: remove references to "sha1"
  git-cat-file.txt: monospace args, placeholders and filenames

3 years agoMerge branch 'rs/pretty-describe'
Junio C Hamano [Mon, 22 Mar 2021 21:00:24 +0000 (14:00 -0700)] 
Merge branch 'rs/pretty-describe'

"git log --format='...'" learned "%(describe)" placeholder.

* rs/pretty-describe:
  archive: expand only a single %(describe) per archive
  pretty: document multiple %(describe) being inconsistent
  t4205: assert %(describe) test coverage
  pretty: add merge and exclude options to %(describe)
  pretty: add %(describe)

3 years agoMerge branch 'dl/stash-show-untracked'
Junio C Hamano [Mon, 22 Mar 2021 21:00:24 +0000 (14:00 -0700)] 
Merge branch 'dl/stash-show-untracked'

"git stash show" learned to optionally show untracked part of the
stash.

* dl/stash-show-untracked:
  stash show: learn stash.showIncludeUntracked
  stash show: teach --include-untracked and --only-untracked

3 years agoMerge branch 'en/ort-perf-batch-8'
Junio C Hamano [Mon, 22 Mar 2021 21:00:23 +0000 (14:00 -0700)] 
Merge branch 'en/ort-perf-batch-8'

Rename detection rework continues.

* en/ort-perf-batch-8:
  diffcore-rename: compute dir_rename_guess from dir_rename_counts
  diffcore-rename: limit dir_rename_counts computation to relevant dirs
  diffcore-rename: compute dir_rename_counts in stages
  diffcore-rename: extend cleanup_dir_rename_info()
  diffcore-rename: move dir_rename_counts into dir_rename_info struct
  diffcore-rename: add function for clearing dir_rename_count
  Move computation of dir_rename_count from merge-ort to diffcore-rename
  diffcore-rename: add a mapping of destination names to their indices
  diffcore-rename: provide basic implementation of idx_possible_rename()
  diffcore-rename: use directory rename guided basename comparisons

3 years agoMerge branch 'ab/grep-pcre2-allocfix'
Junio C Hamano [Mon, 22 Mar 2021 21:00:23 +0000 (14:00 -0700)] 
Merge branch 'ab/grep-pcre2-allocfix'

Updates to memory allocation code around the use of pcre2 library.

* ab/grep-pcre2-allocfix:
  grep/pcre2: move definitions of pcre2_{malloc,free}
  grep/pcre2: move back to thread-only PCREv2 structures
  grep/pcre2: actually make pcre2 use custom allocator
  grep/pcre2: use pcre2_maketables_free() function
  grep/pcre2: use compile-time PCREv2 version test
  grep/pcre2: add GREP_PCRE2_DEBUG_MALLOC debug mode
  grep/pcre2: prepare to add debugging to pcre2_malloc()
  grep/pcre2: correct reference to grep_init() in comment
  grep/pcre2: drop needless assignment to NULL
  grep/pcre2: drop needless assignment + assert() on opt->pcre2

3 years agoMerge branch 'jk/perf-in-worktrees'
Junio C Hamano [Mon, 22 Mar 2021 21:00:23 +0000 (14:00 -0700)] 
Merge branch 'jk/perf-in-worktrees'

Perf test update to work better in secondary worktrees.

* jk/perf-in-worktrees:
  t/perf: avoid copying worktree files from test repo
  t/perf: handle worktrees as test repos

3 years agoMerge branch 'ds/commit-graph-generation-config'
Junio C Hamano [Mon, 22 Mar 2021 21:00:23 +0000 (14:00 -0700)] 
Merge branch 'ds/commit-graph-generation-config'

A new configuration variable has been introduced to allow choosing
which version of the generation number gets used in the
commit-graph file.

* ds/commit-graph-generation-config:
  commit-graph: use config to specify generation type
  commit-graph: create local repository pointer

3 years agoMerge branch 'ab/remote-write-config-in-camel-case'
Junio C Hamano [Mon, 22 Mar 2021 21:00:23 +0000 (14:00 -0700)] 
Merge branch 'ab/remote-write-config-in-camel-case'

Update C code that sets a few configuration variables when a remote
is configured so that it spells configuration variable names in the
canonical camelCase.

* ab/remote-write-config-in-camel-case:
  remote: write camel-cased *.pushRemote on rename
  remote: add camel-cased *.tagOpt key, like clone

3 years agoMerge branch 'mt/cleanly-die-upon-missing-required-filter'
Junio C Hamano [Mon, 22 Mar 2021 21:00:22 +0000 (14:00 -0700)] 
Merge branch 'mt/cleanly-die-upon-missing-required-filter'

We had a code to diagnose and die cleanly when a required
clean/smudge filter is missing, but an assert before that
unnecessarily fired, hiding the end-user facing die() message.

* mt/cleanly-die-upon-missing-required-filter:
  convert: fail gracefully upon missing clean cmd on required filter

3 years agoMerge branch 'jk/open-dotgitx-with-nofollow'
Junio C Hamano [Mon, 22 Mar 2021 21:00:22 +0000 (14:00 -0700)] 
Merge branch 'jk/open-dotgitx-with-nofollow'

It does not make sense to make ".gitattributes", ".gitignore" and
".mailmap" symlinks, as they are supposed to be usable from the
object store (think: bare repositories where HEAD:.mailmap etc. are
used).  When these files are symbolic links, we used to read the
contents of the files pointed by them by mistake, which has been
corrected.

* jk/open-dotgitx-with-nofollow:
  mailmap: do not respect symlinks for in-tree .mailmap
  exclude: do not respect symlinks for in-tree .gitignore
  attr: do not respect symlinks for in-tree .gitattributes
  exclude: add flags parameter to add_patterns()
  attr: convert "macro_ok" into a flags field
  add open_nofollow() helper

3 years agodiff --no-index tests: test mode normalization
Ævar Arnfjörð Bjarmason [Sun, 21 Mar 2021 22:36:20 +0000 (23:36 +0100)] 
diff --no-index tests: test mode normalization

When "git diff --no-index X Y" is run the modes of the files being
differ are normalized by canon_mode() in fill_filespec().

I recently broke that behavior in a patch of mine[1] which would pass
all tests, or not, depending on the umask of the git.git checkout.

Let's test for this explicitly. Arguably this should not be the
behavior of "git diff --no-index". We aren't diffing our own objects
or the index, so it might be useful to show mode differences between
files.

On the other hand diff(1) does not do that, and it would be needlessly
distracting when e.g. diffing an extracted tar archive whose contents
is the same, but whose file modes are different.

1. https://lore.kernel.org/git/20210316155829.31242-2-avarab@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopack-bitmap: avoid traversal of objects referenced by uninteresting tag
Patrick Steinhardt [Mon, 22 Mar 2021 12:19:06 +0000 (13:19 +0100)] 
pack-bitmap: avoid traversal of objects referenced by uninteresting tag

When preparing the bitmap walk, we first establish the set of of have
and want objects by iterating over the set of pending objects: if an
object is marked as uninteresting, it's declared as an object we already
have, otherwise as an object we want. These two sets are then used to
compute which transitively referenced objects we need to obtain.

One special case here are tag objects: when a tag is requested, we
resolve it to its first not-tag object and add both resolved objects as
well as the tag itself into either the have or want set. Given that the
uninteresting-property always propagates to referenced objects, it is
clear that if the tag is uninteresting, so are its children and vice
versa. But we fail to propagate the flag, which effectively means that
referenced objects will always be interesting except for the case where
they have already been marked as uninteresting explicitly.

This mislabeling does not impact correctness: we now have it in our
"wants" set, and given that we later do an `AND NOT` of the bitmaps of
"wants" and "haves" sets it is clear that the result must be the same.
But we now start to needlessly traverse the tag's referenced objects in
case it is uninteresting, even though we know that each referenced
object will be uninteresting anyway. In the worst case, this can lead to
a complete graph walk just to establish that we do not care for any
object.

Fix the issue by propagating the `UNINTERESTING` flag to pointees of tag
objects and add a benchmark with negative revisions to p5310. This shows
some nice performance benefits, tested with linux.git:

Test                                                          HEAD~                  HEAD
---------------------------------------------------------------------------------------------------------------
5310.3: repack to disk                                        193.18(181.46+16.42)   194.61(183.41+15.83) +0.7%
5310.4: simulated clone                                       25.93(24.88+1.05)      25.81(24.73+1.08) -0.5%
5310.5: simulated fetch                                       2.64(5.30+0.69)        2.59(5.16+0.65) -1.9%
5310.6: pack to file (bitmap)                                 58.75(57.56+6.30)      58.29(57.61+5.73) -0.8%
5310.7: rev-list (commits)                                    1.45(1.18+0.26)        1.46(1.22+0.24) +0.7%
5310.8: rev-list (objects)                                    15.35(14.22+1.13)      15.30(14.23+1.07) -0.3%
5310.9: rev-list with tag negated via --not --all (objects)   22.49(20.93+1.56)      0.11(0.09+0.01) -99.5%
5310.10: rev-list with negative tag (objects)                 0.61(0.44+0.16)        0.51(0.35+0.16) -16.4%
5310.11: rev-list count with blob:none                        12.15(11.19+0.96)      12.18(11.19+0.99) +0.2%
5310.12: rev-list count with blob:limit=1k                    17.77(15.71+2.06)      17.75(15.63+2.12) -0.1%
5310.13: rev-list count with tree:0                           1.69(1.31+0.38)        1.68(1.28+0.39) -0.6%
5310.14: simulated partial clone                              20.14(19.15+0.98)      19.98(18.93+1.05) -0.8%
5310.16: clone (partial bitmap)                               12.78(13.89+1.07)      12.72(13.99+1.01) -0.5%
5310.17: pack to file (partial bitmap)                        42.07(45.44+2.72)      41.44(44.66+2.80) -1.5%
5310.18: rev-list with tree filter (partial bitmap)           0.44(0.29+0.15)        0.46(0.32+0.14) +4.5%

While most benchmarks are probably in the range of noise, the newly
added 5310.9 and 5310.10 benchmarks consistenly perform better.

Signed-off-by: Patrick Steinhardt <ps@pks.im>.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-curl: fall back to basic auth if Negotiate fails
Christopher Schenk [Mon, 22 Mar 2021 11:51:16 +0000 (11:51 +0000)] 
remote-curl: fall back to basic auth if Negotiate fails

When the username and password are supplied in a url like this
https://myuser:secret@git.exampe/myrepo.git and the server supports the
negotiate authenticaten method, git does not fall back to basic auth and
libcurl hardly tries to authenticate with the negotiate method.

Stop using the Negotiate authentication method after the first failure
because if it fails on the first try it will never succeed.

Signed-off-by: Christopher Schenk <christopher@cschenk.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot0052: add simple-ipc tests and t/helper/test-simple-ipc tool
Jeff Hostetler [Mon, 22 Mar 2021 10:29:48 +0000 (10:29 +0000)] 
t0052: add simple-ipc tests and t/helper/test-simple-ipc tool

Create t0052-simple-ipc.sh with unit tests for the "simple-ipc" mechanism.

Create t/helper/test-simple-ipc test tool to exercise the "simple-ipc"
functions.

When the tool is invoked with "run-daemon", it runs a server to listen
for "simple-ipc" connections on a test socket or named pipe and
responds to a set of commands to exercise/stress the communication
setup.

When the tool is invoked with "start-daemon", it spawns a "run-daemon"
command in the background and waits for the server to become ready
before exiting.  (This helps make unit tests in t0052 more predictable
and avoids the need for arbitrary sleeps in the test script.)

The tool also has a series of client "send" commands to send commands
and data to a server instance.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosimple-ipc: add Unix domain socket implementation
Jeff Hostetler [Mon, 22 Mar 2021 10:29:47 +0000 (10:29 +0000)] 
simple-ipc: add Unix domain socket implementation

Create Unix domain socket based implementation of "simple-ipc".

A set of `ipc_client` routines implement a client library to connect
to an `ipc_server` over a Unix domain socket, send a simple request,
and receive a single response.  Clients use blocking IO on the socket.

A set of `ipc_server` routines implement a thread pool to listen for
and concurrently service client connections.

The server creates a new Unix domain socket at a known location.  If a
socket already exists with that name, the server tries to determine if
another server is already listening on the socket or if the socket is
dead.  If socket is busy, the server exits with an error rather than
stealing the socket.  If the socket is dead, the server creates a new
one and starts up.

If while running, the server detects that its socket has been stolen
by another server, it automatically exits.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff --no-index tests: add test for --exit-code
Ævar Arnfjörð Bjarmason [Sun, 21 Mar 2021 22:36:19 +0000 (23:36 +0100)] 
diff --no-index tests: add test for --exit-code

Add a test for --exit-code working with --no-index. There's no reason
to suppose it wouldn't, but we weren't testing for it anywhere in our
tests. Let's fix that blind spot.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotransport: also free remote_refs in transport_disconnect()
Andrzej Hunt [Sun, 21 Mar 2021 16:58:37 +0000 (16:58 +0000)] 
transport: also free remote_refs in transport_disconnect()

transport_get_remote_refs() can populate the transport struct's
remote_refs. transport_disconnect() is already responsible for most of
transport's cleanup - therefore we also take care of freeing remote_refs
there.

There are 2 locations where transport_disconnect() is called before
we're done using the returned remote_refs. This patch changes those
callsites to only call transport_disconnect() after the returned refs
are no longer being used - which is necessary to safely be able to
free remote_refs during transport_disconnect().

This commit fixes the following leak which was found while running
t0000, but is expected to also fix the same pattern of leak in all
locations that use transport_get_remote_refs():

Direct leak of 165 byte(s) in 1 object(s) allocated from:
    #0 0x49a6b2 in calloc /home/abuild/rpmbuild/BUILD/llvm-11.0.0.src/build/../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:154:3
    #1 0x9a72f2 in xcalloc /home/ahunt/oss-fuzz/git/wrapper.c:140:8
    #2 0x8ce203 in alloc_ref_with_prefix /home/ahunt/oss-fuzz/git/remote.c:867:20
    #3 0x8ce1a2 in alloc_ref /home/ahunt/oss-fuzz/git/remote.c:875:9
    #4 0x72f63e in process_ref_v2 /home/ahunt/oss-fuzz/git/connect.c:426:8
    #5 0x72f21a in get_remote_refs /home/ahunt/oss-fuzz/git/connect.c:525:8
    #6 0x979ab7 in handshake /home/ahunt/oss-fuzz/git/transport.c:305:4
    #7 0x97872d in get_refs_via_connect /home/ahunt/oss-fuzz/git/transport.c:339:9
    #8 0x9774b5 in transport_get_remote_refs /home/ahunt/oss-fuzz/git/transport.c:1388:4
    #9 0x51cf80 in cmd_clone /home/ahunt/oss-fuzz/git/builtin/clone.c:1271:9
    #10 0x4cd60d in run_builtin /home/ahunt/oss-fuzz/git/git.c:453:11
    #11 0x4cb2da in handle_builtin /home/ahunt/oss-fuzz/git/git.c:704:3
    #12 0x4ccc37 in run_argv /home/ahunt/oss-fuzz/git/git.c:771:4
    #13 0x4cac29 in cmd_main /home/ahunt/oss-fuzz/git/git.c:902:19
    #14 0x69c45e in main /home/ahunt/oss-fuzz/git/common-main.c:52:11
    #15 0x7f6a459d5349 in __libc_start_main (/lib64/libc.so.6+0x24349)

Signed-off-by: Andrzej Hunt <ajrhunt@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoparse-options: don't leak alias help messages
Andrzej Hunt [Sun, 21 Mar 2021 16:58:36 +0000 (16:58 +0000)] 
parse-options: don't leak alias help messages

preprocess_options() allocates new strings for help messages for
OPTION_ALIAS. Therefore we also need to clean those help messages up
when freeing the returned options.

First introduced in:
  7c280589cf (parse-options: teach "git cmd -h" to show alias as alias, 2020-03-16)

The preprocessed options themselves no longer contain any indication
that a given option is/was an alias - therefore we add a new flag to
indicate former aliases. (An alternative approach would be to look back
at the original options to determine which options are aliases - but
that seems like a fragile approach. Or we could even look at the
alias_groups list - which might be less fragile, but would be slower
as it requires nested looping.)

As far as I can tell, parse_options() is only ever used once per
command, and the help messages are small - hence this leak has very
little impact.

This leak was found while running t0001. LSAN output can be found below:

Direct leak of 65 byte(s) in 1 object(s) allocated from:
    #0 0x49a859 in realloc /home/abuild/rpmbuild/BUILD/llvm-11.0.0.src/build/../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:164:3
    #1 0x9aae36 in xrealloc /home/ahunt/oss-fuzz/git/wrapper.c:126:8
    #2 0x939d8d in strbuf_grow /home/ahunt/oss-fuzz/git/strbuf.c:98:2
    #3 0x93b936 in strbuf_vaddf /home/ahunt/oss-fuzz/git/strbuf.c:392:3
    #4 0x93b7ff in strbuf_addf /home/ahunt/oss-fuzz/git/strbuf.c:333:2
    #5 0x86747e in preprocess_options /home/ahunt/oss-fuzz/git/parse-options.c:666:3
    #6 0x866ed2 in parse_options /home/ahunt/oss-fuzz/git/parse-options.c:847:17
    #7 0x51c4a7 in cmd_clone /home/ahunt/oss-fuzz/git/builtin/clone.c:989:9
    #8 0x4cd60d in run_builtin /home/ahunt/oss-fuzz/git/git.c:453:11
    #9 0x4cb2da in handle_builtin /home/ahunt/oss-fuzz/git/git.c:704:3
    #10 0x4ccc37 in run_argv /home/ahunt/oss-fuzz/git/git.c:771:4
    #11 0x4cac29 in cmd_main /home/ahunt/oss-fuzz/git/git.c:902:19
    #12 0x69c9fe in main /home/ahunt/oss-fuzz/git/common-main.c:52:11
    #13 0x7fdac42d4349 in __libc_start_main (/lib64/libc.so.6+0x24349)

Signed-off-by: Andrzej Hunt <ajrhunt@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoparse-options: convert bitfield values to use binary shift
Andrzej Hunt [Sun, 21 Mar 2021 16:58:35 +0000 (16:58 +0000)] 
parse-options: convert bitfield values to use binary shift

Because it's easier to read, but also likely to be easier to maintain.
I am making this change because I need to add a new flag in a later
commit.

Also add a trailing comma to the last enum entry to simplify addition of
new flags.

This change was originally suggested by Peff in:
https://public-inbox.org/git/YEZ%2FBWWbpfVwl6nO@coredump.intra.peff.net/

Signed-off-by: Andrzej Hunt <ajrhunt@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotree.h API: simplify read_tree_recursive() signature
Ævar Arnfjörð Bjarmason [Sat, 20 Mar 2021 22:37:51 +0000 (23:37 +0100)] 
tree.h API: simplify read_tree_recursive() signature

Simplify the signature of read_tree_recursive() to omit the "base",
"baselen" and "stage" arguments. No callers of it use these parameters
for anything anymore.

The last function to call read_tree_recursive() with a non-"" path was
read_tree_recursive() itself, but that was changed in
ffd31f661d5 (Reimplement read_tree_recursive() using
tree_entry_interesting(), 2011-03-25).

The last user of the "stage" parameter went away in the last commit,
and even that use was mere boilerplate.

So let's remove those and rename the read_tree_recursive() function to
just read_tree(). We had another read_tree() function that I've
refactored away in preceding commits, since all in-tree users read
trees recursively with a callback we can change the name to signify
that this is the norm.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotree.h API: expose read_tree_1() as read_tree_at()
Ævar Arnfjörð Bjarmason [Sat, 20 Mar 2021 22:37:50 +0000 (23:37 +0100)] 
tree.h API: expose read_tree_1() as read_tree_at()

Rename the static read_tree_1() function to read_tree_at(). This
function works just like read_tree_recursive(), except you provide
your own strbuf.

This step doesn't make much sense now, but in follow-up commits I'll
remove the base/baselen/stage arguments to read_tree_recursive(). At
that point an anticipated in-tree user[1] for the old
read_tree_recursive() couldn't provide a path to start the
traversal.

Let's give them a function to do so with an API that makes more sense
for them, by taking a strbuf we should be able to avoid more casting
and/or reallocations in the future.

1. https://lore.kernel.org/git/xmqqft106sok.fsf@gitster.g

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoarchive: stop passing "stage" through read_tree_recursive()
Ævar Arnfjörð Bjarmason [Sat, 20 Mar 2021 22:37:49 +0000 (23:37 +0100)] 
archive: stop passing "stage" through read_tree_recursive()

The "stage" variable being passed around in the archive code has only
ever been an elaborate way to hardcode the value "0".

This code was added in its original form in e4fbbfe9ecc (Add
git-zip-tree, 2006-08-26), at which point a hardcoded "0" would be
passed down through read_tree_recursive() to write_zip_entry().

It was then diligently added to the "struct directory" in
ed22b4173bd (archive: support filtering paths with glob, 2014-09-21),
but we were still not doing anything except passing it around as-is.

Let's stop doing that in the code internal to archive.c, we'll still
feed "0" to read_tree_recursive() itself, but won't use it. That we're
providing it at all to read_tree_recursive() will be changed in a
follow-up commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agols-files: refactor away read_tree()
Ævar Arnfjörð Bjarmason [Sat, 20 Mar 2021 22:37:48 +0000 (23:37 +0100)] 
ls-files: refactor away read_tree()

Refactor away the read_tree() function into its only user,
overlay_tree_on_index().

First, change read_one_entry_opt() to use the strbuf parameter
read_tree_recursive() passes down in place. This finishes up a partial
refactoring started in 6a0b0b6de99 (tree.c: update read_tree_recursive
callback to pass strbuf as base, 2014-11-30).

Moving the rest into overlay_tree_on_index() makes this index juggling
we're doing easier to read.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agols-files: don't needlessly pass around stage variable
Ævar Arnfjörð Bjarmason [Sat, 20 Mar 2021 22:37:47 +0000 (23:37 +0100)] 
ls-files: don't needlessly pass around stage variable

Now that read_tree() has been moved to ls-files.c we can get rid of
the stage != 1 case that'll never happen.

Let's not use read_tree_recursive() as a pass-through to pass "stage =
1" either. For now we'll pass an unused "stage = 0" for consistency
with other read_tree_recursive() callers, that argument will be
removed in a follow-up commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotree.c API: move read_tree() into builtin/ls-files.c
Ævar Arnfjörð Bjarmason [Sat, 20 Mar 2021 22:37:46 +0000 (23:37 +0100)] 
tree.c API: move read_tree() into builtin/ls-files.c

Since the read_tree() API was added around the same time as
read_tree_recursive() in 94537c78a82 (Move "read_tree()" to
"tree.c"[...], 2005-04-22) and b12ec373b8e ([PATCH] Teach read-tree
about commit objects, 2005-04-20) things have gradually migrated over
to the read_tree_recursive() version.

Now builtin/ls-files.c is the last user of this code, let's move all
the relevant code there. This allows for subsequent simplification of
it, and an eventual move to read_tree_recursive().

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agols-files tests: add meaningful --with-tree tests
Ævar Arnfjörð Bjarmason [Sat, 20 Mar 2021 22:37:45 +0000 (23:37 +0100)] 
ls-files tests: add meaningful --with-tree tests

Add tests for "ls-files --with-tree". There was effectively no
coverage for any normal usage of this command, only the tests added in
54e1abce90e (Add test case for ls-files --with-tree, 2007-10-03) for
an obscure bug.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoshow tests: add test for "git show <tree>"
Ævar Arnfjörð Bjarmason [Sat, 20 Mar 2021 22:37:44 +0000 (23:37 +0100)] 
show tests: add test for "git show <tree>"

Add missing tests for showing a tree with "git show". Let's test for
showing a tree, two trees, and that doing so doesn't recurse.

The only tests for this code added in 5d7eeee2ac6 (git-show: grok
blobs, trees and tags, too, 2006-12-14) were the tests in
t7701-repack-unpack-unreachable.sh added in ccc1297226b (repack:
modify behavior of -A option to leave unreferenced objects unpacked,
2008-05-09).

Let's add this common mode of operation to the "show" tests
themselves. It's more obvious, and the tests in
t7701-repack-unpack-unreachable.sh happily pass if we start buggily
emitting trees recursively.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'tb/git-mv-icase-fix'
Junio C Hamano [Fri, 19 Mar 2021 22:25:40 +0000 (15:25 -0700)] 
Merge branch 'tb/git-mv-icase-fix'

Fix a corner case bug in "git mv" on case insensitive systems,
which was introduced in 2.29 timeframe.

* tb/git-mv-icase-fix:
  git mv foo FOO ; git mv foo bar gave an assert

3 years agoThe first batch in 2.32 cycle
Junio C Hamano [Fri, 19 Mar 2021 22:07:58 +0000 (15:07 -0700)] 
The first batch in 2.32 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'rs/xcalloc-takes-nelem-first'
Junio C Hamano [Fri, 19 Mar 2021 22:25:39 +0000 (15:25 -0700)] 
Merge branch 'rs/xcalloc-takes-nelem-first'

Code cleanup.

* rs/xcalloc-takes-nelem-first:
  fix xcalloc() argument order

3 years agoMerge branch 'ah/make-fuzz-all-doc-update'
Junio C Hamano [Fri, 19 Mar 2021 22:25:39 +0000 (15:25 -0700)] 
Merge branch 'ah/make-fuzz-all-doc-update'

Update insn in Makefile comments to run fuzz-all target.

* ah/make-fuzz-all-doc-update:
  Makefile: update 'make fuzz-all' docs to reflect modern clang

3 years agoMerge branch 'jk/slimmed-down'
Junio C Hamano [Fri, 19 Mar 2021 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'jk/slimmed-down'

Unused code removal.

* jk/slimmed-down:
  vcs-svn: remove header files as well

3 years agoMerge branch 'rs/calloc-array'
Junio C Hamano [Fri, 19 Mar 2021 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'rs/calloc-array'

CALLOC_ARRAY() macro replaces many uses of xcalloc().

* rs/calloc-array:
  cocci: allow xcalloc(1, size)
  use CALLOC_ARRAY
  git-compat-util.h: drop trailing semicolon from macro definition

3 years agoMerge branch 'rs/avoid-null-statement-after-macro-call'
Junio C Hamano [Fri, 19 Mar 2021 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'rs/avoid-null-statement-after-macro-call'

Fix macros that can silently inject unintended null-statements.

* rs/avoid-null-statement-after-macro-call:
  mem-pool: drop trailing semicolon from macro definition
  block-sha1: drop trailing semicolon from macro definition

3 years agoMerge branch 'km/config-doc-typofix'
Junio C Hamano [Fri, 19 Mar 2021 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'km/config-doc-typofix'

Docfix.

* km/config-doc-typofix:
  config.txt: add missing period

3 years agoMerge branch 'jt/clone-unborn-head'
Junio C Hamano [Fri, 19 Mar 2021 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'jt/clone-unborn-head'

Test fix.

* jt/clone-unborn-head:
  t5606: run clone branch name test with protocol v2

3 years agoMerge branch 'js/fsmonitor-unpack-fix'
Junio C Hamano [Fri, 19 Mar 2021 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'js/fsmonitor-unpack-fix'

The data structure used by fsmonitor interface was not properly
duplicated during an in-core merge, leading to use-after-free etc.

* js/fsmonitor-unpack-fix:
  fsmonitor: do not forget to release the token in `discard_index()`
  fsmonitor: fix memory corruption in some corner cases

3 years agoMerge branch 'jk/bisect-peel-tag-fix'
Junio C Hamano [Fri, 19 Mar 2021 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'jk/bisect-peel-tag-fix'

"git bisect" reimplemented more in C during 2.30 timeframe did not
take an annotated tag as a good/bad endpoint well.  This regression
has been corrected.

* jk/bisect-peel-tag-fix:
  bisect: peel annotated tags to commits

3 years agoMerge branch 'jh/fsmonitor-prework'
Junio C Hamano [Fri, 19 Mar 2021 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'jh/fsmonitor-prework'

The fsmonitor interface read from its input without making sure
there is something to read from.  This bug is new in 2.31
timeframe.

* jh/fsmonitor-prework:
  fsmonitor: avoid global-buffer-overflow READ when checking trivial response

3 years agoMerge branch 'jc/calloc-fix'
Junio C Hamano [Fri, 19 Mar 2021 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'jc/calloc-fix'

Code clean-up.

* jc/calloc-fix:
  xcalloc: use CALLOC_ARRAY() when applicable

3 years agobuiltin/pack-objects.c: ignore missing links with --stdin-packs
Taylor Blau [Fri, 19 Mar 2021 15:40:52 +0000 (11:40 -0400)] 
builtin/pack-objects.c: ignore missing links with --stdin-packs

When 'git pack-objects --stdin-packs' encounters a commit in a pack, it
marks it as a starting point of a best-effort reachability traversal
that is used to populate the name-hash of the objects listed in the
given packs.

The traversal expects that it should be able to walk the ancestors of
all commits in a pack without issue. Ordinarily this is the case, but it
is possible to having missing parents from an unreachable part of the
repository. In that case, we'd consider any missing objects in the
unreachable portion of the graph to be junk.

This should be handled gracefully: since the traversal is best-effort
(i.e., we don't strictly need to fill in all of the name-hash fields),
we should simply ignore any missing links.

This patch does that (by setting the 'ignore_missing_links' bit on the
rev_info struct), and ensures we don't regress in the future by adding a
test which demonstrates this case.

It is a little over-eager, since it will also ignore missing links in
reachable parts of the packs (which would indicate a corrupted
repository), but '--stdin-packs' is explicitly *not* about reachability.
So this step isn't making anything worse for a repository which contains
packs missing reachable objects (since we never drop objects with
'--stdin-packs').

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoINSTALL: note on using Asciidoctor to build doc
Bagas Sanjaya [Fri, 19 Mar 2021 11:00:45 +0000 (18:00 +0700)] 
INSTALL: note on using Asciidoctor to build doc

Note on using Asciidoctor to build documentation suite.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot: annotate !PTHREADS tests with !FAIL_PREREQS
Jeff King [Wed, 17 Mar 2021 22:47:03 +0000 (18:47 -0400)] 
t: annotate !PTHREADS tests with !FAIL_PREREQS

Some tests in t5300 and t7810 expect us to complain about a "--threads"
argument when Git is compiled without pthread support. Running these
under GIT_TEST_FAIL_PREREQS produces a confusing failure: we pretend to
the tests that there is no pthread support, so they expect the warning,
but of course the actual build is perfectly happy to respect the
--threads argument.

We never noticed before the recent a926c4b904 (tests: remove most uses
of C_LOCALE_OUTPUT, 2021-02-11), because the tests also were marked as
requiring the C_LOCALE_OUTPUT prerequisite. Which means they'd never
have run in FAIL_PREREQS mode, since it would always pretend that the
locale prereq was not satisfied.

These tests can't possibly work in this mode; it is a mismatch between
what the tests expect and what the build was told to do. So let's just
mark them to be skipped, using the special prereq introduced by
dfe1a17df9 (tests: add a special setup where prerequisites fail,
2019-05-13).

Reported-by: Son Luong Ngoc <sluongng@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>