]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
19 months agot/t5NNN: allow local submodules
Taylor Blau [Fri, 29 Jul 2022 19:21:06 +0000 (15:21 -0400)] 
t/t5NNN: allow local submodules

To prepare for the default value of `protocol.file.allow` to change to
"user", ensure tests that rely on local submodules can initialize them
over the file protocol.

Tests that only need to interact with submodules in a limited capacity
have individual Git commands annotated with the appropriate
configuration via `-c`. Tests that interact with submodules a handful of
times use `test_config_global` instead. Test scripts that rely on
submodules throughout use a `git config --global` during a setup test
towards the beginning of the script.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agot/t4NNN: allow local submodules
Taylor Blau [Fri, 29 Jul 2022 19:20:43 +0000 (15:20 -0400)] 
t/t4NNN: allow local submodules

To prepare for the default value of `protocol.file.allow` to change to
"user", ensure tests that rely on local submodules can initialize them
over the file protocol.

Tests that only need to interact with submodules in a limited capacity
have individual Git commands annotated with the appropriate
configuration via `-c`. Tests that interact with submodules a handful of
times use `test_config_global` instead. Test scripts that rely on
submodules throughout use a `git config --global` during a setup test
towards the beginning of the script.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agot/t3NNN: allow local submodules
Taylor Blau [Fri, 29 Jul 2022 19:20:28 +0000 (15:20 -0400)] 
t/t3NNN: allow local submodules

To prepare for the default value of `protocol.file.allow` to change to
"user", ensure tests that rely on local submodules can initialize them
over the file protocol.

Tests that only need to interact with submodules in a limited capacity
have individual Git commands annotated with the appropriate
configuration via `-c`. Tests that interact with submodules a handful of
times use `test_config_global` instead. Test scripts that rely on
submodules throughout use a `git config --global` during a setup test
towards the beginning of the script.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agot/2NNNN: allow local submodules
Taylor Blau [Fri, 29 Jul 2022 19:20:03 +0000 (15:20 -0400)] 
t/2NNNN: allow local submodules

To prepare for the default value of `protocol.file.allow` to change to
"user", ensure tests that rely on local submodules can initialize them
over the file protocol.

Tests that only need to interact with submodules in a limited capacity
have individual Git commands annotated with the appropriate
configuration via `-c`. Tests that interact with submodules a handful of
times use `test_config_global` instead. Test scripts that rely on
submodules throughout use a `git config --global` during a setup test
towards the beginning of the script.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agot/t1NNN: allow local submodules
Taylor Blau [Fri, 29 Jul 2022 19:16:10 +0000 (15:16 -0400)] 
t/t1NNN: allow local submodules

To prepare for the default value of `protocol.file.allow` to change to
"user", ensure tests that rely on local submodules can initialize them
over the file protocol.

Tests that only need to interact with submodules in a limited capacity
have individual Git commands annotated with the appropriate
configuration via `-c`. Tests that interact with submodules a handful of
times use `test_config_global` instead.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agot/lib-submodule-update.sh: allow local submodules
Taylor Blau [Fri, 29 Jul 2022 19:13:58 +0000 (15:13 -0400)] 
t/lib-submodule-update.sh: allow local submodules

To prepare for changing the default value of `protocol.file.allow` to
"user", update the `prolog()` function in lib-submodule-update to allow
submodules to be cloned over the file protocol.

This is used by a handful of submodule-related test scripts, which
themselves will have to tweak the value of `protocol.file.allow` in
certain locations. Those will be done in subsequent commits.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agobuiltin/clone.c: disallow `--local` clones with symlinks
Taylor Blau [Thu, 28 Jul 2022 21:35:17 +0000 (17:35 -0400)] 
builtin/clone.c: disallow `--local` clones with symlinks

When cloning a repository with `--local`, Git relies on either making a
hardlink or copy to every file in the "objects" directory of the source
repository. This is done through the callpath `cmd_clone()` ->
`clone_local()` -> `copy_or_link_directory()`.

The way this optimization works is by enumerating every file and
directory recursively in the source repository's `$GIT_DIR/objects`
directory, and then either making a copy or hardlink of each file. The
only exception to this rule is when copying the "alternates" file, in
which case paths are rewritten to be absolute before writing a new
"alternates" file in the destination repo.

One quirk of this implementation is that it dereferences symlinks when
cloning. This behavior was most recently modified in 36596fd2df (clone:
better handle symlinked files at .git/objects/, 2019-07-10), which
attempted to support `--local` clones of repositories with symlinks in
their objects directory in a platform-independent way.

Unfortunately, this behavior of dereferencing symlinks (that is,
creating a hardlink or copy of the source's link target in the
destination repository) can be used as a component in attacking a
victim by inadvertently exposing the contents of file stored outside of
the repository.

Take, for example, a repository that stores a Dockerfile and is used to
build Docker images. When building an image, Docker copies the directory
contents into the VM, and then instructs the VM to execute the
Dockerfile at the root of the copied directory. This protects against
directory traversal attacks by copying symbolic links as-is without
dereferencing them.

That is, if a user has a symlink pointing at their private key material
(where the symlink is present in the same directory as the Dockerfile,
but the key itself is present outside of that directory), the key is
unreadable to a Docker image, since the link will appear broken from the
container's point of view.

This behavior enables an attack whereby a victim is convinced to clone a
repository containing an embedded submodule (with a URL like
"file:///proc/self/cwd/path/to/submodule") which has a symlink pointing
at a path containing sensitive information on the victim's machine. If a
user is tricked into doing this, the contents at the destination of
those symbolic links are exposed to the Docker image at runtime.

One approach to preventing this behavior is to recreate symlinks in the
destination repository. But this is problematic, since symlinking the
objects directory are not well-supported. (One potential problem is that
when sharing, e.g. a "pack" directory via symlinks, different writers
performing garbage collection may consider different sets of objects to
be reachable, enabling a situation whereby garbage collecting one
repository may remove reachable objects in another repository).

Instead, prohibit the local clone optimization when any symlinks are
present in the `$GIT_DIR/objects` directory of the source repository.
Users may clone the repository again by prepending the "file://" scheme
to their clone URL, or by adding the `--no-local` option to their `git
clone` invocation.

The directory iterator used by `copy_or_link_directory()` must no longer
dereference symlinks (i.e., it *must* call `lstat()` instead of `stat()`
in order to discover whether or not there are symlinks present). This has
no bearing on the overall behavior, since we will immediately `die()` on
encounter a symlink.

Note that t5604.33 suggests that we do support local clones with
symbolic links in the source repository's objects directory, but this
was likely unintentional, or at least did not take into consideration
the problem with sharing parts of the objects directory with symbolic
links at the time. Update this test to reflect which options are and
aren't supported.

Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Sat, 1 Oct 2022 02:02:03 +0000 (10:02 +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 3)

19 months agobranch: do not fail a no-op --edit-desc
Junio C Hamano [Fri, 30 Sep 2022 18:06:22 +0000 (11:06 -0700)] 
branch: do not fail a no-op --edit-desc

Imagine running "git branch --edit-description" while on a branch
without the branch description, and then exit the editor after
emptying the edit buffer, which is the way to tell the command that
you changed your mind and you do not want the description after all.

The command should just happily oblige, adding no branch description
for the current branch, and exit successfully.  But it fails to do
so:

    $ git init -b main
    $ git commit --allow-empty -m commit
    $ GIT_EDITOR=: git branch --edit-description
    fatal: could not unset 'branch.main.description'

The end result is OK in that the configuration variable does not
exist in the resulting repository, but we should do better.  If we
know we didn't have a description, and if we are asked not to have a
description by the editor, we can just return doing nothing.

This of course introduces TOCTOU.  If you add a branch description
to the same branch from another window, while you had the editor
open to edit the description, and then exit the editor without
writing anything there, we'd end up not removing the description you
added in the other window.  But you are fooling yourself in your own
repository at that point, and if it hurts, you'd be better off not
doing so ;-).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agotest-lib: have SANITIZE=leak imply TEST_NO_MALLOC_CHECK
Ævar Arnfjörð Bjarmason [Wed, 28 Sep 2022 10:01:54 +0000 (12:01 +0200)] 
test-lib: have SANITIZE=leak imply TEST_NO_MALLOC_CHECK

Since 131b94a10a7 (test-lib.sh: Use GLIBC_TUNABLES instead of
MALLOC_CHECK_ on glibc >= 2.34, 2022-03-04) compiling with
SANITIZE=leak has missed reporting some leaks. The old MALLOC_CHECK
method used before glibc 2.34 seems to have been (mostly?) compatible
with it, but after 131b94a10a7 e.g. running:

TEST_NO_MALLOC_CHECK=1 make SANITIZE=leak test T=t6437-submodule-merge.sh

Would report a leak in builtin/commit.c, but this would not:

TEST_NO_MALLOC_CHECK= make SANITIZE=leak test T=t6437-submodule-merge.sh

Since the interaction is clearly breaking the SANITIZE=leak mode,
let's mark them as explicitly incompatible.

A related regression for SANITIZE=address was fixed in
067109a5e7d (tests: make SANITIZE=address imply TEST_NO_MALLOC_CHECK,
2022-04-09).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoMerge branch 'l10n-de-2.38-rnd3' of github.com:ralfth/git
Jiang Xin [Thu, 29 Sep 2022 10:54:12 +0000 (18:54 +0800)] 
Merge branch 'l10n-de-2.38-rnd3' of github.com:ralfth/git

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

19 months agoMerge branch 'fr_2.38_rnd3' of github.com:jnavila/git
Jiang Xin [Thu, 29 Sep 2022 00:00:30 +0000 (08:00 +0800)] 
Merge branch 'fr_2.38_rnd3' of github.com:jnavila/git

* 'fr_2.38_rnd3' of github.com:jnavila/git:
  l10n: fr: v2.38.0 round 3

19 months agoMerge branch 'catalan' of github.com:Softcatala/git-po
Jiang Xin [Wed, 28 Sep 2022 23:59:44 +0000 (07:59 +0800)] 
Merge branch 'catalan' of github.com:Softcatala/git-po

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

19 months agol10n: fr: v2.38.0 round 3
Jean-Noël Avila [Wed, 28 Sep 2022 19:46:22 +0000 (21:46 +0200)] 
l10n: fr: v2.38.0 round 3

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
19 months agoread-cache: avoid misaligned reads in index v4
Victoria Dye [Wed, 28 Sep 2022 17:19:00 +0000 (17:19 +0000)] 
read-cache: avoid misaligned reads in index v4

The process for reading the index into memory from disk is to first read its
contents into a single memory-mapped file buffer (type 'char *'), then
sequentially convert each on-disk index entry into a corresponding incore
'cache_entry'. To access the contents of the on-disk entry for processing, a
moving pointer within the memory-mapped file is cast to type 'struct
ondisk_cache_entry *'.

In index v4, the entries in the on-disk index file are written *without*
aligning their first byte to a 4-byte boundary; entries are a variable
length (depending on the entry name and whether or not extended flags are
used). As a result, casting the 'char *' buffer pointer to 'struct
ondisk_cache_entry *' then accessing its contents in a 'SANITIZE=undefined'
build can trigger the following error:

  read-cache.c:1886:46: runtime error: member access within misaligned
  address <address> for type 'struct ondisk_cache_entry', which requires 4
  byte alignment

Avoid this error by reading fields directly from the 'char *' buffer, using
the 'offsetof' individual fields in 'struct ondisk_cache_entry'.
Additionally, add documentation describing why the new approach avoids the
misaligned address error, as well as advice on how to improve the
implementation in the future.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agol10n: Update Catalan translation
Jordi Mas [Wed, 28 Sep 2022 17:05:55 +0000 (19:05 +0200)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
19 months agomerge-ort: return early when failing to write a blob
Johannes Schindelin [Wed, 28 Sep 2022 07:29:22 +0000 (07:29 +0000)] 
merge-ort: return early when failing to write a blob

In the previous commit, we fixed a segmentation fault when a tree object
could not be written.

However, before the tree object is written, `merge-ort` wants to write
out a blob object (except in cases where the merge results in a blob
that already exists in the database). And this can fail, too, but we
ignore that write failure so far.

Let's pay close attention and error out early if the blob could not be
written. This reduces the error output of t4301.25 ("merge-ort fails
gracefully in a read-only repository") from:

error: insufficient permission for adding an object to repository database ./objects
error: error: Unable to add numbers to database
error: insufficient permission for adding an object to repository database ./objects
error: error: Unable to add greeting to database
error: insufficient permission for adding an object to repository database ./objects
fatal: failure to merge

to:

error: insufficient permission for adding an object to repository database ./objects
error: error: Unable to add numbers to database
fatal: failure to merge

This is _not_ just a cosmetic change: Even though one might assume that
the operation would have failed anyway at the point when the new tree
object is written (and the corresponding tree object _will_ be new if it
contains a blob that is new), but that is not so: As pointed out by
Elijah Newren, when Git has previously been allowed to add loose objects
via `sudo` calls, it is very possible that the blob object cannot be
written (because the corresponding `.git/objects/??/` directory may be
owned by `root`) but the tree object can be written (because the
corresponding objects directory is owned by the current user). This
would result in a corrupt repository because it is missing the blob
object, and with this here patch we prevent that.

Note: This patch adjusts two variable declarations from `unsigned` to
`int` because their purpose is to hold the return value of
`handle_content_merge()`, which is of type `int`. The existing users of
those variables are only interested whether that variable is zero or
non-zero, therefore this type change does not affect the existing code.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agomerge-ort: fix segmentation fault in read-only repositories
Johannes Schindelin [Wed, 28 Sep 2022 07:29:21 +0000 (07:29 +0000)] 
merge-ort: fix segmentation fault in read-only repositories

If the blob/tree objects cannot be written, we really need the merge
operations to fail, and not to continue (and then try to access the tree
object which is however still set to `NULL`).

Let's stop ignoring the return value of `write_object_file()` and
`write_tree()` and set `clean = -1` in the error case.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agol10n: de.po: update German translation
Ralf Thielow [Wed, 28 Sep 2022 15:15:53 +0000 (17:15 +0200)] 
l10n: de.po: update German translation

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
19 months agol10n: zh_CN: 2.38.0 round 3
Fangyi Zhou [Wed, 28 Sep 2022 14:50:49 +0000 (15:50 +0100)] 
l10n: zh_CN: 2.38.0 round 3

Signed-off-by: Fangyi Zhou <me@fangyi.io>
19 months agoMerge branch 'turkish' of github.com:bitigchi/git-po
Jiang Xin [Wed, 28 Sep 2022 12:54:29 +0000 (20:54 +0800)] 
Merge branch 'turkish' of github.com:bitigchi/git-po

* 'turkish' of github.com:bitigchi/git-po:
  l10n: tr: v2.38.0 3rd round

19 months agoMerge branch 'master' of github.com:alshopov/git-po
Jiang Xin [Wed, 28 Sep 2022 12:52:34 +0000 (20:52 +0800)] 
Merge branch 'master' of github.com:alshopov/git-po

* 'master' of github.com:alshopov/git-po:
  l10n: bg.po: Updated Bulgarian translation (5484t)

19 months agol10n: tr: v2.38.0 3rd round
Emir SARI [Wed, 28 Sep 2022 09:32:13 +0000 (12:32 +0300)] 
l10n: tr: v2.38.0 3rd round

Signed-off-by: Emir SARI <emir_sari@icloud.com>
19 months agol10n: bg.po: Updated Bulgarian translation (5484t)
Alexander Shopov [Wed, 28 Sep 2022 09:00:59 +0000 (11:00 +0200)] 
l10n: bg.po: Updated Bulgarian translation (5484t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
19 months agol10n: po-id for 2.38 (round 3)
Bagas Sanjaya [Sun, 25 Sep 2022 07:53:53 +0000 (14:53 +0700)] 
l10n: po-id for 2.38 (round 3)

Update following components:

  * sequencer.c
  * wt-status.c

Translate following new components:

  * compat/compiler.h
  * compat/disk.h
  * compat/fsmonitor/fsm-health-win32.c
  * compat/fsmonitor/fsm-listen-darwin.c
  * compat/fsmonitor/fsm-listen-win32.c
  * compat/fsmonitor/fsm-settings-win32.c
  * compat/mingw.c
  * compat/obstack.c
  * compat/regex/regcomp.c
  * compat/simple-ipc/ipc-unix-socket.c
  * compat/simple-ipc/ipc-win32.c
  * compat/terminal.c
  * convert.c
  * entry.c
  * environment.c
  * exec-cmd.c
  * git-merge-octopus.sh
  * git-sh-setup.sh
  * list-objects-filter-options.c
  * list-objects-filter-options.h
  * list-objects.c
  * lockfile.c
  * ls-refs.c
  * mailinfo.c
  * name-hash.c
  * notes-merge.c
  * notes-utils.c
  * pkt-line.c
  * preload-index.c
  * pretty.c
  * promisor-remote.c
  * protocol-caps.c
  * read-cache.c
  * scalar.c
  * transport-helper.c
  * transport.c
  * tree-walk.c
  * urlmatch.c
  * walker.c
  * wrapper.c

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
19 months agol10n: es: update translation
Alex Henrie [Wed, 28 Sep 2022 04:56:55 +0000 (22:56 -0600)] 
l10n: es: update translation

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
19 months agoMerge branch 'main' of github.com:git/git
Jiang Xin [Wed, 28 Sep 2022 00:03:38 +0000 (08:03 +0800)] 
Merge branch 'main' of github.com:git/git

* 'main' of github.com:git/git:
  Git 2.38-rc2
  pack-bitmap: remove trace2 region from hot path

20 months agoGit 2.38-rc2 v2.38.0-rc2
Junio C Hamano [Tue, 27 Sep 2022 18:25:52 +0000 (11:25 -0700)] 
Git 2.38-rc2

We have small updates since -rc1 but none of them is about a new
thing and there is no updates to the release notes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoMerge branch 'ds/bitmap-lookup-remove-tracing'
Junio C Hamano [Tue, 27 Sep 2022 04:46:51 +0000 (21:46 -0700)] 
Merge branch 'ds/bitmap-lookup-remove-tracing'

Perf-fix.

* ds/bitmap-lookup-remove-tracing:
  pack-bitmap: remove trace2 region from hot path

20 months agopack-bitmap: remove trace2 region from hot path
Derrick Stolee [Mon, 26 Sep 2022 13:17:57 +0000 (13:17 +0000)] 
pack-bitmap: remove trace2 region from hot path

The trace2 region around the call to lazy_bitmap_for_commit() in
bitmap_for_commit() was added in 28cd730680d (pack-bitmap: prepare to
read lookup table extension, 2022-08-14). While adding trace2 regions is
typically helpful for tracking performance, this method is called
possibly thousands of times as a commit walk explores commit history
looking for a matching bitmap. When trace2 output is enabled, this
region is emitted many times and performance is throttled by that
output.

For now, remove these regions entirely.

This is a critical path, and it would be valuable to measure that the
time spent in bitmap_for_commit() does not increase when using the
commit lookup table. The best way to do that would be to use a mechanism
that sums the time spent in a region and reports a single value at the
end of the process. This technique was introduced but not merged by [1]
so maybe this example presents some justification to revisit that
approach.

[1] https://lore.kernel.org/git/pull.1099.v2.git.1640720202.gitgitgadget@gmail.com/

To help with the 'git blame' output in this region, add a comment that
warns against adding a trace2 region. Delete a test from t5310 that used
that trace output to check that this lookup optimization was activated.
To create this kind of test again in the future, the stopwatch traces
mentioned earlier could be used as a signal that we activated this code
path.

Helpedy-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoref-filter.c: fix a leak in get_head_description
Rubén Justo [Sat, 24 Sep 2022 22:53:18 +0000 (00:53 +0200)] 
ref-filter.c: fix a leak in get_head_description

In 2708ce62d2 (branch: sort detached HEAD based on a flag, 2021-01-07) a
call to wt_status_state_free_buffers, responsible of freeing the
resources that could be allocated in the local struct wt_status_state
state, was eliminated.

The call to wt_status_state_free_buffers was introduced in 962dd7ebc3
(wt-status: introduce wt_status_state_free_buffers(), 2020-09-27).  This
commit brings back that call in get_head_description.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Reviewed-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agosequencer: avoid dropping fixup commit that targets self via commit-ish
Johannes Altmanninger [Sat, 24 Sep 2022 22:29:04 +0000 (17:29 -0500)] 
sequencer: avoid dropping fixup commit that targets self via commit-ish

Commit 68d5d03bc4 (rebase: teach --autosquash to match on sha1 in
addition to message, 2010-11-04) taught autosquash to recognize
subjects like "fixup! 7a235b" where 7a235b is an OID-prefix. It
actually did more than advertised: 7a235b can be an arbitrary
commit-ish (as long as it's not trailed by spaces).

Accidental(?) use of this secret feature revealed a bug where we
would silently drop a fixup commit. The bug can also be triggered
when using an OID-prefix but that's unlikely in practice.

Let the commit with subject "fixup! main" be the tip of the "main"
branch. When computing the fixup target for this commit, we find
the commit itself. This is wrong because, by definition, a fixup
target must be an earlier commit in the todo list. We wrongly find
the current commit because we added it to the todo list prematurely.
Avoid these fixup-cycles by only adding the current commit to the
todo list after we have finished looking for the fixup target.

Reported-by: Erik Cervin Edin <erik@cervined.in>
Signed-off-by: Johannes Altmanninger <aclopte@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agol10n: sv.po: Update Swedish translation (5484t0f0u)
Peter Krefting [Mon, 26 Sep 2022 05:36:23 +0000 (06:36 +0100)] 
l10n: sv.po: Update Swedish translation (5484t0f0u)

Also fix a couple of typos.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
20 months agol10n: Update Catalan translation
Jordi Mas [Sun, 25 Sep 2022 19:04:22 +0000 (21:04 +0200)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
20 months agoMerge branch 'main' of github.com:git/git
Jiang Xin [Sat, 24 Sep 2022 13:51:06 +0000 (21:51 +0800)] 
Merge branch 'main' of github.com:git/git

* 'main' of github.com:git/git:
  cmd-list.perl: fix identifying man sections
  pack-bitmap: improve grammar of "xor chain" error message

20 months agoMerge branch 'fr_quickfix' of github.com:jnavila/git
Jiang Xin [Sat, 24 Sep 2022 13:12:37 +0000 (21:12 +0800)] 
Merge branch 'fr_quickfix' of github.com:jnavila/git

* 'fr_quickfix' of github.com:jnavila/git:
  l10n: fr: don't say that merge is "the default strategy"

20 months agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Sat, 24 Sep 2022 13:09:22 +0000 (21:09 +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 2)

20 months agoMerge branch 'turkish' of github.com:bitigchi/git-po
Jiang Xin [Sat, 24 Sep 2022 13:08:11 +0000 (21:08 +0800)] 
Merge branch 'turkish' of github.com:bitigchi/git-po

* 'turkish' of github.com:bitigchi/git-po:
  l10n: tr: v2.38.0 round 2

20 months agol10n: fr: don't say that merge is "the default strategy"
Alex Henrie [Mon, 27 Jun 2022 04:17:24 +0000 (22:17 -0600)] 
l10n: fr: don't say that merge is "the default strategy"

The text of this message was changed in commit
71076d0edde43a7672a9a0f555753ff078602a64 to avoid making any
suggestion about which strategy is better for the situation at hand.
Update the Franch translation to match.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
20 months agoMerge branch 'ac/bitmap-lookup-table'
Junio C Hamano [Fri, 23 Sep 2022 18:07:49 +0000 (11:07 -0700)] 
Merge branch 'ac/bitmap-lookup-table'

Grammofix.

* ac/bitmap-lookup-table:
  pack-bitmap: improve grammar of "xor chain" error message

20 months agoMerge branch 'ma/scalar-to-main-fix'
Junio C Hamano [Fri, 23 Sep 2022 18:07:48 +0000 (11:07 -0700)] 
Merge branch 'ma/scalar-to-main-fix'

Fix manpage generation.

* ma/scalar-to-main-fix:
  cmd-list.perl: fix identifying man sections

20 months agocmd-list.perl: fix identifying man sections
Martin Ågren [Fri, 23 Sep 2022 08:07:33 +0000 (10:07 +0200)] 
cmd-list.perl: fix identifying man sections

We attribute each documentation text file to a man section by finding a
line in the file that looks like "gitfoo(<digit>)". Commit cc75e556a9
("scalar: add to 'git help -a' command list", 2022-09-02) updated this
logic to look not only for "gitfoo" but also "scalarfoo". In doing so,
it forgot to account for the fact that after the updated regex has found
a match, the man section is no longer to be found in `$1` but now lives
in `$2`.

This makes our git(1) manpage look as follows:

  Main porcelain commands
       git-add(git)
           Add file contents to the index.

  [...]

       gitk(git)
           The Git repository browser.

       scalar(scalar)
           A tool for managing large Git repositories.

Restore the man sections by not capturing the (git|scalar) part of the
match into `$1`.

As noted by Ævar [1], we could even match any "foo" rather than just
"gitfoo" and "scalarfoo", but that's a larger change. For now, just fix
the regression in cc75e556a9.

[1] https://lore.kernel.org/git/220923.86wn9u4joo.gmgdl@evledraar.gmail.com/#t

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agopack-bitmap: improve grammar of "xor chain" error message
Alex Henrie [Thu, 22 Sep 2022 02:51:58 +0000 (20:51 -0600)] 
pack-bitmap: improve grammar of "xor chain" error message

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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: po-id for 2.38 (round 2)
Bagas Sanjaya [Thu, 22 Sep 2022 07:54:56 +0000 (14:54 +0700)] 
l10n: po-id for 2.38 (round 2)

Update following components:

  * branch.c
  * builtin/log.c
  * builtin/rebase.c
  * builtin/remote.c
  * builtin/reset.c
  * builtin/rev-list.c
  * builtin/rev-parse.c
  * builtin/revert.c
  * builtin/sparse-checkout.c
  * builtin/submodule--helper.c
  * command-list.h
  * help.c
  * merge.c

Translate following new components:

  * builtin/check-attr.c
  * builtin/check-ignore.c
  * builtin/check-mailmap.c
  * builtin/column.c
  * builtin/credential-cache--daemon.c
  * builtin/credential-cache.c
  * builtin/credential-store.c
  * builtin/diagnose.c
  * builtin/env--helper.c
  * builtin/fsmonitor--daemon.c
  * builtin/interpret-trailers.c
  * builtin/mailinfo.c
  * builtin/mailsplit.c
  * builtin/mktag.c
  * builtin/mktree.c
  * builtin/pack-redundant.c
  * builtin/replace.c
  * builtin/rerere.c
  * builtin/stripspace.c
  * bulk-checkin.c
  * commit.c
  * credential.c
  * fsmonitor-ipc.c
  * fsmonitor-settings.c
  * http-fetch.c
  * http.c

Also remove unused strings.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
20 months agol10n: tr: v2.38.0 round 2
Emir SARI [Thu, 22 Sep 2022 13:40:33 +0000 (16:40 +0300)] 
l10n: tr: v2.38.0 round 2

Signed-off-by: Emir SARI <emir_sari@icloud.com>
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 agoremote: handle rename of remote without fetch refspec
Jeff King [Thu, 22 Sep 2022 05:33:29 +0000 (01:33 -0400)] 
remote: handle rename of remote without fetch refspec

We return an error when trying to rename a remote that has no fetch
refspec:

  $ git config --unset-all remote.origin.fetch
  $ git remote rename origin foo
  fatal: could not unset 'remote.foo.fetch'

To make things even more confusing, we actually _do_ complete the config
modification, via git_config_rename_section(). After that we try to
rewrite the fetch refspec (to say refs/remotes/foo instead of origin).
But our call to git_config_set_multivar() to remove the existing entries
fails, since there aren't any, and it calls die().

We could fix this by using the "gently" form of the config call, and
checking the error code. But there is an even simpler fix: if we know
that there are no refspecs to rewrite, then we can skip that part
entirely.

Reported-by: John A. Leuenhagen <john@zlima12.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoclone: allow "--bare" with "-o"
Jeff King [Thu, 22 Sep 2022 05:32:05 +0000 (01:32 -0400)] 
clone: allow "--bare" with "-o"

We explicitly forbid the combination of "--bare" with "-o", but there
doesn't seem to be any good reason to do so. The original logic came as
part of e6489a1bdf (clone: do not accept more than one -o option.,
2006-01-22), but that commit does not give any reason.

Furthermore, the equivalent combination via config is allowed:

  git -c clone.defaultRemoteName=foo clone ...

and works as expected. It may be that this combination was considered
useless, because a bare clone does not set remote.origin.fetch (and
hence there is no refs/remotes/origin hierarchy). But it does set
remote.origin.url, and that name is visible to the user via "git fetch
origin", etc.

Let's allow the options to be used together, and switch the "forbid"
test in t5606 to check that we use the requested name. That test came
much later in 349cff76de (clone: add tests for --template and some
disallowed option pairs, 2020-09-29), and does not offer any logic
beyond "let's test what the code currently does".

Reported-by: John A. Leuenhagen <john@zlima12.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 agoparse_object_buffer(): respect save_commit_buffer
Jeff King [Thu, 22 Sep 2022 10:15:38 +0000 (06:15 -0400)] 
parse_object_buffer(): respect save_commit_buffer

If the global variable "save_commit_buffer" is set to 0, then
parse_commit() will throw away the commit object data after parsing it,
rather than sticking it into a commit slab. This goes all the way back
to 60ab26de99 ([PATCH] Avoid wasting memory in git-rev-list,
2005-09-15).

But there's another code path which may similarly stash the buffer:
parse_object_buffer(). This is where we end up if we parse a commit via
parse_object(), and it's used directly in a few other code paths like
git-fsck.

The original goal of 60ab26de99 was avoiding extra memory usage for
rev-list. And there it's not all that important to catch parse_object().
We use that function only for looking at the tips of the traversal, and
the majority of the commits are parsed by following parent links, where
we use parse_commit() directly. So we were wasting some memory, but only
a small portion.

It's much easier to see the effect with fsck. Since we now turn off
save_commit_buffer by default there, we _should_ be able to drop the
freeing of the commit buffer in fsck_obj(). But if we do so (taking the
first hunk of this patch without the rest), then the peak heap of "git
fsck" in a clone of git.git goes from 136MB to 194MB. Teaching
parse_object_buffer() to respect save_commit_buffer brings that down to
134.5MB (it's hard to tell from massif's output, but I suspect the
savings comes from avoiding the overhead of the mostly-empty commit
slab).

Other programs should see a small improvement. Both "rev-list --all" and
"fsck --connectivity-only" improve by a few hundred kilobytes, as they'd
avoid loading the tip objects of their traversals.

Most importantly, no code should be hurt by doing this. Any program that
turns off save_commit_buffer is already making the assumption that any
commit it sees may need to have its object data loaded on demand, as it
doesn't know which ones were parsed by parse_commit() versus
parse_object(). Not to mention that anything parsed by the commit graph
may be in the same boat, even if save_commit_buffer was not disabled.

This should be the only spot that needs to be fixed. Grepping for
set_commit_buffer() shows that this and parse_commit() are the only
relevant calls.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agofsck: turn off save_commit_buffer
Jeff King [Thu, 22 Sep 2022 10:13:36 +0000 (06:13 -0400)] 
fsck: turn off save_commit_buffer

When parsing a commit, the default behavior is to stuff the original
buffer into a commit_slab (which takes ownership of it). But for a tool
like fsck, this isn't useful. While we may look at the buffer further as
part of fsck_commit(), we'll always do so through a separate pointer;
attaching the buffer to the slab doesn't help.

Worse, it means we have to remember to free the commit buffer in all
call paths. We do so in fsck_obj(), which covers a regular "git fsck".
But with "--connectivity-only", we forget to do so in both
traverse_one_object(), which covers reachable objects, and
mark_unreachable_referents(), which covers unreachable ones. As a
result, that mode ends up storing an uncompressed copy of every commit
on the heap at once.

We could teach the code paths for --connectivity-only to also free
commit buffers. But there's an even easier fix: we can just turn off the
save_commit_buffer flag, and then we won't attach them to the commits in
the first place.

This reduces the peak heap of running "git fsck --connectivity-only" in
a clone of linux.git from ~2GB to ~1GB. According to massif, the
remaining memory goes where you'd expect: the object structs themselves,
the obj_hash containing them, and the delta base cache.

Note that we'll leave the call to free commit buffers in fsck_obj() for
now; it's not quite redundant because of a related bug that we'll fix in
a subsequent commit.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agofsck: free tree buffers after walking unreachable objects
Jeff King [Thu, 22 Sep 2022 10:11:43 +0000 (06:11 -0400)] 
fsck: free tree buffers after walking unreachable objects

After calling fsck_walk(), a tree object struct may be left in the
parsed state, with the full tree contents available via tree->buffer.
It's the responsibility of the caller to free these when it's done with
the object to avoid having many trees allocated at once.

In a regular "git fsck", we hit fsck_walk() only from fsck_obj(), which
does call free_tree_buffer(). Likewise for "--connectivity-only", we see
most objects via traverse_one_object(), which makes a similar call.

The exception is in mark_unreachable_referents(). When using both
"--connectivity-only" and "--dangling" (the latter of which is the
default), we walk all of the unreachable objects, and there we forget to
free. Most cases would not notice this, because they don't have a lot of
unreachable objects, but you can make a pathological case like this:

  git clone --bare /path/to/linux.git repo.git
  cd repo.git
  rm packed-refs ;# now everything is unreachable!
  git fsck --connectivity-only

That ends up with peak heap usage ~18GB, which is (not coincidentally)
close to the size of all uncompressed trees in the repository. After
this patch, the peak heap is only ~2GB.

A few things to note:

  - it might seem like fsck_walk(), if it is parsing the trees, should
    be responsible for freeing them. But the situation is quite tricky.
    In the non-connectivity mode, after we call fsck_walk() we then
    proceed with fsck_object() which actually does the type-specific
    sanity checks on the object contents. We do pass our own separate
    buffer to fsck_object(), but there's a catch: our earlier call to
    parse_object_buffer() may have attached that buffer to the object
    struct! So by freeing it, we leave the rest of the code with a
    dangling pointer.

    Likewise, the call to fsck_walk() in index-pack is subtle. It
    attaches a buffer to the tree object that must not be freed! And
    so rather than calling free_tree_buffer(), it actually detaches it
    by setting tree->buffer to NULL.

    These cases would _probably_ be fixable by having fsck_walk() free
    the tree buffer only when it was the one who allocated it via
    parse_tree(). But that would still leave the callers responsible for
    freeing other cases, so they wouldn't be simplified. While the
    current semantics for fsck_walk() make it easy to accidentally leak
    in new callers, at least they are simple to explain, and it's not a
    function that's likely to get a lot of new call-sites.

    And in any case, it's probably sensible to fix the leak first with
    this simple patch, and try any more complicated refactoring
    separately.

  - a careful reader may notice that fsck_obj() also frees commit
    buffers, but neither the call in traverse_one_object() nor the one
    touched in this patch does so. And indeed, this is another problem
    for --connectivity-only (and accounts for most of the 2GB heap after
    this patch), but it's one we'll fix in a separate commit.

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 agofsmonitor--daemon: don't translate literal commands
Alex Henrie [Tue, 20 Sep 2022 05:07:09 +0000 (23:07 -0600)] 
fsmonitor--daemon: don't translate literal commands

These commands have no placeholders to be translated.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 agomidx.c: avoid cruft packs with non-zero `repack --batch-size`
Taylor Blau [Tue, 20 Sep 2022 01:55:56 +0000 (21:55 -0400)] 
midx.c: avoid cruft packs with non-zero `repack --batch-size`

Apply similar treatment with respect to cruft packs as in a few commits
ago to `repack` with a non-zero `--batch-size`.

Since the case of a non-zero `--batch-size` is handled separately (in
`fill_included_packs_batch()` instead of `fill_included_packs_all()`), a
separate fix must be applied for this case.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agomidx.c: remove unnecessary loop condition
Taylor Blau [Tue, 20 Sep 2022 01:55:53 +0000 (21:55 -0400)] 
midx.c: remove unnecessary loop condition

The fill_included_packs_batch() routine is responsible for aggregating
objects in packs with a non-zero value for the `--batch-size` option of
the `git multi-pack-index repack` sub-command.

Since this routine is explicitly called only when `--batch-size` is
non-zero, there is no point in checking that this is the case in our
loop condition.

Remove the unnecessary part of this condition to avoid confusion.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agomidx.c: replace `xcalloc()` with `CALLOC_ARRAY()`
Taylor Blau [Tue, 20 Sep 2022 01:55:50 +0000 (21:55 -0400)] 
midx.c: replace `xcalloc()` with `CALLOC_ARRAY()`

Replace a direct invocation of Git's `xcalloc()` wrapper with the
`CALLOC_ARRAY()` macro instead.

The latter is preferred since it is more conventional in Git's codebase,
but also because it automatically picks the correct value for the record
size.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agomidx.c: avoid cruft packs with `repack --batch-size=0`
Taylor Blau [Tue, 20 Sep 2022 01:55:48 +0000 (21:55 -0400)] 
midx.c: avoid cruft packs with `repack --batch-size=0`

The `repack` sub-command of the `git multi-pack-index` builtin creates a
new pack aggregating smaller packs contained in the MIDX up to some
given `--batch-size`.

When `--batch-size=0`, this instructs the MIDX builtin to repack
everything contained in the MIDX into a single pack.

In similar spirit as a previous commit, it is undesirable to repack the
contents of a cruft pack in this step. Teach `repack` to ignore any
cruft pack(s) when `--batch-size=0` for the same reason(s).

(The case of a non-zero `--batch-size` will be handled in a subsequent
commit).

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agomidx.c: prevent `expire` from removing the cruft pack
Taylor Blau [Tue, 20 Sep 2022 01:55:45 +0000 (21:55 -0400)] 
midx.c: prevent `expire` from removing the cruft pack

The `expire` sub-command unlinks any packs that are (a) contained in the
MIDX, but (b) have no objects referenced by the MIDX.

This sub-command ignores `.keep` packs, which remain on-disk even if
they have no objects referenced by the MIDX. Cruft packs, however,
aren't given the same treatment: if none of the objects contained in the
cruft pack are selected from the cruft pack by the MIDX, then the cruft
pack is eligible to be expired.

This is less than desireable, since the cruft pack has important
metadata about the individual object mtimes, which is useful to
determine how quickly an object should age out of the repository when
pruning.

Ordinarily, we wouldn't expect the contents of a cruft pack to
duplicated across non-cruft packs (and we'd expect to see the MIDX
select all cruft objects from other sources even less often). But
nonetheless, it is still possible to trick the `expire` sub-command into
removing the `.mtimes` file in this circumstance.

Teach the `expire` sub-command to ignore cruft packs in the same manner
as it does `.keep` packs, in order to keep their metadata around, even
when they are unreferenced by the MIDX.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoDocumentation/git-multi-pack-index.txt: clarify expire behavior
Taylor Blau [Tue, 20 Sep 2022 01:55:42 +0000 (21:55 -0400)] 
Documentation/git-multi-pack-index.txt: clarify expire behavior

The `expire` sub-command of `git multi-pack-index` will never expire
`.keep` packs, regardless of whether or not any of their objects were
selected in the MIDX.

This has always been the case since 19575c7c8e (multi-pack-index:
implement 'expire' subcommand, 2019-06-10), which came after cff9711616
(multi-pack-index: prepare for 'expire' subcommand, 2019-06-10), when
this documentation was originally written.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 months agoDocumentation/git-multi-pack-index.txt: fix typo
Taylor Blau [Tue, 20 Sep 2022 01:55:40 +0000 (21:55 -0400)] 
Documentation/git-multi-pack-index.txt: fix typo

Remove the extra space character between "tracked" and "by", which dates
back to when this paragraph was originally written in cff9711616
(multi-pack-index: prepare for 'expire' subcommand, 2019-06-10).

Signed-off-by: Taylor Blau <me@ttaylorr.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