]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
4 months agoMerge branch 'rj/add-p-typo-reaction'
Junio C Hamano [Wed, 8 May 2024 17:18:45 +0000 (10:18 -0700)] 
Merge branch 'rj/add-p-typo-reaction'

When the user responds to a prompt given by "git add -p" with an
unsupported command, list of available commands were given, which
was too much if the user knew what they wanted to type but merely
made a typo.  Now the user gets a much shorter error message.

* rj/add-p-typo-reaction:
  add-patch: response to unknown command
  add-patch: do not show UI messages on stderr

4 months agoMerge branch 'jt/doc-submitting-rerolled-series'
Junio C Hamano [Wed, 8 May 2024 17:18:45 +0000 (10:18 -0700)] 
Merge branch 'jt/doc-submitting-rerolled-series'

Developer doc update.

* jt/doc-submitting-rerolled-series:
  doc: clarify practices for submitting updated patch versions

4 months agoMerge branch 'rh/complete-symbolic-ref'
Junio C Hamano [Wed, 8 May 2024 17:18:45 +0000 (10:18 -0700)] 
Merge branch 'rh/complete-symbolic-ref'

Command line completion script (in contrib/) learned to complete
"git symbolic-ref" a bit better (you need to enable plumbing
commands to be completed with GIT_COMPLETION_SHOW_ALL_COMMANDS).

* rh/complete-symbolic-ref:
  completion: add docs on how to add subcommand completions
  completion: improve docs for using __git_complete
  completion: add 'symbolic-ref'

4 months agoMerge branch 'ps/the-index-is-no-more'
Junio C Hamano [Wed, 8 May 2024 17:18:44 +0000 (10:18 -0700)] 
Merge branch 'ps/the-index-is-no-more'

The singleton index_state instance "the_index" has been eliminated
by always instantiating "the_repository" and replacing references
to "the_index"  with references to its .index member.

* ps/the-index-is-no-more:
  repository: drop `initialize_the_repository()`
  repository: drop `the_index` variable
  builtin/clone: stop using `the_index`
  repository: initialize index in `repo_init()`
  builtin: stop using `the_index`
  t/helper: stop using `the_index`

4 months agoMerge branch 'bc/credential-scheme-enhancement'
Junio C Hamano [Wed, 8 May 2024 17:18:44 +0000 (10:18 -0700)] 
Merge branch 'bc/credential-scheme-enhancement'

The credential helper protocol, together with the HTTP layer, have
been enhanced to support authentication schemes different from
username & password pair, like Bearer and NTLM.

* bc/credential-scheme-enhancement:
  credential: add method for querying capabilities
  credential-cache: implement authtype capability
  t: add credential tests for authtype
  credential: add support for multistage credential rounds
  t5563: refactor for multi-stage authentication
  docs: set a limit on credential line length
  credential: enable state capability
  credential: add an argument to keep state
  http: add support for authtype and credential
  docs: indicate new credential protocol fields
  credential: add a field called "ephemeral"
  credential: gate new fields on capability
  credential: add a field for pre-encoded credentials
  http: use new headers for each object request
  remote-curl: reset headers on new request
  credential: add an authtype field

4 months agoMerge branch 'ps/ci-test-with-jgit'
Junio C Hamano [Wed, 8 May 2024 17:18:44 +0000 (10:18 -0700)] 
Merge branch 'ps/ci-test-with-jgit'

Tests to ensure interoperability between reftable written by jgit
and our code have been added and enabled in CI.

* ps/ci-test-with-jgit:
  t0612: add tests to exercise Git/JGit reftable compatibility
  t0610: fix non-portable variable assignment
  t06xx: always execute backend-specific tests
  ci: install JGit dependency
  ci: make Perforce binaries executable for all users
  ci: merge scripts which install dependencies
  ci: fix setup of custom path for GitLab CI
  ci: merge custom PATH directories
  ci: convert "install-dependencies.sh" to use "/bin/sh"
  ci: drop duplicate package installation for "linux-gcc-default"
  ci: skip sudo when we are already root
  ci: expose distro name in dockerized GitHub jobs
  ci: rename "runs_on_pool" to "distro"

4 months agoMerge branch 'ps/reftable-write-optim'
Junio C Hamano [Wed, 8 May 2024 17:18:43 +0000 (10:18 -0700)] 
Merge branch 'ps/reftable-write-optim'

Code to write out reftable has seen some optimization and
simplification.

* ps/reftable-write-optim:
  reftable/block: reuse compressed array
  reftable/block: reuse zstream when writing log blocks
  reftable/writer: reset `last_key` instead of releasing it
  reftable/writer: unify releasing memory
  reftable/writer: refactorings for `writer_flush_nonempty_block()`
  reftable/writer: refactorings for `writer_add_record()`
  refs/reftable: don't recompute committer ident
  reftable: remove name checks
  refs/reftable: skip duplicate name checks
  refs/reftable: perform explicit D/F check when writing symrefs
  refs/reftable: fix D/F conflict error message on ref copy

4 months agoStart the 2.46 cycle
Junio C Hamano [Tue, 30 Apr 2024 21:49:22 +0000 (14:49 -0700)] 
Start the 2.46 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'js/for-each-repo-keep-going'
Junio C Hamano [Tue, 30 Apr 2024 21:49:45 +0000 (14:49 -0700)] 
Merge branch 'js/for-each-repo-keep-going'

A scheduled "git maintenance" job is expected to work on all
repositories it knows about, but it stopped at the first one that
errored out.  Now it keeps going.

* js/for-each-repo-keep-going:
  maintenance: running maintenance should not stop on errors
  for-each-repo: optionally keep going on an error

4 months agoMerge branch 'js/build-fuzz-more-often'
Junio C Hamano [Tue, 30 Apr 2024 21:49:44 +0000 (14:49 -0700)] 
Merge branch 'js/build-fuzz-more-often'

In addition to building the objects needed, try to link the objects
that are used in fuzzer tests, to make sure at least they build
without bitrot, in Linux CI runs.

* js/build-fuzz-more-often:
  fuzz: link fuzz programs with `make all` on Linux

4 months agoMerge branch 'la/doc-use-of-contacts-when-contributing'
Junio C Hamano [Tue, 30 Apr 2024 21:49:43 +0000 (14:49 -0700)] 
Merge branch 'la/doc-use-of-contacts-when-contributing'

Advertise "git contacts", a tool for newcomers to find people to
ask review for their patches, a bit more in our developer
documentation.

* la/doc-use-of-contacts-when-contributing:
  SubmittingPatches: demonstrate using git-contacts with git-send-email
  SubmittingPatches: add heading for format-patch and send-email
  SubmittingPatches: dedupe discussion of security patches
  SubmittingPatches: discuss reviewers first
  SubmittingPatches: quote commands
  SubmittingPatches: mention GitGitGadget
  SubmittingPatches: clarify 'git-contacts' location
  MyFirstContribution: mention contrib/contacts/git-contacts

4 months agoMerge branch 'aj/stash-staged-fix'
Junio C Hamano [Tue, 30 Apr 2024 21:49:43 +0000 (14:49 -0700)] 
Merge branch 'aj/stash-staged-fix'

"git stash -S" did not handle binary files correctly, which has
been corrected.

* aj/stash-staged-fix:
  stash: fix "--staged" with binary files

4 months agoMerge branch 'jc/format-patch-rfc-more'
Junio C Hamano [Tue, 30 Apr 2024 21:49:42 +0000 (14:49 -0700)] 
Merge branch 'jc/format-patch-rfc-more'

The "--rfc" option of "git format-patch" learned to take an
optional string value to be used in place of "RFC" to tweak the
"[PATCH]" on the subject header.

* jc/format-patch-rfc-more:
  format-patch: "--rfc=-(WIP)" appends to produce [PATCH (WIP)]
  format-patch: allow --rfc to optionally take a value, like --rfc=WIP

4 months agoMerge branch 'ds/format-patch-rfc-and-k'
Junio C Hamano [Tue, 30 Apr 2024 21:49:42 +0000 (14:49 -0700)] 
Merge branch 'ds/format-patch-rfc-and-k'

The "-k" and "--rfc" options of "format-patch" will now error out
when used together, as one tells us not to add anything to the
title of the commit, and the other one tells us to add "RFC" in
addition to "PATCH".

* ds/format-patch-rfc-and-k:
  format-patch: ensure that --rfc and -k are mutually exclusive

4 months agoMerge branch 'xx/disable-replace-when-building-midx'
Junio C Hamano [Tue, 30 Apr 2024 21:49:41 +0000 (14:49 -0700)] 
Merge branch 'xx/disable-replace-when-building-midx'

The procedure to build multi-pack-index got confused by the
replace-refs mechanism, which has been corrected by disabling the
latter.

* xx/disable-replace-when-building-midx:
  midx: disable replace objects

4 months agoMerge branch 'pw/rebase-m-signoff-fix'
Junio C Hamano [Tue, 30 Apr 2024 21:49:41 +0000 (14:49 -0700)] 
Merge branch 'pw/rebase-m-signoff-fix'

"git rebase --signoff" used to forget that it needs to add a
sign-off to the resulting commit when told to continue after a
conflict stops its operation.

* pw/rebase-m-signoff-fix:
  rebase -m: fix --signoff with conflicts
  sequencer: store commit message in private context
  sequencer: move current fixups to private context
  sequencer: start removing private fields from public API
  sequencer: always free "struct replay_opts"

4 months agoadd-patch: response to unknown command
Rubén Justo [Mon, 29 Apr 2024 18:37:12 +0000 (20:37 +0200)] 
add-patch: response to unknown command

When the user gives an unknown command to the "add -p" prompt, the list
of accepted commands with their explanation is given.  This is the same
output they get when they say '?'.

However, the unknown command may be due to a user input error rather
than the user not knowing the valid command.

To reduce the likelihood of user confusion and error repetition, instead
of displaying the list of accepted commands, display a short error
message with the unknown command received, as feedback to the user.

Include a reminder about the current command '?' in the new message, to
guide the user if they want help.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoadd-patch: do not show UI messages on stderr
Rubén Justo [Mon, 29 Apr 2024 18:37:03 +0000 (20:37 +0200)] 
add-patch: do not show UI messages on stderr

There is no need to show some UI messages on stderr, and yet doing so
may produce some undesirable results, such as messages appearing in an
unexpected order.

Let's use stdout for all UI messages, and adjusts the tests accordingly.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoGit 2.45 v2.45.0
Junio C Hamano [Mon, 29 Apr 2024 14:30:29 +0000 (07:30 -0700)] 
Git 2.45

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge tag 'l10n-2.45.0-rnd1' of https://github.com/git-l10n/git-po
Junio C Hamano [Mon, 29 Apr 2024 14:29:35 +0000 (07:29 -0700)] 
Merge tag 'l10n-2.45.0-rnd1' of https://github.com/git-l10n/git-po

l10n-2.45.0-rnd1

* tag 'l10n-2.45.0-rnd1' of https://github.com/git-l10n/git-po:
  l10n: tr: Update Turkish translations
  l10n: zh_CN: for git 2.45 rounds
  l10n: zh-TW: Git 2.45
  l10n: vi: Updated translation for 2.45
  l10n: TEAMS: retire l10n teams no update in 1 year
  l10n: uk: v2.45 update
  l10n: sv.po: Update Swedish translation
  l10n: Update German translation
  l10n: po-id for 2.45
  l10n: bg.po: Updated Bulgarian translation (5652t)
  l10n: fr: v2.45.0
  l10n: Update Vietnamese team contact

4 months agoMerge branch 'master' of github.com:alshopov/git-po
Jiang Xin [Mon, 29 Apr 2024 06:50:23 +0000 (14:50 +0800)] 
Merge branch 'master' of github.com:alshopov/git-po

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

4 months agoMerge branch 'fr_v2.45.0' of github.com:jnavila/git
Jiang Xin [Mon, 29 Apr 2024 06:49:44 +0000 (14:49 +0800)] 
Merge branch 'fr_v2.45.0' of github.com:jnavila/git

* 'fr_v2.45.0' of github.com:jnavila/git:
  l10n: fr: v2.45.0

4 months agol10n: tr: Update Turkish translations
Emir SARI [Mon, 15 Apr 2024 22:44:25 +0000 (01:44 +0300)] 
l10n: tr: Update Turkish translations

Signed-off-by: Emir SARI <emir_sari@icloud.com>
4 months agoMerge branch 'l10n/zh-TW/240428' of github.com:l10n-tw/git-po
Jiang Xin [Sun, 28 Apr 2024 12:36:57 +0000 (20:36 +0800)] 
Merge branch 'l10n/zh-TW/240428' of github.com:l10n-tw/git-po

* 'l10n/zh-TW/240428' of github.com:l10n-tw/git-po:
  l10n: zh-TW: Git 2.45

4 months agoMerge branch 'tl/zh_CN_2.45.0_rnd' of github.com:dyrone/git
Jiang Xin [Sun, 28 Apr 2024 12:35:54 +0000 (20:35 +0800)] 
Merge branch 'tl/zh_CN_2.45.0_rnd' of github.com:dyrone/git

* 'tl/zh_CN_2.45.0_rnd' of github.com:dyrone/git:
  l10n: zh_CN: for git 2.45 rounds

4 months agol10n: zh_CN: for git 2.45 rounds
Teng Long [Wed, 24 Apr 2024 13:43:34 +0000 (21:43 +0800)] 
l10n: zh_CN: for git 2.45 rounds

Signed-off-by: Teng Long <dyroneteng@gmail.com>
4 months agol10n: zh-TW: Git 2.45
Yi-Jyun Pan [Sun, 28 Apr 2024 10:46:20 +0000 (18:46 +0800)] 
l10n: zh-TW: Git 2.45

Co-Authored-By: Lumynous <lumynou5.tw@gmail.com>
Co-Authored-By: Kisaragi Hiu <mail@kisaragi-hiu.com>
Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
4 months agoMerge branch 'update-teams' of https://github.com/Nekosha/git-po
Jiang Xin [Sun, 28 Apr 2024 10:28:48 +0000 (18:28 +0800)] 
Merge branch 'update-teams' of https://github.com/Nekosha/git-po

* 'update-teams' of https://github.com/Nekosha/git-po:
  l10n: Update Vietnamese team contact

4 months agol10n: vi: Updated translation for 2.45
Vũ Tiến Hưng [Tue, 16 Apr 2024 09:13:00 +0000 (16:13 +0700)] 
l10n: vi: Updated translation for 2.45

Signed-off-by: Vũ Tiến Hưng <newcomerminecraft@gmail.com>
4 months agol10n: TEAMS: retire l10n teams no update in 1 year
Jiang Xin [Fri, 19 Apr 2024 07:57:47 +0000 (15:57 +0800)] 
l10n: TEAMS: retire l10n teams no update in 1 year

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
4 months agoMerge branch 'l10n/uk/2.45-uk-update'
Jiang Xin [Sat, 27 Apr 2024 23:30:08 +0000 (07:30 +0800)] 
Merge branch 'l10n/uk/2.45-uk-update'

* '2.45-uk-update' of github.com:arkid15r/git-ukrainian-l10n:
  l10n: uk: v2.45 update

4 months agoMerge branch 'l10n-de-2.45' of github.com:ralfth/git
Jiang Xin [Sat, 27 Apr 2024 23:25:22 +0000 (07:25 +0800)] 
Merge branch 'l10n-de-2.45' of github.com:ralfth/git

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

4 months agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Sat, 27 Apr 2024 23:23:52 +0000 (07:23 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

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

4 months agol10n: uk: v2.45 update
Arkadii Yakovets [Sat, 27 Apr 2024 18:41:08 +0000 (11:41 -0700)] 
l10n: uk: v2.45 update

Co-authored-by: Kate Golovanova <kate@kgthreads.com>
Signed-off-by: Arkadii Yakovets <ark@cho.red>
Signed-off-by: Kate Golovanova <kate@kgthreads.com>
4 months agol10n: sv.po: Update Swedish translation
Peter Krefting [Sat, 27 Apr 2024 14:21:53 +0000 (15:21 +0100)] 
l10n: sv.po: Update Swedish translation

Also fix some inconsistencies, and fix issue reported by
Anders Jonsson <anders.jonsson@norsjovallen.se>.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
4 months agol10n: Update German translation
Ralf Thielow [Fri, 26 Apr 2024 14:24:36 +0000 (16:24 +0200)] 
l10n: Update German translation

Reviewed-by: Matthias Rüster <matthias.ruester@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
4 months agol10n: po-id for 2.45
Bagas Sanjaya [Wed, 17 Apr 2024 05:41:49 +0000 (12:41 +0700)] 
l10n: po-id for 2.45

Translate following new components:

  * refs/reftable-backend.c

Update following components:

  * branch.c
  * builtin/column.c
  * builtin/config.c
  * builtin/for-each-ref.c
  * builtin/pack-refs.c
  * revision.c

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
4 months agodoc: clarify practices for submitting updated patch versions
Justin Tobler [Thu, 25 Apr 2024 21:34:04 +0000 (16:34 -0500)] 
doc: clarify practices for submitting updated patch versions

The `SubmittingPatches` documentation briefly mentions that related
patches should be grouped together in their own e-mail thread. Expand on
this to explicitly state that updated versions of a patch series should
also follow this. Also provide add a link to existing documentation from
`MyFirstContribution` that provides detailed instructions on how to do
this via `git-send-email(1)`.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'rj/add-i-leak-fix'
Junio C Hamano [Thu, 25 Apr 2024 17:34:24 +0000 (10:34 -0700)] 
Merge branch 'rj/add-i-leak-fix'

Leakfix.

* rj/add-i-leak-fix:
  add: plug a leak on interactive_add
  add-patch: plug a leak handling the '/' command
  add-interactive: plug a leak in get_untracked_files
  apply: plug a leak in apply_data

4 months agoMerge branch 'rs/vsnprintf-failure-is-not-a-bug'
Junio C Hamano [Thu, 25 Apr 2024 17:34:23 +0000 (10:34 -0700)] 
Merge branch 'rs/vsnprintf-failure-is-not-a-bug'

Demote a BUG() to an die() when the failure from vsnprintf() may
not be due to a programmer error.

* rs/vsnprintf-failure-is-not-a-bug:
  don't report vsnprintf(3) error as bug

4 months agocompletion: add docs on how to add subcommand completions
Roland Hieber [Thu, 25 Apr 2024 10:18:44 +0000 (12:18 +0200)] 
completion: add docs on how to add subcommand completions

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agocompletion: improve docs for using __git_complete
Roland Hieber [Thu, 25 Apr 2024 10:18:43 +0000 (12:18 +0200)] 
completion: improve docs for using __git_complete

It took me more than a few tries and a good lecture of __git_main to
understand that the two paragraphs really only refer to adding
completion functions for executables that are not called through git's
subcommand magic. Improve the docs and be more specific.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agocompletion: add 'symbolic-ref'
Roland Hieber [Thu, 25 Apr 2024 10:18:42 +0000 (12:18 +0200)] 
completion: add 'symbolic-ref'

Even 'symbolic-ref' is only completed when
GIT_COMPLETION_SHOW_ALL_COMMANDS=1 is set, it currently defaults to
completing file names, which is not very helpful. Add a simple
completion function which completes options and refs.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agofuzz: link fuzz programs with `make all` on Linux
Josh Steadmon [Wed, 24 Apr 2024 18:14:42 +0000 (11:14 -0700)] 
fuzz: link fuzz programs with `make all` on Linux

Since 5e47215080 (fuzz: add basic fuzz testing target., 2018-10-12), we
have compiled object files for the fuzz tests as part of the default
'make all' target. This helps prevent bit-rot in lesser-used parts of
the codebase, by making sure that incompatible changes are caught at
build time.

However, since we never linked the fuzzer executables, this did not
protect us from link-time errors. As of 8b9a42bf48 (fuzz: fix fuzz test
build rules, 2024-01-19), it's now possible to link the fuzzer
executables without using a fuzzing engine and a variety of
compiler-specific (and compiler-version-specific) flags, at least on
Linux. So let's add a platform-specific option in config.mak.uname to
link the executables as part of the default `make all` target.

Since linking the fuzzer executables without a fuzzing engine does not
require a C++ compiler, we can change the FUZZ_PROGRAMS build rule to
use $(CC) by default. This avoids compiler mis-match issues when
overriding $(CC) but not $(CXX). When we *do* want to actually link with
a fuzzing engine, we can set $(FUZZ_CXX). The build instructions in the
CI fuzz-smoke-test job and in the Makefile comment have been updated
accordingly.

While we're at it, we can consolidate some of the fuzzer build
instructions into one location in the Makefile.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agomaintenance: running maintenance should not stop on errors
Johannes Schindelin [Wed, 24 Apr 2024 16:14:59 +0000 (16:14 +0000)] 
maintenance: running maintenance should not stop on errors

In https://github.com/microsoft/git/issues/623, it was reported that
maintenance stops on a missing repository, omitting the remaining
repositories that were scheduled for maintenance.

This is undesirable, as it should be a best effort type of operation.

It should still fail due to the missing repository, of course, but not
leave the non-missing repositories in unmaintained shapes.

Let's use `for-each-repo`'s shiny new `--keep-going` option that we just
introduced for that very purpose.

This change will be picked up when running `git maintenance start`,
which is run implicitly by `scalar reconfigure`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agofor-each-repo: optionally keep going on an error
Johannes Schindelin [Wed, 24 Apr 2024 16:14:58 +0000 (16:14 +0000)] 
for-each-repo: optionally keep going on an error

In https://github.com/microsoft/git/issues/623, it was reported that
the regularly scheduled maintenance stops if one repo in the middle of
the list was found to be missing.

This is undesirable, and points out a gap in the design of `git
for-each-repo`: We need a mode where that command does not stop on an
error, but continues to try running the specified command with the other
repositories.

Imitating the `--keep-going` option of GNU make, this commit teaches
`for-each-repo` the same trick: to continue with the operation on all
the remaining repositories in case there was a problem with one
repository, still setting the exit code to indicate an error occurred.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoDocumentation/RelNotes/2.45.0.txt: fix typo
Taylor Blau [Wed, 24 Apr 2024 16:27:05 +0000 (12:27 -0400)] 
Documentation/RelNotes/2.45.0.txt: fix typo

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoGit 2.45-rc1 v2.45.0-rc1
Junio C Hamano [Tue, 23 Apr 2024 22:05:07 +0000 (15:05 -0700)] 
Git 2.45-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'ps/run-auto-maintenance-in-receive-pack'
Junio C Hamano [Tue, 23 Apr 2024 22:05:56 +0000 (15:05 -0700)] 
Merge branch 'ps/run-auto-maintenance-in-receive-pack'

The "receive-pack" program (which responds to "git push") was not
converted to run "git maintenance --auto" when other codepaths that
used to run "git gc --auto" were updated, which has been corrected.

* ps/run-auto-maintenance-in-receive-pack:
  builtin/receive-pack: convert to use git-maintenance(1)
  run-command: introduce function to prepare auto-maintenance process

5 months agoMerge branch 'pk/bisect-use-show'
Junio C Hamano [Tue, 23 Apr 2024 22:05:56 +0000 (15:05 -0700)] 
Merge branch 'pk/bisect-use-show'

When "git bisect" reports the commit it determined to be the
culprit, we used to show it in a format that does not honor common
UI tweaks, like log.date and log.decorate.  The code has been
taught to use "git show" to follow more customizations.

* pk/bisect-use-show:
  bisect: report the found commit with "show"

5 months agoA bit more topics before -rc1
Junio C Hamano [Tue, 23 Apr 2024 18:52:19 +0000 (11:52 -0700)] 
A bit more topics before -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'rs/apply-reject-long-name'
Junio C Hamano [Tue, 23 Apr 2024 18:52:41 +0000 (11:52 -0700)] 
Merge branch 'rs/apply-reject-long-name'

The filename used for rejected hunks "git apply --reject" creates
was limited to PATH_MAX, which has been lifted.

* rs/apply-reject-long-name:
  apply: avoid using fixed-size buffer in write_out_one_reject()

5 months agoMerge branch 'mr/rerere-crash-fix'
Junio C Hamano [Tue, 23 Apr 2024 18:52:41 +0000 (11:52 -0700)] 
Merge branch 'mr/rerere-crash-fix'

When .git/rr-cache/ rerere database gets corrupted or rerere is fed to
work on a file with conflicted hunks resolved incompletely, the rerere
machinery got confused and segfaulted, which has been corrected.

* mr/rerere-crash-fix:
  rerere: fix crashes due to unmatched opening conflict markers

5 months agoMerge branch 'rs/imap-send-simplify-cmd-issuing-codepath'
Junio C Hamano [Tue, 23 Apr 2024 18:52:41 +0000 (11:52 -0700)] 
Merge branch 'rs/imap-send-simplify-cmd-issuing-codepath'

Code simplification.

* rs/imap-send-simplify-cmd-issuing-codepath:
  imap-send: increase command size limit

5 months agoMerge branch 'xx/rfc2822-date-format-in-doc'
Junio C Hamano [Tue, 23 Apr 2024 18:52:40 +0000 (11:52 -0700)] 
Merge branch 'xx/rfc2822-date-format-in-doc'

Docfix.

* xx/rfc2822-date-format-in-doc:
  Documentation: fix typos describing date format

5 months agoMerge branch 'ps/missing-btmp-fix'
Junio C Hamano [Tue, 23 Apr 2024 18:52:40 +0000 (11:52 -0700)] 
Merge branch 'ps/missing-btmp-fix'

GIt 2.44 introduced a regression that makes the updated code to
barf in repositories with multi-pack index written by older
versions of Git, which has been corrected.

* ps/missing-btmp-fix:
  pack-bitmap: gracefully handle missing BTMP chunks

5 months agoMerge branch 'la/format-trailer-info'
Junio C Hamano [Tue, 23 Apr 2024 18:52:39 +0000 (11:52 -0700)] 
Merge branch 'la/format-trailer-info'

The code to format trailers have been cleaned up.

* la/format-trailer-info:
  trailer: finish formatting unification
  trailer: begin formatting unification
  format_trailer_info(): append newline for non-trailer lines
  format_trailer_info(): drop redundant unfold_value()
  format_trailer_info(): use trailer_item objects

5 months agoMerge branch 'dd/t9604-use-posix-timezones'
Junio C Hamano [Tue, 23 Apr 2024 18:52:39 +0000 (11:52 -0700)] 
Merge branch 'dd/t9604-use-posix-timezones'

The cvsimport tests required that the platform understands
traditional timezone notations like CST6CDT, which has been
updated to work on those systems as long as they understand
POSIX notation with explicit tz transition dates.

* dd/t9604-use-posix-timezones:
  t9604: Fix test for musl libc and new Debian

5 months agoMerge branch 'rj/launch-editor-error-message'
Junio C Hamano [Tue, 23 Apr 2024 18:52:39 +0000 (11:52 -0700)] 
Merge branch 'rj/launch-editor-error-message'

Git writes a "waiting for your editor" message on an incomplete
line after launching an editor, and then append another error
message on the same line if the editor errors out.  It now clears
the "waiting for..." line before giving the error message.

* rj/launch-editor-error-message:
  launch_editor: waiting message on error

5 months agoMerge branch 'yb/replay-doc-linkfix'
Junio C Hamano [Tue, 23 Apr 2024 18:52:38 +0000 (11:52 -0700)] 
Merge branch 'yb/replay-doc-linkfix'

Docfix.

* yb/replay-doc-linkfix:
  Documentation: fix linkgit reference

5 months agoMerge branch 'rs/no-openssl-compilation-fix-on-macos'
Junio C Hamano [Tue, 23 Apr 2024 18:52:38 +0000 (11:52 -0700)] 
Merge branch 'rs/no-openssl-compilation-fix-on-macos'

Build fix.

* rs/no-openssl-compilation-fix-on-macos:
  git-compat-util: fix NO_OPENSSL on current macOS

5 months agoMerge branch 'ta/fast-import-parse-path-fix'
Junio C Hamano [Tue, 23 Apr 2024 18:52:37 +0000 (11:52 -0700)] 
Merge branch 'ta/fast-import-parse-path-fix'

The way "git fast-import" handles paths described in its input has
been tightened up and more clearly documented.

* ta/fast-import-parse-path-fix:
  fast-import: make comments more precise
  fast-import: forbid escaped NUL in paths
  fast-import: document C-style escapes for paths
  fast-import: improve documentation for path quoting
  fast-import: remove dead strbuf
  fast-import: allow unquoted empty path for root
  fast-import: directly use strbufs for paths
  fast-import: tighten path unquoting

5 months agoMerge branch 'ps/reftable-block-iteration-optim'
Junio C Hamano [Tue, 23 Apr 2024 18:52:37 +0000 (11:52 -0700)] 
Merge branch 'ps/reftable-block-iteration-optim'

The code to iterate over reftable blocks has seen some optimization
to reduce memory allocation and deallocation.

* ps/reftable-block-iteration-optim:
  reftable/block: avoid copying block iterators on seek
  reftable/block: reuse `zstream` state on inflation
  reftable/block: open-code call to `uncompress2()`
  reftable/block: reuse uncompressed blocks
  reftable/reader: iterate to next block in place
  reftable/block: move ownership of block reader into `struct table_iter`
  reftable/block: introduce `block_reader_release()`
  reftable/block: better grouping of functions
  reftable/block: merge `block_iter_seek()` and `block_reader_seek()`
  reftable/block: rename `block_reader_start()`

5 months agoformat-patch: "--rfc=-(WIP)" appends to produce [PATCH (WIP)]
Junio C Hamano [Tue, 23 Apr 2024 17:52:34 +0000 (10:52 -0700)] 
format-patch: "--rfc=-(WIP)" appends to produce [PATCH (WIP)]

In the previous step, the "--rfc" option of "format-patch" learned
to take an optional string value to prepend to the subject prefix,
so that --rfc=WIP can give "[WIP PATCH]".

There may be cases in which the extra string wants to come after the
subject prefix.  Extend the mechanism to allow "--rfc=-(WIP)" [*] to
signal that the extra string is to be appended instead of getting
prepended, resulting in "[PATCH (WIP)]".

In the documentation, discourage (ab)using "--rfc=-RFC" to say
"[PATCH RFC]" just to be different, when "[RFC PATCH]" is the norm.

[Footnote]

 * The syntax takes inspiration from Perl's open syntax that opens
   pipes "open fh, '|-', 'cmd'", where the dash signals "the other
   stuff comes here".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoformat-patch: allow --rfc to optionally take a value, like --rfc=WIP
Junio C Hamano [Tue, 23 Apr 2024 17:52:33 +0000 (10:52 -0700)] 
format-patch: allow --rfc to optionally take a value, like --rfc=WIP

With the "--rfc" option, we can tweak the "[PATCH]" (or whatever
string specified with the "--subject-prefix" option, instead of
"PATCH") that we prefix the title of the commit with into "[RFC
PATCH]", but some projects may want "[rfc PATCH]".  Adding a new
option, e.g., "--rfc-lowercase", to support such need every time
somebody wants to use different strings would lead to insanity of
accumulating unbounded number of such options.

Allow an optional value specified for the option, so that users can
use "--rfc=rfc" (think of "--rfc" without value as a short-hand for
"--rfc=RFC") if they wanted to.

This can of course be (ab)used to make the prefix "[WIP PATCH]" by
passing "--rfc=WIP".  Passing an empty string, i.e., "--rfc=", is
the same as "--no-rfc" to override an option given earlier on the
same command line.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoadd: plug a leak on interactive_add
Rubén Justo [Mon, 22 Apr 2024 22:54:18 +0000 (00:54 +0200)] 
add: plug a leak on interactive_add

Plug a leak we have since 5a76aff1a6 (add: convert to use
parse_pathspec, 2013-07-14).

This leak can be triggered with:
    $ git add -p anything

Fixing this leak allows us to mark as leak-free the following tests:

    + t3701-add-interactive.sh
    + t7514-commit-patch.sh

Mark them with "TEST_PASSES_SANITIZE_LEAK=true" to notice and fix
promply any new leak that may be introduced and triggered by them in the
future.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoadd-patch: plug a leak handling the '/' command
Rubén Justo [Mon, 22 Apr 2024 22:54:14 +0000 (00:54 +0200)] 
add-patch: plug a leak handling the '/' command

Plug a leak we have since d6cf873340 (built-in add -p: implement the '/'
("search regex") command, 2019-12-13).

This leak can be triggered with:

    $ printf "A\n\nB\n" >file
    $ git add file && git commit -m file
    $ printf "AA\n\nBB\n" >file
    $ printf "s\n/ .\n" >lines
    $ git add -p <lines

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoadd-interactive: plug a leak in get_untracked_files
Rubén Justo [Mon, 22 Apr 2024 22:54:08 +0000 (00:54 +0200)] 
add-interactive: plug a leak in get_untracked_files

Plug a leak we have since ab1e1cccaf (built-in add -i: re-implement
`add-untracked` in C, 2019-11-29).

This leak can be triggered with:

$ echo a | git add -i

As a curiosity, we have a somewhat similar function in builtin/stash.c,
which correctly frees the memory.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoapply: plug a leak in apply_data
Rubén Justo [Mon, 22 Apr 2024 22:54:05 +0000 (00:54 +0200)] 
apply: plug a leak in apply_data

We have an execution path in apply_data that leaks the local struct
image.  Plug it.

This leak can be triggered with:

    $ echo foo >file
    $ git add file && git commit -m file
    $ echo bar >file
    $ git diff file >diff
    $ sed s/foo/frotz/ <diff >baddiff
    $ git apply --cached <baddiff

Fixing this leak allows us to mark as leak-free the following tests:

    + t2016-checkout-patch.sh
    + t4103-apply-binary.sh
    + t4104-apply-boundary.sh
    + t4113-apply-ending.sh
    + t4117-apply-reject.sh
    + t4123-apply-shrink.sh
    + t4252-am-options.sh
    + t4258-am-quoted-cr.sh

Mark them with "TEST_PASSES_SANITIZE_LEAK=true" to notice and fix
promply any new leak that may be introduced and triggered by them in the
future.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agostash: fix "--staged" with binary files
Adam Johnson [Mon, 22 Apr 2024 10:28:14 +0000 (10:28 +0000)] 
stash: fix "--staged" with binary files

"git stash --staged" errors out when given binary files, after saving the
stash.

This behaviour dates back to the addition of the feature in 41a28eb6c1
(stash: implement '--staged' option for 'push' and 'save', 2021-10-18).
Adding the "--binary" option of "diff-tree" fixes this. The "diff-tree" call
in stash_patch() also omits "--binary", but that is fine since binary files
cannot be selected interactively.

Helped-By: Jeff King <peff@peff.net>
Helped-By: Randall S. Becker <randall.becker@nexbridge.ca>
Signed-off-by: Adam Johnson <me@adamj.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agodocs: address typos in Git v2.45 changelog
Patrick Steinhardt [Mon, 22 Apr 2024 06:35:11 +0000 (08:35 +0200)] 
docs: address typos in Git v2.45 changelog

Address some typos in the Git v2.45 changelog.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agodocs: improve changelog entry for `git pack-refs --auto`
Patrick Steinhardt [Mon, 22 Apr 2024 06:35:06 +0000 (08:35 +0200)] 
docs: improve changelog entry for `git pack-refs --auto`

The changelog entry for the new `git pack-refs --auto` mode only says
that the new flag is useful, but doesn't really say what it does. Add
some more information.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agodocs: remove duplicate entry and fix typo in 2.45 changelog
Orgad Shaneh [Sat, 20 Apr 2024 19:51:30 +0000 (19:51 +0000)] 
docs: remove duplicate entry and fix typo in 2.45 changelog

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agodon't report vsnprintf(3) error as bug
René Scharfe [Sun, 21 Apr 2024 12:40:28 +0000 (14:40 +0200)] 
don't report vsnprintf(3) error as bug

strbuf_addf() has been reporting a negative return value of vsnprintf(3)
as a bug since f141bd804d (Handle broken vsnprintf implementations in
strbuf, 2007-11-13).  Other functions copied that behavior:

7b03c89ebd (add xsnprintf helper function, 2015-09-24)
5ef264dbdb (strbuf.c: add `strbuf_insertf()` and `strbuf_vinsertf()`, 2019-02-25)
8d25663d70 (mem-pool: add mem_pool_strfmt(), 2024-02-25)

However, vsnprintf(3) can legitimately return a negative value if the
formatted output would be longer than INT_MAX.  Stop accusing it of
being broken and just report the fact that formatting failed.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agol10n: bg.po: Updated Bulgarian translation (5652t)
Alexander Shopov [Sun, 21 Apr 2024 12:20:00 +0000 (14:20 +0200)] 
l10n: bg.po: Updated Bulgarian translation (5652t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
5 months agol10n: fr: v2.45.0
Jean-Noël Avila [Sat, 20 Apr 2024 09:06:46 +0000 (17:06 +0800)] 
l10n: fr: v2.45.0

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
5 months agol10n: Update Vietnamese team contact
Vũ Tiến Hưng [Sat, 20 Apr 2024 05:02:27 +0000 (12:02 +0700)] 
l10n: Update Vietnamese team contact

The previous team has not maintained the translation since 2.37. Leader
has agreed to transfer leadership to me.

Signed-off-by: Vũ Tiến Hưng <newcomerminecraft@gmail.com>
5 months agoGit 2.45-rc0 v2.45.0-rc0
Junio C Hamano [Fri, 19 Apr 2024 16:11:41 +0000 (09:11 -0700)] 
Git 2.45-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'la/mailmap-entry'
Junio C Hamano [Fri, 19 Apr 2024 16:13:47 +0000 (09:13 -0700)] 
Merge branch 'la/mailmap-entry'

Update contact address for Linus Arver.

* la/mailmap-entry:
  mailmap: change primary address for Linus Arver

5 months agoMerge branch 'pf/commitish-committish'
Junio C Hamano [Fri, 19 Apr 2024 16:13:47 +0000 (09:13 -0700)] 
Merge branch 'pf/commitish-committish'

Spellfix.

* pf/commitish-committish:
  typo: replace 'commitish' with 'committish'

5 months agoformat-patch: ensure that --rfc and -k are mutually exclusive
Dragan Simic [Fri, 19 Apr 2024 01:05:30 +0000 (03:05 +0200)] 
format-patch: ensure that --rfc and -k are mutually exclusive

Fix a bug that allows the "--rfc" and "-k" options to be specified together
when "git format-patch" is executed, which was introduced in the commit
e0d7db7423a9 ("format-patch: --rfc honors what --subject-prefix sets").

Add a couple of additional tests to t4014, to cover additional cases of
the mutual exclusivity between different "git format-patch" options.

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoSubmittingPatches: demonstrate using git-contacts with git-send-email
Linus Arver [Thu, 18 Apr 2024 21:52:05 +0000 (21:52 +0000)] 
SubmittingPatches: demonstrate using git-contacts with git-send-email

Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoSubmittingPatches: add heading for format-patch and send-email
Linus Arver [Thu, 18 Apr 2024 21:52:04 +0000 (21:52 +0000)] 
SubmittingPatches: add heading for format-patch and send-email

Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoSubmittingPatches: dedupe discussion of security patches
Linus Arver [Thu, 18 Apr 2024 21:52:03 +0000 (21:52 +0000)] 
SubmittingPatches: dedupe discussion of security patches

Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoSubmittingPatches: discuss reviewers first
Linus Arver [Thu, 18 Apr 2024 21:52:02 +0000 (21:52 +0000)] 
SubmittingPatches: discuss reviewers first

No matter how well someone configures their email tooling, understanding
who to send the patches to is something that must always be considered.
So discuss it first instead of at the end.

In the following commit we will clean up the (now redundant) discussion
about sending security patches to the Git Security mailing list.

Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoSubmittingPatches: quote commands
Linus Arver [Thu, 18 Apr 2024 21:52:01 +0000 (21:52 +0000)] 
SubmittingPatches: quote commands

Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoSubmittingPatches: mention GitGitGadget
Linus Arver [Thu, 18 Apr 2024 21:52:00 +0000 (21:52 +0000)] 
SubmittingPatches: mention GitGitGadget

Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoSubmittingPatches: clarify 'git-contacts' location
Linus Arver [Thu, 18 Apr 2024 21:51:59 +0000 (21:51 +0000)] 
SubmittingPatches: clarify 'git-contacts' location

Use a dash ("git-contacts", not "git contacts") because the script is
not installed as part of "git" toolset. This also puts the script on
one line, which should make it easier to grep for with a loose search
query, such as

    $ git grep git.contacts Documentation

Also add a footnote to describe where the script is located, to help
readers who may not be familiar with such "contrib" scripts (and how
they are not accessible with the usual "git <subcommand>" syntax).

Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMyFirstContribution: mention contrib/contacts/git-contacts
Linus Arver [Thu, 18 Apr 2024 21:51:58 +0000 (21:51 +0000)] 
MyFirstContribution: mention contrib/contacts/git-contacts

Although we've had this script since 4d06402b1b (contrib: add
git-contacts helper, 2013-07-21), we don't mention it in our
introductory docs. Do so now.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agorebase -m: fix --signoff with conflicts
Phillip Wood [Thu, 18 Apr 2024 13:14:09 +0000 (14:14 +0100)] 
rebase -m: fix --signoff with conflicts

When rebasing with "--signoff" the commit created by "rebase --continue"
after resolving conflicts or editing a commit fails to add the
"Signed-off-by:" trailer. This happens because the message from the
original commit is reused instead of the one that would have been used
if the sequencer had not stopped for the user interaction. The correct
message is stored in ctx->message and so with a couple of exceptions
this is written to rebase_path_message() when stopping for user
interaction instead. The exceptions are (i) "fixup" and "squash"
commands where the file is written by error_failed_squash() and (ii)
"edit" commands that are fast-forwarded where the original message is
still reused. The latter is safe because "--signoff" will never
fast-forward.

Note this introduces a change in behavior as the message file now
contains conflict comments. This is safe because commit_staged_changes()
passes an explicit cleanup flag when not editing the message and when
the message is being edited it will be cleaned up automatically. This
means user now sees the same message comments in editor with "rebase
--continue" as they would if they ran "git commit" themselves before
continuing the rebase. It also matches the behavior of "git
cherry-pick", "git merge" etc. which all list the files with merge
conflicts.

The tests are extended to check that all commits made after continuing a
rebase have a "Signed-off-by:" trailer. Sadly there are a couple of
leaks in apply.c which I've not been able to track down that mean this
test file is no-longer leak free when testing "git rebase --apply
--signoff" with conflicts.

Reported-by: David Bimmler <david.bimmler@isovalent.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agosequencer: store commit message in private context
Phillip Wood [Thu, 18 Apr 2024 13:14:08 +0000 (14:14 +0100)] 
sequencer: store commit message in private context

Add an strbuf to "struct replay_ctx" to hold the current commit
message. This does not change the behavior but it will allow us to fix a
bug with "git rebase --signoff" in the next commit. A future patch
series will use the changes here to avoid writing the commit message to
disc unless there are conflicts or the commit is being reworded.

The changes in do_pick_commit() are a mechanical replacement of "msgbuf"
with "ctx->message". In do_merge() the code to write commit message to
disc is factored out of the conditional now that both branches store the
message in the same buffer.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agosequencer: move current fixups to private context
Phillip Wood [Thu, 18 Apr 2024 13:14:07 +0000 (14:14 +0100)] 
sequencer: move current fixups to private context

The list of current fixups is an implementation detail of the sequencer
and so it should not be stored in the public options struct.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agosequencer: start removing private fields from public API
Phillip Wood [Thu, 18 Apr 2024 13:14:06 +0000 (14:14 +0100)] 
sequencer: start removing private fields from public API

"struct replay_opts" has a number of fields that are for internal
use. While they are marked as private having them in a public struct is
a distraction for callers and means that every time the internal details
are changed we have to recompile all the files that include sequencer.h
even though the public API is unchanged. This commit starts the process
of removing the private fields by adding an opaque pointer to a "struct
replay_ctx" to "struct replay_opts" and moving the "reflog_message"
member to the new private struct.

The sequencer currently updates the state files on disc each time it
processes a command in the todo list. This is an artifact of the
scripted implementation and makes the code hard to reason about as it is
not possible to get a complete view of the state in memory. In the
future we will add new members to "struct replay_ctx" to remedy this and
avoid writing state to disc unless the sequencer stops for user
interaction.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agosequencer: always free "struct replay_opts"
Phillip Wood [Thu, 18 Apr 2024 13:14:05 +0000 (14:14 +0100)] 
sequencer: always free "struct replay_opts"

sequencer_post_commit_cleanup() initializes an instance of "struct
replay_opts" but does not call replay_opts_release(). Currently this
does not leak memory because the code paths called don't allocate any of
the struct members. That will change in the next commit so add call to
replay_opts_release() to prevent a memory leak in "git commit" that
breaks all of the leak free tests.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'pw/t3428-cleanup' into pw/rebase-m-signoff-fix
Junio C Hamano [Thu, 18 Apr 2024 20:33:37 +0000 (13:33 -0700)] 
Merge branch 'pw/t3428-cleanup' into pw/rebase-m-signoff-fix

* pw/t3428-cleanup:
  t3428: restore coverage for "apply" backend
  t3428: use test_commit_message
  t3428: modernize test setup

5 months agorepository: drop `initialize_the_repository()`
Patrick Steinhardt [Thu, 18 Apr 2024 12:14:33 +0000 (14:14 +0200)] 
repository: drop `initialize_the_repository()`

Now that we have dropped `the_index`, `initialize_the_repository()`
doesn't really do a lot anymore except for setting up the pointer for
`the_repository` and then calling `initialize_repository()`. The former
can be replaced by statically initializing the pointer though, which
basically makes this function moot.

Convert callers to instead call `initialize_repository(the_repository)`
and drop `initialize_thee_repository()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agorepository: drop `the_index` variable
Patrick Steinhardt [Thu, 18 Apr 2024 12:14:29 +0000 (14:14 +0200)] 
repository: drop `the_index` variable

All users of `the_index` have been converted to use either a custom
`struct index_state *` or the index provided by `the_repository`. We can
thus drop the globally-accessible declaration of this variable. In fact,
we can go further than that and drop `the_index` completely now and have
it be allocated dynamically in `initialize_repository()` as all the
other data structures in it are.

This concludes the quest to make Git `the_index` free, which has started
with 4aab5b46f4 (Make read-cache.c "the_index" free., 2007-04-01).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agobuiltin/clone: stop using `the_index`
Patrick Steinhardt [Thu, 18 Apr 2024 12:14:24 +0000 (14:14 +0200)] 
builtin/clone: stop using `the_index`

Convert git-clone(1) to use `the_repository->index` instead of
`the_index`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agorepository: initialize index in `repo_init()`
Patrick Steinhardt [Thu, 18 Apr 2024 12:14:19 +0000 (14:14 +0200)] 
repository: initialize index in `repo_init()`

When Git starts, one of the first things it will do is to call
`initialize_the_repository()`. This function sets up both the global
`the_repository` and `the_index` variables as required. Part of that
setup is also to set `the_repository.index = &the_index` so that the
index can be accessed via the repository.

When calling `repo_init()` on a repository though we set the complete
struct to all-zeroes, which will also cause us to unset the `index`
pointer. And as we don't re-initialize the index in that function, we
will end up with a `NULL` pointer here.

This has been fine until now becaues this function is only used to
create a new repository. git-init(1) does not access the index at all
after initializing the repository, whereas git-checkout(1) only uses
`the_index` directly. We are about to remove `the_index` though, which
will uncover this partially-initialized repository structure.

Refactor the code and create a common `initialize_repository()` function
that gets called from `repo_init()` and `initialize_the_repository()`.
This function sets up both the repository and the index as required.
Like this, we can easily special-case when `repo_init()` gets called
with `the_repository`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agobuiltin: stop using `the_index`
Patrick Steinhardt [Thu, 18 Apr 2024 12:14:14 +0000 (14:14 +0200)] 
builtin: stop using `the_index`

Convert builtins to use `the_repository->index` instead of `the_index`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>