]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
8 months agotest-lib: check for leak logs after every test
Jeff King [Tue, 24 Sep 2024 21:38:36 +0000 (17:38 -0400)] 
test-lib: check for leak logs after every test

If you are trying to find and fix leaks in a large test script, it can
be overwhelming to see the leak logs for every test at once. The
previous commit let you use "--immediate" to see the logs after the
first failing test, but this isn't always the first leak. As discussed
there, we may see leaks from previous tests that didn't happen to fail.

To catch those, let's check for any logs that appeared after each test
snippet is run, meaning that in a SANITIZE=leak build, any leak is an
immediate failure of the test snippet.

This check is mostly free in non-leak builds (just a "test -z"), and
only a few extra processes in a leak build, so I don't think the
overhead should matter (if it does, we could probably optimize for the
common "no logs" case without even spending a process).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agotest-lib: show leak-sanitizer logs on --immediate failure
Jeff King [Tue, 24 Sep 2024 21:36:36 +0000 (17:36 -0400)] 
test-lib: show leak-sanitizer logs on --immediate failure

When we've compiled with SANITIZE=leak, at the end of the test script
we'll dump any collected logs to stdout. These logs have two uses:

  1. Leaks don't always cause a test snippet to fail (e.g., if they
     happen in a sub-process that we expect to return non-zero).
     Checking the logs catches these cases that we'd otherwise miss
     entirely.

  2. LSan will dump the leak info to stderr, but that is sometimes
     hidden (e.g., because it's redirected by the test, or because it's
     in a sub-process whose stderr goes elsewhere). Dumping the logs is
     the easiest way for the developer to see them.

One downside is that the set of logs for an entire script may be very
long, especially when you're trying to fix existing test scripts. You
can run with --immediate to stop at the first failing test, which means
we'll have accrued fewer logs. But we don't show the logs in that case!

Let's start doing so. This can only help case (2), of course (since it
depends on test failure). And it's somewhat weakened by the fact that
any cases of (1) will pollute the logs. But we can improve things
further in the next patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agotest-lib: stop showing old leak logs
Jeff King [Tue, 24 Sep 2024 21:35:40 +0000 (17:35 -0400)] 
test-lib: stop showing old leak logs

We ask LSan to record the logs of all leaks in test-results/, which is
useful for finding leaks that didn't trigger a test failure.

We don't clean out the leak/ directory for each test before running it,
though. Instead, we count the number of files it has, and complain only
if we ended up with more when the script finishes. So we shouldn't
trigger any output if you've made a script leak free. But if you simply
_reduced_ the number of leaks, then there is an annoying outcome: we do
not record which logs were from this run and which were from previous
ones. So when we dump them to stdout, you get a mess of
possibly-outdated leaks. This is very confusing when you are in an
edit-compile-test cycle trying to fix leaks.

The instructions do note that you should "rm -rf test-results/" if you
want to avoid this. But I'm having trouble seeing how this cumulative
count could ever be useful. It is not even counting the number of leaks,
but rather the number of processes with at least one leak!

So let's just blow away the per-test leak/ directory before running. We
already overwrite the ".out" file in test-results/ in the same way, so
this is following that pattern.

Running "make test" isn't affected by this, since it blows away all of
test-results/ already. This only comes up when you are iterating on a
single script that you're running manually.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoThe 20th batch
Junio C Hamano [Mon, 23 Sep 2024 17:31:05 +0000 (10:31 -0700)] 
The 20th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jc/pass-repo-to-builtins'
Junio C Hamano [Mon, 23 Sep 2024 17:35:09 +0000 (10:35 -0700)] 
Merge branch 'jc/pass-repo-to-builtins'

The convention to calling into built-in command implementation has
been updated to pass the repository, if known, together with the
prefix value.

* jc/pass-repo-to-builtins:
  add: pass in repo variable instead of global the_repository
  builtin: remove USE_THE_REPOSITORY for those without the_repository
  builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h
  builtin: add a repository parameter for builtin functions

9 months agoMerge branch 'jk/t9001-deflake'
Junio C Hamano [Mon, 23 Sep 2024 17:35:08 +0000 (10:35 -0700)] 
Merge branch 'jk/t9001-deflake'

Test fix.

* jk/t9001-deflake:
  t9001: use a more distinct fake BugID

9 months agoMerge branch 'jk/jump-quickfix-fixes'
Junio C Hamano [Mon, 23 Sep 2024 17:35:08 +0000 (10:35 -0700)] 
Merge branch 'jk/jump-quickfix-fixes'

A few usability fixes to "git jump" (in contrib/).

* jk/jump-quickfix-fixes:
  git-jump: ignore deleted files in diff mode
  git-jump: always specify column 1 for diff entries

9 months agoMerge branch 'ak/typofixes'
Junio C Hamano [Mon, 23 Sep 2024 17:35:07 +0000 (10:35 -0700)] 
Merge branch 'ak/typofixes'

Trivial typofixes.

* ak/typofixes:
  cbtree: fix a typo
  bloom: fix a typo
  attr: fix a typo

9 months agoMerge branch 'jk/diag-unexpected-remote-helper-death'
Junio C Hamano [Mon, 23 Sep 2024 17:35:06 +0000 (10:35 -0700)] 
Merge branch 'jk/diag-unexpected-remote-helper-death'

When a remote-helper dies before Git writes to it, SIGPIPE killed
Git silently.  We now explain the situation a bit better to the end
user in our error message.

* jk/diag-unexpected-remote-helper-death:
  print an error when remote helpers die during capabilities

9 months agoMerge branch 'jc/t5512-sigpipe-fix'
Junio C Hamano [Mon, 23 Sep 2024 17:35:05 +0000 (10:35 -0700)] 
Merge branch 'jc/t5512-sigpipe-fix'

Test fix.

* jc/t5512-sigpipe-fix:
  t5512.40 sometimes dies by SIGPIPE

9 months agoMerge branch 'ps/environ-wo-the-repository'
Junio C Hamano [Mon, 23 Sep 2024 17:35:04 +0000 (10:35 -0700)] 
Merge branch 'ps/environ-wo-the-repository'

Code clean-up.

* ps/environ-wo-the-repository: (21 commits)
  environment: stop storing "core.notesRef" globally
  environment: stop storing "core.warnAmbiguousRefs" globally
  environment: stop storing "core.preferSymlinkRefs" globally
  environment: stop storing "core.logAllRefUpdates" globally
  refs: stop modifying global `log_all_ref_updates` variable
  branch: stop modifying `log_all_ref_updates` variable
  repo-settings: track defaults close to `struct repo_settings`
  repo-settings: split out declarations into a standalone header
  environment: guard state depending on a repository
  environment: reorder header to split out `the_repository`-free section
  environment: move `set_git_dir()` and related into setup layer
  environment: make `get_git_namespace()` self-contained
  environment: move object database functions into object layer
  config: make dependency on repo in `read_early_config()` explicit
  config: document `read_early_config()` and `read_very_early_config()`
  environment: make `get_git_work_tree()` accept a repository
  environment: make `get_graft_file()` accept a repository
  environment: make `get_index_file()` accept a repository
  environment: make `get_object_directory()` accept a repository
  environment: make `get_git_common_dir()` accept a repository
  ...

9 months agoSync with Git 2.46.2
Junio C Hamano [Mon, 23 Sep 2024 17:34:39 +0000 (10:34 -0700)] 
Sync with Git 2.46.2

9 months agoGit 2.46.2 v2.46.2
Junio C Hamano [Fri, 20 Sep 2024 16:10:24 +0000 (09:10 -0700)] 
Git 2.46.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'ma/test-libcurl-prereq' into maint-2.46
Junio C Hamano [Mon, 23 Sep 2024 17:33:00 +0000 (10:33 -0700)] 
Merge branch 'ma/test-libcurl-prereq' into maint-2.46

Test portability fix.

* ma/test-libcurl-prereq:
  t0211: add missing LIBCURL prereq
  t1517: add missing LIBCURL prereq

9 months agoMerge branch 'jc/doc-skip-fetch-all-and-prefetch' into maint-2.46
Junio C Hamano [Mon, 23 Sep 2024 17:33:00 +0000 (10:33 -0700)] 
Merge branch 'jc/doc-skip-fetch-all-and-prefetch' into maint-2.46

Doc updates.

* jc/doc-skip-fetch-all-and-prefetch:
  doc: remote.*.skip{DefaultUpdate,FetchAll} stops prefetch

9 months agoMerge branch 'bl/trailers-and-incomplete-last-line-fix' into maint-2.46
Junio C Hamano [Mon, 23 Sep 2024 17:32:59 +0000 (10:32 -0700)] 
Merge branch 'bl/trailers-and-incomplete-last-line-fix' into maint-2.46

The interpret-trailers command failed to recognise the end of the
message when the commit log ends in an incomplete line.

* bl/trailers-and-incomplete-last-line-fix:
  interpret-trailers: handle message without trailing newline

9 months agoMerge branch 'rj/cygwin-has-dev-tty' into maint-2.46
Junio C Hamano [Mon, 23 Sep 2024 17:32:59 +0000 (10:32 -0700)] 
Merge branch 'rj/cygwin-has-dev-tty' into maint-2.46

Cygwin does have /dev/tty support that is needed by things like
single-key input mode.

* rj/cygwin-has-dev-tty:
  config.mak.uname: add HAVE_DEV_TTY to cygwin config section

9 months agoMerge branch 'rs/diff-exit-code-fix' into maint-2.46
Junio C Hamano [Mon, 23 Sep 2024 17:32:58 +0000 (10:32 -0700)] 
Merge branch 'rs/diff-exit-code-fix' into maint-2.46

In a few corner cases "git diff --exit-code" failed to report
"changes" (e.g., renamed without any content change), which has
been corrected.

* rs/diff-exit-code-fix:
  diff: report dirty submodules as changes in builtin_diff()
  diff: report copies and renames as changes in run_diff_cmd()

9 months agoThe 19th batch
Junio C Hamano [Fri, 20 Sep 2024 15:59:27 +0000 (08:59 -0700)] 
The 19th batch

Merge the topics that have been cooking since 2024-09-13 or so in
'next'.

Let's try a new workflow to update the maintenance track by removing
the "merge ... later to maint" comments from the draft release notes
on the 'master' track.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jk/git-pm-bare-repo-fix'
Junio C Hamano [Fri, 20 Sep 2024 18:16:32 +0000 (11:16 -0700)] 
Merge branch 'jk/git-pm-bare-repo-fix'

In Git 2.39, Git.pm stopped working in a bare repository, which has
been corrected.

* jk/git-pm-bare-repo-fix:
  Git.pm: use "rev-parse --absolute-git-dir" rather than perl code
  Git.pm: fix bare repository search with Directory option

9 months agoMerge branch 'bb/unicode-width-table-16'
Junio C Hamano [Fri, 20 Sep 2024 18:16:32 +0000 (11:16 -0700)] 
Merge branch 'bb/unicode-width-table-16'

Update the character width table for Unicode 16.

* bb/unicode-width-table-16:
  unicode: update the width tables to Unicode 16

9 months agoMerge branch 'ma/test-libcurl-prereq'
Junio C Hamano [Fri, 20 Sep 2024 18:16:31 +0000 (11:16 -0700)] 
Merge branch 'ma/test-libcurl-prereq'

Test portability fix.

* ma/test-libcurl-prereq:
  t0211: add missing LIBCURL prereq
  t1517: add missing LIBCURL prereq

9 months agoMerge branch 'jk/interop-test-build-options'
Junio C Hamano [Fri, 20 Sep 2024 18:16:31 +0000 (11:16 -0700)] 
Merge branch 'jk/interop-test-build-options'

The support to customize build options to adjust for older versions
and/or older systems for the interop tests has been improved.

* jk/interop-test-build-options:
  t/interop: allow per-version make options

9 months agoMerge branch 'jk/no-openssl-with-openssl-sha1'
Junio C Hamano [Fri, 20 Sep 2024 18:16:30 +0000 (11:16 -0700)] 
Merge branch 'jk/no-openssl-with-openssl-sha1'

The "imap-send" now allows to be compiled with NO_OPENSSL and
OPENSSL_SHA1 defined together.

* jk/no-openssl-with-openssl-sha1:
  imap-send: handle NO_OPENSSL even when openssl exists

9 months agoMerge branch 'ps/leakfixes-part-6'
Junio C Hamano [Fri, 20 Sep 2024 18:16:30 +0000 (11:16 -0700)] 
Merge branch 'ps/leakfixes-part-6'

More leakfixes.

* ps/leakfixes-part-6: (22 commits)
  builtin/repack: fix leaking keep-pack list
  merge-ort: fix two leaks when handling directory rename modifications
  match-trees: fix leaking prefixes in `shift_tree()`
  builtin/fmt-merge-msg: fix leaking buffers
  builtin/grep: fix leaking object context
  builtin/pack-objects: plug leaking list of keep-packs
  builtin/repack: fix leaking line buffer when packing promisors
  negotiator/skipping: fix leaking commit entries
  shallow: fix leaking members of `struct shallow_info`
  shallow: free grafts when unregistering them
  object: clear grafts when clearing parsed object pool
  gpg-interface: fix misdesigned signing key interfaces
  send-pack: fix leaking push cert nonce
  remote: fix leak in reachability check of a remote-tracking ref
  remote: fix leaking tracking refs
  builtin/submodule--helper: fix leaking refs on push-check
  submodule: fix leaking fetch task data
  upload-pack: fix leaking child process data on reachability checks
  builtin/push: fix leaking refspec query result
  send-pack: fix leaking common object IDs
  ...

9 months agoMerge branch 'pw/rebase-autostash-fix'
Junio C Hamano [Fri, 20 Sep 2024 18:16:29 +0000 (11:16 -0700)] 
Merge branch 'pw/rebase-autostash-fix'

"git rebase --autostash" failed to resurrect the autostashed
changes when the command gets aborted after giving back control
asking for hlep in conflict resolution.

* pw/rebase-autostash-fix:
  rebase: apply and cleanup autostash when rebase fails to start

9 months agoThe eighteenth batch
Junio C Hamano [Thu, 19 Sep 2024 00:47:14 +0000 (17:47 -0700)] 
The eighteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'es/chainlint-message-updates'
Junio C Hamano [Thu, 19 Sep 2024 01:02:05 +0000 (18:02 -0700)] 
Merge branch 'es/chainlint-message-updates'

The error messages from the test script checker have been improved.

* es/chainlint-message-updates:
  chainlint: reduce annotation noise-factor
  chainlint: make error messages self-explanatory
  chainlint: don't be fooled by "?!...?!" in test body

9 months agoMerge branch 'ps/clar-unit-test'
Junio C Hamano [Thu, 19 Sep 2024 01:02:05 +0000 (18:02 -0700)] 
Merge branch 'ps/clar-unit-test'

Import clar unit tests framework libgit2 folks invented for our
use.

* ps/clar-unit-test:
  Makefile: rename clar-related variables to avoid confusion
  clar: add CMake support
  t/unit-tests: convert ctype tests to use clar
  t/unit-tests: convert strvec tests to use clar
  t/unit-tests: implement test driver
  Makefile: wire up the clar unit testing framework
  Makefile: do not use sparse on third-party sources
  Makefile: make hdr-check depend on generated headers
  Makefile: fix sparse dependency on GENERATED_H
  clar: stop including `shellapi.h` unnecessarily
  clar(win32): avoid compile error due to unused `fs_copy()`
  clar: avoid compile error with mingw-w64
  t/clar: fix compatibility with NonStop
  t: import the clar unit testing framework
  t: do not pass GIT_TEST_OPTS to unit tests with prove

9 months agoci updates
Junio C Hamano [Mon, 16 Sep 2024 22:31:39 +0000 (15:31 -0700)] 
ci updates

This batch is solely to unbreak the 32-bit CI jobs that can no
longer work with Ubuntu xenial image that is too ancient.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoSync with 'maint'
Junio C Hamano [Mon, 16 Sep 2024 22:27:46 +0000 (15:27 -0700)] 
Sync with 'maint'

9 months agoMerge branch 'jk/ci-linux32-update'
Junio C Hamano [Mon, 16 Sep 2024 22:27:08 +0000 (15:27 -0700)] 
Merge branch 'jk/ci-linux32-update'

CI updates

* jk/ci-linux32-update:
  ci: add Ubuntu 16.04 job to GitLab CI
  ci: use regular action versions for linux32 job
  ci: use more recent linux32 image
  ci: unify ubuntu and ubuntu32 dependencies
  ci: drop run-docker scripts

9 months agoMerge branch 'jc/ci-upload-artifact-and-linux32'
Junio C Hamano [Mon, 16 Sep 2024 22:27:08 +0000 (15:27 -0700)] 
Merge branch 'jc/ci-upload-artifact-and-linux32'

CI started failing completely for linux32 jobs, as the step to
upload failed test directory uses GitHub actions that is deprecated
and is now disabled.  Remove the step so at least we will know if
the tests are passing.

* jc/ci-upload-artifact-and-linux32:
  ci: remove 'Upload failed tests' directories' step from linux32 jobs

9 months agoStart preparing for Git 2.46.2
Junio C Hamano [Mon, 16 Sep 2024 22:18:58 +0000 (15:18 -0700)] 
Start preparing for Git 2.46.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jk/ci-linux32-update' into maint-2.46
Junio C Hamano [Mon, 16 Sep 2024 22:13:24 +0000 (15:13 -0700)] 
Merge branch 'jk/ci-linux32-update' into maint-2.46

CI updates

* jk/ci-linux32-update:
  ci: add Ubuntu 16.04 job to GitLab CI
  ci: use regular action versions for linux32 job
  ci: use more recent linux32 image
  ci: unify ubuntu and ubuntu32 dependencies
  ci: drop run-docker scripts

9 months agoMerge branch 'jc/ci-upload-artifact-and-linux32' into maint-2.46
Junio C Hamano [Mon, 16 Sep 2024 22:13:24 +0000 (15:13 -0700)] 
Merge branch 'jc/ci-upload-artifact-and-linux32' into maint-2.46

CI started failing completely for linux32 jobs, as the step to
upload failed test directory uses GitHub actions that is deprecated
and is now disabled.  Remove the step so at least we will know if
the tests are passing.

* jc/ci-upload-artifact-and-linux32:
  ci: remove 'Upload failed tests' directories' step from linux32 jobs

9 months agoRevert "Merge branch 'jc/patch-id' into maint-2.46"
Junio C Hamano [Mon, 16 Sep 2024 22:12:06 +0000 (15:12 -0700)] 
Revert "Merge branch 'jc/patch-id' into maint-2.46"

This reverts commit 41c952ebacf7e3369e7bee721f768114d65e50c4,
reversing changes made to 712d970c0145b95ce655773e7cd1676f09dfd215.
Keeping a known breakage for now is better than introducing new
regression(s).

9 months agoThe seventeenth batch
Junio C Hamano [Mon, 16 Sep 2024 21:22:38 +0000 (14:22 -0700)] 
The seventeenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jk/ref-filter-trailer-fixes'
Junio C Hamano [Mon, 16 Sep 2024 21:22:55 +0000 (14:22 -0700)] 
Merge branch 'jk/ref-filter-trailer-fixes'

Bugfixes and leak plugging in "git for-each-ref --format=..." code
paths.

* jk/ref-filter-trailer-fixes:
  ref-filter: fix leak with unterminated %(if) atoms
  ref-filter: add ref_format_clear() function
  ref-filter: fix leak when formatting %(push:remoteref)
  ref-filter: fix leak with %(describe) arguments
  ref-filter: fix leak of %(trailers) "argbuf"
  ref-filter: store ref_trailer_buf data per-atom
  ref-filter: drop useless cast in trailers_atom_parser()
  ref-filter: strip signature when parsing tag trailers
  ref-filter: avoid extra copies of payload/signature
  t6300: drop newline from wrapped test title

9 months agoMerge branch 'jc/range-diff-lazy-setup'
Junio C Hamano [Mon, 16 Sep 2024 21:22:54 +0000 (14:22 -0700)] 
Merge branch 'jc/range-diff-lazy-setup'

Code clean-up.

* jc/range-diff-lazy-setup:
  remerge-diff: clean up temporary objdir at a central place
  remerge-diff: lazily prepare temporary objdir on demand

9 months agoMerge branch 'ah/apply-3way-ours'
Junio C Hamano [Mon, 16 Sep 2024 21:22:53 +0000 (14:22 -0700)] 
Merge branch 'ah/apply-3way-ours'

"git apply --3way" learned to take "--ours" and other options.

* ah/apply-3way-ours:
  apply: support --ours, --theirs, and --union for three-way merges

9 months agoMerge branch 'cp/unit-test-reftable-stack'
Junio C Hamano [Mon, 16 Sep 2024 21:22:53 +0000 (14:22 -0700)] 
Merge branch 'cp/unit-test-reftable-stack'

Another reftable test migrated to the unit-test framework.

* cp/unit-test-reftable-stack:
  t-reftable-stack: add test for stack iterators
  t-reftable-stack: add test for non-default compaction factor
  t-reftable-stack: use reftable_ref_record_equal() to compare ref records
  t-reftable-stack: use Git's tempfile API instead of mkstemp()
  t: harmonize t-reftable-stack.c with coding guidelines
  t: move reftable/stack_test.c to the unit testing framework

9 months agocbtree: fix a typo
Andrew Kreimer [Sun, 15 Sep 2024 23:05:22 +0000 (02:05 +0300)] 
cbtree: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agobloom: fix a typo
Andrew Kreimer [Sun, 15 Sep 2024 23:03:37 +0000 (02:03 +0300)] 
bloom: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoattr: fix a typo
Andrew Kreimer [Sun, 15 Sep 2024 23:01:25 +0000 (02:01 +0300)] 
attr: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot9001: use a more distinct fake BugID
Jeff King [Sun, 15 Sep 2024 11:31:15 +0000 (07:31 -0400)] 
t9001: use a more distinct fake BugID

In the test "cc list is sanitized", we feed a commit with a variety of
trailers to send-email, and then check its output to see how it handled
them. For most of them, we are grepping for a specific mention of the
header, but there's a "BugID" header which we expect to be ignored. We
confirm this by grepping for "12345", the fake BugID, and making sure it
is not present.

But we can be fooled by false positives! I just tracked down a flaky
test failure here that was caused by matching this unrelated line in the
output:

  <20240914090449.612345-1-author@example.com>

which will change from run to run based on the time, pid, etc.

Ideally we'd tighten the regex to make this more specifically, but since
the point is that it _shouldn't_ be mentioned, it's hard to say what the
right match would be (e.g., would there be a leading space?).

Instead, let's just choose a match that is much less likely to appear.
The actual content of the header isn't important, since it's supposed to
be ignored.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agogit-jump: ignore deleted files in diff mode
Jeff King [Sun, 15 Sep 2024 11:20:24 +0000 (07:20 -0400)] 
git-jump: ignore deleted files in diff mode

If you do something like this:

  rm file_a
  echo change >file_b
  git jump diff

then we'll generate two quickfix entries for the diff, one for each
file. But the one for the deleted file is rather pointless. There's no
content to show since the file is gone, and in fact we open the editor
with the path /dev/null!

In vim, at least, the result is a confusing annoyance: the editor opens
with an empty buffer, and you have to skip past it to the useful
quickfix entry (after scratching your head and figuring out that no,
nothing is broken).

Let's skip such entries entirely. There's nothing useful to show, since
the point is that the file has been deleted.

It is possible that you could be doing a diff whose post-image is not
the working tree, and then you'd perhaps be jumping to the deleted
content (or at least something that was in the same spot). But I don't
think it's worth worrying about that case. For one thing, using git-jump
for such diffs is a bad idea in general, as it's going to sometimes move
you to the wrong spot. And two, a deletion is always going to have one
hunk starting at line 1, which is not that interesting to jump to in the
first place.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agogit-jump: always specify column 1 for diff entries
Jeff King [Sun, 15 Sep 2024 11:18:46 +0000 (07:18 -0400)] 
git-jump: always specify column 1 for diff entries

When we generate a quickfix entry for a diff hunk, we provide just the
filename and line number along with the content, like:

  file:1: contents of the line

This can be a problem if the line itself looks like a quickfix header.
For example (and this is adapted from a real-world case that bit me):

  echo 'static_lease 10:11:12:13:14:15:16 10.0.0.1' >file
  git add file
  echo change >file

produces:

  file:1: static_lease 10:11:12:13:14:15:16 10.0.0.1

which is ambiguous. It could be line 1 of "file", or line 11 of the file
"file:1: static_lease 10", and so on. In the case of vim's default
config, it seems to prefer the latter (you can configure "errorformat"
with a variety of patterns, but out of the box it matches some common
ones).

One easy way to fix this is to provide a column number, like:

  file:1:1: static_lease 10:11:12:13:14:15:16 10.0.0.1

which causes vim to prefer line 1 of "file" again (due to the preference
order of the various patterns in the default errorformat).

There are other options. For example, at least in my version of vim,
wrapping the file in quotation marks like:

  "file":1: static_lease 10:11:12:13:14:15:16 10.0.0.1

also works. That perhaps would the right thing even if you had the silly
file name "file:1:1: foo 10". But it's not clear what would happen if
you had a filename with quotes in it.

This feature is inherently scraping text, and there's bound to be some
ambiguities. I don't think it's worth worrying too much about unlikely
filenames, as its the file content that is more likely to introduce
unexpected characters.

So let's just go with the extra ":1" column specifier. We know this is
supported everywhere, as git-jump's "grep" mode already uses it (and
thus doesn't exhibit the same problem).

The "merge" mode is mostly immune to this, as it only matches "<<<<<<<"
conflict marker lines. It's possible of course to have a marker that
says "foo 10:11" later in the line, but in practice these will only have
branches and perhaps file names, so it's probably not worth worrying
about (and fixing it would involve passing --column to the system grep,
which may not be portable).

I also gave some thought as to whether we could put something more
useful than "1" in the column field for diffs. In theory we could find
the first changed character of the line, but this is tricky in practice.
You'd have to correlate before/after lines of the hunk to decide what
changed. So:

  -this is a foo line
  +this is a bar line

is easy (column 11). But:

  -this is a foo line
  +another line
  +this is a bar line

is harder.

This commit certainly doesn't preclude trying to do something more
clever later, but it's a much deeper rabbit hole than just fixing the
syntactic ambiguity.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoprint an error when remote helpers die during capabilities
Jeff King [Fri, 17 Jan 2014 20:36:21 +0000 (15:36 -0500)] 
print an error when remote helpers die during capabilities

The transport-helper code generally relies on the
remote-helper to provide an informative message to the user
when it encounters an error. In the rare cases where the
helper does not do so, the output can be quite confusing.
E.g.:

  $ git clone https://example.com/foo.git
  Cloning into 'foo'...
  $ echo $?
  128
  $ ls foo
  /bin/ls: cannot access foo: No such file or directory

We tried to address this with 81d340d (transport-helper:
report errors properly, 2013-04-10).

But that makes the common case much more confusing. The
remote helper protocol's method for signaling normal errors
is to simply hang up. So when the helper does encounter a
routine error and prints something to stderr, the extra
error message is redundant and misleading. So we dropped it
again in 266f1fd (transport-helper: be quiet on read errors
from helpers, 2013-06-21).

This puts the uncommon case right back where it started. We
may be able to do a little better, though. It is common for
the helper to die during a "real" command, like fetching the
list of remote refs. It is not common for it to die during
the initial "capabilities" negotiation, right after we
start. Reporting failure here is likely to catch fundamental
problems that prevent the helper from running (and reporting
errors) at all. Anything after that is the responsibility of
the helper itself to report.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoSync with Git 2.46.1
Junio C Hamano [Fri, 13 Sep 2024 22:28:15 +0000 (15:28 -0700)] 
Sync with Git 2.46.1

9 months agoThe sixteenth batch
Junio C Hamano [Fri, 13 Sep 2024 21:48:30 +0000 (14:48 -0700)] 
The sixteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'bl/trailers-and-incomplete-last-line-fix'
Junio C Hamano [Fri, 13 Sep 2024 22:27:45 +0000 (15:27 -0700)] 
Merge branch 'bl/trailers-and-incomplete-last-line-fix'

The interpret-trailers command failed to recognise the end of the
message when the commit log ends in an incomplete line.

* bl/trailers-and-incomplete-last-line-fix:
  interpret-trailers: handle message without trailing newline

9 months agoMerge branch 'rj/cygwin-has-dev-tty'
Junio C Hamano [Fri, 13 Sep 2024 22:27:44 +0000 (15:27 -0700)] 
Merge branch 'rj/cygwin-has-dev-tty'

Cygwin does have /dev/tty support that is needed by things like
single-key input mode.

* rj/cygwin-has-dev-tty:
  config.mak.uname: add HAVE_DEV_TTY to cygwin config section

9 months agoMerge branch 'rs/diff-exit-code-fix'
Junio C Hamano [Fri, 13 Sep 2024 22:27:43 +0000 (15:27 -0700)] 
Merge branch 'rs/diff-exit-code-fix'

In a few corner cases "git diff --exit-code" failed to report
"changes" (e.g., renamed without any content change), which has
been corrected.

* rs/diff-exit-code-fix:
  diff: report dirty submodules as changes in builtin_diff()
  diff: report copies and renames as changes in run_diff_cmd()

9 months agoMerge branch 'jc/doc-skip-fetch-all-and-prefetch'
Junio C Hamano [Fri, 13 Sep 2024 22:27:43 +0000 (15:27 -0700)] 
Merge branch 'jc/doc-skip-fetch-all-and-prefetch'

Doc updates.

* jc/doc-skip-fetch-all-and-prefetch:
  doc: remote.*.skip{DefaultUpdate,FetchAll} stops prefetch

9 months agoMerge branch 'ds/doc-wholesale-disabling-advice-messages'
Junio C Hamano [Fri, 13 Sep 2024 22:27:43 +0000 (15:27 -0700)] 
Merge branch 'ds/doc-wholesale-disabling-advice-messages'

The environment GIT_ADVICE has been intentionally kept undocumented
to discourage its use by interactive users.  Add documentation to
help tool writers.

* ds/doc-wholesale-disabling-advice-messages:
  advice: recommend GIT_ADVICE=0 for tools

9 months agoMerge branch 'jk/sparse-fdleak-fix'
Junio C Hamano [Fri, 13 Sep 2024 22:27:42 +0000 (15:27 -0700)] 
Merge branch 'jk/sparse-fdleak-fix'

A file descriptor left open is now properly closed when "git
sparse-checkout" updates the sparse patterns.

* jk/sparse-fdleak-fix:
  sparse-checkout: use fdopen_lock_file() instead of xfdopen()
  sparse-checkout: check commit_lock_file when writing patterns
  sparse-checkout: consolidate cleanup when writing patterns

9 months agoMerge branch 'ds/scalar-no-tags'
Junio C Hamano [Fri, 13 Sep 2024 22:27:42 +0000 (15:27 -0700)] 
Merge branch 'ds/scalar-no-tags'

The "scalar clone" command learned the "--no-tags" option.

* ds/scalar-no-tags:
  scalar: add --no-tags option to 'scalar clone'

9 months agoGit 2.46.1 v2.46.1
Junio C Hamano [Fri, 13 Sep 2024 21:05:56 +0000 (14:05 -0700)] 
Git 2.46.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'rj/compat-terminal-unused-fix' into maint-2.46
Junio C Hamano [Fri, 13 Sep 2024 22:26:52 +0000 (15:26 -0700)] 
Merge branch 'rj/compat-terminal-unused-fix' into maint-2.46

Build fix.

* rj/compat-terminal-unused-fix:
  compat/terminal: mark parameter of git_terminal_prompt() UNUSED

9 months agoMerge branch 'jc/config-doc-update' into maint-2.46
Junio C Hamano [Fri, 13 Sep 2024 22:26:52 +0000 (15:26 -0700)] 
Merge branch 'jc/config-doc-update' into maint-2.46

Docfix.

* jc/config-doc-update:
  git-config.1: fix description of --regexp in synopsis
  git-config.1: --get-all description update

9 months agoMerge branch 'aa/cat-file-batch-output-doc' into maint-2.46
Junio C Hamano [Fri, 13 Sep 2024 22:26:51 +0000 (15:26 -0700)] 
Merge branch 'aa/cat-file-batch-output-doc' into maint-2.46

Docfix.

* aa/cat-file-batch-output-doc:
  docs: explain the order of output in the batched mode of git-cat-file(1)

9 months agoMerge branch 'cl/config-regexp-docfix' into maint-2.46
Junio C Hamano [Fri, 13 Sep 2024 22:26:51 +0000 (15:26 -0700)] 
Merge branch 'cl/config-regexp-docfix' into maint-2.46

Docfix.

* cl/config-regexp-docfix:
  doc: replace 3 dash with correct 2 dash in git-config(1)

9 months agoMerge branch 'jc/coding-style-c-operator-with-spaces' into maint-2.46
Junio C Hamano [Fri, 13 Sep 2024 22:26:51 +0000 (15:26 -0700)] 
Merge branch 'jc/coding-style-c-operator-with-spaces' into maint-2.46

Write down whitespacing rules around C opeators.

* jc/coding-style-c-operator-with-spaces:
  CodingGuidelines: spaces around C operators

9 months agoMerge branch 'ps/stash-keep-untrack-empty-fix' into maint-2.46
Junio C Hamano [Fri, 13 Sep 2024 22:26:50 +0000 (15:26 -0700)] 
Merge branch 'ps/stash-keep-untrack-empty-fix' into maint-2.46

A corner case bug in "git stash" was fixed.

* ps/stash-keep-untrack-empty-fix:
  builtin/stash: fix `--keep-index --include-untracked` with empty HEAD

9 months agoMerge branch 'ps/index-pack-outside-repo-fix' into maint-2.46
Junio C Hamano [Fri, 13 Sep 2024 22:26:50 +0000 (15:26 -0700)] 
Merge branch 'ps/index-pack-outside-repo-fix' into maint-2.46

"git verify-pack" and "git index-pack" started dying outside a
repository, which has been corrected.

* ps/index-pack-outside-repo-fix:
  builtin/index-pack: fix segfaults when running outside of a repo

9 months agoMerge branch 'jk/free-commit-buffer-of-skipped-commits' into maint-2.46
Junio C Hamano [Fri, 13 Sep 2024 22:26:49 +0000 (15:26 -0700)] 
Merge branch 'jk/free-commit-buffer-of-skipped-commits' into maint-2.46

The code forgot to discard unnecessary in-core commit buffer data
for commits that "git log --skip=<number>" traversed but omitted
from the output, which has been corrected.

* jk/free-commit-buffer-of-skipped-commits:
  revision: free commit buffers for skipped commits

9 months agoadd: pass in repo variable instead of global the_repository
John Cai [Fri, 13 Sep 2024 21:16:17 +0000 (21:16 +0000)] 
add: pass in repo variable instead of global the_repository

With the repository variable available in the builtin function as an
argument, pass this down into helper functions instead of using the
global the_repository.

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agobuiltin: remove USE_THE_REPOSITORY for those without the_repository
John Cai [Fri, 13 Sep 2024 21:16:16 +0000 (21:16 +0000)] 
builtin: remove USE_THE_REPOSITORY for those without the_repository

For builtins that do not operate on a repository, remove
the #define USE_THE_REPOSITORY.

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agobuiltin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h
John Cai [Fri, 13 Sep 2024 21:16:15 +0000 (21:16 +0000)] 
builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h

Instead of including USE_THE_REPOSITORY_VARIABLE by default on every
builtin, remove it from builtin.h and add it to all the builtins that
include builtin.h (by definition, that means all builtins/*.c).

Also, remove the include statement for repository.h since it gets
brought in through builtin.h.

The next step will be to migrate each builtin
from having to use the_repository.

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agobuiltin: add a repository parameter for builtin functions
John Cai [Fri, 13 Sep 2024 21:16:14 +0000 (21:16 +0000)] 
builtin: add a repository parameter for builtin functions

In order to reduce the usage of the global the_repository, add a
parameter to builtin functions that will get passed a repository
variable.

This commit uses UNUSED on most of the builtin functions, as subsequent
commits will modify the actual builtins to pass the repository parameter
down.

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot5512.40 sometimes dies by SIGPIPE
Junio C Hamano [Fri, 13 Sep 2024 19:26:41 +0000 (12:26 -0700)] 
t5512.40 sometimes dies by SIGPIPE

The last test in t5512 we recently added seems to be flaky.
Running

    $ make && cd t && sh ./t5512-ls-remote.sh --stress

shows that "git ls-remote foo::bar" exited with status 141, which
means we got a SIGPIPE.  This test piece was introduced by 9e89dcb6
(builtin/ls-remote: fall back to SHA1 outside of a repo, 2024-08-02)
and is pretty much independent from all other tests in the script
(it can even run standalone with everything before it removed).

The transport-helper.c:get_helper() function tries to write to the
helper.  As we can see the helper script is very short and can exit
even before it reads anything, when get_helper() tries to give the
first command, "capabilities", the helper may already be gone.

A trivial fix, presented here, is to make sure that the helper reads
the first command it is given, as what it writes later is a response
to that command.

I however would wonder if the interactions with the helper initiated
by get_helper() should be done on a non-blocking I/O (we do check
the return value from our write(2) system calls, do we?).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoGit.pm: use "rev-parse --absolute-git-dir" rather than perl code
Jeff King [Thu, 12 Sep 2024 22:37:25 +0000 (18:37 -0400)] 
Git.pm: use "rev-parse --absolute-git-dir" rather than perl code

When we open a repository with the "Directory" option, we use "rev-parse
--git-dir" to get the path relative to that directory, and then use
Cwd::abs_path() to make it absolute (since our process working directory
may not be the same).

These days we can just ask for "--absolute-git-dir" instead, which saves
us a little code. That option was added in Git v2.13.0 via a2f5a87626
(rev-parse: add '--absolute-git-dir' option, 2017-02-03). I don't think
we make any promises about running mismatched versions of git and
Git.pm, but even if somebody tries it, that's sufficiently old that it
should be OK.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoGit.pm: fix bare repository search with Directory option
Jeff King [Thu, 12 Sep 2024 22:36:04 +0000 (18:36 -0400)] 
Git.pm: fix bare repository search with Directory option

When opening a bare repository like:

  Git->repository(Directory => '/path/to/bare.git');

we will incorrectly point the repository object at the _current_
directory, not the one specified by the option.

The bug was introduced by 20da61f25f (Git.pm: trust rev-parse to find
bare repositories, 2022-10-22). Before then, we'd ask "rev-parse
--git-dir" if it was a Git repo, and if it returned anything, we'd
correctly convert that result to an absolute path using File::Spec and
Cwd::abs_path(). If it didn't, we'd guess it might be a bare repository
and find it ourselves, which was wrong (rev-parse should find even a
bare repo, and our search circumvented some of its rules).

That commit dropped most of the custom bare-repo search code in favor of
using "rev-parse --is-bare-repository" and trusting the "--git-dir" it
returned. But it mistakenly left some of the bare-repo code path in
place, which was now broken. That code calls Cwd::abs_path($dir); prior
to 20da61f25f $dir contained the "Directory" option the user passed in.
But afterwards, it contains the output of "rev-parse --git-dir". And
since our tentative rev-parse command is invoked after changing
directory, it will always be the relative path "."! So we'll end up with
the absolute path of the process's current directory, not the Directory
option the caller asked for.

So the non-bare case is correct, but the bare one is broken. Our tests
only check the non-bare one, so we didn't notice. We can fix this by
running the same absolute-path fixup code for both sides.

Helped-by: Rodrigo <rodrigolive@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoci: add Ubuntu 16.04 job to GitLab CI
Patrick Steinhardt [Fri, 13 Sep 2024 05:52:51 +0000 (07:52 +0200)] 
ci: add Ubuntu 16.04 job to GitLab CI

In the preceding commits we had to convert the linux32 job to be based
on Ubuntu 20.04 instead of Ubuntu 16.04 due to a limitation in GitHub
Workflows. This was the only job left that still tested against this old
but supported Ubuntu version, and we have no other jobs that test with a
comparatively old Linux distribution.

Add a new job to GitLab CI that tests with Ubuntu 16.04 to cover the
resulting test gap. GitLab doesn't modify Docker images in the same way
GitHub does and thus doesn't fall prey to the same issue. There are two
compatibility issues uncovered by this:

  - Ubuntu 16.04 does not support HTTP/2 in Apache. We thus cannot set
    `GIT_TEST_HTTPD=true`, which would otherwise cause us to fail when
    Apache fails to start.

  - Ubuntu 16.04 cannot use recent JGit versions as they depend on a
    more recent Java runtime than we have available. We thus disable
    installing any kind of optional dependencies that do not come from
    the package manager.

These two restrictions are fine though, as we only really care about
whether Git compiles and runs on such old distributions in the first
place.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agounicode: update the width tables to Unicode 16
Beat Bolli [Thu, 12 Sep 2024 20:40:47 +0000 (22:40 +0200)] 
unicode: update the width tables to Unicode 16

Unicode 16 has been announced on 2024-09-10 [0], so update the character
width tables to the new version.

[0] https://blog.unicode.org/2024/09/announcing-unicode-standard-version-160.html

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot/interop: allow per-version make options
Jeff King [Wed, 11 Sep 2024 06:10:09 +0000 (02:10 -0400)] 
t/interop: allow per-version make options

Building older versions of Git may require tweaking some build knobs. In
particular, very old versions of Git will fail to build with recent
OpenSSL, because the bignum type switched from a struct to a pointer.

The i5500 interop test uses Git v1.0.0 by default, which triggers this
problem. You can work around it by setting NO_OPENSSL in your
GIT_TEST_MAKE_OPTS variable. But there are two downsides:

  1. You have to know to do this, and it's not at all obvious.

  2. That sets the options for _all_ versions of Git that we build. And
     it's possible for two versions to require conflicting knobs. E.g.,
     building with "make NO_OPENSSL=Nope OPENSSL_SHA1=Yes" causes
     imap-send.c to barf, because it declares a fallback typedef for SSL.
     This is something we may want to fix, but of course many historical
     versions are affected, and the interop scripts should be flexible
     enough to build everything.

So let's introduce per-version make options, along with the ability for
scripts to specify knobs that match their default versions. That should
make everything build out of the box, but also allow testers flexibility
if they are testing interoperability between non-default versions.

We'll set NO_OPENSSL by default for v1.0.0 in i5500. It doesn't have to
worry about the conflict with OPENSSL_SHA1 because imap-send did not
exist back then (but if it did, it could also just explicitly use a
different hash implementation).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoSync with 'maint'
Junio C Hamano [Thu, 12 Sep 2024 18:48:46 +0000 (11:48 -0700)] 
Sync with 'maint'

9 months agoThe fifteenth batch
Junio C Hamano [Thu, 12 Sep 2024 17:36:55 +0000 (10:36 -0700)] 
The fifteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'kl/cat-file-on-sparse-index'
Junio C Hamano [Thu, 12 Sep 2024 18:47:23 +0000 (11:47 -0700)] 
Merge branch 'kl/cat-file-on-sparse-index'

"git cat-file" works well with the sparse-index, and gets marked as
such.

* kl/cat-file-on-sparse-index:
  builtin/cat-file: mark 'git cat-file' sparse-index compatible
  t1092: allow run_on_* functions to use standard input

9 months agoMerge branch 'jk/messages-with-excess-lf-fix'
Junio C Hamano [Thu, 12 Sep 2024 18:47:23 +0000 (11:47 -0700)] 
Merge branch 'jk/messages-with-excess-lf-fix'

One-line messages to "die" and other helper functions will get LF
added by these helper functions, but many existing messages had an
unnecessary LF at the end, which have been corrected.

* jk/messages-with-excess-lf-fix:
  drop trailing newline from warning/error/die messages

9 months agoMerge branch 'ps/pack-refs-auto-heuristics'
Junio C Hamano [Thu, 12 Sep 2024 18:47:23 +0000 (11:47 -0700)] 
Merge branch 'ps/pack-refs-auto-heuristics'

"git pack-refs --auto" for the files backend was too aggressive,
which has been a bit tamed.

* ps/pack-refs-auto-heuristics:
  refs/files: use heuristic to decide whether to repack with `--auto`
  t0601: merge tests for auto-packing of refs
  wrapper: introduce `log2u()`

9 months agoMerge branch 'tb/multi-pack-reuse-fix'
Junio C Hamano [Thu, 12 Sep 2024 18:47:23 +0000 (11:47 -0700)] 
Merge branch 'tb/multi-pack-reuse-fix'

A data corruption bug when multi-pack-index is used and the same
objects are stored in multiple packfiles has been corrected.

* tb/multi-pack-reuse-fix:
  builtin/pack-objects.c: do not open-code `MAX_PACK_OBJECT_HEADER`
  pack-bitmap.c: avoid repeated `pack_pos_to_offset()` during reuse
  builtin/pack-objects.c: translate bit positions during pack-reuse
  pack-bitmap: tag bitmapped packs with their corresponding MIDX
  t/t5332-multi-pack-reuse.sh: verify pack generation with --strict

9 months agoMerge branch 'gt/unit-test-oid-array'
Junio C Hamano [Thu, 12 Sep 2024 18:47:22 +0000 (11:47 -0700)] 
Merge branch 'gt/unit-test-oid-array'

Another unit-test.

* gt/unit-test-oid-array:
  t: port helper/test-oid-array.c to unit-tests/t-oid-array.c

9 months agoMerge branch 'ps/index-pack-outside-repo-fix'
Junio C Hamano [Thu, 12 Sep 2024 18:47:22 +0000 (11:47 -0700)] 
Merge branch 'ps/index-pack-outside-repo-fix'

"git verify-pack" and "git index-pack" started dying outside a
repository, which has been corrected.

* ps/index-pack-outside-repo-fix:
  builtin/index-pack: fix segfaults when running outside of a repo

9 months agoMerge branch 'jc/mailinfo-header-cleanup'
Junio C Hamano [Thu, 12 Sep 2024 18:47:22 +0000 (11:47 -0700)] 
Merge branch 'jc/mailinfo-header-cleanup'

Code clean-up.

* jc/mailinfo-header-cleanup:
  mailinfo: we parse fixed headers

9 months agoAnother batch of topics for 2.46.1
Junio C Hamano [Thu, 12 Sep 2024 18:09:46 +0000 (11:09 -0700)] 
Another batch of topics for 2.46.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jc/grammo-fixes' into maint-2.46
Junio C Hamano [Thu, 12 Sep 2024 18:02:19 +0000 (11:02 -0700)] 
Merge branch 'jc/grammo-fixes' into maint-2.46

Doc updates.

* jc/grammo-fixes:
  doc: grammofix in git-diff-tree
  tutorial: grammofix

9 months agoMerge branch 'jc/tests-no-useless-tee' into maint-2.46
Junio C Hamano [Thu, 12 Sep 2024 18:02:18 +0000 (11:02 -0700)] 
Merge branch 'jc/tests-no-useless-tee' into maint-2.46

Test fixes.

* jc/tests-no-useless-tee:
  tests: drop use of 'tee' that hides exit status

9 months agoMerge branch 'jc/how-to-maintain-updates' into maint-2.46
Junio C Hamano [Thu, 12 Sep 2024 18:02:17 +0000 (11:02 -0700)] 
Merge branch 'jc/how-to-maintain-updates' into maint-2.46

Doc updates.

* jc/how-to-maintain-updates:
  howto-maintain: mention preformatted docs

9 months agoMerge branch 'ps/bundle-outside-repo-fix' into maint-2.46
Junio C Hamano [Thu, 12 Sep 2024 18:02:16 +0000 (11:02 -0700)] 
Merge branch 'ps/bundle-outside-repo-fix' into maint-2.46

"git bundle unbundle" outside a repository triggered a BUG()
unnecessarily, which has been corrected.

* ps/bundle-outside-repo-fix:
  bundle: default to SHA1 when reading bundle headers
  builtin/bundle: have unbundle check for repo before opening its bundle

9 months agoMerge branch 'jc/patch-id' into maint-2.46
Junio C Hamano [Thu, 12 Sep 2024 18:02:16 +0000 (11:02 -0700)] 
Merge branch 'jc/patch-id' into maint-2.46

The patch parser in "git patch-id" has been tightened to avoid
getting confused by lines that look like a patch header in the log
message.
cf. <Zqh2T_2RLt0SeKF7@tanuki>

* jc/patch-id:
  patch-id: tighten code to detect the patch header
  patch-id: rewrite code that detects the beginning of a patch
  patch-id: make get_one_patchid() more extensible
  patch-id: call flush_current_id() only when needed
  t4204: patch-id supports various input format

9 months agoMerge branch 'jk/apply-patch-mode-check-fix' into maint-2.46
Junio C Hamano [Thu, 12 Sep 2024 18:02:15 +0000 (11:02 -0700)] 
Merge branch 'jk/apply-patch-mode-check-fix' into maint-2.46

Test fix.

* jk/apply-patch-mode-check-fix:
  t4129: fix racy index when calling chmod after git-add
  apply: canonicalize modes read from patches

9 months agoimap-send: handle NO_OPENSSL even when openssl exists
Jeff King [Wed, 11 Sep 2024 06:12:57 +0000 (02:12 -0400)] 
imap-send: handle NO_OPENSSL even when openssl exists

If NO_OPENSSL is defined, then imap-send.c defines a fallback "SSL"
type, which is just a void pointer that remains NULL. This works, but it
has one problem: it is using the type name "SSL", which conflicts with
the upstream name, if some other part of the system happens to include
openssl. For example:

  $ make NO_OPENSSL=Nope OPENSSL_SHA1=Yes imap-send.o
      CC imap-send.o
  imap-send.c:35:15: error: conflicting types for ‘SSL’; have ‘void *’
     35 | typedef void *SSL;
        |               ^~~
  In file included from /usr/include/openssl/evp.h:26,
                   from sha1/openssl.h:4,
                   from hash.h:10,
                   from object.h:4,
                   from commit.h:4,
                   from refs.h:4,
                   from setup.h:4,
                   from imap-send.c:32:
  /usr/include/openssl/types.h:187:23: note: previous declaration of ‘SSL’ with type ‘SSL’ {aka ‘struct ssl_st’}
    187 | typedef struct ssl_st SSL;
        |                       ^~~
  make: *** [Makefile:2761: imap-send.o] Error 1

This is not a terribly common combination in practice:

  1. Why are we disabling openssl support but still using its sha1? The
     answer is that you may use the same build options across many
     versions, and some older versions of Git no longer build with
     modern versions of openssl.

  2. Why are we using a totally unsafe sha1 that does not detect
     collisions? You're right, we shouldn't. But in preparation for
     using unsafe sha1 for non-cryptographic checksums, it would be nice
     to be able to turn it on without hassle.

We can make this work by adjusting the way imap-send handles its
fallback. One solution is something like this:

  #ifdef NO_OPENSSL
  #define git_SSL void *
  #else
  #define git_SSL SSL
  #endif

But we can observe that we only need this definition in one spot: the
struct which holds the variable. So rather than play around with macros
that may cause unexpected effects, we can just directly use the correct
type in that struct.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoci: use regular action versions for linux32 job
Jeff King [Thu, 12 Sep 2024 09:48:41 +0000 (05:48 -0400)] 
ci: use regular action versions for linux32 job

The linux32 job runs inside a docker container with a 32-bit libc, etc.
This breaks any GitHub Actions scripts that are implemented in
javascript, because they ship with their own 64-bit version of Node.js
that's dynamically linked. They'll fail with a message like:

    exec /__e/node20/bin/node: no such file or directory

because they can't find the runtime linker.

This hasn't been a problem until recently because we special-case older,
non-javascript versions of these actions for the linux32 job. But it
recently became an issue when our old version of actions/upload-artifact
was deprecated, causing the job to fail. We worked around that in
90f2c7240c (ci: remove 'Upload failed tests' directories' step from
linux32 jobs, 2024-09-09), but it meant a loss of functionality for that
job. And we may eventually run into the same deprecation problem with
actions/checkout, which can't just be removed.

We can solve the linking issue by installing the 64-bit libc and stdc++
packages before doing anything else. Coupled with the switch to a more
recent image in the previous patch, that lets us remove the
special-casing of the action scripts entirely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoci: use more recent linux32 image
Jeff King [Thu, 12 Sep 2024 09:47:30 +0000 (05:47 -0400)] 
ci: use more recent linux32 image

The Xenial image we're using was released more than 8 years ago. This is
a problem for using some recent GitHub Actions scripts, as they require
Node.js 20, and all of the binaries they ship need glibc 2.28 or later.
We're not using them yet, but moving forward prepares us for a future
patch which will.

Xenial was actually the last official 32-bit Ubuntu release, but you can
still find i386 images for more recent releases. This patch uses Focal,
which was released in 2020 (and is the oldest one with glibc 2.28).

There are two small downsides here:

  - while Xenial is pretty old, it is still in LTS support until April
    2026. So there's probably some value in testing with such an old
    system, and we're losing that.

  - there are no i386 subversion packages in the Focal repository. So we
    won't be able to test that (OTOH, we had never tested it until the
    previous patch which unified the 32/64-bit dependency code).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoci: unify ubuntu and ubuntu32 dependencies
Jeff King [Thu, 12 Sep 2024 09:45:37 +0000 (05:45 -0400)] 
ci: unify ubuntu and ubuntu32 dependencies

The script to install dependencies has two separate entries for 32-bit
and 64-bit Ubuntu systems. This increases the maintenance burden since
both should need roughly the same packages.

That hasn't been too bad so far because we've stayed on the same 32-bit
image since 2017. Trying to move to a newer image revealed several
problems with the linux32 job:

  - newer images complain about using "linux32 --32bit i386", due to
    seccomp restrictions. We can loosen these with a docker option, but
    I don't think running it is even doing anything. We use it only for
    pretending to "apt" that we're on a 32-bit machine, but inside the
    container image apt is already configured as a 32-bit system (even
    though the kernel outside the container is obviously 64-bit).  Using
    the same apt invocation for both architectures just gets rid of this
    call entirely.

  - we set DEBIAN_FRONTEND to avoid hanging on packages that ask the
    user questions. This wasn't a problem on the old image, but it is on
    newer ones. The 64-bit stanza handles this already.

    As a bonus, the 64-bit stanza uses "apt -q" instead of redirecting
    output to /dev/null. This would have saved me a lot of debugging
    time trying to figure out why it was hanging. :)

  - the old image seems to have zlib-dev installed by default, but newer
    ones do not.

In addition, there were probably many tests being skipped on the 32-bit
build because we didn't have support packages installed (e.g., gpg). Now
we'll run them.

We do need to keep some parts split off just for 64-bit systems: our p4
and lfs installs reference x86_64/amd64 binaries. The downloaded jgit
should work in theory, since it's just a jar file embedded in a shell
script that relies on the system java. But the system java in our image
is too old, so I've left it as 64-bit only for now.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoci: drop run-docker scripts
Jeff King [Thu, 12 Sep 2024 09:43:36 +0000 (05:43 -0400)] 
ci: drop run-docker scripts

We haven't used these scripts since 4a6e4b9602 (CI: remove Travis CI
support, 2021-11-23), as the GitHub Actions config has support for
directly running jobs within docker containers.

It's possible we might want to resurrect something like this in order to
be more agnostic to the CI platform. But it's not clear exactly what it
would look like. And in the meantime, it's just a maintenance burden as
we make changes to CI config, and is subject to bitrot. In fact it's
already broken; it references ci/install-docker-dependencies.sh, which
went away in 9cdeb34b96 (ci: merge scripts which install dependencies,
2024-04-12).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoenvironment: stop storing "core.notesRef" globally
Patrick Steinhardt [Thu, 12 Sep 2024 11:30:26 +0000 (13:30 +0200)] 
environment: stop storing "core.notesRef" globally

Stop storing the "core.notesRef" config value globally. Instead,
retrieve the value in `default_notes_ref()`. The code is never called in
a hot loop anyway, so doing this on every invocation should be perfectly
fine.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoenvironment: stop storing "core.warnAmbiguousRefs" globally
Patrick Steinhardt [Thu, 12 Sep 2024 11:30:24 +0000 (13:30 +0200)] 
environment: stop storing "core.warnAmbiguousRefs" globally

Same as the preceding commits, storing the "core.warnAmbiguousRefs"
value globally is misdesigned as this setting may be set per repository.

Move the logic into the repo-settings subsystem. The usual pattern here
is that users are expected to call `prepare_repo_settings()` before they
access the settings themselves. This seems somewhat fragile though, as
it is easy to miss and leads to somewhat ugly code patterns at the call
sites.

Instead, introduce a new function that encapsulates this logic for us.
This also allows us to change how exactly the lazy initialization works
in the future, e.g. by only partially initializing values as requested
by the caller.

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