Commit graph

73056 commits

Author SHA1 Message Date
Patrick Steinhardt 95ea69c67b builtin/config: introduce "unset" subcommand
Introduce a new "unset" subcommand to git-config(1). Please refer to
preceding commits regarding the motivation behind this change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:50:09 -07:00
Patrick Steinhardt 00bbdde141 builtin/config: introduce "set" subcommand
Introduce a new "set" subcommand to git-config(1). Please refer to
preceding commits regarding the motivation behind this change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:50:09 -07:00
Patrick Steinhardt 4e51389000 builtin/config: introduce "get" subcommand
Introduce a new "get" subcommand to git-config(1). Please refer to
preceding commits regarding the motivation behind this change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:50:09 -07:00
Patrick Steinhardt 14970509c6 builtin/config: introduce "list" subcommand
While git-config(1) has several modes, those modes are not exposed with
subcommands but instead by specifying action flags like `--unset` or
`--list`. This user interface is not really in line with how our more
modern commands work, where it is a lot more customary to say e.g. `git
remote list`. Furthermore, to add to the confusion, git-config(1) also
allows the user to request modes implicitly by just specifying the
correct number of arguments. Thus, `git config foo.bar` will retrieve
the value of "foo.bar" while `git config foo.bar baz` will set it to
"baz".

Overall, this makes for a confusing interface that could really use a
makeover. It hurts discoverability of what you can do with git-config(1)
and is comparatively easy to get wrong. Converting the command to have
subcommands instead would go a long way to help address these issues.

One concern in this context is backwards compatibility. Luckily, we can
introduce subcommands without breaking backwards compatibility at all.
This is because all the implicit modes of git-config(1) require that the
first argument is a properly formatted config key. And as config keys
_must_ have a dot in their name, any value without a dot would have been
discarded by git-config(1) previous to this change. Thus, given that
none of the subcommands do have a dot, they are unambiguous.

Introduce the first such new subcommand, which is "git config list". To
retain backwards compatibility we only conditionally use subcommands and
will fall back to the old syntax in case no subcommand was detected.
This should help to transition to the new-style syntax until we
eventually deprecate and remove the old-style syntax.

Note that the way we handle this we're duplicating some functionality
across old and new syntax. While this isn't pretty, it helps us to
ensure that there really is no change in behaviour for the old syntax.

Amend tests such that we run them both with old and new style syntax.
As tests are now run twice, state from the first run may be still be
around in the second run and thus cause tests to fail. Add cleanup logic
as required to fix such tests.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:50:08 -07:00
Patrick Steinhardt fee3796616 builtin/config: pull out function to handle --null
Pull out function to handle the `--null` option, which we are about to
reuse in subsequent commits.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:50:08 -07:00
Patrick Steinhardt 9dda6b72b7 builtin/config: pull out function to handle config location
There's quite a bunch of options to git-config(1) that allow the user to
specify which config location to use when reading or writing config
options. The logic to handle this is thus by necessity also quite
involved.

Pull it out into a separate function so that we can reuse it in
subsequent commits which introduce proper subcommands.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:50:08 -07:00
Patrick Steinhardt daa3325024 builtin/config: use OPT_CMDMODE() to specify modes
The git-config(1) command has various different modes which are
accessible via e.g. `--get-urlmatch` or `--unset-all`. These modes are
declared with `OPT_BIT()`, which causes two minor issues:

  - The respective modes also have a negated form `--no-get-urlmatch`,
    which is unintended.

  - We have to manually handle exclusiveness of the modes.

Switch these options to instead use `OPT_CMDMODE()`, which is made
exactly for this usecase. Remove the now-unneeded check that only a
single mode is given, which is now handled by the parse-options
interface.

While at it, format optional placeholders for arguments to conform to
our style guidelines by using `[<placeholder>]`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:50:07 -07:00
Patrick Steinhardt 8415507b32 builtin/config: move "fixed-value" option to correct group
The `--fixed-value` option can be used to alter how the value-pattern
parameter is interpreted for the various actions of git-config(1). But
while it is an option, it is currently listed as part of the actions
group, which is wrong.

Move the option to the "Other" group, which hosts the various options
known to git-config(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:50:07 -07:00
Patrick Steinhardt 424a29c3a7 builtin/config: move option array around
Move around the option array. This will help us with a follow-up commit
that introduces subcommands to git-config(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:50:07 -07:00
Patrick Steinhardt a78b462976 config: clarify memory ownership when preparing comment strings
The ownership of memory returned when preparing a comment string is
quite intricate: when the returned value is different than the passed
value, then the caller is responsible to free the memory. This is quite
subtle, and it's even easier to miss because the returned value is in
fact a `const char *`.

Adapt the function to always return either `NULL` or a newly allocated
string. The function is called at most once per git-config(1), so it's
not like this micro-optimization really matters. Thus, callers are now
always responsible for freeing the value.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:50:07 -07:00
Junio C Hamano 786a3e4b8d Git 2.45
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-04-29 07:30:29 -07:00
Junio C Hamano f4edad9530 l10n-2.45.0-rnd1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE37vMEzKDqYvVxs51k24VDd1FMtUFAmYvSbkACgkQk24VDd1F
 MtUkgg/+ONzez0C+y1+xddvhkBtTYmcLDtB4mXNnt65RSNIXWJRhgDb9KFSfl3ki
 9FxaHtFiRyNAfLTuv5EwfV9B+t4Prdh6tuz7dCcz7jy0HEIpwStH5fA+x12GEU2+
 C/QexPQQ1tZFPFAlfrexhT4hBKQ/irbZLLb7dl8hp3NtjdCkwMllH4N9lrHGfUKi
 w0AKr+9Bj73AOWhQqxeh0KlyVk5y8+DOgHvN/Dp46igN3+rZfhGDq7D7CNQBGncx
 iJsiyXTUEdHGqvCgJCB290cz1kmNnt5v2n4Zmr6HsagzRrT6M7KeUrfmO+S+jAy/
 gmiF2qyW6+u3yVIeE+WqDIWqbkgrVWiGcfqlj+IxCFYY6ZoQy+5HjnOb8JMtXe0A
 C/Y1yn/pGaDXAx4dncKMIdXnXtpzQJM6107nr5NqtQ/U2OqFYM5PPxMYxtWNDlMn
 Hxp1nkYPbdd5nOUj+Xh+i8uOpA0D/FG2pBLHXVABjtf409shQ1ykkLHcmnX6Cv6p
 gI8J/TIxwJAzKl+CHusDhStWutnsKajAapE1va/YaNyeysD63a6gySOAac+ovgir
 +LSVuAA/o/uSv28btHO9aKNO54tKVvzro0zspWyaeT2lzaolZXfi+iHzDlfiWgOj
 TG9fjXfMPOrAL2HOYLw8wmJhBdeGemSRdwl5uWimBAeQiMj1lAw=
 =0564
 -----END PGP SIGNATURE-----

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
2024-04-29 07:29:35 -07:00
Jiang Xin 2cf631412d Merge branch 'master' of github.com:alshopov/git-po
* 'master' of github.com:alshopov/git-po:
  l10n: bg.po: Updated Bulgarian translation (5652t)
2024-04-29 14:50:23 +08:00
Jiang Xin afb6f74b96 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
2024-04-29 14:49:44 +08:00
Emir SARI c994a2c5ea l10n: tr: Update Turkish translations
Signed-off-by: Emir SARI <emir_sari@icloud.com>
2024-04-29 01:12:09 +03:00
Jiang Xin aa5ce16a4f 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
2024-04-28 20:36:57 +08:00
Jiang Xin 1919aa01b5 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
2024-04-28 20:35:54 +08:00
Teng Long b705d3a745 l10n: zh_CN: for git 2.45 rounds
Signed-off-by: Teng Long <dyroneteng@gmail.com>
2024-04-28 20:31:55 +08:00
Yi-Jyun Pan ef7ba0e1f2
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>
2024-04-28 18:54:03 +08:00
Jiang Xin 7ddd462820 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
2024-04-28 18:28:48 +08:00
Vũ Tiến Hưng 562f54eb3d l10n: vi: Updated translation for 2.45
Signed-off-by: Vũ Tiến Hưng <newcomerminecraft@gmail.com>
2024-04-28 14:05:51 +07:00
Jiang Xin 900af19275 l10n: TEAMS: retire l10n teams no update in 1 year
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2024-04-28 07:33:25 +08:00
Jiang Xin 9a9872ad87 Merge branch 'l10n/uk/2.45-uk-update'
* '2.45-uk-update' of github.com:arkid15r/git-ukrainian-l10n:
  l10n: uk: v2.45 update
2024-04-28 07:30:08 +08:00
Jiang Xin 1b632c84d7 Merge branch 'l10n-de-2.45' of github.com:ralfth/git
* 'l10n-de-2.45' of github.com:ralfth/git:
  l10n: Update German translation
2024-04-28 07:25:22 +08:00
Jiang Xin 155ceb38ce Merge branch 'po-id' of github.com:bagasme/git-po
* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.45
2024-04-28 07:23:52 +08:00
Arkadii Yakovets e35a8c9a52
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>
2024-04-27 11:41:08 -07:00
Peter Krefting 7607417b23 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>
2024-04-27 15:21:53 +01:00
Ralf Thielow 3a8a93672b l10n: Update German translation
Reviewed-by: Matthias Rüster <matthias.ruester@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2024-04-26 16:24:36 +02:00
Bagas Sanjaya 4c4e43e736 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>
2024-04-26 15:52:10 +07:00
Junio C Hamano e326e52010 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
2024-04-25 10:34:24 -07:00
Junio C Hamano c9d1ee7cdf 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
2024-04-25 10:34:23 -07:00
Taylor Blau 9f32d8da7a 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>
2024-04-24 10:32:55 -07:00
Junio C Hamano bf995e7a4f Git 2.45-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-04-23 15:05:56 -07:00
Junio C Hamano 5c7ffafcea 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
2024-04-23 15:05:56 -07:00
Junio C Hamano 5b78774820 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"
2024-04-23 15:05:56 -07:00
Junio C Hamano 10f1281498 A bit more topics before -rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-04-23 11:52:42 -07:00
Junio C Hamano b0679fa2b8 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()
2024-04-23 11:52:42 -07:00
Junio C Hamano 7b66f5dd8b 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
2024-04-23 11:52:41 -07:00
Junio C Hamano fb9f603f3c Merge branch 'rs/imap-send-simplify-cmd-issuing-codepath'
Code simplification.

* rs/imap-send-simplify-cmd-issuing-codepath:
  imap-send: increase command size limit
2024-04-23 11:52:41 -07:00
Junio C Hamano 9cb0bbf0b4 Merge branch 'xx/rfc2822-date-format-in-doc'
Docfix.

* xx/rfc2822-date-format-in-doc:
  Documentation: fix typos describing date format
2024-04-23 11:52:40 -07:00
Junio C Hamano 567293123d 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
2024-04-23 11:52:40 -07:00
Junio C Hamano c9f1f88bb0 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
2024-04-23 11:52:39 -07:00
Junio C Hamano b258237f4d 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
2024-04-23 11:52:39 -07:00
Junio C Hamano 5615be39bc 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
2024-04-23 11:52:39 -07:00
Junio C Hamano 7f49008602 Merge branch 'yb/replay-doc-linkfix'
Docfix.

* yb/replay-doc-linkfix:
  Documentation: fix linkgit reference
2024-04-23 11:52:38 -07:00
Junio C Hamano ec465fcb75 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
2024-04-23 11:52:38 -07:00
Junio C Hamano 050e334979 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
2024-04-23 11:52:37 -07:00
Junio C Hamano 33bbc21c92 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()`
2024-04-23 11:52:37 -07:00
Rubén Justo 16727404c4 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>
2024-04-22 16:27:43 -07:00
Rubén Justo ec9b74b18e 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>
2024-04-22 16:27:42 -07:00