]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
6 months agoDocument HOME environment variable
Alejandro Barreto [Mon, 9 Dec 2024 19:18:14 +0000 (19:18 +0000)] 
Document HOME environment variable

Git documentation refers to $HOME and $XDG_CONFIG_HOME often, but does
not specify how or where these values come from on Windows where neither
is set by default. The new documentation reflects the behavior of
setup_windows_environment() in compat/mingw.c.

Signed-off-by: Alejandro Barreto <alejandro.barreto@ni.com>
Signed-off-by: M Hickford <mirth.hickford@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 months agoGit 2.47.1 v2.47.1
Junio C Hamano [Mon, 25 Nov 2024 03:32:21 +0000 (12:32 +0900)] 
Git 2.47.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 months agoMerge branch 'ak/typofixes' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:48 +0000 (12:29 +0900)] 
Merge branch 'ak/typofixes' into maint-2.47

Typofixes.

* ak/typofixes:
  t: fix typos
  t/helper: fix a typo
  t/perf: fix typos
  t/unit-tests: fix typos
  contrib: fix typos
  compat: fix typos

6 months agoMerge branch 'xx/protocol-v2-doc-markup-fix' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:47 +0000 (12:29 +0900)] 
Merge branch 'xx/protocol-v2-doc-markup-fix' into maint-2.47

Docfix.

* xx/protocol-v2-doc-markup-fix:
  Documentation/gitprotocol-v2.txt: fix a slight inconsistency in format

6 months agoMerge branch 'tc/bundle-uri-leakfix' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:45 +0000 (12:29 +0900)] 
Merge branch 'tc/bundle-uri-leakfix' into maint-2.47

Leakfix.

* tc/bundle-uri-leakfix:
  bundle-uri: plug leak in unbundle_from_file()

6 months agoMerge branch 'kh/checkout-ignore-other-docfix' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:45 +0000 (12:29 +0900)] 
Merge branch 'kh/checkout-ignore-other-docfix' into maint-2.47

Doc updates.

* kh/checkout-ignore-other-docfix:
  checkout: refer to other-worktree branch, not ref

6 months agoMerge branch 'kh/merge-tree-doc' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:44 +0000 (12:29 +0900)] 
Merge branch 'kh/merge-tree-doc' into maint-2.47

Docfix.
cf. <CABPp-BE=JfoZp19Va-1oF60ADBUibGDwDkFX-Zytx7A3uJ__gg@mail.gmail.com>

* kh/merge-tree-doc:
  doc: merge-tree: improve example script

6 months agoMerge branch 'kn/loose-object-layer-wo-global-hash' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:43 +0000 (12:29 +0900)] 
Merge branch 'kn/loose-object-layer-wo-global-hash' into maint-2.47

Code clean-up.

* kn/loose-object-layer-wo-global-hash:
  loose: don't rely on repository global state

6 months agoMerge branch 'jc/doc-refspec-syntax' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:42 +0000 (12:29 +0900)] 
Merge branch 'jc/doc-refspec-syntax' into maint-2.47

Doc updates.

* jc/doc-refspec-syntax:
  doc: clarify <src> in refspec syntax

6 months agoMerge branch 'js/doc-platform-support-link-fix' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:41 +0000 (12:29 +0900)] 
Merge branch 'js/doc-platform-support-link-fix' into maint-2.47

Docfix.

* js/doc-platform-support-link-fix:
  docs: fix the `maintain-git` links in `technical/platform-support`

6 months agoMerge branch 'jh/config-unset-doc-fix' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:40 +0000 (12:29 +0900)] 
Merge branch 'jh/config-unset-doc-fix' into maint-2.47

Docfix.

* jh/config-unset-doc-fix:
  git-config.1: remove value from positional args in unset usage

6 months agoMerge branch 'jk/output-prefix-cleanup' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:39 +0000 (12:29 +0900)] 
Merge branch 'jk/output-prefix-cleanup' into maint-2.47

Code clean-up.

* jk/output-prefix-cleanup:
  diff: store graph prefix buf in git_graph struct
  diff: return line_prefix directly when possible
  diff: return const char from output_prefix callback
  diff: drop line_prefix_length field
  line-log: use diff_line_prefix() instead of custom helper

6 months agoMerge branch 'sk/doc-maintenance-schedule' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:38 +0000 (12:29 +0900)] 
Merge branch 'sk/doc-maintenance-schedule' into maint-2.47

Doc update to clarify how periodical maintenance are scheduled,
spread across time to avoid thundering hurds.

* sk/doc-maintenance-schedule:
  doc: add a note about staggering of maintenance

6 months agoMerge branch 'tb/notes-amlog-doc' into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:29:37 +0000 (12:29 +0900)] 
Merge branch 'tb/notes-amlog-doc' into maint-2.47

Document "amlog" notes.

* tb/notes-amlog-doc:
  Documentation: mention the amlog in howto/maintain-git.txt

6 months agoMerge branch 'master' of https://github.com/j6t/gitk into maint-2.47
Junio C Hamano [Mon, 25 Nov 2024 03:20:42 +0000 (12:20 +0900)] 
Merge branch 'master' of https://github.com/j6t/gitk into maint-2.47

* 'master' of https://github.com/j6t/gitk:
  Makefile(s): avoid recipe prefix in conditional statements
  doc: switch links to https
  doc: update links to current pages

7 months agoMakefile(s): avoid recipe prefix in conditional statements
Taylor Blau [Mon, 8 Apr 2024 15:51:44 +0000 (11:51 -0400)] 
Makefile(s): avoid recipe prefix in conditional statements

In GNU Make commit 07fcee35 ([SV 64815] Recipe lines cannot contain
conditional statements, 2023-05-22) and following, conditional
statements may no longer be preceded by a tab character (which Make
refers to as the recipe prefix).

There are a handful of spots in our various Makefile(s) which will break
in a future release of Make containing 07fcee35. For instance, trying to
compile the pre-image of this patch with the tip of make.git results in
the following:

    $ make -v | head -1 && make
    GNU Make 4.4.90
    config.mak.uname:842: *** missing 'endif'.  Stop.

The kernel addressed this issue in 82175d1f9430 (kbuild: Replace tabs
with spaces when followed by conditionals, 2024-01-28). Address the
issues in Git's tree by applying the same strategy.

When a conditional word (ifeq, ifneq, ifdef, etc.) is preceded by one or
more tab characters, replace each tab character with 8 space characters
with the following:

    find . -type f -not -path './.git/*' -name Makefile -or -name '*.mak' |
      xargs perl -i -pe '
        s/(\t+)(ifn?eq|ifn?def|else|endif)/" " x (length($1) * 8) . $2/ge unless /\\$/
      '

The "unless /\\$/" removes any false-positives (like "\telse \"
appearing within a shell script as part of a recipe).

After doing so, Git compiles on newer versions of Make:

    $ make -v | head -1 && make
    GNU Make 4.4.90
    GIT_VERSION = 2.44.0.414.gfac1dc44ca9
    [...]

    $ echo $?
    0

Reported-by: Dario Gjorgjevski <dario.gjorgjevski@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Cherry-picked-from: 728b9ac0c3b93aaa4ea80280c591deb198051785
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
7 months agodoc: switch links to https
Josh Soref [Fri, 24 Nov 2023 03:35:13 +0000 (03:35 +0000)] 
doc: switch links to https

These sites offer https versions of their content.
Using the https versions provides some protection for users.

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Cherry-picked-from: d05b08cd52cfda627f1d865bdfe6040a2c9521b5
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
7 months agodoc: update links to current pages
Josh Soref [Fri, 24 Nov 2023 03:35:12 +0000 (03:35 +0000)] 
doc: update links to current pages

It's somewhat traditional to respect sites' self-identification.

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Cherry-picked-from: 65175d9ea26bebeb9d69977d0e75efc0e88dbced
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
7 months agoPrepare for 2.47.1
Junio C Hamano [Wed, 20 Nov 2024 05:43:30 +0000 (14:43 +0900)] 
Prepare for 2.47.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agoMerge branch 'db/submodule-fetch-with-remote-name-fix' into maint-2.47
Junio C Hamano [Wed, 20 Nov 2024 05:42:59 +0000 (14:42 +0900)] 
Merge branch 'db/submodule-fetch-with-remote-name-fix' into maint-2.47

A "git fetch" from the superproject going down to a submodule used
a wrong remote when the default remote names are set differently
between them.

* db/submodule-fetch-with-remote-name-fix:
  submodule: correct remote name with fetch

7 months agoMerge branch 'ps/cache-tree-w-broken-index-entry' into maint-2.47
Junio C Hamano [Wed, 20 Nov 2024 05:42:58 +0000 (14:42 +0900)] 
Merge branch 'ps/cache-tree-w-broken-index-entry' into maint-2.47

Fail gracefully instead of crashing when attempting to write the
contents of a corrupt in-core index as a tree object.

* ps/cache-tree-w-broken-index-entry:
  unpack-trees: detect mismatching number of cache-tree/index entries
  cache-tree: detect mismatching number of index entries
  cache-tree: refactor verification to return error codes

7 months agoMerge branch 'ps/maintenance-start-crash-fix' into maint-2.47
Junio C Hamano [Wed, 20 Nov 2024 05:42:57 +0000 (14:42 +0900)] 
Merge branch 'ps/maintenance-start-crash-fix' into maint-2.47

"git maintenance start" crashed due to an uninitialized variable
reference, which has been corrected.

* ps/maintenance-start-crash-fix:
  builtin/gc: fix crash when running `git maintenance start`

7 months agoMerge branch 'jk/fsmonitor-event-listener-race-fix' into maint-2.47
Junio C Hamano [Wed, 20 Nov 2024 05:42:57 +0000 (14:42 +0900)] 
Merge branch 'jk/fsmonitor-event-listener-race-fix' into maint-2.47

On macOS, fsmonitor can fall into a race condition that results in
a client waiting forever to be notified for an event that have
already happened.  This problem has been corrected.

* jk/fsmonitor-event-listener-race-fix:
  fsmonitor: initialize fs event listener before accepting clients
  simple-ipc: split async server initialization and running

7 months agoMerge branch 'ds/line-log-asan-fix' into maint-2.47
Junio C Hamano [Wed, 20 Nov 2024 05:42:56 +0000 (14:42 +0900)] 
Merge branch 'ds/line-log-asan-fix' into maint-2.47

Use after free and double freeing at the end in "git log -L... -p"
had been identified and fixed.

* ds/line-log-asan-fix:
  line-log: protect inner strbuf from free

8 months agot: fix typos
Andrew Kreimer [Thu, 10 Oct 2024 15:11:22 +0000 (18:11 +0300)] 
t: fix typos

Fix typos via codespell.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agot/helper: fix a typo
Andrew Kreimer [Thu, 10 Oct 2024 15:11:25 +0000 (18:11 +0300)] 
t/helper: fix a typo

Fix a typo in comments: bellow -> below.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agot/perf: fix typos
Andrew Kreimer [Thu, 10 Oct 2024 15:11:23 +0000 (18:11 +0300)] 
t/perf: fix typos

Fix typos via codespell.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agot/unit-tests: fix typos
Andrew Kreimer [Thu, 10 Oct 2024 15:11:24 +0000 (18:11 +0300)] 
t/unit-tests: fix typos

Fix typos via codespell.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agocontrib: fix typos
Andrew Kreimer [Thu, 10 Oct 2024 15:11:20 +0000 (18:11 +0300)] 
contrib: fix typos

Fix typos via codespell.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agocompat: fix typos
Andrew Kreimer [Thu, 10 Oct 2024 15:11:19 +0000 (18:11 +0300)] 
compat: fix typos

Fix typos and grammar.

Reported-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agocheckout: refer to other-worktree branch, not ref
Kristoffer Haugsbakk [Thu, 10 Oct 2024 18:39:29 +0000 (20:39 +0200)] 
checkout: refer to other-worktree branch, not ref

We can only check out commits or branches, not refs in general.  And the
problem here is if another worktree is using the branch that we want to
check out.

Let’s be more direct and just talk about branches instead of refs.

Also replace “be held” with “in use”.  Further, “in use” is not
restricted to a branch being checked out (e.g. the branch could be busy
on a rebase), hence generalize to “or otherwise in use” in the option
description.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoDocumentation/gitprotocol-v2.txt: fix a slight inconsistency in format
Xing Xin [Thu, 10 Oct 2024 13:20:42 +0000 (13:20 +0000)] 
Documentation/gitprotocol-v2.txt: fix a slight inconsistency in format

Signed-off-by: Xing Xin <xingxin.xx@bytedance.com>
Acked-by: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agobundle-uri: plug leak in unbundle_from_file()
Toon Claes [Thu, 10 Oct 2024 09:12:49 +0000 (11:12 +0200)] 
bundle-uri: plug leak in unbundle_from_file()

The function `unbundle_from_file()` has two memory leaks:

  - We do not release the `struct bundle_header header` when hitting
    errors because we return early without any cleanup.

  - We do not release the `struct strbuf bundle_ref` at all.

Plug these leaks by creating a common exit path where both of these
variables are released.

While at it, refactor the code such that the variable assignments do not
happen inside the conditional statement itself according to our coding
style.

Signed-off-by: Toon Claes <toon@iotcl.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agobuiltin/gc: fix crash when running `git maintenance start`
Patrick Steinhardt [Thu, 10 Oct 2024 05:33:01 +0000 (07:33 +0200)] 
builtin/gc: fix crash when running `git maintenance start`

It was reported on the mailing list that running `git maintenance start`
immediately segfaults starting with b6c3f8e12c (builtin/maintenance: fix
leak in `get_schedule_cmd()`, 2024-09-26). And indeed, this segfault is
trivial to reproduce up to a point where one is scratching their head
why we didn't catch this regression in our test suite.

The root cause of this error is `get_schedule_cmd()`, which does not
populate the `out` parameter in all cases anymore starting with the
mentioned commit. Callers do assume it to always be populated though and
will e.g. call `strvec_split()` on the returned value, which will of
course segfault when the variable is uninitialized.

So why didn't we catch this trivial regression? The reason is that our
tests always set up the "GIT_TEST_MAINT_SCHEDULER" environment variable
via "t/test-lib.sh", which allows us to override the scheduler command
with a custom one so that we don't accidentally modify the developer's
system. But the faulty code where we don't set the `out` parameter will
only get hit in case that environment variable is _not_ set, which is
never the case when executing our tests.

Fix the regression by again unconditionally allocating the value in the
`out` parameter, if provided. Add a test that unsets the environment
variable to catch future regressions in this area.

Reported-by: Shubham Kanodia <shubham.kanodia10@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agodoc: clarify <src> in refspec syntax
Junio C Hamano [Tue, 1 Oct 2024 18:36:52 +0000 (11:36 -0700)] 
doc: clarify <src> in refspec syntax

We explicitly avoid saying "ref <src>" when introducing the source
side of a refspec, because it can be a fully-spelled hexadecimal
object name, and it also can be a pattern that is not quite a "ref".

But we are loose when we introduce <dst> and say "ref <dst>", even
though it can also be a pattern.  Let's omit "ref" also from the
destination side.

Clarify that <src> can be a ref, a (limited glob) pattern, or an
object name.

Even though the very original design of refspec expected that '*'
was used only at the end (e.g., "refs/heads/*" was expected, but not
"refs/heads/*-wip"), the code and its use evolved to handle a single
'*' anywhere in the pattern.  Update the text to remove the mention
of "the same prefix".  Anything that matches the pattern are named
by such a (limited glob) pattern in <src>.

Also put a bit more stress on the fact that we accept only one '*'
in the pattern by saying "one and only one `*`".

Helped-by: Monika Kairaitytė <monika@kibit.lt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoloose: don't rely on repository global state
Karthik Nayak [Wed, 9 Oct 2024 09:58:59 +0000 (02:58 -0700)] 
loose: don't rely on repository global state

In `loose.c`, we rely on the global variable `the_hash_algo`. As such we
have guarded the file with the 'USE_THE_REPOSITORY_VARIABLE' definition.
Let's derive the hash algorithm from the available repository variable
and remove this guard. This brings us one step closer to removing the
global 'the_repository' variable.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agosubmodule: correct remote name with fetch
Daniel Black [Wed, 9 Oct 2024 03:32:54 +0000 (14:32 +1100)] 
submodule: correct remote name with fetch

The code fetches the submodules remote based on the superproject remote name
instead of the submodule remote name[1].

Instead of grabbing the default remote of the superproject repository, ask
the default remote of the submodule we are going to run 'git fetch' in.

1. https://lore.kernel.org/git/ZJR5SPDj4Wt_gmRO@pweza/

Signed-off-by: Daniel Black <daniel@mariadb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agodoc: merge-tree: improve example script
Kristoffer Haugsbakk [Wed, 9 Oct 2024 16:53:45 +0000 (18:53 +0200)] 
doc: merge-tree: improve example script

• Provide a commit message in the example command.

  The command will hang since it is waiting for a commit message on
  stdin.  Which is usable but not straightforward enough since this is
  example code.
• Use `||` directly since that is more straightforward than checking the
  last exit status.

  Also use `echo` and `exit` since `die` is not defined.
• Expose variable declarations.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agogit-config.1: remove value from positional args in unset usage
Josh Heinrichs [Tue, 8 Oct 2024 14:29:20 +0000 (08:29 -0600)] 
git-config.1: remove value from positional args in unset usage

The synopsis for `git config unset` mentions two positional arguments:
`<name>` and `<value>`. While the first argument is correct, the second
is not. Users are expected to provide the value via `--value=<value>`.

Remove the positional argument. The `--value=<value>` option is already
documented correctly, so this is all we need to do to fix the
documentation.

Signed-off-by: Josh Heinrichs <joshiheinrichs@gmail.com>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agofsmonitor: initialize fs event listener before accepting clients
Jeff King [Tue, 8 Oct 2024 08:36:13 +0000 (04:36 -0400)] 
fsmonitor: initialize fs event listener before accepting clients

There's a racy hang in fsmonitor on macOS that we sometimes see in CI.
When we serve a client, what's supposed to happen is:

  1. The client thread calls with_lock__wait_for_cookie() in which we
     create a cookie file and then wait for a pthread_cond event

  2. The filesystem event listener sees the cookie file creation, does
     some internal book-keeping, and then triggers the pthread_cond.

But there's a problem: we start the listener that accepts client threads
before we start the fs event thread. So it's possible for us to accept a
client which creates the cookie file and starts waiting before the fs
event thread is initialized, and we miss those filesystem events
entirely. That leaves the client thread hanging forever.

In CI, the symptom is that t9210 (which is testing scalar, which always
enables fsmonitor under the hood) may hang forever in "scalar clone". It
is waiting on "git fetch" which is waiting on the fsmonitor daemon.

The race happens more frequently under load, but you can trigger it
predictably with a sleep like this, which delays the start of the fs
event thread:

  --- a/compat/fsmonitor/fsm-listen-darwin.c
  +++ b/compat/fsmonitor/fsm-listen-darwin.c
  @@ -510,6 +510,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
          FSEventStreamSetDispatchQueue(data->stream, data->dq);
          data->stream_scheduled = 1;

  +       sleep(1);
          if (!FSEventStreamStart(data->stream)) {
                  error(_("Failed to start the FSEventStream"));
                  goto force_error_stop_without_loop;

One solution might be to reverse the order of initialization: start the
fs event thread before we start the thread listening for clients. But
the fsmonitor code explicitly does it in the opposite direction. The fs
event thread wants to refer to the ipc_server_data struct, so we need it
to be initialized first.

A further complication is that we need a signal from the fs event thread
that it is actually ready and listening. And those details happen within
backend-specific fsmonitor code, whereas the initialization is in the
shared code.

So instead, let's use the ipc_server init/start split added in the
previous commit. The generic fsmonitor code will init the ipc_server but
_not_ start it, leaving that to the backend specific code, which now
needs to call ipc_server_start_async() at the right time.

For macOS, that is right after we start the FSEventStream that you can
see in the diff above.

It's not clear to me if Windows suffers from the same problem (and we
simply don't trigger it in CI), or if it is immune. Regardless, the
obvious place to start accepting clients there is right after we've
established the ReadDirectoryChanges watch.

This makes the hangs go away in our macOS CI environment, even when
compiled with the sleep() above.

Helped-by: Koji Nakamaru <koji.nakamaru@gree.net>
Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Koji Nakamaru <koji.nakamaru@gree.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agosimple-ipc: split async server initialization and running
Jeff King [Tue, 8 Oct 2024 08:33:47 +0000 (04:33 -0400)] 
simple-ipc: split async server initialization and running

To start an async ipc server, you call ipc_server_run_async(). That
initializes the ipc_server_data object, and starts all of the threads
running, which may immediately start serving clients.

This can create some awkward timing problems, though. In the fsmonitor
daemon (the sole user of the simple-ipc system), we want to create the
ipc server early in the process, which means we may start serving
clients before the rest of the daemon is fully initialized.

To solve this, let's break run_async() into two parts: an initialization
which allocates all data and spawns the threads (without letting them
run), and a start function which actually lets them begin work. Since we
have two simple-ipc implementations, we have to handle this twice:

  - in ipc-unix-socket.c, we have a central listener thread which hands
    connections off to worker threads using a work_available mutex. We
    can hold that mutex after init, and release it when we're ready to
    start.

    We do need an extra "started" flag so that we know whether the main
    thread is holding the mutex or not (e.g., if we prematurely stop the
    server, we want to make sure all of the worker threads are released
    to hear about the shutdown).

  - in ipc-win32.c, we don't have a central mutex. So we'll introduce a
    new startup_barrier mutex, which we'll similarly hold until we're
    ready to let the threads proceed.

    We again need a "started" flag here to make sure that we release the
    barrier mutex when shutting down, so that the sub-threads can
    proceed to the finish.

I've renamed the run_async() function to init_async() to make sure we
catch all callers, since they'll now need to call the matching
start_async().

We could leave run_async() as a wrapper that does both, but there's not
much point. There are only two callers, one of which is fsmonitor, which
will want to actually do work between the two calls. And the other is
just a test-tool wrapper.

For now I've added the start_async() calls in fsmonitor where they would
otherwise have happened, so there should be no behavior change with this
patch.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Koji Nakamaru <koji.nakamaru@gree.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agodocs: fix the `maintain-git` links in `technical/platform-support`
Johannes Schindelin [Mon, 7 Oct 2024 21:49:24 +0000 (21:49 +0000)] 
docs: fix the `maintain-git` links in `technical/platform-support`

These links should point to `.html` files, not to `.txt` ones.

Compare also to 4945f046c7f (api docs: link to html version of
api-trace2, 2022-09-16).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agounpack-trees: detect mismatching number of cache-tree/index entries
Patrick Steinhardt [Mon, 7 Oct 2024 04:38:21 +0000 (06:38 +0200)] 
unpack-trees: detect mismatching number of cache-tree/index entries

Same as the preceding commit, we unconditionally dereference the index's
cache entries depending on the number of cache-tree entries, which can
lead to a segfault when the cache-tree is corrupted. Fix this bug.

This also makes t4058 pass with the leak sanitizer enabled.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agocache-tree: detect mismatching number of index entries
Patrick Steinhardt [Mon, 7 Oct 2024 04:38:18 +0000 (06:38 +0200)] 
cache-tree: detect mismatching number of index entries

In t4058 we have some tests that exercise git-read-tree(1) when used
with a tree that contains duplicate entries. While the expectation is
that we fail, we ideally should fail gracefully without a segfault.

But that is not the case: we never check that the number of entries in
the cache-tree is less than or equal to the number of entries in the
index. This can lead to an out-of-bounds read as we unconditionally
access `istate->cache[idx]`, where `idx` is controlled by the number of
cache-tree entries and the current position therein. The result is a
segfault.

Fix this segfault by adding a sanity check for the number of index
entries before dereferencing them.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agocache-tree: refactor verification to return error codes
Patrick Steinhardt [Mon, 7 Oct 2024 04:38:15 +0000 (06:38 +0200)] 
cache-tree: refactor verification to return error codes

The function `cache_tree_verify()` will `BUG()` whenever it finds that
the cache-tree extension of the index is corrupt. The function is thus
inherently untestable because the resulting call to `abort()` will be
detected by our testing framework and labelled an error. And rightfully
so: it shouldn't ever be possible to hit bugs, as they should indicate a
programming error rather than corruption of on-disk state.

Refactor the function to instead return error codes. This also ensures
that the function can be used e.g. by git-fsck(1) without the whole
process dying. Furthermore, this refactoring plugs some memory leaks
when returning early by creating a common exit path.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoGit 2.47 v2.47.0
Junio C Hamano [Sun, 6 Oct 2024 22:56:06 +0000 (15:56 -0700)] 
Git 2.47

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoMerge tag 'l10n-2.47.0-rnd2' of https://github.com/git-l10n/git-po
Junio C Hamano [Sun, 6 Oct 2024 18:14:12 +0000 (11:14 -0700)] 
Merge tag 'l10n-2.47.0-rnd2' of https://github.com/git-l10n/git-po

l10n-2.47.0-rnd2

* tag 'l10n-2.47.0-rnd2' of https://github.com/git-l10n/git-po:
  l10n: Update German translation
  l10n: bg.po: Updated Bulgarian translation (5772t)
  l10n: vi: Updated translation for 2.47
  l10n: zh_TW: Git 2.47
  l10n: new lead for Catalan translation
  l10n: Update Catalan translation
  l10n: fr.po: 2.47.0
  l10n: zh_CN: updated translation for 2.47
  l10n: po-id for 2.47
  l10n: tr: Update Turkish translations for 2.47.0
  l10n: sv.po: Update Swedish translation

8 months agoMerge branch 'l10n-de-2.47' of github.com:ralfth/git
Jiang Xin [Sun, 6 Oct 2024 04:06:21 +0000 (12:06 +0800)] 
Merge branch 'l10n-de-2.47' of github.com:ralfth/git

* 'l10n-de-2.47' of github.com:ralfth/git:
  l10n: Update German translation

8 months agoMerge branch 'master' of github.com:alshopov/git-po
Jiang Xin [Sun, 6 Oct 2024 04:04:11 +0000 (12:04 +0800)] 
Merge branch 'master' of github.com:alshopov/git-po

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

8 months agoMerge branch 'catalan-247' of github.com:Softcatala/git-po
Jiang Xin [Sun, 6 Oct 2024 04:03:46 +0000 (12:03 +0800)] 
Merge branch 'catalan-247' of github.com:Softcatala/git-po

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

8 months agoMerge branch 'new-catalan-maintainer' of github.com:Softcatala/git-po
Jiang Xin [Sun, 6 Oct 2024 04:03:08 +0000 (12:03 +0800)] 
Merge branch 'new-catalan-maintainer' of github.com:Softcatala/git-po

* 'new-catalan-maintainer' of github.com:Softcatala/git-po:
  l10n: new lead for Catalan translation

8 months agoMerge branch 'l10n/zh-TW/2024-10-05' of github.com:l10n-tw/git-po
Jiang Xin [Sun, 6 Oct 2024 03:39:29 +0000 (11:39 +0800)] 
Merge branch 'l10n/zh-TW/2024-10-05' of github.com:l10n-tw/git-po

* 'l10n/zh-TW/2024-10-05' of github.com:l10n-tw/git-po:
  l10n: zh_TW: Git 2.47

8 months agoMerge branch 'tl/zh_CN_2.47.0_rnd' of github.com:dyrone/git
Jiang Xin [Sun, 6 Oct 2024 03:39:03 +0000 (11:39 +0800)] 
Merge branch 'tl/zh_CN_2.47.0_rnd' of github.com:dyrone/git

* 'tl/zh_CN_2.47.0_rnd' of github.com:dyrone/git:
  l10n: zh_CN: updated translation for 2.47

8 months agoMerge branch 'master' of github.com:nafmo/git-l10n-sv
Jiang Xin [Sun, 6 Oct 2024 03:38:15 +0000 (11:38 +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

8 months agoMerge branch 'fr_2.47.0_rnd1' of github.com:jnavila/git
Jiang Xin [Sun, 6 Oct 2024 03:37:56 +0000 (11:37 +0800)] 
Merge branch 'fr_2.47.0_rnd1' of github.com:jnavila/git

* 'fr_2.47.0_rnd1' of github.com:jnavila/git:
  l10n: fr.po: 2.47.0

8 months agoMerge branch 'vi-2.47' of github.com:Nekosha/git-po
Jiang Xin [Sun, 6 Oct 2024 03:35:59 +0000 (11:35 +0800)] 
Merge branch 'vi-2.47' of github.com:Nekosha/git-po

* 'vi-2.47' of github.com:Nekosha/git-po:
  l10n: vi: Updated translation for 2.47

8 months agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Sun, 6 Oct 2024 03:35:06 +0000 (11:35 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.47

8 months agol10n: Update German translation
Ralf Thielow [Sat, 5 Oct 2024 17:28:19 +0000 (19:28 +0200)] 
l10n: Update German translation

Reviewed-by: Matthias Rüster <matthias.ruester@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
8 months agol10n: bg.po: Updated Bulgarian translation (5772t)
Alexander Shopov [Sat, 5 Oct 2024 11:16:48 +0000 (13:16 +0200)] 
l10n: bg.po: Updated Bulgarian translation (5772t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
8 months agol10n: vi: Updated translation for 2.47
Vũ Tiến Hưng [Thu, 26 Sep 2024 07:41:59 +0000 (14:41 +0700)] 
l10n: vi: Updated translation for 2.47

Signed-off-by: Vũ Tiến Hưng <newcomerminecraft@gmail.com>
8 months agol10n: zh_TW: Git 2.47
Yi-Jyun Pan [Sat, 5 Oct 2024 03:36:12 +0000 (11:36 +0800)] 
l10n: zh_TW: Git 2.47

Co-authored-by: Lumynous <lumynou5.tw@gmail.com>
Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
8 months agol10n: new lead for Catalan translation
Jordi Mas [Sat, 5 Oct 2024 07:26:43 +0000 (09:26 +0200)] 
l10n: new lead for Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
8 months agol10n: Update Catalan translation
Jordi Mas [Sat, 5 Oct 2024 07:19:18 +0000 (09:19 +0200)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
8 months agoMostly there for 2.47 final
Junio C Hamano [Fri, 4 Oct 2024 21:21:16 +0000 (14:21 -0700)] 
Mostly there for 2.47 final

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoMerge branch 'kn/osx-fsmonitor-with-submodules-fix'
Junio C Hamano [Fri, 4 Oct 2024 21:21:43 +0000 (14:21 -0700)] 
Merge branch 'kn/osx-fsmonitor-with-submodules-fix'

macOS with fsmonitor daemon can hang forever when a submodule is
involved, which has been corrected.

* kn/osx-fsmonitor-with-submodules-fix:
  fsmonitor OSX: fix hangs for submodules

8 months agoMerge branch 'ak/doc-typofix'
Junio C Hamano [Fri, 4 Oct 2024 21:21:43 +0000 (14:21 -0700)] 
Merge branch 'ak/doc-typofix'

Typofixes.

* ak/doc-typofix:
  Documentation: fix typos
  Documentation/config: fix typos

8 months agoMerge branch 'tb/weak-sha1-for-tail-sum'
Junio C Hamano [Fri, 4 Oct 2024 21:21:42 +0000 (14:21 -0700)] 
Merge branch 'tb/weak-sha1-for-tail-sum'

Build fix.

* tb/weak-sha1-for-tail-sum:
  hash.h: set NEEDS_CLONE_HELPER_UNSAFE in fallback mode

8 months agoMerge branch 'ps/reftable-concurrent-writes'
Junio C Hamano [Fri, 4 Oct 2024 21:21:41 +0000 (14:21 -0700)] 
Merge branch 'ps/reftable-concurrent-writes'

Test fix.

* ps/reftable-concurrent-writes:
  t0610: work around flaky test with concurrent writers

8 months agoMerge branch 'mh/w-unused-fix'
Junio C Hamano [Fri, 4 Oct 2024 21:21:41 +0000 (14:21 -0700)] 
Merge branch 'mh/w-unused-fix'

Buildfix.

* mh/w-unused-fix:
  utf8.h: squelch unused-parameter warnings with NO_ICONV

8 months agoMerge branch 'rs/archive-with-attr-pathspec-fix'
Junio C Hamano [Fri, 4 Oct 2024 21:21:40 +0000 (14:21 -0700)] 
Merge branch 'rs/archive-with-attr-pathspec-fix'

Message update.

* rs/archive-with-attr-pathspec-fix:
  archive: fix misleading error message

8 months agoMerge branch 'ak/typofix-2.46-maint'
Junio C Hamano [Fri, 4 Oct 2024 21:21:40 +0000 (14:21 -0700)] 
Merge branch 'ak/typofix-2.46-maint'

Typofixes.

* ak/typofix-2.46-maint:
  perl: fix a typo
  mergetool: fix a typo
  reftable: fix a typo
  trace2: fix typos

8 months agol10n: fr.po: 2.47.0
Jean-Noël Avila [Fri, 27 Sep 2024 20:05:44 +0000 (22:05 +0200)] 
l10n: fr.po: 2.47.0

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
8 months agol10n: zh_CN: updated translation for 2.47
Teng Long [Fri, 4 Oct 2024 18:56:55 +0000 (02:56 +0800)] 
l10n: zh_CN: updated translation for 2.47

Signed-off-by: Teng Long <dyroneteng@gmail.com>
8 months agoA bit more after 2.47-rc1
Junio C Hamano [Fri, 4 Oct 2024 17:13:51 +0000 (10:13 -0700)] 
A bit more after 2.47-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoMerge branch 'ds/read-cache-mempool-leakfix'
Junio C Hamano [Fri, 4 Oct 2024 17:14:07 +0000 (10:14 -0700)] 
Merge branch 'ds/read-cache-mempool-leakfix'

Leakfix.

* ds/read-cache-mempool-leakfix:
  read-cache: free threaded memory pool

8 months agoMerge branch 'jc/doc-discarding-stalled-topics'
Junio C Hamano [Fri, 4 Oct 2024 17:14:06 +0000 (10:14 -0700)] 
Merge branch 'jc/doc-discarding-stalled-topics'

Document that inactive topics are subject to be discarded.

* jc/doc-discarding-stalled-topics:
  howto-maintain-git: discarding inactive topics

8 months agoMerge branch 'jk/test-lsan-improvements'
Junio C Hamano [Fri, 4 Oct 2024 17:14:06 +0000 (10:14 -0700)] 
Merge branch 'jk/test-lsan-improvements'

Usability improvements for running tests in leak-checking mode.

* jk/test-lsan-improvements:
  test-lib: check for leak logs after every test
  test-lib: show leak-sanitizer logs on --immediate failure
  test-lib: stop showing old leak logs

8 months agot0610: work around flaky test with concurrent writers
Patrick Steinhardt [Fri, 4 Oct 2024 15:32:16 +0000 (17:32 +0200)] 
t0610: work around flaky test with concurrent writers

In 6241ce2170 (refs/reftable: reload locked stack when preparing
transaction, 2024-09-24) we have introduced a new test that exercises
how the reftable backend behaves with many concurrent writers all racing
with each other. This test was introduced after a couple of fixes in
this context that should make concurrent writes behave gracefully. As it
turns out though, Windows systems do not yet handle concurrent writes
properly, as we've got two reports for Cygwin and MinGW failing in this
newly added test.

The root cause of this is how we update the "tables.list" file: when
writing a new stack of tables we first write the data into a lockfile
and then rename that file into place. But Windows forbids us from doing
that rename when the target path is open for reading by another process.
And as the test races both readers and writers with each other we are
quite likely to hit this edge case.

This is not a regression: the logic didn't work before the mentioned
commit, and after the commit it performs well on Linux and macOS, and
the situation on Windows should have at least improved a bit. But the
test shows that we need to put more thought into how to make this work
properly there.

Work around the issue by disabling the test on Windows for now. While at
it, increase the locking timeout to address reported timeouts when using
either the address or memory sanitizer, which also tend to significantly
extend the runtime of this test.

This should be revisited after Git v2.47 is out.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agofsmonitor OSX: fix hangs for submodules
Koji Nakamaru [Fri, 4 Oct 2024 00:07:13 +0000 (00:07 +0000)] 
fsmonitor OSX: fix hangs for submodules

fsmonitor_classify_path_absolute() expects state->path_gitdir_watch.buf
has no trailing '/' or '.' For a submodule, fsmonitor_run_daemon() sets
the value with trailing "/." (as repo_get_git_dir(the_repository) on
Darwin returns ".") so that fsmonitor_classify_path_absolute() returns
IS_OUTSIDE_CONE.

In this case, fsevent_callback() doesn't update cookie_list so that
fsmonitor_publish() does nothing and with_lock__mark_cookies_seen() is
not invoked.

As with_lock__wait_for_cookie() infinitely waits for state->cookies_cond
that with_lock__mark_cookies_seen() should unlock, the whole daemon
hangs.

Remove trailing "/." from state->path_gitdir_watch.buf for submodules
and add a corresponding test in t7527-builtin-fsmonitor.sh. The test is
disabled for MINGW because hangs treated with this patch occur only for
Darwin and there is no simple way to terminate the win32 fsmonitor
daemon that hangs.

Suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Koji Nakamaru <koji.nakamaru@gree.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agol10n: po-id for 2.47
Bagas Sanjaya [Tue, 24 Sep 2024 02:52:25 +0000 (09:52 +0700)] 
l10n: po-id for 2.47

Update following components:

  * add-patch.c
  * apply.c
  * builtin/check-mailmap.c
  * builtin/checkout.c
  * builtin/commit.c
  * builtin/config.c
  * builtin/fetch.c
  * builtin/gc.c
  * builtin/multi-pack-index.c
  * builtin/refs.c
  * builtin/show-refs.c
  * builtin/sparse-checkout.c
  * builtin/submodule--helper.c
  * loose.c
  * midx-write.c
  * midx.c
  * object-file.c
  * ref-filter.c
  * refs/file-backend.c
  * scalar.c
  * setup.c
  * git-send-email.perl

Translate following new components:

  * t/unit-tests/unit-tests.c

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
8 months agodiff: store graph prefix buf in git_graph struct
Jeff King [Thu, 3 Oct 2024 21:13:17 +0000 (17:13 -0400)] 
diff: store graph prefix buf in git_graph struct

The diffopt output_prefix interface makes it the callback's job to
handle ownership of the memory it returns, keeping it valid while
callers are using it and then eventually freeing it when we are done
diffing.

In diff_output_prefix_callback() we handle this with a static strbuf,
effectively "leaking" it when the diff is done (but not triggering any
leak detectors because it's technically still reachable). This has not
been a big problem in practice, but it is a problem for libification:
two diffs running in the same process could stomp on each other's prefix
buffers.

Since we only need the strbuf when we are formatting graph padding, we
can give ownership of the strbuf to the git_graph struct, letting us
free it when that struct is no longer in use.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agodiff: return line_prefix directly when possible
Jeff King [Thu, 3 Oct 2024 21:11:31 +0000 (17:11 -0400)] 
diff: return line_prefix directly when possible

We may point our output_prefix callback to diff_output_prefix_callback()
in any of these cases:

  1. we have a user-provided line_prefix

  2. we have a graph prefix to show

  3. both (1) and (2)

The function combines the available elements into a strbuf and returns
its pointer.

In the case that we just have the line_prefix, though, there is no need
for the strbuf. We can return the string directly.

This is a minor optimization by itself, but also will allow us to clean
up some memory ownership issues on top.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agodiff: return const char from output_prefix callback
Jeff King [Thu, 3 Oct 2024 21:09:24 +0000 (17:09 -0400)] 
diff: return const char from output_prefix callback

The diff_options structure has an output_prefix callback for returning a
prefix string, but it does so by returning a pointer to a strbuf.

This makes the interface awkward. There's no reason the callback should
need to use a strbuf, and it creates questions about whether the
ownership of the resulting buffer should be transferred to the caller
(it should not be, but a recent attempt to clean up this code led to a
double-free in some cases).

The one advantage we get is that the strbuf contains a ptr/len pair, so
we could in theory have a prefix with embedded NULs. But we can observe
that none of the existing callbacks would ever produce such a NUL (they
are usually just indentation or graph symbols, and even the
"--line-prefix" option takes a NUL-terminated string).

And anyway, only one caller (the one in log_tree_diff_flush) actually
looks at the strbuf length. In every other case we use a helper function
which discards the length and just returns the NUL-terminated string.

So let's just have the callback return a "const char *" pointer. It's up
to the callbacks themselves if they want to use a strbuf under the hood.
And now the caller in log_tree_diff_flush() can just use the helper
function along with everybody else. That lets us even simplify out the
function pointer check, since the helper returns an empty string
(technically this does mean we'll sometimes issue an empty fputs() call,
but I don't think this code path is hot enough to care about that).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agodiff: drop line_prefix_length field
Jeff King [Thu, 3 Oct 2024 21:06:54 +0000 (17:06 -0400)] 
diff: drop line_prefix_length field

The diff_options structure holds a line_prefix string and an associated
length. But the length is always just the strlen() of the NUL-terminated
string. Let's simplify the code by just storing the string pointer and
assuming it is NUL-terminated when we use it.

This will cause us to compute the string length in a few extra spots,
but I don't think any of these are particularly hot code paths.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoline-log: use diff_line_prefix() instead of custom helper
Jeff King [Thu, 3 Oct 2024 21:06:27 +0000 (17:06 -0400)] 
line-log: use diff_line_prefix() instead of custom helper

Our local output_prefix() is exactly the same as the public
diff_line_prefix() function. Let's just use that one, saving us a little
bit of code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoperl: fix a typo
Andrew Kreimer [Wed, 2 Oct 2024 22:38:16 +0000 (01:38 +0300)] 
perl: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agomergetool: fix a typo
Andrew Kreimer [Wed, 2 Oct 2024 22:38:14 +0000 (01:38 +0300)] 
mergetool: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoreftable: fix a typo
Andrew Kreimer [Wed, 2 Oct 2024 22:38:13 +0000 (01:38 +0300)] 
reftable: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agotrace2: fix typos
Andrew Kreimer [Wed, 2 Oct 2024 22:38:12 +0000 (01:38 +0300)] 
trace2: fix typos

Fix typos in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoDocumentation: mention the amlog in howto/maintain-git.txt
Taylor Blau [Thu, 3 Oct 2024 01:09:56 +0000 (21:09 -0400)] 
Documentation: mention the amlog in howto/maintain-git.txt

Part of the maintainer's job is to keep up-to-date and publish the
'amlog' which stores a mapping between a patch's 'Message-Id' e-mail
header and the commit generated by applying said patch.

But our Documentation/howto/maintain-git.txt does not mention the amlog,
or the scripts which exist to help the maintainer keep the amlog
up-to-date.

(This bit me during the first integration round I did as interim
maintainer[1] involved a lot of manual clean-up. More recently it has
come up as part of a research effort to better understand a patch's
lifecycle on the list[2].)

Address this gap by briefly documenting the existence and purpose of the
'post-applypatch' hook in maintaining the amlog entries.

[1]: https://lore.kernel.org/git/Y19dnb2M+yObnftj@nand.local/
[2]: https://lore.kernel.org/git/CAJoAoZ=4ARuH3aHGe5yC_Xcnou_c396q_ZienYPY7YnEzZcyEg@mail.gmail.com/

Suggested-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agodoc: add a note about staggering of maintenance
Shubham Kanodia [Thu, 3 Oct 2024 08:57:57 +0000 (08:57 +0000)] 
doc: add a note about staggering of maintenance

Git maintenance tasks are staggered to a random minute of the hour per
client to avoid thundering herd issues. Updates the doc to add a note
about the same.

Signed-off-by: Shubham Kanodia <shubham.kanodia10@gmail.com>
Acked-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agohash.h: set NEEDS_CLONE_HELPER_UNSAFE in fallback mode
Jeff King [Wed, 2 Oct 2024 23:26:18 +0000 (19:26 -0400)] 
hash.h: set NEEDS_CLONE_HELPER_UNSAFE in fallback mode

Commit 253ed9ecff (hash.h: scaffolding for _unsafe hashing variants,
2024-09-26) introduced the concept of having two hash algorithms: a safe
and an unsafe one. When the Makefile knobs do not explicitly request an
unsafe one, we fall back to using the safe algorithm.

However, the fallback to do so forgot one case: we should inherit the
NEEDS_CLONE_HELPER flag from the safe variant. Failing to do so means
that we'll end up defining two clone functions (the algorithm specific
one, and the generic one that just calls memcpy). You'll see an error
like this:

  $ make OPENSSL_SHA1=1
  [...]
  sha1/openssl.h:46:29: error: redefinition of ‘openssl_SHA1_Clone’
     46 | #define platform_SHA1_Clone openssl_SHA1_Clone
        |                             ^~~~~~~~~~~~~~~~~~
  hash.h:83:40: note: in expansion of macro ‘platform_SHA1_Clone’
     83 | #    define platform_SHA1_Clone_unsafe platform_SHA1_Clone
        |                                        ^~~~~~~~~~~~~~~~~~~
  hash.h:101:33: note: in expansion of macro ‘platform_SHA1_Clone_unsafe’
    101 | #  define git_SHA1_Clone_unsafe platform_SHA1_Clone_unsafe
        |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
  hash.h:133:20: note: in expansion of macro ‘git_SHA1_Clone_unsafe’
    133 | static inline void git_SHA1_Clone_unsafe(git_SHA_CTX_unsafe *dst,
        |                    ^~~~~~~~~~~~~~~~~~~~~
  sha1/openssl.h:37:20: note: previous definition of ‘openssl_SHA1_Clone’ with type ‘void(struct openssl_SHA1_CTX *, const struct openssl_SHA1_CTX *)’
     37 | static inline void openssl_SHA1_Clone(struct openssl_SHA1_CTX *dst,
        |                    ^~~~~~~~~~~~~~~~~~

This only matters when compiling with openssl as the "safe" variant,
since it's the only algorithm that requires a clone helper (and even
then, only if you are using openssl 3.0+). And you should never do that,
because it's not safe. But still, the invocation above used to work and
should continue to do so until we decide to require a
collision-detecting variant for the safe algorithm entirely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoarchive: fix misleading error message
René Scharfe [Thu, 3 Oct 2024 15:51:01 +0000 (17:51 +0200)] 
archive: fix misleading error message

The error message added by 296743a7ca (archive: load index before
pathspec checks, 2024-09-21) is misleading: unpack_trees() is not
touching the working tree at all here, but just loading a tree into
the index.  Correct it.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoline-log: protect inner strbuf from free
Derrick Stolee [Thu, 3 Oct 2024 11:58:42 +0000 (11:58 +0000)] 
line-log: protect inner strbuf from free

The output_prefix() method in line-log.c may call a function pointer via
the diff_options struct. This function pointer returns a strbuf struct
and then its buffer is passed back. However, that implies that the
consumer is responsible to free the string. This is especially true
because the default behavior is to duplicate the empty string.

The existing functions used in the output_prefix pointer include:

 1. idiff_prefix_cb() in diff-lib.c. This returns the data pointer, so
    the value exists across multiple calls.

 2. diff_output_prefix_callback() in graph.c. This uses a static strbuf
    struct, so it reuses buffers across calls. These should not be
    freed.

 3. output_prefix_cb() in range-diff.c. This is similar to the
    diff-lib.c case.

In each case, we should not be freeing this buffer. We can convert the
output_prefix() function to return a const char pointer and stop freeing
the result.

This choice is essentially the opposite of what was done in 394affd46d
(line-log: always allocate the output prefix, 2024-06-07).

This was discovered via 'valgrind' while investigating a public report
of a bug in 'git log --graph -L' [1].

[1] https://github.com/git-for-windows/git/issues/5185

This issue would have been caught by the new test, when Git is compiled
with ASan to catch these double frees.

Co-authored-by: Jeff King <peff@peff.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agol10n: tr: Update Turkish translations for 2.47.0
Emir SARI [Tue, 24 Sep 2024 06:55:47 +0000 (09:55 +0300)] 
l10n: tr: Update Turkish translations for 2.47.0

Signed-off-by: Emir SARI <emir_sari@icloud.com>
8 months agoutf8.h: squelch unused-parameter warnings with NO_ICONV
Mike Hommey [Wed, 2 Oct 2024 20:01:40 +0000 (05:01 +0900)] 
utf8.h: squelch unused-parameter warnings with NO_ICONV

Since DEVELOPER=YesPlease build enables -Wunused-parameter warnings
these days, the fallback definition for reencode_string_len() that
did not touch any of its parameters but one needs to be annotated
properly.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoGit 2.47-rc1 v2.47.0-rc1
Junio C Hamano [Wed, 2 Oct 2024 14:45:44 +0000 (07:45 -0700)] 
Git 2.47-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoMerge branch 'tb/weak-sha1-for-tail-sum'
Junio C Hamano [Wed, 2 Oct 2024 14:46:27 +0000 (07:46 -0700)] 
Merge branch 'tb/weak-sha1-for-tail-sum'

The checksum at the tail of files are now computed without
collision detection protection.  This is safe as the consumer of
the information to protect itself from replay attacks checks for
hash collisions independently.

* tb/weak-sha1-for-tail-sum:
  csum-file.c: use unsafe SHA-1 implementation when available
  Makefile: allow specifying a SHA-1 for non-cryptographic uses
  hash.h: scaffolding for _unsafe hashing variants
  sha1: do not redefine `platform_SHA_CTX` and friends
  pack-objects: use finalize_object_file() to rename pack/idx/etc
  finalize_object_file(): implement collision check
  finalize_object_file(): refactor unlink_or_warn() placement
  finalize_object_file(): check for name collision before renaming

8 months agoMerge branch 'jk/http-leakfixes'
Junio C Hamano [Wed, 2 Oct 2024 14:46:26 +0000 (07:46 -0700)] 
Merge branch 'jk/http-leakfixes'

Leakfixes.

* jk/http-leakfixes: (28 commits)
  http-push: clean up local_refs at exit
  http-push: clean up loose request when falling back to packed
  http-push: clean up objects list
  http-push: free xml_ctx.cdata after use
  http-push: free remote_ls_ctx.dentry_name
  http-push: free transfer_request strbuf
  http-push: free transfer_request dest field
  http-push: free curl header lists
  http-push: free repo->url string
  http-push: clear refspecs before exiting
  http-walker: free fake packed_git list
  remote-curl: free HEAD ref with free_one_ref()
  http: stop leaking buffer in http_get_info_packs()
  http: call git_inflate_end() when releasing http_object_request
  http: fix leak of http_object_request struct
  http: fix leak when redacting cookies from curl trace
  transport-helper: fix leak of dummy refs_list
  fetch-pack: clear pack lockfiles list
  fetch: free "raw" string when shrinking refspec
  transport-helper: fix strbuf leak in push_refs_with_push()
  ...

8 months agoMerge branch 'ps/leakfixes-part-7'
Junio C Hamano [Wed, 2 Oct 2024 14:46:25 +0000 (07:46 -0700)] 
Merge branch 'ps/leakfixes-part-7'

More leak-fixes.

* ps/leakfixes-part-7: (23 commits)
  diffcore-break: fix leaking filespecs when merging broken pairs
  revision: fix leaking parents when simplifying commits
  builtin/maintenance: fix leak in `get_schedule_cmd()`
  builtin/maintenance: fix leaking config string
  promisor-remote: fix leaking partial clone filter
  grep: fix leaking grep pattern
  submodule: fix leaking submodule ODB paths
  trace2: destroy context stored in thread-local storage
  builtin/difftool: plug several trivial memory leaks
  builtin/repack: fix leaking configuration
  diffcore-order: fix leaking buffer when parsing orderfiles
  parse-options: free previous value of `OPTION_FILENAME`
  diff: fix leaking orderfile option
  builtin/pull: fix leaking "ff" option
  dir: fix off by one errors for ignored and untracked entries
  builtin/submodule--helper: fix leaking remote ref on errors
  t/helper: fix leaking subrepo in nested submodule config helper
  builtin/submodule--helper: fix leaking error buffer
  builtin/submodule--helper: clear child process when not running it
  submodule: fix leaking update strategy
  ...