]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
6 weeks 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

6 weeks 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

6 weeks 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

6 weeks 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"

6 weeks 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>
6 weeks 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

6 weeks 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)

6 weeks 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

6 weeks 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>
6 weeks 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

6 weeks 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

6 weeks 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>
6 weeks 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>
6 weeks 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

6 weeks 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>
6 weeks 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>
6 weeks 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

6 weeks 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

6 weeks 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

6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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

6 weeks 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

6 weeks 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>
7 weeks 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>
7 weeks 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

7 weeks 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"

7 weeks 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>
7 weeks 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()

7 weeks 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

7 weeks 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

7 weeks 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

7 weeks 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

7 weeks 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

7 weeks 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

7 weeks 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

7 weeks 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

7 weeks 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

7 weeks 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

7 weeks 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()`

7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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

7 weeks 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'

7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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

7 weeks agomidx: disable replace objects
Xing Xin [Mon, 8 Apr 2024 05:26:57 +0000 (05:26 +0000)] 
midx: disable replace objects

We observed a series of clone failures arose in a specific set of
repositories after we fully enabled the MIDX bitmap feature within our
Codebase service. These failures were accompanied with error messages
such as:

    Cloning into bare repository 'clone.git'...
    remote: Enumerating objects: 8, done.
    remote: Total 8 (delta 0), reused 0 (delta 0), pack-reused 8 (from 1)
    Receiving objects: 100% (8/8), done.
    fatal: did not receive expected object ...
    fatal: fetch-pack: invalid index-pack output

Temporarily disabling the MIDX feature eliminated the reported issues.
After some investigation we found that all repositories experiencing
failures contain replace references, which seem to be improperly
acknowledged by the MIDX bitmap generation logic.

A more thorough explanation about the root cause from Taylor Blau says:

Indeed, the pack-bitmap-write machinery does not itself call
disable_replace_refs(). So when it generates a reachability bitmap, it
is doing so with the replace refs in mind. You can see that this is
indeed the cause of the problem by looking at the output of an
instrumented version of Git that indicates what bits are being set
during the bitmap generation phase.

With replace refs (incorrectly) enabled, we get:

    [2, 4, 6, 8, 13, 3, 6, 7, 3, 4, 6, 8]

and doing the same after calling disable_replace_refs(), we instead get:

    [2, 5, 6, 13, 3, 6, 7, 3, 4, 6, 8]

Single pack bitmaps are unaffected by this issue because we generate
them from within pack-objects, which does call disable_replace_refs().

This patch updates the MIDX logic to disable replace objects within the
multi-pack-index builtin, and a test showing a clone (which would fail
with MIDX bitmap) is added to demonstrate the bug.

Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Xing Xin <xingxin.xx@bytedance.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 weeks agobuiltin/receive-pack: convert to use git-maintenance(1)
Patrick Steinhardt [Wed, 17 Apr 2024 06:16:35 +0000 (08:16 +0200)] 
builtin/receive-pack: convert to use git-maintenance(1)

In 850b6edefa (auto-gc: extract a reusable helper from "git fetch",
2020-05-06), we have introduced a helper function `run_auto_gc()` that
kicks off `git gc --auto`. The intent of this function was to pass down
the "--quiet" flag to git-gc(1) as required without duplicating this at
all callsites. In 7c3e9e8cfb (auto-gc: pass --quiet down from am,
commit, merge and rebase, 2020-05-06) we then converted callsites that
need to pass down this flag to use the new helper function. This has the
notable omission of git-receive-pack(1), which is the only remaining
user of `git gc --auto` that sets up the proccess manually. This is
probably because it unconditionally passes down the `--quiet` flag and
thus didn't benefit much from the new helper function.

In a95ce12430 (maintenance: replace run_auto_gc(), 2020-09-17) we then
replaced `run_auto_gc()` with `run_auto_maintenance()` which invokes
git-maintenance(1) instead of git-gc(1). This command is the modern
replacement for git-gc(1) and is both more thorough and also more
flexible because administrators can configure which tasks exactly to run
during maintenance.

But due to git-receive-pack(1) not using `run_auto_gc()` in the first
place it did not get converted to use git-maintenance(1) like we do
everywhere else now. Address this oversight and start to use the newly
introduced function `prepare_auto_maintenance()`. This will also make it
easier for us to adapt this code together with all the other callsites
that invoke auto-maintenance in the future.

This removes the last internal user of `git gc --auto`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 weeks agorun-command: introduce function to prepare auto-maintenance process
Patrick Steinhardt [Wed, 17 Apr 2024 06:16:31 +0000 (08:16 +0200)] 
run-command: introduce function to prepare auto-maintenance process

The `run_auto_maintenance()` function is responsible for spawning a new
`git maintenance run --auto` process. To do so, it sets up the `sturct
child_process` and then runs it by executing `run_command()` directly.
This is rather inflexible in case callers want to modify the child
process somewhat, e.g. to redirect stderr or stdout.

Introduce a new `prepare_auto_maintenance()` function to plug this gap.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 weeks agomailmap: change primary address for Linus Arver
Linus Arver [Tue, 16 Apr 2024 23:21:51 +0000 (23:21 +0000)] 
mailmap: change primary address for Linus Arver

Linus will lose access to his work email soon.

Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agoThe twentieth batch
Junio C Hamano [Tue, 16 Apr 2024 21:01:39 +0000 (14:01 -0700)] 
The twentieth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agoMerge branch 'pw/t3428-cleanup'
Junio C Hamano [Tue, 16 Apr 2024 21:50:31 +0000 (14:50 -0700)] 
Merge branch 'pw/t3428-cleanup'

Test cleanup.

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

8 weeks agoMerge branch 'ba/osxkeychain-updates'
Junio C Hamano [Tue, 16 Apr 2024 21:50:30 +0000 (14:50 -0700)] 
Merge branch 'ba/osxkeychain-updates'

Update osxkeychain backend with features required for the recent
credential subsystem.

* ba/osxkeychain-updates:
  osxkeychain: store new attributes
  osxkeychain: erase matching passwords only
  osxkeychain: erase all matching credentials
  osxkeychain: replace deprecated SecKeychain API

8 weeks agoMerge branch 'jt/reftable-geometric-compaction'
Junio C Hamano [Tue, 16 Apr 2024 21:50:30 +0000 (14:50 -0700)] 
Merge branch 'jt/reftable-geometric-compaction'

The strategy to compact multiple tables of reftables after many
operations accumulate many entries has been improved to avoid
accumulating too many tables uncollected.

* jt/reftable-geometric-compaction:
  reftable/stack: use geometric table compaction
  reftable/stack: add env to disable autocompaction
  reftable/stack: expose option to disable auto-compaction

8 weeks agoMerge branch 'tb/make-indent-conditional-with-non-spaces'
Junio C Hamano [Tue, 16 Apr 2024 21:50:29 +0000 (14:50 -0700)] 
Merge branch 'tb/make-indent-conditional-with-non-spaces'

Adjust to an upcoming changes to GNU make that breaks our Makefiles.

* tb/make-indent-conditional-with-non-spaces:
  Makefile(s): do not enforce "all indents must be done with tab"
  Makefile(s): avoid recipe prefix in conditional statements

8 weeks agoMerge branch 'rs/usage-fallback-to-show-message-format'
Junio C Hamano [Tue, 16 Apr 2024 21:50:29 +0000 (14:50 -0700)] 
Merge branch 'rs/usage-fallback-to-show-message-format'

vreportf(), which is usede by error() and friends, has been taught
to give the error message printf-format string when its vsnprintf()
call fails, instead of showing nothing useful to identify the
nature of the error.

* rs/usage-fallback-to-show-message-format:
  usage: report vsnprintf(3) failure

8 weeks agoMerge branch 'rs/date-mode-pass-by-value'
Junio C Hamano [Tue, 16 Apr 2024 21:50:28 +0000 (14:50 -0700)] 
Merge branch 'rs/date-mode-pass-by-value'

The codepaths that reach date_mode_from_type() have been updated to
pass "struct date_mode" by value to make them thread safe.

* rs/date-mode-pass-by-value:
  date: make DATE_MODE thread-safe

8 weeks agoMerge branch 'sj/userdiff-c-sharp'
Junio C Hamano [Tue, 16 Apr 2024 21:50:28 +0000 (14:50 -0700)] 
Merge branch 'sj/userdiff-c-sharp'

The userdiff patterns for C# has been updated.

Acked-by: Johannes Sixt <j6t@kdbg.org>
cf. <c2154457-3f2f-496e-9b8b-c8ea7257027b@kdbg.org>

* sj/userdiff-c-sharp:
  userdiff: better method/property matching for C#

8 weeks agoMerge branch 'tb/t7700-fixup'
Junio C Hamano [Tue, 16 Apr 2024 21:50:28 +0000 (14:50 -0700)] 
Merge branch 'tb/t7700-fixup'

Test fix.

* tb/t7700-fixup:
  t/t7700-repack.sh: fix test breakages with `GIT_TEST_MULTI_PACK_INDEX=1 `

8 weeks agoMerge branch 'jc/local-extern-shell-rules'
Junio C Hamano [Tue, 16 Apr 2024 21:50:27 +0000 (14:50 -0700)] 
Merge branch 'jc/local-extern-shell-rules'

Document and apply workaround for a buggy version of dash that
mishandles "local var=val" construct.

* jc/local-extern-shell-rules:
  t1016: local VAR="VAL" fix
  t0610: local VAR="VAL" fix
  t: teach lint that RHS of 'local VAR=VAL' needs to be quoted
  t: local VAR="VAL" (quote ${magic-reference})
  t: local VAR="VAL" (quote command substitution)
  t: local VAR="VAL" (quote positional parameters)
  CodingGuidelines: quote assigned value in 'local var=$val'
  CodingGuidelines: describe "export VAR=VAL" rule

8 weeks agoapply: avoid using fixed-size buffer in write_out_one_reject()
René Scharfe [Tue, 16 Apr 2024 20:16:05 +0000 (22:16 +0200)] 
apply: avoid using fixed-size buffer in write_out_one_reject()

On some systems PATH_MAX is not a hard limit.  Support longer paths by
building them on the heap instead of using static buffers.

Take care to work around (arguably buggy) implementations of free(3)
that change errno by calling it only after using the errno value.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agorerere: fix crashes due to unmatched opening conflict markers
Marcel Röthke [Tue, 16 Apr 2024 10:52:48 +0000 (12:52 +0200)] 
rerere: fix crashes due to unmatched opening conflict markers

When rerere handles a conflict with an unmatched opening conflict marker
in a file with other conflicts, it will fail create a preimage and also
fail allocate the status member of struct rerere_dir. Currently the
status member is allocated after the error handling. This will lead to a
SEGFAULT when the status member is accessed during cleanup of the failed
parse.

Additionally, in subsequent executions of rerere, after removing the
MERGE_RR.lock manually, rerere crashes for a similar reason. MERGE_RR
points to a conflict id that has no preimage, therefore the status
member is not allocated and a SEGFAULT happens when trying to check if a
preimage exists.

Solve this by making sure the status field is allocated correctly and add
tests to prevent the bug from reoccurring.

This does not fix the root cause, failing to parse stray conflict
markers, but I don't think we can do much better than recognizing it,
printing an error, and moving on gracefully.

Signed-off-by: Marcel Röthke <marcel@roethke.info>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agoThe ninteenth batch
Junio C Hamano [Mon, 15 Apr 2024 21:11:30 +0000 (14:11 -0700)] 
The ninteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agoMerge branch 'jc/t2104-style-fixes'
Junio C Hamano [Mon, 15 Apr 2024 21:11:44 +0000 (14:11 -0700)] 
Merge branch 'jc/t2104-style-fixes'

Test style fixes.

* jc/t2104-style-fixes:
  t2104: style fixes

8 weeks agoMerge branch 'jc/unleak-core-excludesfile'
Junio C Hamano [Mon, 15 Apr 2024 21:11:44 +0000 (14:11 -0700)] 
Merge branch 'jc/unleak-core-excludesfile'

The variable that holds the value read from the core.excludefile
configuration variable used to leak, which has been corrected.

* jc/unleak-core-excludesfile:
  config: do not leak excludes_file

8 weeks agoMerge branch 'jk/libcurl-8.7-regression-workaround'
Junio C Hamano [Mon, 15 Apr 2024 21:11:44 +0000 (14:11 -0700)] 
Merge branch 'jk/libcurl-8.7-regression-workaround'

Fix was added to work around a regression in libcURL 8.7.0 (which has
already been fixed in their tip of the tree).

* jk/libcurl-8.7-regression-workaround:
  remote-curl: add Transfer-Encoding header only for older curl
  INSTALL: bump libcurl version to 7.21.3
  http: reset POSTFIELDSIZE when clearing curl handle

8 weeks agoMerge branch 'ps/t0610-umask-fix'
Junio C Hamano [Mon, 15 Apr 2024 21:11:43 +0000 (14:11 -0700)] 
Merge branch 'ps/t0610-umask-fix'

The "shared repository" test in the t0610 reftable test failed
under restrictive umask setting (e.g. 007), which has been
corrected.

* ps/t0610-umask-fix:
  t0610: execute git-pack-refs(1) with specified umask
  t0610: make `--shared=` tests reusable

8 weeks agoMerge branch 'gt/add-u-commit-i-pathspec-check'
Junio C Hamano [Mon, 15 Apr 2024 21:11:43 +0000 (14:11 -0700)] 
Merge branch 'gt/add-u-commit-i-pathspec-check'

"git add -u <pathspec>" and "git commit [-i] <pathspec>" did not
diagnose a pathspec element that did not match any files in certain
situations, unlike "git add <pathspec>" did.

* gt/add-u-commit-i-pathspec-check:
  builtin/add: error out when passing untracked path with -u
  builtin/commit: error out when passing untracked path with -i
  revision: optionally record matches with pathspec elements

8 weeks agoMerge branch 'ds/fetch-config-parse-microfix'
Junio C Hamano [Mon, 15 Apr 2024 21:11:43 +0000 (14:11 -0700)] 
Merge branch 'ds/fetch-config-parse-microfix'

A config parser callback function fell through instead of returning
after recognising and processing a variable, wasting cycles, which
has been corrected.

* ds/fetch-config-parse-microfix:
  fetch: return when parsing submodule.recurse

8 weeks agoMerge branch 'rs/apply-reject-fd-leakfix'
Junio C Hamano [Mon, 15 Apr 2024 21:11:42 +0000 (14:11 -0700)] 
Merge branch 'rs/apply-reject-fd-leakfix'

A file descriptor leak in an error codepath, used when "git apply
--reject" fails to create the *.rej file, has been corrected.

* rs/apply-reject-fd-leakfix:
  apply: don't leak fd on fdopen() error

8 weeks agoMerge branch 'rs/apply-lift-path-length-limit'
Junio C Hamano [Mon, 15 Apr 2024 21:11:42 +0000 (14:11 -0700)] 
Merge branch 'rs/apply-lift-path-length-limit'

"git apply" has been updated to lift the hardcoded pathname length
limit, which in turn allowed a mksnpath() function that is no
longer used.

* rs/apply-lift-path-length-limit:
  path: remove mksnpath()
  apply: avoid fixed-size buffer in create_one_file()

8 weeks agoMerge branch 'ma/win32-unix-domain-socket'
Junio C Hamano [Mon, 15 Apr 2024 21:11:42 +0000 (14:11 -0700)] 
Merge branch 'ma/win32-unix-domain-socket'

Windows binary used to decide the use of unix-domain socket at
build time, but it learned to make the decision at runtime instead.

* ma/win32-unix-domain-socket:
  Win32: detect unix socket support at runtime

8 weeks agoimap-send: increase command size limit
René Scharfe [Sun, 14 Apr 2024 16:47:52 +0000 (18:47 +0200)] 
imap-send: increase command size limit

nfvasprintf() has a 8KB limit, but it's not relevant, as its result is
combined with other strings and added to a 1KB buffer by its caller.
That 1KB limit is not mentioned in RFC 9051, which specifies IMAP.

While 1KB is plenty for user names, passwords and mailbox names,
there's no point in limiting our commands like that.  Call xstrvfmt()
instead of open-coding it and use strbuf to format the command to
send, as we need its length.  Fail hard if it exceeds INT_MAX, because
socket_write() can't take more than that.

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>
8 weeks agobisect: report the found commit with "show"
Peter Krefting [Sat, 13 Apr 2024 20:14:48 +0000 (21:14 +0100)] 
bisect: report the found commit with "show"

When "git bisect" finds the first bad commit and shows it to the user,
it calls "git diff-tree" to do so, whose output is meant to be stable
and deliberately ignores end-user customizations.

As the output is supposed to be consumed by humans, replace this with
a call to "git show". This command honors configuration options (such
as "log.date" and "log.mailmap") and other UI improvements (renames
are detected).

Pass some hard-coded options to "git show" to make the output similar
to the one we are replacing, such as showing a patch summary only.

Reported-by: Michael Osipov <michael.osipov@innomotics.com>
Signed-off-By: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agoDocumentation: fix linkgit reference
Yehezkel Bernat [Sun, 14 Apr 2024 22:08:02 +0000 (22:08 +0000)] 
Documentation: fix linkgit reference

In git-replay documentation, linkgit to git-rev-parse is missing the
man section, which breaks its rendering.

Add section number as done in other references to this command.

Signed-off-by: Yehezkel Bernat <YehezkelShB@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agogit-compat-util: fix NO_OPENSSL on current macOS
René Scharfe [Sun, 14 Apr 2024 16:47:54 +0000 (18:47 +0200)] 
git-compat-util: fix NO_OPENSSL on current macOS

b195aa00c1 (git-compat-util: suppress unavoidable Apple-specific
deprecation warnings, 2014-12-16) started to define
__AVAILABILITY_MACROS_USES_AVAILABILITY in git-compat-util.h.  On
current versions it is already defined (e.g. on macOS 14.4.1).  Undefine
it before redefining it to avoid a compilation error.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agopack-bitmap: gracefully handle missing BTMP chunks
Patrick Steinhardt [Mon, 15 Apr 2024 06:41:25 +0000 (08:41 +0200)] 
pack-bitmap: gracefully handle missing BTMP chunks

In 0fea6b73f1 (Merge branch 'tb/multi-pack-verbatim-reuse', 2024-01-12)
we have introduced multi-pack verbatim reuse of objects. This series has
introduced a new BTMP chunk, which encodes information about bitmapped
objects in the multi-pack index. Starting with dab60934e3 (pack-bitmap:
pass `bitmapped_pack` struct to pack-reuse functions, 2023-12-14) we use
this information to figure out objects which we can reuse from each of
the packfiles.

One thing that we glossed over though is backwards compatibility with
repositories that do not yet have BTMP chunks in their multi-pack index.
In that case, `nth_bitmapped_pack()` would return an error, which causes
us to emit a warning followed by another error message. These warnings
are visible to users that fetch from a repository:

```
$ git fetch
...
remote: error: MIDX does not contain the BTMP chunk
remote: warning: unable to load pack: 'pack-f6bb7bd71d345ea9fe604b60cab9ba9ece54ffbe.idx', disabling pack-reuse
remote: Enumerating objects: 40, done.
remote: Counting objects: 100% (40/40), done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 40 (delta 5), reused 0 (delta 0), pack-reused 0 (from 0)
...
```

While the fetch succeeds the user is left wondering what they did wrong.
Furthermore, as visible both from the warning and from the reuse stats,
pack-reuse is completely disabled in such repositories.

What is quite interesting is that this issue can even be triggered in
case `pack.allowPackReuse=single` is set, which is the default value.
One could have expected that in this case we fall back to the old logic,
which is to use the preferred packfile without consulting BTMP chunks at
all. But either we fail with the above error in case they are missing,
or we use the first pack in the multi-pack-index. The former case
disables pack-reuse altogether, whereas the latter case may result in
reusing objects from a suboptimal packfile.

Fix this issue by partially reverting the logic back to what we had
before this patch series landed. Namely, in the case where we have no
BTMP chunks or when `pack.allowPackReuse=single` are set, we use the
preferred pack instead of consulting the BTMP chunks.

Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agoreftable/block: avoid copying block iterators on seek
Patrick Steinhardt [Mon, 8 Apr 2024 12:17:08 +0000 (14:17 +0200)] 
reftable/block: avoid copying block iterators on seek

When seeking a reftable record in a block we need to position the
iterator _before_ the sought-after record so that the next call to
`block_iter_next()` would yield that record. To achieve this, the loop
that performs the linear seeks to restore the previous position once it
has found the record.

This is done by advancing two `block_iter`s: one to check whether the
next record is our sought-after record, and one that we update after
every iteration. This of course involves quite a lot of copying and also
leads to needless memory allocations.

Refactor the code to get rid of the `next` iterator and the copying this
involves. Instead, we can restore the previous offset such that the call
to `next` will return the correct record.

Next to being simpler conceptually this also leads to a nice speedup.
The following benchmark parser 10k refs out of 100k existing refs via
`git-rev-list --no-walk`:

  Benchmark 1: rev-list: print many refs (HEAD~)
    Time (mean ± σ):     170.2 ms ±   1.7 ms    [User: 86.1 ms, System: 83.6 ms]
    Range (min … max):   166.4 ms … 180.3 ms    500 runs

  Benchmark 2: rev-list: print many refs (HEAD~)
    Time (mean ± σ):     161.6 ms ±   1.6 ms    [User: 78.1 ms, System: 83.0 ms]
    Range (min … max):   158.4 ms … 172.3 ms    500 runs

  Summary
    rev-list: print many refs (HEAD) ran
      1.05 ± 0.01 times faster than rev-list: print many refs (HEAD~)

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agoreftable/block: reuse `zstream` state on inflation
Patrick Steinhardt [Mon, 8 Apr 2024 12:17:04 +0000 (14:17 +0200)] 
reftable/block: reuse `zstream` state on inflation

When calling `inflateInit()` and `inflate()`, the zlib library will
allocate several data structures for the underlying `zstream` to keep
track of various information. Thus, when inflating repeatedly, it is
possible to optimize memory allocation patterns by reusing the `zstream`
and then calling `inflateReset()` on it to prepare it for the next chunk
of data to inflate.

This is exactly what the reftable code is doing: when iterating through
reflogs we need to potentially inflate many log blocks, but we discard
the `zstream` every single time. Instead, as we reuse the `block_reader`
for each of the blocks anyway, we can initialize the `zstream` once and
then reuse it for subsequent inflations.

Refactor the code to do so, which leads to a significant reduction in
the number of allocations. The following measurements were done when
iterating through 1 million reflog entries. Before:

  HEAP SUMMARY:
      in use at exit: 13,473 bytes in 122 blocks
    total heap usage: 23,028 allocs, 22,906 frees, 162,813,552 bytes allocated

After:

  HEAP SUMMARY:
      in use at exit: 13,473 bytes in 122 blocks
    total heap usage: 302 allocs, 180 frees, 88,352 bytes allocated

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agoreftable/block: open-code call to `uncompress2()`
Patrick Steinhardt [Mon, 8 Apr 2024 12:16:59 +0000 (14:16 +0200)] 
reftable/block: open-code call to `uncompress2()`

The reftable format stores log blocks in a compressed format. Thus,
whenever we want to read such a block we first need to decompress it.
This is done by calling the convenience function `uncompress2()` of the
zlib library, which is a simple wrapper that manages the lifecycle of
the `zstream` structure for us.

While nice for one-off inflation of data, when iterating through reflogs
we will likely end up inflating many such log blocks. This requires us
to reallocate the state of the `zstream` every single time, which adds
up over time. It would thus be great to reuse the `zstream` instead of
discarding it after every inflation.

Open-code the call to `uncompress2()` such that we can start reusing the
`zstream` in the subsequent commit. Note that our open-coded variant is
different from `uncompress2()` in two ways:

  - We do not loop around `inflate()` until we have processed all input.
    As our input is limited by the maximum block size, which is 16MB, we
    should not hit limits of `inflate()`.

  - We use `Z_FINISH` instead of `Z_NO_FLUSH`. Quoting the `inflate()`
    documentation: "inflate() should normally be called until it returns
    Z_STREAM_END or an error. However if all decompression is to be
    performed in a single step (a single call of inflate), the parameter
    flush should be set to Z_FINISH."

    Furthermore, "Z_FINISH also informs inflate to not maintain a
    sliding window if the stream completes, which reduces inflate's
    memory footprint."

Other than that this commit is expected to be functionally equivalent
and does not yet reuse the `zstream`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 weeks agoreftable/block: reuse uncompressed blocks
Patrick Steinhardt [Mon, 8 Apr 2024 12:16:54 +0000 (14:16 +0200)] 
reftable/block: reuse uncompressed blocks

The reftable backend stores reflog entries in a compressed format and
thus needs to uncompress blocks before one can read records from it.
For each reflog block we thus have to allocate an array that we can
decompress the block contents into. This block is being discarded
whenever the table iterator moves to the next block. Consequently, we
reallocate a new array on every block, which is quite wasteful.

Refactor the code to reuse the uncompressed block data when moving the
block reader to a new block. This significantly reduces the number of
allocations when iterating through many compressed blocks. The following
measurements are done with `git reflog list` when listing 100k reflogs.
Before:

  HEAP SUMMARY:
      in use at exit: 13,473 bytes in 122 blocks
    total heap usage: 45,755 allocs, 45,633 frees, 254,779,456 bytes allocated

After:

  HEAP SUMMARY:
      in use at exit: 13,473 bytes in 122 blocks
    total heap usage: 23,028 allocs, 22,906 frees, 162,813,547 bytes allocated

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