]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
20 months agol10n: zh_CN v2.38.0 rounds 1 & 2
Fangyi Zhou [Fri, 16 Sep 2022 10:31:26 +0000 (11:31 +0100)] 
l10n: zh_CN v2.38.0 rounds 1 & 2

Reviewed-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: Li Linchao <lilinchao@oschina.cn>
Reviewed-by: 依云 <lilydjwg@gmail.com>
Signed-off-by: Fangyi Zhou <me@fangyi.io>
20 months agol10n: bg.po: Updated Bulgarian translation (5484t)
Alexander Shopov [Fri, 23 Sep 2022 09:18:57 +0000 (11:18 +0200)] 
l10n: bg.po: Updated Bulgarian translation (5484t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
20 months agoMerge branch 'fr_v2.38_rnd2' of github.com:jnavila/git
Jiang Xin [Fri, 23 Sep 2022 09:06:12 +0000 (17:06 +0800)] 
Merge branch 'fr_v2.38_rnd2' of github.com:jnavila/git

* 'fr_v2.38_rnd2' of github.com:jnavila/git:
  l10n: fr: v2.38.0 round 2
  l10n: fr: v2.38 round 1
  l10n: fr: The word 'branche' is only feminine

20 months agoMerge branch 'catalan' of github.com:Softcatala/git-po
Jiang Xin [Fri, 23 Sep 2022 08:58:14 +0000 (16:58 +0800)] 
Merge branch 'catalan' of github.com:Softcatala/git-po

* 'catalan' of github.com:Softcatala/git-po:
  l10n: Update Catalan translation

20 months agoMerge branch 'l10n-de-2.38' of github.com:ralfth/git
Jiang Xin [Fri, 23 Sep 2022 08:51:23 +0000 (16:51 +0800)] 
Merge branch 'l10n-de-2.38' of github.com:ralfth/git

* 'l10n-de-2.38' of github.com:ralfth/git:
  l10n: de.po: update German translation

20 months agoMerge branch 'main' of github.com:git/git
Jiang Xin [Fri, 23 Sep 2022 08:50:32 +0000 (16:50 +0800)] 
Merge branch 'main' of github.com:git/git

* 'main' of github.com:git/git:
  list-objects-filter: initialize sub-filter structs
  Git 2.38-rc1
  Final batch before -rc1
  builtin/diagnose.c: don't translate the two mode values
  t/Makefile: remove 'test-results' on 'make clean'
  gc: don't translate literal commands
  Documentation: clean up various typos in technical docs
  Documentation: clean up a few misspelled word typos
  version: fix builtin linking & documentation
  diagnose: add to command-list.txt
  Documentation: add ReviewingGuidelines
  commit-graph: Fix missing closedir in expire_commit_graphs
  diagnose.c: refactor to safely use 'd_type'
  help: fix doubled words in explanation for developer interfaces
  api docs: link to html version of api-trace2
  docs: fix a few recently broken links
  reftable: use a pointer for pq_entry param

20 months agoMerge branch 'jk/list-objects-filter-cleanup'
Junio C Hamano [Thu, 22 Sep 2022 22:30:47 +0000 (15:30 -0700)] 
Merge branch 'jk/list-objects-filter-cleanup'

Fix uninitialized memory access in a recent fix-up that is already
in -rc1.

* jk/list-objects-filter-cleanup:
  list-objects-filter: initialize sub-filter structs

20 months agol10n: fr: v2.38.0 round 2
Jean-Noël Avila [Thu, 22 Sep 2022 19:42:36 +0000 (21:42 +0200)] 
l10n: fr: v2.38.0 round 2

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
20 months agol10n: fr: v2.38 round 1
Jean-Noël Avila [Sat, 17 Sep 2022 14:26:16 +0000 (16:26 +0200)] 
l10n: fr: v2.38 round 1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
20 months agol10n: fr: The word 'branche' is only feminine
Hubert Bossot [Sun, 20 Jun 2021 19:40:43 +0000 (21:40 +0200)] 
l10n: fr: The word 'branche' is only feminine

Signed-off-by: hbossot <hbossot@profideo.com>
20 months agolist-objects-filter: initialize sub-filter structs
Jeff King [Thu, 22 Sep 2022 09:35:33 +0000 (05:35 -0400)] 
list-objects-filter: initialize sub-filter structs

Since commit c54980ab83 (list-objects-filter: convert filter_spec to a
strbuf, 2022-09-11), building with SANITIZE=undefined triggers an error
in t5616.

The problem is that we end up with a strbuf that has been
zero-initialized instead of via STRBUF_INIT. Feeding that strbuf to
strbuf_addbuf() in list_objects_filter_copy() means we will call memcpy
like:

   memcpy(some_actual_buffer, NULL, 0);

This works on most systems because we're copying zero bytes, but it is
technically undefined behavior to ever pass NULL to memcpy.

Even though c54980ab83 is where the bug manifests, that is only because
we switched away from a string_list, which is OK with being
zero-initialized (though it may cause other problems by not duplicating
the strings, it happened to be OK in this instance).

The actual bug is caused by the commit before that, 2a01bdedf8
(list-objects-filter: add and use initializers, 2022-09-11). There we
consistently initialize the top-level filter structs, but we forgot the
dynamically allocated ones we stick in filter_options->sub when creating
combined filters.

Note that we need to fix two spots here: where we parse a "combine:"
filter, but also where we transform from a single-filter into a combined
one after seeing multiple "--filter" options. In the second spot, we'll
do some minor refactoring to avoid repeating our very-long array index.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agol10n: Update Catalan translation
Jordi Mas [Thu, 22 Sep 2022 16:30:42 +0000 (18:30 +0200)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
20 months agol10n: de.po: update German translation
Ralf Thielow [Thu, 22 Sep 2022 15:23:13 +0000 (17:23 +0200)] 
l10n: de.po: update German translation

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Reviewed-by: Phillip Szelat <phillip.szelat@gmail.com>
20 months agoGit 2.38-rc1 v2.38.0-rc1
Junio C Hamano [Wed, 21 Sep 2022 22:26:39 +0000 (15:26 -0700)] 
Git 2.38-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'sg/parse-options-subcommand'
Junio C Hamano [Wed, 21 Sep 2022 22:27:03 +0000 (15:27 -0700)] 
Merge branch 'sg/parse-options-subcommand'

Fix messages incorrectly marked for translation.

* sg/parse-options-subcommand:
  gc: don't translate literal commands

20 months agoMerge branch 'js/typofix'
Junio C Hamano [Wed, 21 Sep 2022 22:27:02 +0000 (15:27 -0700)] 
Merge branch 'js/typofix'

* js/typofix:
  Documentation: clean up various typos in technical docs
  Documentation: clean up a few misspelled word typos

20 months agoMerge branch 'sg/clean-test-results'
Junio C Hamano [Wed, 21 Sep 2022 22:27:02 +0000 (15:27 -0700)] 
Merge branch 'sg/clean-test-results'

"make clean" stopped cleaning the test results directory as a side
effect of a topic that has nothing to do with "make clean", which
has been corrected.

* sg/clean-test-results:
  t/Makefile: remove 'test-results' on 'make clean'

20 months agoMerge branch 'vd/check-docs-fixes'
Junio C Hamano [Wed, 21 Sep 2022 22:27:02 +0000 (15:27 -0700)] 
Merge branch 'vd/check-docs-fixes'

Build fix.

* vd/check-docs-fixes:
  version: fix builtin linking & documentation
  diagnose: add to command-list.txt

20 months agoMerge branch 'vd/doc-reviewing-guidelines'
Junio C Hamano [Wed, 21 Sep 2022 22:27:02 +0000 (15:27 -0700)] 
Merge branch 'vd/doc-reviewing-guidelines'

Just like we have coding guidelines, we now have guidelines for
reviewers.

* vd/doc-reviewing-guidelines:
  Documentation: add ReviewingGuidelines

20 months agoMerge branch 'vd/scalar-generalize-diagnose'
Junio C Hamano [Wed, 21 Sep 2022 22:27:01 +0000 (15:27 -0700)] 
Merge branch 'vd/scalar-generalize-diagnose'

Portability fix.

* vd/scalar-generalize-diagnose:
  builtin/diagnose.c: don't translate the two mode values
  diagnose.c: refactor to safely use 'd_type'

20 months agoFinal batch before -rc1
Junio C Hamano [Wed, 21 Sep 2022 20:50:47 +0000 (13:50 -0700)] 
Final batch before -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'fz/help-doublofix'
Junio C Hamano [Wed, 21 Sep 2022 21:23:14 +0000 (14:23 -0700)] 
Merge branch 'fz/help-doublofix'

Typofix for topic already in -rc0.

* fz/help-doublofix:
  help: fix doubled words in explanation for developer interfaces

20 months agoMerge branch 'tz/tech-docs-to-help-fix'
Junio C Hamano [Wed, 21 Sep 2022 21:23:14 +0000 (14:23 -0700)] 
Merge branch 'tz/tech-docs-to-help-fix'

Docfix for topic already in -rc0.

* tz/tech-docs-to-help-fix:
  api docs: link to html version of api-trace2
  docs: fix a few recently broken links

20 months agoMerge branch 'ml/commit-graph-expire-dir-leak-fix'
Junio C Hamano [Wed, 21 Sep 2022 21:23:14 +0000 (14:23 -0700)] 
Merge branch 'ml/commit-graph-expire-dir-leak-fix'

A result from opendir() was leaking in the commit-graph expiration
codepath, which has been plugged.

* ml/commit-graph-expire-dir-leak-fix:
  commit-graph: Fix missing closedir in expire_commit_graphs

20 months agoMerge branch 'ec/reftable-pass-pq-entry-by-reference'
Junio C Hamano [Wed, 21 Sep 2022 21:23:13 +0000 (14:23 -0700)] 
Merge branch 'ec/reftable-pass-pq-entry-by-reference'

Small code clean-up in reftable implementation.

* ec/reftable-pass-pq-entry-by-reference:
  reftable: use a pointer for pq_entry param

20 months agobuiltin/diagnose.c: don't translate the two mode values
Alex Henrie [Tue, 20 Sep 2022 05:06:32 +0000 (23:06 -0600)] 
builtin/diagnose.c: don't translate the two mode values

These strings are not translatable in the diagnose_options array in
diagnose.c. Don't translate them in builtin/diagnose.c either.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agot/Makefile: remove 'test-results' on 'make clean'
SZEDER Gábor [Tue, 20 Sep 2022 20:16:19 +0000 (22:16 +0200)] 
t/Makefile: remove 'test-results' on 'make clean'

The 't/test-results' directory and its contents are by-products of the
test process, so 'make clean' should remove them, but, alas, this has
been broken since fee65b194d (t/Makefile: don't remove test-results in
"clean-except-prove-cache", 2022-07-28).

The 'clean' target in 't/Makefile' was not directly responsible for
removing the 'test-results' directory, but relied on its dependency
'clean-except-prove-cache' to do that [1].  ee65b194d broke this,
because it only removed the 'rm -r test-results' command from the
'clean-except-prove-cache' target instead of moving it to the 'clean'
target, resulting in stray 't/test-results' directories.

Add that missing cleanup command to 't/Makefile', and to all
sub-Makefiles touched by that commit as well.

[1] 60f26f6348 (t/Makefile: retain cache t/.prove across prove runs,
                2012-05-02)

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agogc: don't translate literal commands
Alex Henrie [Tue, 20 Sep 2022 05:07:25 +0000 (23:07 -0600)] 
gc: don't translate literal commands

The command you type is still "git maintenance" even in other languages.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoDocumentation: clean up various typos in technical docs
Jacob Stopak [Tue, 20 Sep 2022 02:45:57 +0000 (19:45 -0700)] 
Documentation: clean up various typos in technical docs

Used GNU "aspell check <filename>" to review various technical
documentation files with the default aspell dictionary. Ignored
false-positives between american and british english.

Signed-off-by: Jacob Stopak <jacob@initialcommit.io>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoDocumentation: clean up a few misspelled word typos
Jacob Stopak [Tue, 20 Sep 2022 02:45:56 +0000 (19:45 -0700)] 
Documentation: clean up a few misspelled word typos

Used GNU "aspell check <filename>" to review various documentation
files with the default aspell dictionary. Ignored false-positives
between american and british english.

Signed-off-by: Jacob Stopak <jacob@initialcommit.io>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Wed, 21 Sep 2022 00:14:37 +0000 (08:14 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

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

20 months agoMerge branch 'main' of github.com:git/git
Jiang Xin [Wed, 21 Sep 2022 00:13:27 +0000 (08:13 +0800)] 
Merge branch 'main' of github.com:git/git

* 'main' of github.com:git/git: (45 commits)
  A bit more of remaining topics before -rc1
  t1800: correct test to handle Cygwin
  chainlint: colorize problem annotations and test delimiters
  ls-files: fix black space in error message
  list-objects-filter: convert filter_spec to a strbuf
  list-objects-filter: add and use initializers
  list-objects-filter: handle null default filter spec
  list-objects-filter: don't memset after releasing filter struct
  builtin/mv.c: fix possible segfault in add_slash()
  Documentation/technical: include Scalar technical doc
  t/perf: add 'GIT_PERF_USE_SCALAR' run option
  t/perf: add Scalar performance tests
  scalar-clone: add test coverage
  scalar: add to 'git help -a' command list
  scalar: implement the `help` subcommand
  git help: special-case `scalar`
  scalar: include in standard Git build & installation
  scalar: fix command documentation section header
  t: retire unused chainlint.sed
  t/Makefile: teach `make test` and `make prove` to run chainlint.pl
  ...

20 months agol10n: po-id for 2.38 (round 1)
Bagas Sanjaya [Sat, 17 Sep 2022 03:39:24 +0000 (10:39 +0700)] 
l10n: po-id for 2.38 (round 1)

Update following components:

  * add-patch.c
  * advice.c
  * builtin/add.c
  * builtin/am.c
  * builtin/clone.c
  * builtin/gc.c
  * builtin/help.c
  * builtin/ls-files.c
  * builtin/merge.c
  * diff.c
  * merge-ort.c
  * merge-tree.c
  * object-file.c
  * pack-bitmap.c
  * remote.c
  * revision.c
  * setup.c

Translate following new components:

  * builtin/bugreport.c
  * builtin/checkout--worker.c
  * builtin/checkout-index.c
  * builtin/commit-graph.c
  * builtin/fmt-merge-msg.c
  * builtin/for-each-ref.c
  * builtin/merge-file.c
  * builtin/merge-recursive.c
  * builtin/range-diff.c
  * bundle-uri.c
  * chunk-format.c
  * color.c
  * command-list.h
  * commit-graph.c
  * delta-islands.c
  * diagnose.c
  * diff-lib.c
  * diff-no-index.c
  * diffcore-order.c
  * diffcore-rename.c
  * diffcore-rotate.c
  * dir.c
  * editor.c
  * for-each-repo.c
  * parse-options-cb.c
  * parse-options.c
  * parse-options.h
  * path.c
  * pathspec.c
  * prune-packed.c
  * range-diff.c
  * ref-filter.c
  * ref-filter.h
  * remote-curl.c
  * replace-object.c
  * rerere.h
  * run-command.c
  * unpack-trees.c
  * usage.c

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
20 months agoversion: fix builtin linking & documentation
Victoria Dye [Tue, 20 Sep 2022 00:19:55 +0000 (00:19 +0000)] 
version: fix builtin linking & documentation

Like most builtins, 'version' is documented in a corresponding
'Documentation/git-version.txt' and can be invoked with 'git version'.
However, the 'check-docs' Makefile target showed that it was "removed but
documented: git-version." This was cause by the fact that it is not built as
a standalone 'git-version' executable, therefore appearing "removed" to
'check-docs'.

Without a precedent for documented builtins that aren't built into an
executable *or* any clear reason why a standalone 'git-version' shouldn't
exist, the 'check-docs' error appears to correctly identify an issue. To
correct that mismatch, add 'git-version' to the 'BUILT_INS' list in the root
Makefile (indicating that the 'cmd_version()' function appears in a file
that is *not* 'builtin/version.c'). Additionally, to avoid the "no link"
message in 'check-docs', list 'git-version' as an "ancilliaryinterrogator"
(like 'git help') in 'command-list.txt'.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agodiagnose: add to command-list.txt
Victoria Dye [Tue, 20 Sep 2022 00:19:54 +0000 (00:19 +0000)] 
diagnose: add to command-list.txt

Add 'git diagnose' as an "ancilliaryinterrogator" (like 'git bugreport') to
'command-list.txt' in order to have it show up in 'git help -a' and avoid
the "no link" warning message from the 'check-docs' Makefile target.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoDocumentation: add ReviewingGuidelines
Victoria Dye [Mon, 19 Sep 2022 19:12:46 +0000 (19:12 +0000)] 
Documentation: add ReviewingGuidelines

Add a reviewing guidelines document including advice and common terminology
used in Git mailing list reviews. The document is included in the
'TECH_DOCS' list in order to include it in Git's published documentation.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Derrick Stolee <derrickstolee@github.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoA bit more of remaining topics before -rc1
Junio C Hamano [Mon, 19 Sep 2022 19:55:59 +0000 (12:55 -0700)] 
A bit more of remaining topics before -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'ad/t1800-cygwin'
Junio C Hamano [Mon, 19 Sep 2022 21:35:25 +0000 (14:35 -0700)] 
Merge branch 'ad/t1800-cygwin'

Test fix.

* ad/t1800-cygwin:
  t1800: correct test to handle Cygwin

20 months agoMerge branch 'vd/scalar-to-main'
Junio C Hamano [Mon, 19 Sep 2022 21:35:25 +0000 (14:35 -0700)] 
Merge branch 'vd/scalar-to-main'

Hoist the remainder of "scalar" out of contrib/ to the main part of
the codebase.

* vd/scalar-to-main:
  Documentation/technical: include Scalar technical doc
  t/perf: add 'GIT_PERF_USE_SCALAR' run option
  t/perf: add Scalar performance tests
  scalar-clone: add test coverage
  scalar: add to 'git help -a' command list
  scalar: implement the `help` subcommand
  git help: special-case `scalar`
  scalar: include in standard Git build & installation
  scalar: fix command documentation section header

20 months agoMerge branch 'es/chainlint'
Junio C Hamano [Mon, 19 Sep 2022 21:35:24 +0000 (14:35 -0700)] 
Merge branch 'es/chainlint'

Revamp chainlint script for our tests.

* es/chainlint:
  chainlint: colorize problem annotations and test delimiters
  t: retire unused chainlint.sed
  t/Makefile: teach `make test` and `make prove` to run chainlint.pl
  test-lib: replace chainlint.sed with chainlint.pl
  test-lib: retire "lint harder" optimization hack
  t/chainlint: add more chainlint.pl self-tests
  chainlint.pl: allow `|| echo` to signal failure upstream of a pipe
  chainlint.pl: complain about loops lacking explicit failure handling
  chainlint.pl: don't flag broken &&-chain if failure indicated explicitly
  chainlint.pl: don't flag broken &&-chain if `$?` handled explicitly
  chainlint.pl: don't require `&` background command to end with `&&`
  t/Makefile: apply chainlint.pl to existing self-tests
  chainlint.pl: don't require `return|exit|continue` to end with `&&`
  chainlint.pl: validate test scripts in parallel
  chainlint.pl: add parser to identify test definitions
  chainlint.pl: add parser to validate tests
  chainlint.pl: add POSIX shell parser
  chainlint.pl: add POSIX shell lexical analyzer
  t: add skeleton chainlint.pl

20 months agoMerge branch 'jk/list-objects-filter-cleanup'
Junio C Hamano [Mon, 19 Sep 2022 21:35:24 +0000 (14:35 -0700)] 
Merge branch 'jk/list-objects-filter-cleanup'

A couple of bugfixes with code clean-up.

* jk/list-objects-filter-cleanup:
  list-objects-filter: convert filter_spec to a strbuf
  list-objects-filter: add and use initializers
  list-objects-filter: handle null default filter spec
  list-objects-filter: don't memset after releasing filter struct

20 months agoMerge branch 'zh/ls-files-format'
Junio C Hamano [Mon, 19 Sep 2022 21:35:24 +0000 (14:35 -0700)] 
Merge branch 'zh/ls-files-format'

Typofix in the UI of a topic that has graduated to 'master'.

* zh/ls-files-format:
  ls-files: fix black space in error message

20 months agoMerge branch 'sy/mv-out-of-cone'
Junio C Hamano [Mon, 19 Sep 2022 21:35:23 +0000 (14:35 -0700)] 
Merge branch 'sy/mv-out-of-cone'

"git mv A B" in a sparsely populated working tree can be asked to
move a path from a directory that is "in cone" to another directory
that is "out of cone".  Handling of such a case has been improved.

* sy/mv-out-of-cone:
  builtin/mv.c: fix possible segfault in add_slash()
  mv: check overwrite for in-to-out move
  advice.h: add advise_on_moving_dirty_path()
  mv: cleanup empty WORKING_DIRECTORY
  mv: from in-cone to out-of-cone
  mv: remove BOTH from enum update_mode
  mv: check if <destination> is a SKIP_WORKTREE_DIR
  mv: free the with_slash in check_dir_in_index()
  mv: rename check_dir_in_index() to empty_dir_has_sparse_contents()
  t7002: add tests for moving from in-cone to out-of-cone

20 months agocommit-graph: Fix missing closedir in expire_commit_graphs
Miaoqian Lin [Mon, 19 Sep 2022 14:14:40 +0000 (18:14 +0400)] 
commit-graph: Fix missing closedir in expire_commit_graphs

The function calls opendir() but missing the corresponding
closedir() before exit the function.
Add missing closedir() to fix it.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agodiagnose.c: refactor to safely use 'd_type'
Victoria Dye [Sat, 17 Sep 2022 18:16:55 +0000 (18:16 +0000)] 
diagnose.c: refactor to safely use 'd_type'

Refactor usage of the 'd_type' property of 'struct dirent' in 'diagnose.c'
to instead utilize the compatibility macro 'DTYPE()'. On systems where
'd_type' is not present in 'struct dirent', this macro will always return
'DT_UNKNOWN'. In that case, instead fall back on using the 'stat.st_mode' to
determine whether the dirent points to a dir, file, or link.

Additionally, add a test to 't0092-diagnose.sh' to verify that files (e.g.,
loose objects) are counted properly.

Note that the new function 'get_dtype()' is based on 'resolve_dtype()' in
'dir.c' (which itself was refactored from a prior 'get_dtype()' in
ad6f2157f9 (dir: restructure in a way to avoid passing around a struct
dirent, 2020-01-16)), but differs in that it is meant for use on arbitrary
files, such as those inside the '.git' dir. Because of this, it does not
search the index for a matching entry to derive the 'd_type'.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'master' of github.com:nafmo/git-l10n-sv
Jiang Xin [Mon, 19 Sep 2022 02:50:10 +0000 (10:50 +0800)] 
Merge branch 'master' of github.com:nafmo/git-l10n-sv

* 'master' of github.com:nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (5482t0f0u)

20 months agol10n: bg.po: Updated Bulgarian translation (5482t)
Alexander Shopov [Sun, 18 Sep 2022 18:27:26 +0000 (20:27 +0200)] 
l10n: bg.po: Updated Bulgarian translation (5482t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
20 months agol10n: sv.po: Update Swedish translation (5482t0f0u)
Peter Krefting [Fri, 16 Sep 2022 21:03:08 +0000 (22:03 +0100)] 
l10n: sv.po: Update Swedish translation (5482t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
20 months agol10n: tr: Update translations for v2.38.0 round #1
Emir SARI [Fri, 16 Sep 2022 19:22:08 +0000 (22:22 +0300)] 
l10n: tr: Update translations for v2.38.0 round #1

Signed-off-by: Emir SARI <emir_sari@icloud.com>
20 months agohelp: fix doubled words in explanation for developer interfaces
Fangyi Zhou [Fri, 16 Sep 2022 13:05:29 +0000 (13:05 +0000)] 
help: fix doubled words in explanation for developer interfaces

Signed-off-by: Fangyi Zhou <me@fangyi.io>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoapi docs: link to html version of api-trace2
Todd Zullinger [Fri, 16 Sep 2022 06:23:03 +0000 (02:23 -0400)] 
api docs: link to html version of api-trace2

In f6d25d7878 (api docs: document that BUG() emits a trace2 error event,
2021-04-13), a link to the plain text version of api-trace2 was added in
`technical/api-error-handling.txt`.

All of our other `link:`s point to the html versions.  Do the same here.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agodocs: fix a few recently broken links
Todd Zullinger [Fri, 16 Sep 2022 06:23:02 +0000 (02:23 -0400)] 
docs: fix a few recently broken links

Some links were broken in the recent move of various technical docs
c0f6dd49f1 (Merge branch 'ab/tech-docs-to-help', 2022-08-14).

Fix them.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoGit 2.38-rc0 v2.38.0-rc0
Junio C Hamano [Thu, 15 Sep 2022 22:38:46 +0000 (15:38 -0700)] 
Git 2.38-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'jk/proto-v2-ref-prefix-fix'
Junio C Hamano [Thu, 15 Sep 2022 23:09:47 +0000 (16:09 -0700)] 
Merge branch 'jk/proto-v2-ref-prefix-fix'

"git fetch" over protocol v2 sent an incorrect ref prefix request
to the server and made "git pull" with configured fetch refspec
that does not cover the remote branch to merge with fail, which has
been corrected.

* jk/proto-v2-ref-prefix-fix:
  fetch: add branch.*.merge to default ref-prefix extension
  fetch: stop checking for NULL transport->remote in do_fetch()

20 months agoMerge branch 'rs/add-p-worktree-mode-prompt-fix'
Junio C Hamano [Thu, 15 Sep 2022 23:09:46 +0000 (16:09 -0700)] 
Merge branch 'rs/add-p-worktree-mode-prompt-fix'

Fix another UI regression in the reimplemented "add -p".

* rs/add-p-worktree-mode-prompt-fix:
  add -p: fix worktree patch mode prompts

20 months agoMerge branch 'js/typofix'
Junio C Hamano [Thu, 15 Sep 2022 23:09:46 +0000 (16:09 -0700)] 
Merge branch 'js/typofix'

Typofix.

* js/typofix:
  Documentation: fix various repeat word typos

20 months agoMerge branch 'en/remerge-diff-fixes'
Junio C Hamano [Thu, 15 Sep 2022 23:09:46 +0000 (16:09 -0700)] 
Merge branch 'en/remerge-diff-fixes'

Fix a few "git log --remerge-diff" bugs.

* en/remerge-diff-fixes:
  diff: fix filtering of merge commits under --remerge-diff
  diff: fix filtering of additional headers under --remerge-diff
  diff: have submodule_format logic avoid additional diff headers

20 months agoreftable: use a pointer for pq_entry param
Elijah Conners [Thu, 15 Sep 2022 03:37:34 +0000 (20:37 -0700)] 
reftable: use a pointer for pq_entry param

The speed of the merged_iter_pqueue_add() can be improved by using a
pointer to the pq_entry struct, which is 96 bytes. Since the pq_entry
param is worked directly on the stack and does not currently have a
pointer to it, the merged_iter_pqueue_add() function is slightly
slower.

References to pq_entry in reftable have typically included pointers,
such as both of the params for pq_less().

Since we are working with pointers in the pq_entry param, as keenly
pointed out, the pq_entry param has also been made into a const since
the contents of the pq_entry param are copied and not manipulated.

Signed-off-by: Elijah Conners <business@elijahpepe.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agot1800: correct test to handle Cygwin
Adam Dinwoodie [Thu, 15 Sep 2022 07:57:17 +0000 (08:57 +0100)] 
t1800: correct test to handle Cygwin

On Cygwin, when failing to spawn a process using start_command, Git
outputs the same error as on Linux systems, rather than using the
GIT_WINDOWS_NATIVE-specific error output.  The WINDOWS test prerequisite
is set in both Cygwin and native Windows environments, which means it's
not appropriate to use to anticipate the error output from
start_command.  Instead, use the MINGW test prerequisite, which is only
set for Git in native Windows environments, and not for Cygwin.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Helped-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoPrepare for 2.38-rc0
Junio C Hamano [Wed, 14 Sep 2022 19:56:22 +0000 (12:56 -0700)] 
Prepare for 2.38-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'jk/plug-list-object-filter-leaks'
Junio C Hamano [Wed, 14 Sep 2022 19:56:40 +0000 (12:56 -0700)] 
Merge branch 'jk/plug-list-object-filter-leaks'

The code that manages list-object-filter structure, used in partial
clones, leaked the instances, which has been plugged.

* jk/plug-list-object-filter-leaks:
  prepare_repo_settings(): plug leak of config values
  list_objects_filter_options: plug leak of filter_spec strings
  transport: free filter options in disconnect_git()
  transport: deep-copy object-filter struct for fetch-pack
  list_objects_filter_copy(): deep-copy sparse_oid_name field

20 months agoMerge branch 'ab/submodule-helper-leakfix'
Junio C Hamano [Wed, 14 Sep 2022 19:56:40 +0000 (12:56 -0700)] 
Merge branch 'ab/submodule-helper-leakfix'

Plugging leaks in submodule--helper.

* ab/submodule-helper-leakfix:
  submodule--helper: fix a configure_added_submodule() leak
  submodule--helper: free rest of "displaypath" in "struct update_data"
  submodule--helper: free some "displaypath" in "struct update_data"
  submodule--helper: fix a memory leak in print_status()
  submodule--helper: fix a leak in module_add()
  submodule--helper: fix obscure leak in module_add()
  submodule--helper: fix "reference" leak
  submodule--helper: fix a memory leak in get_default_remote_submodule()
  submodule--helper: fix a leak with repo_clear()
  submodule--helper: fix "sm_path" and other "module_cb_list" leaks
  submodule--helper: fix "errmsg_str" memory leak
  submodule--helper: add and use *_release() functions
  submodule--helper: don't leak {run,capture}_command() cp.dir argument
  submodule--helper: "struct pathspec" memory leak in module_update()
  submodule--helper: fix most "struct pathspec" memory leaks
  submodule--helper: fix trivial get_default_remote_submodule() leak
  submodule--helper: fix a leak in "clone_submodule"

20 months agoMerge branch 'ab/dedup-config-and-command-docs'
Junio C Hamano [Wed, 14 Sep 2022 19:56:39 +0000 (12:56 -0700)] 
Merge branch 'ab/dedup-config-and-command-docs'

Share the text used to explain configuration variables used by "git
<subcmd>" in "git help <subcmd>" with the text from "git help config".

* ab/dedup-config-and-command-docs:
  docs: add CONFIGURATION sections that fuzzy map to built-ins
  docs: add CONFIGURATION sections that map to a built-in
  log docs: de-duplicate configuration sections
  difftool docs: de-duplicate configuration sections
  notes docs: de-duplicate and combine configuration sections
  apply docs: de-duplicate configuration sections
  send-email docs: de-duplicate configuration sections
  grep docs: de-duplicate configuration sections
  docs: add and use include template for config/* includes

20 months agoMerge branch 'ab/unused-annotation'
Junio C Hamano [Wed, 14 Sep 2022 19:56:39 +0000 (12:56 -0700)] 
Merge branch 'ab/unused-annotation'

Undoes 'jk/unused-annotation' topic and redoes it to work around
Coccinelle rules misfiring false positives in unrelated codepaths.

* ab/unused-annotation:
  git-compat-util.h: use "deprecated" for UNUSED variables
  git-compat-util.h: use "UNUSED", not "UNUSED(var)"

20 months agoMerge branch 'jk/unused-annotation'
Junio C Hamano [Wed, 14 Sep 2022 19:56:38 +0000 (12:56 -0700)] 
Merge branch 'jk/unused-annotation'

Annotate function parameters that are not used (but cannot be
removed for structural reasons), to prepare us to later compile
with -Wunused warning turned on.

* jk/unused-annotation:
  is_path_owned_by_current_uid(): mark "report" parameter as unused
  run-command: mark unused async callback parameters
  mark unused read_tree_recursive() callback parameters
  hashmap: mark unused callback parameters
  config: mark unused callback parameters
  streaming: mark unused virtual method parameters
  transport: mark bundle transport_options as unused
  refs: mark unused virtual method parameters
  refs: mark unused reflog callback parameters
  refs: mark unused each_ref_fn parameters
  git-compat-util: add UNUSED macro

20 months agoadd -p: fix worktree patch mode prompts
René Scharfe [Wed, 14 Sep 2022 09:47:33 +0000 (11:47 +0200)] 
add -p: fix worktree patch mode prompts

cee6cb7300 (built-in add -p: implement the "worktree" patch modes,
2019-12-21) added the worktree patch modes to the built-in add -p.
Its commit message claims to be a port of 2f0896ec3ad4 (restore:
support --patch, 2019-04-25), which did the same for the script
git-add--interactive.perl.

The script mentioned only the worktree in its prompt messages in
worktree mode, while the built-in mentions the worktree and also the
index, even though the command doesn't actually affect the index.

2c8bd8471a (checkout -p: handle new files correctly, 2020-05-27)
added new prompt messages for addition that also mention the index in
worktree mode in the built-in, but not in the script.

Correct these prompts to state that only the worktree will be affected.

Reported-by: David Plumpton <david.plumpton@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoSync with 'maint'
Junio C Hamano [Tue, 13 Sep 2022 19:23:48 +0000 (12:23 -0700)] 
Sync with 'maint'

20 months agoMerge a handful of topics from the 'master' front
Junio C Hamano [Tue, 13 Sep 2022 19:18:30 +0000 (12:18 -0700)] 
Merge a handful of topics from the 'master' front

As the 'master' front will soon tag a preview and then release
candidates for 2.38, it is unknown if we are going to issue another
maintenance release on the 2.37.x track, but as we have accumulated
enough material there, let's prepare a draft for it.

Even if we end up not tagging 2.37.4, it would help motivated distro
packagers to maintain their slightly older and "more stable" versions.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'en/merge-unstash-only-on-clean-merge' into maint
Junio C Hamano [Tue, 13 Sep 2022 19:21:11 +0000 (12:21 -0700)] 
Merge branch 'en/merge-unstash-only-on-clean-merge' into maint

The auto-stashed local changes created by "git merge --autostash"
was mixed into a conflicted state left in the working tree, which
has been corrected.

* en/merge-unstash-only-on-clean-merge:
  merge: only apply autostash when appropriate

20 months agoMerge branch 'ds/github-actions-use-newer-ubuntu' into maint
Junio C Hamano [Tue, 13 Sep 2022 19:21:10 +0000 (12:21 -0700)] 
Merge branch 'ds/github-actions-use-newer-ubuntu' into maint

Update the version of Ubuntu used for GitHub Actions CI from 18.04
to 22.04.

* ds/github-actions-use-newer-ubuntu:
  ci: update 'static-analysis' to Ubuntu 22.04

20 months agoMerge branch 'ad/preload-plug-memleak' into maint
Junio C Hamano [Tue, 13 Sep 2022 19:21:10 +0000 (12:21 -0700)] 
Merge branch 'ad/preload-plug-memleak' into maint

The preload-index codepath made copies of pathspec to give to
multiple threads, which were left leaked.

* ad/preload-plug-memleak:
  preload-index: fix memleak

20 months agoMerge branch 'sg/xcalloc-cocci-fix' into maint
Junio C Hamano [Tue, 13 Sep 2022 19:21:09 +0000 (12:21 -0700)] 
Merge branch 'sg/xcalloc-cocci-fix' into maint

xcalloc(), imitating calloc(), takes "number of elements of the
array", and "size of a single element", in this order.  A call that
does not follow this ordering has been corrected.

* sg/xcalloc-cocci-fix:
  promisor-remote: fix xcalloc() argument order

20 months agoMerge branch 'jk/pipe-command-nonblock' into maint
Junio C Hamano [Tue, 13 Sep 2022 19:21:08 +0000 (12:21 -0700)] 
Merge branch 'jk/pipe-command-nonblock' into maint

Fix deadlocks between main Git process and subprocess spawned via
the pipe_command() API, that can kill "git add -p" that was
reimplemented in C recently.

* jk/pipe-command-nonblock:
  pipe_command(): mark stdin descriptor as non-blocking
  pipe_command(): handle ENOSPC when writing to a pipe
  pipe_command(): avoid xwrite() for writing to pipe
  git-compat-util: make MAX_IO_SIZE define globally available
  nonblock: support Windows
  compat: add function to enable nonblocking pipes

20 months agoMerge branch 'jk/is-promisor-object-keep-tree-in-use' into maint
Junio C Hamano [Tue, 13 Sep 2022 19:21:07 +0000 (12:21 -0700)] 
Merge branch 'jk/is-promisor-object-keep-tree-in-use' into maint

An earlier optimization discarded a tree-object buffer that is
still in use, which has been corrected.

* jk/is-promisor-object-keep-tree-in-use:
  is_promisor_object(): fix use-after-free of tree buffer

20 months agoThe twentieth batch
Junio C Hamano [Tue, 13 Sep 2022 18:37:17 +0000 (11:37 -0700)] 
The twentieth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'ow/rev-parse-parseopt-fix'
Junio C Hamano [Tue, 13 Sep 2022 18:38:25 +0000 (11:38 -0700)] 
Merge branch 'ow/rev-parse-parseopt-fix'

The parser in the script interface to parse-options in "git
rev-parse" has been updated to diagnose a bogus input correctly.

* ow/rev-parse-parseopt-fix:
  rev-parse --parseopt: detect missing opt-spec

20 months agoMerge branch 'js/builtin-add-p-portability-fix'
Junio C Hamano [Tue, 13 Sep 2022 18:38:24 +0000 (11:38 -0700)] 
Merge branch 'js/builtin-add-p-portability-fix'

More fixes to "add -p"

* js/builtin-add-p-portability-fix:
  t6132(NO_PERL): do not run the scripted `add -p`
  t3701: test the built-in `add -i` regardless of NO_PERL
  add -p: avoid ambiguous signed/unsigned comparison

20 months agoMerge branch 'sg/parse-options-subcommand'
Junio C Hamano [Tue, 13 Sep 2022 18:38:24 +0000 (11:38 -0700)] 
Merge branch 'sg/parse-options-subcommand'

The codepath for the OPT_SUBCOMMAND facility has been cleaned up.

* sg/parse-options-subcommand:
  notes, remote: show unknown subcommands between `'
  notes: simplify default operation mode arguments check
  test-parse-options.c: fix style of comparison with zero
  test-parse-options.c: don't use for loop initial declaration
  t0040-parse-options: remove leftover debugging

20 months agoMerge branch 'jk/rev-list-verify-objects-fix'
Junio C Hamano [Tue, 13 Sep 2022 18:38:24 +0000 (11:38 -0700)] 
Merge branch 'jk/rev-list-verify-objects-fix'

"git rev-list --verify-objects" ought to inspect the contents of
objects and notice corrupted ones, but it didn't when the commit
graph is in use, which has been corrected.

* jk/rev-list-verify-objects-fix:
  rev-list: disable commit graph with --verify-objects
  lookup_commit_in_graph(): use prepare_commit_graph() to check for graph

20 months agoMerge branch 'jk/upload-pack-skip-hash-check'
Junio C Hamano [Tue, 13 Sep 2022 18:38:23 +0000 (11:38 -0700)] 
Merge branch 'jk/upload-pack-skip-hash-check'

The server side that responds to "git fetch" and "git clone"
request has been optimized by allowing it to send objects in its
object store without recomputing and validating the object names.

* jk/upload-pack-skip-hash-check:
  t1060: check partial clone of misnamed blob
  parse_object(): check commit-graph when skip_hash set
  upload-pack: skip parse-object re-hashing of "want" objects
  parse_object(): allow skipping hash check

20 months agoMerge branch 'rs/diff-no-index-cleanup'
Junio C Hamano [Tue, 13 Sep 2022 18:38:23 +0000 (11:38 -0700)] 
Merge branch 'rs/diff-no-index-cleanup'

"git diff --no-index A B" managed its the pathnames of its two
input files rather haphazardly, sometimes leaking them.  The
command line argument processing has been straightened out to clean
it up.

* rs/diff-no-index-cleanup:
  diff-no-index: simplify argv index calculation
  diff-no-index: release prefixed filenames
  diff-no-index: release strbuf on queue error

20 months agoMerge branch 'ab/submodule-helper-prep'
Junio C Hamano [Tue, 13 Sep 2022 18:38:23 +0000 (11:38 -0700)] 
Merge branch 'ab/submodule-helper-prep'

Code clean-up of "git submodule--helper".

* ab/submodule-helper-prep: (33 commits)
  submodule--helper: fix bad config API usage
  submodule--helper: libify even more "die" paths for module_update()
  submodule--helper: libify more "die" paths for module_update()
  submodule--helper: check repo{_submodule,}_init() return values
  submodule--helper: libify "must_die_on_failure" code paths (for die)
  submodule--helper update: don't override 'checkout' exit code
  submodule--helper: libify "must_die_on_failure" code paths
  submodule--helper: libify determine_submodule_update_strategy()
  submodule--helper: don't exit() on failure, return
  submodule--helper: use "code" in run_update_command()
  submodule API: don't handle SM_..{UNSPECIFIED,COMMAND} in to_string()
  submodule--helper: don't call submodule_strategy_to_string() in BUG()
  submodule--helper: add missing braces to "else" arm
  submodule--helper: return "ret", not "1" from update_submodule()
  submodule--helper: rename "int res" to "int ret"
  submodule--helper: don't redundantly check "else if (res)"
  submodule--helper: refactor "errmsg_str" to be a "struct strbuf"
  submodule--helper: add "const" to passed "struct update_data"
  submodule--helper: add "const" to copy of "update_data"
  submodule--helper: add "const" to passed "module_clone_data"
  ...

20 months agoMerge branch 'ed/fsmonitor-on-network-disk'
Junio C Hamano [Tue, 13 Sep 2022 18:38:22 +0000 (11:38 -0700)] 
Merge branch 'ed/fsmonitor-on-network-disk'

The built-in fsmonitor refuses to work on a network mounted
repositories; a configuration knob for users to override this has
been introduced.

* ed/fsmonitor-on-network-disk:
  fsmonitor: option to allow fsmonitor to run against network-mounted repos

20 months agochainlint: colorize problem annotations and test delimiters
Eric Sunshine [Tue, 13 Sep 2022 04:01:47 +0000 (04:01 +0000)] 
chainlint: colorize problem annotations and test delimiters

When `chainlint.pl` detects problems in a test definition, it emits the
test definition with "?!FOO?!" annotations highlighting the problems it
discovered. For instance, given this problematic test:

    test_expect_success 'discombobulate frobnitz' '
        git frob babble &&
        (echo balderdash; echo gnabgib) >expect &&
        for i in three two one
        do
            git nitfol $i
        done >actual
        test_cmp expect actual
    '

chainlint.pl will output:

    # chainlint: t1234-confusing.sh
    # chainlint: discombobulate frobnitz
    git frob babble &&
    (echo balderdash ; ?!AMP?! echo gnabgib) >expect &&
    for i in three two one
    do
    git nitfol $i ?!LOOP?!
    done >actual ?!AMP?!
    test_cmp expect actual

in which it may be difficult to spot the "?!FOO?!" annotations. The
problem is compounded when multiple tests, possibly in multiple
scripts, fail "linting", in which case it may be difficult to spot the
"# chainlint:" lines which delimit one problematic test from another.

To ameliorate this potential problem, colorize the "?!FOO?!" annotations
in order to quickly draw the test author's attention to the problem
spots, and colorize the "# chainlint:" lines to help the author identify
the name of each script and each problematic test.

Colorization is disabled automatically if output is not directed to a
terminal or if NO_COLOR environment variable is set. The implementation
is specific to Unix (it employs `tput` if available) but works equally
well in the Git for Windows development environment which emulates Unix
sufficiently.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoDocumentation: fix various repeat word typos
Jacob Stopak [Sun, 11 Sep 2022 10:23:20 +0000 (03:23 -0700)] 
Documentation: fix various repeat word typos

Inspired by 24966cd982 ("doc: fix repeated words", 08-09-2019),
I ran "egrep -R "\<([a-zA-Z]+)\> \<\1\>" ./Documentation/*" to
find current cases of repeated words such as "the the" that were
quite clearly typos.

There were many false positives reported, such as "really really"
or valid uses of "that that" which I left alone.

Signed-off-by: Jacob Stopak <jacob@initialcommit.io>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agols-files: fix black space in error message
ZheNing Hu [Sun, 11 Sep 2022 14:03:17 +0000 (14:03 +0000)] 
ls-files: fix black space in error message

ce74de9(ls-files: introduce "--format" option) miss
a space between two words incorrectly, it leads to
wrong i10n messages. So fix it by adding a space at
the end of the error message.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agolist-objects-filter: convert filter_spec to a strbuf
Jeff King [Sun, 11 Sep 2022 05:03:31 +0000 (01:03 -0400)] 
list-objects-filter: convert filter_spec to a strbuf

Originally, the filter_spec field was just a string pointer. In
cf9ceb5a12 (list-objects-filter-options: make filter_spec a string_list,
2019-06-27) it became a string_list, but that commit notes:

    A strbuf would seem to be a more natural choice for this object, but
    it unfortunately requires initialization besides just zero'ing out
    the memory.  This results in all container structs, and all
    containers of those structs, etc., to also require initialization.
    Initializing them all would be more cumbersome that simply using a
    string_list, which behaves properly when its contents are zero'd.

Now that we've changed the struct to require non-zero initialization
anyway (ironically, because string_list also needed non-zero
initialization to avoid leaks), we can now convert to that more natural
type.

This makes the list_objects_filter_spec() function much less awkward, as
it had to collapse the string_list to a single-entry list on the fly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agolist-objects-filter: add and use initializers
Jeff King [Sun, 11 Sep 2022 05:03:07 +0000 (01:03 -0400)] 
list-objects-filter: add and use initializers

In 7e2619d8ff (list_objects_filter_options: plug leak of filter_spec
strings, 2022-09-08), we noted that the filter_spec string_list was
inconsistent in how it handled memory ownership of strings stored in the
list. The fix there was a bit of a band-aid to set the "strdup_strings"
variable right before adding anything.

That works OK, and it lets the users of the API continue to
zero-initialize the struct. But it makes the code a bit hard to follow
and accident-prone, as any other spots appending the filter_spec need to
think about whether to set the strdup_strings value, too (there's one
such spot in partial_clone_get_default_filter_spec(), which is probably
a possible memory leak).

So let's do that full cleanup now. We'll introduce a
LIST_OBJECTS_FILTER_INIT macro and matching function, and use them as
appropriate (though it is for the "_options" struct, this matches the
corresponding list_objects_filter_release() function).

This is harder than it seems! Many other structs, like
git_transport_data, embed the filter struct. So they need to initialize
it themselves even if the rest of the enclosing struct is OK with
zero-initialization. I found all of the relevant spots by grepping
manually for declarations of list_objects_filter_options. And then doing
so recursively for structs which embed it, and ones which embed those,
and so on.

I'm pretty sure I got everything, but there's no change that would alert
the compiler if any topics in flight added new declarations. To catch
this case, we now double-check in the parsing function that things were
initialized as expected and BUG() if appropriate.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agolist-objects-filter: handle null default filter spec
Jeff King [Sun, 11 Sep 2022 05:00:45 +0000 (01:00 -0400)] 
list-objects-filter: handle null default filter spec

When we have a remote.*.promisor config variable, we know that we're in
a partial clone. Usually there's a matching remote.*.partialclonefilter
option, which tells us which filter to use with the remote. If that
option is missing, we skip setting up the filter at all. But something
funny happens: we stick a NULL entry into the string_list storing the
text filter spec.

This is a weird state, and could possibly segfault if anybody called
called list_objects_filter_spec(), etc. In practice, nobody does,
because filter->choice will still be LOFC_DISABLED, so code generally
realizes there's no filter to use. And the string_list itself is OK,
because it starts in non-dup mode until we actually parse a filter spec.
So it blindly stores the NULL without even looking at it.

But it's probably worth avoiding this confused state. It's an accident
waiting to happen, and it will be a problem if we replace the lazy
initialization from 7e2619d8ff (list_objects_filter_options: plug leak
of filter_spec strings, 2022-09-08) with a real initialization function.

The history is a little interesting here, as the bug was introduced
during the merge resolution in 627b826834 (Merge branch
'md/list-objects-filter-combo', 2019-09-18).

The original logic comes from cac1137dc4 (list-objects: check if filter
is NULL before using, 2018-06-11), where we had a single string via
core.partialCloneFilter, and a simple NULL check was sufficient. And it
even added a test in t0410 that covers this situation.

Later, that was expanded to allow per-remote filters in fa3d1b63e8
(promisor-remote: parse remote.*.partialclonefilter, 2019-06-25). After
that commit, we get a promisor struct with a partial_clone_filter
string, which could be NULL. The commit checks only that the struct
pointer is non-NULL, which is enough. It may pass NULL to
gently_parse_list_objects_filter(), but that function is smart enough to
consider it a noop.

But in parallel, cf9ceb5a12 (list-objects-filter-options: make
filter_spec a string_list, 2019-06-27) added a new line of code: before
we call gently_parse_list_objets_filter(), we append the filter spec to
the string_list. By itself that was OK, since we'd have returned early
if the string was NULL.

When the two were merged in 627b826834, the result is that we return
early only if the struct is NULL, but not the string. And we append to
the string_list, meaning we may append NULL.

The solution is to return early if either is NULL, as it would mean we
don't have a configured filter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agolist-objects-filter: don't memset after releasing filter struct
Jeff King [Sun, 11 Sep 2022 04:58:09 +0000 (00:58 -0400)] 
list-objects-filter: don't memset after releasing filter struct

If we see an error while parsing a "combine" filter, we call
list_objects_filter_release() to free any allocated memory,
and then use memset() to return the struct to a known state. But the
release function already does that reinitializing. Doing it again is
pointless.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'jk/plug-list-object-filter-leaks' into jk/list-objects-filter-cleanup
Junio C Hamano [Mon, 12 Sep 2022 15:38:47 +0000 (08:38 -0700)] 
Merge branch 'jk/plug-list-object-filter-leaks' into jk/list-objects-filter-cleanup

* jk/plug-list-object-filter-leaks:
  prepare_repo_settings(): plug leak of config values
  list_objects_filter_options: plug leak of filter_spec strings
  transport: free filter options in disconnect_git()
  transport: deep-copy object-filter struct for fetch-pack
  list_objects_filter_copy(): deep-copy sparse_oid_name field

20 months agobuiltin/mv.c: fix possible segfault in add_slash()
Shaoxuan Yuan [Fri, 9 Sep 2022 22:27:36 +0000 (15:27 -0700)] 
builtin/mv.c: fix possible segfault in add_slash()

A possible segfault was introduced in c08830de41 (mv: check if
<destination> is a SKIP_WORKTREE_DIR, 2022-08-09).

When running t7001 with SANITIZE=address, problem appears when running:

git mv path1/path2/ .
or
git mv directory ../
or
any <destination> that makes dest_path[0] an empty string.

The add_slash() call could segfault when path argument to it is an empty
string, because it makes an out-of-bounds read to decide if an extra
slash '/' needs to be appended to it.

As add_slash() is used to make sure that a valid pathname to a file in
the given directory can be made by appending a filename after the value
returned from it, if path is an empty string, we want to return it
as-is.  The path to a file "F" in the top-level of the working tree
(i.e. path=="") is formed by appending "F" after "" (i.e. path) without
any slash in between.

So, just like the case where a non-empty path already ends with a slash,
return an empty path as-is.

Reported-by: Jeff King <peff@peff.net>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Shaoxuan Yuan <shaoxuan.yuan02@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoThe nineteenth batch
Junio C Hamano [Fri, 9 Sep 2022 18:35:53 +0000 (11:35 -0700)] 
The nineteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'vd/sparse-reset-checkout-fixes'
Junio C Hamano [Fri, 9 Sep 2022 19:02:25 +0000 (12:02 -0700)] 
Merge branch 'vd/sparse-reset-checkout-fixes'

Segfault fix-up to an earlier fix to the topic to teach "git reset"
and "git checkout" work better in a sparse checkout.

* vd/sparse-reset-checkout-fixes:
  unpack-trees: fix sparse directory recursion check

20 months agoMerge branch 'ab/retire-ppc-sha1'
Junio C Hamano [Fri, 9 Sep 2022 19:02:25 +0000 (12:02 -0700)] 
Merge branch 'ab/retire-ppc-sha1'

Remove the assembly version of SHA-1 implementation for PPC.

* ab/retire-ppc-sha1:
  Makefile: use $(OBJECTS) instead of $(C_OBJ)
  Makefile + hash.h: remove PPC_SHA1 implementation

20 months agoMerge branch 'cc/doc-trailer-whitespace-rules'
Junio C Hamano [Fri, 9 Sep 2022 19:02:25 +0000 (12:02 -0700)] 
Merge branch 'cc/doc-trailer-whitespace-rules'

Doc update.

* cc/doc-trailer-whitespace-rules:
  Documentation: clarify whitespace rules for trailers

20 months agoMerge branch 'jc/format-patch-force-in-body-from'
Junio C Hamano [Fri, 9 Sep 2022 19:02:25 +0000 (12:02 -0700)] 
Merge branch 'jc/format-patch-force-in-body-from'

"git format-patch --from=<ident>" can be told to add an in-body
"From:" line even for commits that are authored by the given
<ident> with "--force-in-body-from"option.

* jc/format-patch-force-in-body-from:
  format-patch: learn format.forceInBodyFrom configuration variable
  format-patch: allow forcing the use of in-body From: header
  pretty: separate out the logic to decide the use of in-body from

20 months agoMerge branch 'js/range-diff-with-pathspec'
Junio C Hamano [Fri, 9 Sep 2022 19:02:24 +0000 (12:02 -0700)] 
Merge branch 'js/range-diff-with-pathspec'

Allow passing a pathspec to "git range-diff".

* js/range-diff-with-pathspec:
  range-diff: optionally accept pathspecs
  range-diff: consistently validate the arguments
  range-diff: reorder argument handling

20 months agoMerge branch 'jk/tempfile-active-flag-cleanup'
Junio C Hamano [Fri, 9 Sep 2022 19:02:24 +0000 (12:02 -0700)] 
Merge branch 'jk/tempfile-active-flag-cleanup'

Code clean-up.

* jk/tempfile-active-flag-cleanup:
  tempfile: update comment describing state transitions
  tempfile: drop active flag

20 months agoMerge branch 'js/add-p-diff-parsing-fix'
Junio C Hamano [Fri, 9 Sep 2022 19:02:24 +0000 (12:02 -0700)] 
Merge branch 'js/add-p-diff-parsing-fix'

Those who use diff-so-fancy as the diff-filter noticed a regression
or two in the code that parses the diff output in the built-in
version of "add -p", which has been corrected.

* js/add-p-diff-parsing-fix:
  add -p: ignore dirty submodules
  add -p: gracefully handle unparseable hunk headers in colored diffs
  add -p: detect more mismatches between plain vs colored diffs