]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
16 months agoMerge branch 'jk/ext-diff-with-relative' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:50 +0000 (14:15 -0800)] 
Merge branch 'jk/ext-diff-with-relative' into maint-2.39

"git diff --relative" did not mix well with "git diff --ext-diff",
which has been corrected.

* jk/ext-diff-with-relative:
  diff: drop "name" parameter from prepare_temp_file()
  diff: clean up external-diff argv setup
  diff: use filespec path to set up tempfiles for ext-diff

16 months agoMerge branch 'ab/bundle-wo-args' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:50 +0000 (14:15 -0800)] 
Merge branch 'ab/bundle-wo-args' into maint-2.39

Fix to a small regression in 2.38 days.

* ab/bundle-wo-args:
  bundle <cmd>: have usage_msg_opt() note the missing "<file>"
  builtin/bundle.c: remove superfluous "newargc" variable
  bundle: don't segfault on "git bundle <subcmd>"

16 months agoMerge branch 'ps/fsync-refs-fix' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:50 +0000 (14:15 -0800)] 
Merge branch 'ps/fsync-refs-fix' into maint-2.39

Fix the sequence to fsync $GIT_DIR/packed-refs file that forgot to
flush its output to the disk..

* ps/fsync-refs-fix:
  refs: fix corruption by not correctly syncing packed-refs to disk

16 months agoMerge branch 'lk/line-range-parsing-fix' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:49 +0000 (14:15 -0800)] 
Merge branch 'lk/line-range-parsing-fix' into maint-2.39

When given a pattern that matches an empty string at the end of a
line, the code to parse the "git diff" line-ranges fell into an
infinite loop, which has been corrected.

* lk/line-range-parsing-fix:
  line-range: fix infinite loop bug with '$' regex

16 months agoMerge branch 'rs/use-enhanced-bre-on-macos' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:49 +0000 (14:15 -0800)] 
Merge branch 'rs/use-enhanced-bre-on-macos' into maint-2.39

Newer regex library macOS stopped enabling GNU-like enhanced BRE,
where '\(A\|B\)' works as alternation, unless explicitly asked with
the REG_ENHANCED flag.  "git grep" now can be compiled to do so, to
retain the old behaviour.

* rs/use-enhanced-bre-on-macos:
  use enhanced basic regular expressions on macOS

16 months agoMerge branch 'jk/curl-avoid-deprecated-api' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:49 +0000 (14:15 -0800)] 
Merge branch 'jk/curl-avoid-deprecated-api' into maint-2.39

Deal with a few deprecation warning from cURL library.

* jk/curl-avoid-deprecated-api:
  http: support CURLOPT_PROTOCOLS_STR
  http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
  http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT

16 months agoMerge branch 'jk/avoid-redef-system-functions' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:49 +0000 (14:15 -0800)] 
Merge branch 'jk/avoid-redef-system-functions' into maint-2.39

The jk/avoid-redef-system-functions-2.30 topic pre-merged for more
recent codebase.

* jk/avoid-redef-system-functions:

16 months agoMerge branch 'jk/avoid-redef-system-functions-2.30' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:47 +0000 (14:15 -0800)] 
Merge branch 'jk/avoid-redef-system-functions-2.30' into maint-2.39

Redefining system functions for a few functions did not follow our
usual "implement git_foo() and #define foo(args) git_foo(args)"
pattern, which has broken build for some folks.

* jk/avoid-redef-system-functions-2.30:
  git-compat-util: undefine system names before redeclaring them
  git-compat-util: avoid redefining system function names

16 months agoMerge branch 'tb/ci-concurrency' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:46 +0000 (14:15 -0800)] 
Merge branch 'tb/ci-concurrency' into maint-2.39

Avoid unnecessary builds in CI, with settings configured in
ci-config.

* tb/ci-concurrency:
  ci: avoid unnecessary builds

16 months agoMerge branch 'cw/ci-whitespace' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:45 +0000 (14:15 -0800)] 
Merge branch 'cw/ci-whitespace' into maint-2.39

CI updates.  We probably want a clean-up to move the long shell
script embedded in yaml file into a separate file, but that can
come later.

* cw/ci-whitespace:
  ci (check-whitespace): move to actions/checkout@v3
  ci (check-whitespace): add links to job output
  ci (check-whitespace): suggest fixes for errors

16 months agoMerge branch 'js/ci-disable-cmake-by-default' into maint-2.39
Junio C Hamano [Tue, 14 Feb 2023 22:15:45 +0000 (14:15 -0800)] 
Merge branch 'js/ci-disable-cmake-by-default' into maint-2.39

Stop running win+VS build by default.

* js/ci-disable-cmake-by-default:
  ci: only run win+VS build & tests in Git for Windows' fork

16 months agoGit 2.39.2 v2.39.2
Johannes Schindelin [Mon, 6 Feb 2023 08:43:41 +0000 (09:43 +0100)] 
Git 2.39.2

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoSync with 2.38.4
Johannes Schindelin [Mon, 6 Feb 2023 08:43:39 +0000 (09:43 +0100)] 
Sync with 2.38.4

* maint-2.38:
  Git 2.38.4
  Git 2.37.6
  Git 2.36.5
  Git 2.35.7
  Git 2.34.7
  http: support CURLOPT_PROTOCOLS_STR
  http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
  http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT
  Git 2.33.7
  Git 2.32.6
  Git 2.31.7
  Git 2.30.8
  apply: fix writing behind newly created symbolic links
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
  clone: delay picking a transport until after get_repo_path()
  t5619: demonstrate clone_local() with ambiguous transport

16 months agoGit 2.38.4 v2.38.4
Johannes Schindelin [Mon, 6 Feb 2023 08:43:30 +0000 (09:43 +0100)] 
Git 2.38.4

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoSync with 2.37.6
Johannes Schindelin [Mon, 6 Feb 2023 08:43:28 +0000 (09:43 +0100)] 
Sync with 2.37.6

* maint-2.37:
  Git 2.37.6
  Git 2.36.5
  Git 2.35.7
  Git 2.34.7
  http: support CURLOPT_PROTOCOLS_STR
  http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
  http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT
  Git 2.33.7
  Git 2.32.6
  Git 2.31.7
  Git 2.30.8
  apply: fix writing behind newly created symbolic links
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
  clone: delay picking a transport until after get_repo_path()
  t5619: demonstrate clone_local() with ambiguous transport

16 months agoGit 2.37.6 v2.37.6
Johannes Schindelin [Mon, 6 Feb 2023 08:38:32 +0000 (09:38 +0100)] 
Git 2.37.6

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoSync with 2.36.5
Johannes Schindelin [Mon, 6 Feb 2023 08:38:31 +0000 (09:38 +0100)] 
Sync with 2.36.5

* maint-2.36:
  Git 2.36.5
  Git 2.35.7
  Git 2.34.7
  http: support CURLOPT_PROTOCOLS_STR
  http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
  http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT
  Git 2.33.7
  Git 2.32.6
  Git 2.31.7
  Git 2.30.8
  apply: fix writing behind newly created symbolic links
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
  clone: delay picking a transport until after get_repo_path()
  t5619: demonstrate clone_local() with ambiguous transport

16 months agoGit 2.36.5 v2.36.5
Johannes Schindelin [Mon, 6 Feb 2023 08:37:53 +0000 (09:37 +0100)] 
Git 2.36.5

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoSync with 2.35.7
Johannes Schindelin [Mon, 6 Feb 2023 08:37:52 +0000 (09:37 +0100)] 
Sync with 2.35.7

* maint-2.35:
  Git 2.35.7
  Git 2.34.7
  http: support CURLOPT_PROTOCOLS_STR
  http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
  http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT
  Git 2.33.7
  Git 2.32.6
  Git 2.31.7
  Git 2.30.8
  apply: fix writing behind newly created symbolic links
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
  clone: delay picking a transport until after get_repo_path()
  t5619: demonstrate clone_local() with ambiguous transport

16 months agoGit 2.35.7 v2.35.7
Johannes Schindelin [Mon, 6 Feb 2023 08:29:45 +0000 (09:29 +0100)] 
Git 2.35.7

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoSync with 2.34.7
Johannes Schindelin [Mon, 6 Feb 2023 08:29:44 +0000 (09:29 +0100)] 
Sync with 2.34.7

* maint-2.34:
  Git 2.34.7
  http: support CURLOPT_PROTOCOLS_STR
  http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
  http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT
  Git 2.33.7
  Git 2.32.6
  Git 2.31.7
  Git 2.30.8
  apply: fix writing behind newly created symbolic links
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
  clone: delay picking a transport until after get_repo_path()
  t5619: demonstrate clone_local() with ambiguous transport

16 months agoGit 2.34.7 v2.34.7
Johannes Schindelin [Mon, 6 Feb 2023 08:29:17 +0000 (09:29 +0100)] 
Git 2.34.7

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoSync with 2.33.7
Johannes Schindelin [Mon, 6 Feb 2023 08:29:16 +0000 (09:29 +0100)] 
Sync with 2.33.7

* maint-2.33:
  Git 2.33.7
  Git 2.32.6
  Git 2.31.7
  Git 2.30.8
  apply: fix writing behind newly created symbolic links
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
  clone: delay picking a transport until after get_repo_path()
  t5619: demonstrate clone_local() with ambiguous transport

16 months agoMerge branch 'jk/curl-avoid-deprecated-api'
Junio C Hamano [Fri, 20 Jan 2023 23:36:21 +0000 (15:36 -0800)] 
Merge branch 'jk/curl-avoid-deprecated-api'

Deal with a few deprecation warning from cURL library.

* jk/curl-avoid-deprecated-api:
  http: support CURLOPT_PROTOCOLS_STR
  http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
  http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT

16 months agohttp: support CURLOPT_PROTOCOLS_STR
Jeff King [Tue, 17 Jan 2023 03:04:48 +0000 (22:04 -0500)] 
http: support CURLOPT_PROTOCOLS_STR

The CURLOPT_PROTOCOLS (and matching CURLOPT_REDIR_PROTOCOLS) flag was
deprecated in curl 7.85.0, and using it generate compiler warnings as of
curl 7.87.0. The path forward is to use CURLOPT_PROTOCOLS_STR, but we
can't just do so unilaterally, as it was only introduced less than a
year ago in 7.85.0.

Until that version becomes ubiquitous, we have to either disable the
deprecation warning or conditionally use the "STR" variant on newer
versions of libcurl. This patch switches to the new variant, which is
nice for two reasons:

  - we don't have to worry that silencing curl's deprecation warnings
    might cause us to miss other more useful ones

  - we'd eventually want to move to the new variant anyway, so this gets
    us set up (albeit with some extra ugly boilerplate for the
    conditional)

There are a lot of ways to split up the two cases. One way would be to
abstract the storage type (strbuf versus a long), how to append
(strbuf_addstr vs bitwise OR), how to initialize, which CURLOPT to use,
and so on. But the resulting code looks pretty magical:

  GIT_CURL_PROTOCOL_TYPE allowed = GIT_CURL_PROTOCOL_TYPE_INIT;
  if (...http is allowed...)
GIT_CURL_PROTOCOL_APPEND(&allowed, "http", CURLOPT_HTTP);

and you end up with more "#define GIT_CURL_PROTOCOL_TYPE" macros than
actual code.

On the other end of the spectrum, we could just implement two separate
functions, one that handles a string list and one that handles bits. But
then we end up repeating our list of protocols (http, https, ftp, ftp).

This patch takes the middle ground. The run-time code is always there to
handle both types, and we just choose which one to feed to curl.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agohttp: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
Jeff King [Tue, 17 Jan 2023 03:04:44 +0000 (22:04 -0500)] 
http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION

The IOCTLFUNCTION option has been deprecated, and generates a compiler
warning in recent versions of curl. We can switch to using SEEKFUNCTION
instead. It was added in 2008 via curl 7.18.0; our INSTALL file already
indicates we require at least curl 7.19.4.

But there's one catch: curl says we should use CURL_SEEKFUNC_{OK,FAIL},
and those didn't arrive until 7.19.5. One workaround would be to use a
bare 0/1 here (or define our own macros).  But let's just bump the
minimum required version to 7.19.5. That version is only a minor version
bump from our existing requirement, and is only a 2 month time bump for
versions that are almost 13 years old. So it's not likely that anybody
cares about the distinction.

Switching means we have to rewrite the ioctl functions into seek
functions. In some ways they are simpler (seeking is the only
operation), but in some ways more complex (the ioctl allowed only a full
rewind, but now we can seek to arbitrary offsets).

Curl will only ever use SEEK_SET (per their documentation), so I didn't
bother implementing anything else, since it would naturally be
completely untested. This seems unlikely to change, but I added an
assertion just in case.

Likewise, I doubt curl will ever try to seek outside of the buffer sizes
we've told it, but I erred on the defensive side here, rather than do an
out-of-bounds read.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agohttp-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT
Jeff King [Tue, 17 Jan 2023 03:04:38 +0000 (22:04 -0500)] 
http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT

The two options do exactly the same thing, but the latter has been
deprecated and in recent versions of curl may produce a compiler
warning. Since the UPLOAD form is available everywhere (it was
introduced in the year 2000 by curl 7.1), we can just switch to it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoGit 2.33.7 v2.33.7
Johannes Schindelin [Mon, 6 Feb 2023 08:25:58 +0000 (09:25 +0100)] 
Git 2.33.7

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoSync with 2.32.6
Johannes Schindelin [Mon, 6 Feb 2023 08:25:56 +0000 (09:25 +0100)] 
Sync with 2.32.6

* maint-2.32:
  Git 2.32.6
  Git 2.31.7
  Git 2.30.8
  apply: fix writing behind newly created symbolic links
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
  clone: delay picking a transport until after get_repo_path()
  t5619: demonstrate clone_local() with ambiguous transport

16 months agoGit 2.32.6 v2.32.6
Johannes Schindelin [Mon, 6 Feb 2023 08:25:09 +0000 (09:25 +0100)] 
Git 2.32.6

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoSync with 2.31.7
Johannes Schindelin [Mon, 6 Feb 2023 08:25:08 +0000 (09:25 +0100)] 
Sync with 2.31.7

* maint-2.31:
  Git 2.31.7
  Git 2.30.8
  apply: fix writing behind newly created symbolic links
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
  clone: delay picking a transport until after get_repo_path()
  t5619: demonstrate clone_local() with ambiguous transport

16 months agoGit 2.31.7 v2.31.7
Johannes Schindelin [Mon, 6 Feb 2023 08:24:07 +0000 (09:24 +0100)] 
Git 2.31.7

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoSync with 2.30.8
Johannes Schindelin [Mon, 6 Feb 2023 08:24:06 +0000 (09:24 +0100)] 
Sync with 2.30.8

* maint-2.30:
  Git 2.30.8
  apply: fix writing behind newly created symbolic links
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
  clone: delay picking a transport until after get_repo_path()
  t5619: demonstrate clone_local() with ambiguous transport

16 months agoGit 2.30.8 v2.30.8
Junio C Hamano [Fri, 3 Feb 2023 22:58:10 +0000 (14:58 -0800)] 
Git 2.30.8

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 months agoMerge branch 'ps/apply-beyond-symlink' into maint-2.30
Junio C Hamano [Fri, 3 Feb 2023 22:57:27 +0000 (14:57 -0800)] 
Merge branch 'ps/apply-beyond-symlink' into maint-2.30

Fix a vulnerability (CVE-2023-23946) that allows crafted input to trick
`git apply` into writing files outside of the working tree.

* ps/apply-beyond-symlink:
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agoMerge branch 'tb/clone-local-symlinks' into maint-2.30
Taylor Blau [Wed, 25 Jan 2023 19:58:38 +0000 (14:58 -0500)] 
Merge branch 'tb/clone-local-symlinks' into maint-2.30

Resolve a security vulnerability (CVE-2023-22490) where `clone_local()`
is used in conjunction with non-local transports, leading to arbitrary
path exfiltration.

* tb/clone-local-symlinks:
  dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
  clone: delay picking a transport until after get_repo_path()
  t5619: demonstrate clone_local() with ambiguous transport

16 months agoapply: fix writing behind newly created symbolic links
Patrick Steinhardt [Thu, 2 Feb 2023 10:54:34 +0000 (11:54 +0100)] 
apply: fix writing behind newly created symbolic links

When writing files git-apply(1) initially makes sure that none of the
files it is about to create are behind a symlink:

```
 $ git init repo
 Initialized empty Git repository in /tmp/repo/.git/
 $ cd repo/
 $ ln -s dir symlink
 $ git apply - <<EOF
 diff --git a/symlink/file b/symlink/file
 new file mode 100644
 index 0000000..e69de29
 EOF
 error: affected file 'symlink/file' is beyond a symbolic link
```

This safety mechanism is crucial to ensure that we don't write outside
of the repository's working directory. It can be fooled though when the
patch that is being applied creates the symbolic link in the first
place, which can lead to writing files in arbitrary locations.

Fix this by checking whether the path we're about to create is
beyond a symlink or not. Tightening these checks like this should be
fine as we already have these precautions in Git as explained
above. Ideally, we should update the check we do up-front before
starting to reflect the computed changes to the working tree so that
we catch this case as well, but as part of embargoed security work,
adding an equivalent check just before we try to write out a file
should serve us well as a reasonable first step.

Digging back into history shows that this vulnerability has existed
since at least Git v2.9.0. As Git v2.8.0 and older don't build on my
system anymore I cannot tell whether older versions are affected, as
well.

Reported-by: Joern Schneeweisz <jschneeweisz@gitlab.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 months agodir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
Taylor Blau [Wed, 25 Jan 2023 00:43:51 +0000 (19:43 -0500)] 
dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS

When using the dir_iterator API, we first stat(2) the base path, and
then use that as a starting point to enumerate the directory's contents.

If the directory contains symbolic links, we will immediately die() upon
encountering them without the `FOLLOW_SYMLINKS` flag. The same is not
true when resolving the top-level directory, though.

As explained in a previous commit, this oversight in 6f054f9fb3
(builtin/clone.c: disallow `--local` clones with symlinks, 2022-07-28)
can be used as an attack vector to include arbitrary files on a victim's
filesystem from outside of the repository.

Prevent resolving top-level symlinks unless the FOLLOW_SYMLINKS flag is
given, which will cause clones of a repository with a symlink'd
"$GIT_DIR/objects" directory to fail.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 months agoclone: delay picking a transport until after get_repo_path()
Taylor Blau [Wed, 25 Jan 2023 00:43:48 +0000 (19:43 -0500)] 
clone: delay picking a transport until after get_repo_path()

In the previous commit, t5619 demonstrates an issue where two calls to
`get_repo_path()` could trick Git into using its local clone mechanism
in conjunction with a non-local transport.

That sequence is:

 - the starting state is that the local path https:/example.com/foo is a
   symlink that points to ../../../.git/modules/foo. So it's dangling.

 - get_repo_path() sees that no such path exists (because it's
   dangling), and thus we do not canonicalize it into an absolute path

 - because we're using --separate-git-dir, we create .git/modules/foo.
   Now our symlink is no longer dangling!

 - we pass the url to transport_get(), which sees it as an https URL.

 - we call get_repo_path() again, on the url. This second call was
   introduced by f38aa83f9a (use local cloning if insteadOf makes a
   local URL, 2014-07-17). The idea is that we want to pull the url
   fresh from the remote.c API, because it will apply any aliases.

And of course now it sees that there is a local file, which is a
mismatch with the transport we already selected.

The issue in the above sequence is calling `transport_get()` before
deciding whether or not the repository is indeed local, and not passing
in an absolute path if it is local.

This is reminiscent of a similar bug report in [1], where it was
suggested to perform the `insteadOf` lookup earlier. Taking that
approach may not be as straightforward, since the intent is to store the
original URL in the config, but to actually fetch from the insteadOf
one, so conflating the two early on is a non-starter.

Note: we pass the path returned by `get_repo_path(remote->url[0])`,
which should be the same as `repo_name` (aside from any `insteadOf`
rewrites).

We *could* pass `absolute_pathdup()` of the same argument, which
86521acaca (Bring local clone's origin URL in line with that of a remote
clone, 2008-09-01) indicates may differ depending on the presence of
".git/" for a non-bare repo. That matters for forming relative submodule
paths, but doesn't matter for the second call, since we're just feeding
it to the transport code, which is fine either way.

[1]: https://lore.kernel.org/git/CAMoD=Bi41mB3QRn3JdZL-FGHs4w3C2jGpnJB-CqSndO7FMtfzA@mail.gmail.com/

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 months agot5619: demonstrate clone_local() with ambiguous transport
Taylor Blau [Wed, 25 Jan 2023 00:43:45 +0000 (19:43 -0500)] 
t5619: demonstrate clone_local() with ambiguous transport

When cloning a repository, Git must determine (a) what transport
mechanism to use, and (b) whether or not the clone is local.

Since f38aa83f9a (use local cloning if insteadOf makes a local URL,
2014-07-17), the latter check happens after the remote has been
initialized, and references the remote's URL instead of the local path.
This is done to make it possible for a `url.<base>.insteadOf` rule to
convert a remote URL into a local one, in which case the `clone_local()`
mechanism should be used.

However, with a specially crafted repository, Git can be tricked into
using a non-local transport while still setting `is_local` to "1" and
using the `clone_local()` optimization. The below test case
demonstrates such an instance, and shows that it can be used to include
arbitrary (known) paths in the working copy of a cloned repository on a
victim's machine[^1], even if local file clones are forbidden by
`protocol.file.allow`.

This happens in a few parts:

 1. We first call `get_repo_path()` to see if the remote is a local
    path. If it is, we replace the repo name with its absolute path.

 2. We then call `transport_get()` on the repo name and decide how to
    access it. If it was turned into an absolute path in the previous
    step, then we should always treat it like a file.

 3. We use `get_repo_path()` again, and set `is_local` as appropriate.
    But it's already too late to rewrite the repo name as an absolute
    path, since we've already fed it to the transport code.

The attack works by including a submodule whose URL corresponds to a
path on disk. In the below example, the repository "sub" is reachable
via the dumb HTTP protocol at (something like):

    http://127.0.0.1:NNNN/dumb/sub.git

However, the path "http:/127.0.0.1:NNNN/dumb" (that is, a top-level
directory called "http:", then nested directories "127.0.0.1:NNNN", and
"dumb") exists within the repository, too.

To determine this, it first picks the appropriate transport, which is
dumb HTTP. It then uses the remote's URL in order to determine whether
the repository exists locally on disk. However, the malicious repository
also contains an embedded stub repository which is the target of a
symbolic link at the local path corresponding to the "sub" repository on
disk (i.e., there is a symbolic link at "http:/127.0.0.1/dumb/sub.git",
pointing to the stub repository via ".git/modules/sub/../../../repo").

This stub repository fools Git into thinking that a local repository
exists at that URL and thus can be cloned locally. The affected call is
in `get_repo_path()`, which in turn calls `get_repo_path_1()`, which
locates a valid repository at that target.

This then causes Git to set the `is_local` variable to "1", and in turn
instructs Git to clone the repository using its local clone optimization
via the `clone_local()` function.

The exploit comes into play because the stub repository's top-level
"$GIT_DIR/objects" directory is a symbolic link which can point to an
arbitrary path on the victim's machine. `clone_local()` resolves the
top-level "objects" directory through a `stat(2)` call, meaning that we
read through the symbolic link and copy or hardlink the directory
contents at the destination of the link.

In other words, we can get steps (1) and (3) to disagree by leveraging
the dangling symlink to pick a non-local transport in the first step,
and then set is_local to "1" in the third step when cloning with
`--separate-git-dir`, which makes the symlink non-dangling.

This can result in data-exfiltration on the victim's machine when
sensitive data is at a known path (e.g., "/home/$USER/.ssh").

The appropriate fix is two-fold:

 - Resolve the transport later on (to avoid using the local
   clone optimization with a non-local transport).

 - Avoid reading through the top-level "objects" directory when
   (correctly) using the clone_local() optimization.

This patch merely demonstrates the issue. The following two patches will
implement each part of the above fix, respectively.

[^1]: Provided that any target directory does not contain symbolic
  links, in which case the changes from 6f054f9fb3 (builtin/clone.c:
  disallow `--local` clones with symlinks, 2022-07-28) will abort the
  clone.

Reported-by: yvvdwf <yvvdwf@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoSync with maint-2.38
Junio C Hamano [Thu, 19 Jan 2023 21:49:08 +0000 (13:49 -0800)] 
Sync with maint-2.38

* maint-2.38:
  attr: adjust a mismatched data type

17 months agoSync with maint-2.37
Junio C Hamano [Thu, 19 Jan 2023 21:48:26 +0000 (13:48 -0800)] 
Sync with maint-2.37

* maint-2.37:
  attr: adjust a mismatched data type

17 months agoSync with maint-2.36
Junio C Hamano [Thu, 19 Jan 2023 21:48:17 +0000 (13:48 -0800)] 
Sync with maint-2.36

* maint-2.36:
  attr: adjust a mismatched data type

17 months agoSync with maint-2.35
Junio C Hamano [Thu, 19 Jan 2023 21:48:08 +0000 (13:48 -0800)] 
Sync with maint-2.35

* maint-2.35:
  attr: adjust a mismatched data type

17 months agoSync with maint-2.34
Junio C Hamano [Thu, 19 Jan 2023 21:48:00 +0000 (13:48 -0800)] 
Sync with maint-2.34

* maint-2.34:
  attr: adjust a mismatched data type

17 months agoSync with maint-2.33
Junio C Hamano [Thu, 19 Jan 2023 21:47:42 +0000 (13:47 -0800)] 
Sync with maint-2.33

* maint-2.33:
  attr: adjust a mismatched data type

17 months agoSync with maint-2.32
Junio C Hamano [Thu, 19 Jan 2023 21:46:04 +0000 (13:46 -0800)] 
Sync with maint-2.32

* maint-2.32:
  attr: adjust a mismatched data type

17 months agoSync with maint-2.31
Junio C Hamano [Thu, 19 Jan 2023 21:45:37 +0000 (13:45 -0800)] 
Sync with maint-2.31

* maint-2.31:
  attr: adjust a mismatched data type

17 months agoSync with maint-2.30
Junio C Hamano [Thu, 19 Jan 2023 21:45:23 +0000 (13:45 -0800)] 
Sync with maint-2.30

* maint-2.30:
  attr: adjust a mismatched data type

17 months agoattr: adjust a mismatched data type
Johannes Schindelin [Thu, 12 Jan 2023 00:05:02 +0000 (01:05 +0100)] 
attr: adjust a mismatched data type

On platforms where `size_t` does not have the same width as `unsigned
long`, passing a pointer to the former when a pointer to the latter is
expected can lead to problems.

Windows and 32-bit Linux are among the affected platforms.

In this instance, we want to store the size of the blob that was read in
that variable. However, `read_blob_data_from_index()` passes that
pointer to `read_object_file()` which expects an `unsigned long *`.
Which means that on affected platforms, the variable is not fully
populated and part of its value is left uninitialized. (On Big-Endian
platforms, this problem would be even worse.)

The consequence is that depending on the uninitialized memory's
contents, we may erroneously reject perfectly fine attributes.

Let's address this by passing a pointer to a variable of the expected
data type.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agohttp: support CURLOPT_PROTOCOLS_STR
Jeff King [Tue, 17 Jan 2023 03:04:48 +0000 (22:04 -0500)] 
http: support CURLOPT_PROTOCOLS_STR

The CURLOPT_PROTOCOLS (and matching CURLOPT_REDIR_PROTOCOLS) flag was
deprecated in curl 7.85.0, and using it generate compiler warnings as of
curl 7.87.0. The path forward is to use CURLOPT_PROTOCOLS_STR, but we
can't just do so unilaterally, as it was only introduced less than a
year ago in 7.85.0.

Until that version becomes ubiquitous, we have to either disable the
deprecation warning or conditionally use the "STR" variant on newer
versions of libcurl. This patch switches to the new variant, which is
nice for two reasons:

  - we don't have to worry that silencing curl's deprecation warnings
    might cause us to miss other more useful ones

  - we'd eventually want to move to the new variant anyway, so this gets
    us set up (albeit with some extra ugly boilerplate for the
    conditional)

There are a lot of ways to split up the two cases. One way would be to
abstract the storage type (strbuf versus a long), how to append
(strbuf_addstr vs bitwise OR), how to initialize, which CURLOPT to use,
and so on. But the resulting code looks pretty magical:

  GIT_CURL_PROTOCOL_TYPE allowed = GIT_CURL_PROTOCOL_TYPE_INIT;
  if (...http is allowed...)
GIT_CURL_PROTOCOL_APPEND(&allowed, "http", CURLOPT_HTTP);

and you end up with more "#define GIT_CURL_PROTOCOL_TYPE" macros than
actual code.

On the other end of the spectrum, we could just implement two separate
functions, one that handles a string list and one that handles bits. But
then we end up repeating our list of protocols (http, https, ftp, ftp).

This patch takes the middle ground. The run-time code is always there to
handle both types, and we just choose which one to feed to curl.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agohttp: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
Jeff King [Tue, 17 Jan 2023 03:04:44 +0000 (22:04 -0500)] 
http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION

The IOCTLFUNCTION option has been deprecated, and generates a compiler
warning in recent versions of curl. We can switch to using SEEKFUNCTION
instead. It was added in 2008 via curl 7.18.0; our INSTALL file already
indicates we require at least curl 7.19.4.

But there's one catch: curl says we should use CURL_SEEKFUNC_{OK,FAIL},
and those didn't arrive until 7.19.5. One workaround would be to use a
bare 0/1 here (or define our own macros).  But let's just bump the
minimum required version to 7.19.5. That version is only a minor version
bump from our existing requirement, and is only a 2 month time bump for
versions that are almost 13 years old. So it's not likely that anybody
cares about the distinction.

Switching means we have to rewrite the ioctl functions into seek
functions. In some ways they are simpler (seeking is the only
operation), but in some ways more complex (the ioctl allowed only a full
rewind, but now we can seek to arbitrary offsets).

Curl will only ever use SEEK_SET (per their documentation), so I didn't
bother implementing anything else, since it would naturally be
completely untested. This seems unlikely to change, but I added an
assertion just in case.

Likewise, I doubt curl will ever try to seek outside of the buffer sizes
we've told it, but I erred on the defensive side here, rather than do an
out-of-bounds read.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agohttp-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT
Jeff King [Tue, 17 Jan 2023 03:04:38 +0000 (22:04 -0500)] 
http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT

The two options do exactly the same thing, but the latter has been
deprecated and in recent versions of curl may produce a compiler
warning. Since the UPLOAD form is available everywhere (it was
introduced in the year 2000 by curl 7.1), we can just switch to it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoattr: adjust a mismatched data type
Johannes Schindelin [Thu, 12 Jan 2023 00:05:02 +0000 (01:05 +0100)] 
attr: adjust a mismatched data type

On platforms where `size_t` does not have the same width as `unsigned
long`, passing a pointer to the former when a pointer to the latter is
expected can lead to problems.

Windows and 32-bit Linux are among the affected platforms.

In this instance, we want to store the size of the blob that was read in
that variable. However, `read_blob_data_from_index()` passes that
pointer to `read_object_file()` which expects an `unsigned long *`.
Which means that on affected platforms, the variable is not fully
populated and part of its value is left uninitialized. (On Big-Endian
platforms, this problem would be even worse.)

The consequence is that depending on the uninitialized memory's
contents, we may erroneously reject perfectly fine attributes.

Let's address this by passing a pointer to a variable of the expected
data type.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agofsck: document the new `gitattributes` message IDs
Johannes Schindelin [Thu, 12 Jan 2023 19:43:31 +0000 (20:43 +0100)] 
fsck: document the new `gitattributes` message IDs

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agouse enhanced basic regular expressions on macOS
René Scharfe [Sun, 8 Jan 2023 00:42:04 +0000 (01:42 +0100)] 
use enhanced basic regular expressions on macOS

When 1819ad327b (grep: fix multibyte regex handling under macOS,
2022-08-26) started to use the native regex library instead of Git's
own (compat/regex/), it lost support for alternation in basic
regular expressions.

Bring it back by enabling the flag REG_ENHANCED on macOS when
compiling basic regular expressions.

Reported-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
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>
17 months agodiff: drop "name" parameter from prepare_temp_file()
Jeff King [Fri, 6 Jan 2023 11:05:00 +0000 (06:05 -0500)] 
diff: drop "name" parameter from prepare_temp_file()

The prepare_temp_file() function takes a diff_filespec as well as a
filename. But it is almost certainly an error to pass in a name that
isn't the filespec's "path" parameter, since that is the only thing that
reliably tells us how to find the content (and indeed, this was the
source of a recently-fixed bug).

So let's drop the redundant "name" parameter and just use one->path
throughout the function. This simplifies the interface a little bit, and
makes it impossible for calling code to get it wrong.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agodiff: clean up external-diff argv setup
Jeff King [Fri, 6 Jan 2023 11:04:18 +0000 (06:04 -0500)] 
diff: clean up external-diff argv setup

Since the previous commit, setting up the tempfile for an external diff
uses df->path from the diff_filespec, rather than the logical name. This
means add_external_diff_name() does not need to take a "name" parameter
at all, and we can drop it. And that in turn lets us simplify the
conditional for handling renames (when the "other" name is non-NULL).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agodiff: use filespec path to set up tempfiles for ext-diff
Jeff King [Fri, 6 Jan 2023 11:03:57 +0000 (06:03 -0500)] 
diff: use filespec path to set up tempfiles for ext-diff

When we're going to run an external diff, we have to make the contents
of the pre- and post-images available either by dumping them to a
tempfile, or by pointing at a valid file in the worktree. The logic of
this is all handled by prepare_temp_file(), and we just pass in the
filename and the diff_filespec.

But there's a gotcha here. The "filename" we have is a logical filename
and not necessarily a path on disk or in the repository. This matters in
at least one case: when using "--relative", we may have a name like
"foo", even though the file content is found at "subdir/foo". As a
result, we look for the wrong path, fail to find "foo", and claim that
the file has been deleted (passing "/dev/null" to the external diff,
rather than the correct worktree path).

We can fix this by passing the pathname from the diff_filespec, which
should always be a full repository path (and that's what we want even if
reusing a worktree file, since we're always operating from the top-level
of the working tree).

The breakage seems to go all the way back to cd676a5136 (diff
--relative: output paths as relative to the current subdirectory,
2008-02-12). As far as I can tell, before then "name" would always have
been the same as the filespec's "path".

There are two related cases I looked at that aren't buggy:

  1. the only other caller of prepare_temp_file() is run_textconv(). But
     it always passes the filespec's path field, so it's OK.

  2. I wondered if file renames/copies might cause similar confusion.
     But they don't, because run_external_diff() receives two names in
     that case: "name" and "other", which correspond to the two sides of
     the diff. And we did correctly pass "other" when handling the
     post-image side. Barring the use of "--relative", that would always
     match "two->path", the path of the second filespec (and the rename
     destination).

So the only bug is just the interaction with external diff drivers and
--relative.

Reported-by: Carl Baldwin <carl@ecbaldwin.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agobundle <cmd>: have usage_msg_opt() note the missing "<file>"
Ævar Arnfjörð Bjarmason [Tue, 27 Dec 2022 18:39:10 +0000 (19:39 +0100)] 
bundle <cmd>: have usage_msg_opt() note the missing "<file>"

Improve the usage we emit on e.g. "git bundle create" to note why
we're showing the usage, it's because the "<file>" argument is
missing.

We know that'll be the case for all parse_options_cmd_bundle() users,
as they're passing the "char **bundle_file" parameter, which as the
context shows we're expected to populate.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agobuiltin/bundle.c: remove superfluous "newargc" variable
Ævar Arnfjörð Bjarmason [Tue, 27 Dec 2022 18:39:09 +0000 (19:39 +0100)] 
builtin/bundle.c: remove superfluous "newargc" variable

As noted in 891cb09db6c (bundle: don't segfault on "git bundle
<subcmd>", 2022-12-20) the "newargc" in this function is redundant to
using our own "argc". Let's refactor the function to avoid needlessly
introducing another variable.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agorefs: fix corruption by not correctly syncing packed-refs to disk
Patrick Steinhardt [Tue, 20 Dec 2022 14:52:14 +0000 (15:52 +0100)] 
refs: fix corruption by not correctly syncing packed-refs to disk

At GitLab we have recently received a report where a repository was left
with a corrupted `packed-refs` file after the node hard-crashed even
though `core.fsync=reference` was set. This is something that in theory
should not happen if we correctly did the atomic-rename dance to:

    1. Write the data into a temporary file.

    2. Synchronize the temporary file to disk.

    3. Rename the temporary file into place.

So if we crash in the middle of writing the `packed-refs` file we should
only ever see either the old or the new state of the file.

And while we do the dance when writing the `packed-refs` file, there is
indeed one gotcha: we use a `FILE *` stream to write the temporary file,
but don't flush it before synchronizing it to disk. As a consequence any
data that is still buffered will not get synchronized and a crash of the
machine may cause corruption.

Fix this bug by flushing the file stream before we fsync.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agobundle: don't segfault on "git bundle <subcmd>"
Ævar Arnfjörð Bjarmason [Tue, 20 Dec 2022 13:40:18 +0000 (14:40 +0100)] 
bundle: don't segfault on "git bundle <subcmd>"

Since aef7d75e580 (builtin/bundle.c: let parse-options parse
subcommands, 2022-08-19) we've been segfaulting if no argument was
provided.

The fix is easy, as all of the "git bundle" subcommands require a
non-option argument we can check that we have arguments left after
calling parse-options().

This makes use of code added in 73c3253d75e (bundle: framework for
options before bundle file, 2019-11-10), before this change that code
has always been unreachable. In 73c3253d75e we'd never reach it as we
already checked "argc < 2" in cmd_bundle() itself.

Then when aef7d75e580 (whose segfault we're fixing here) migrated this
code to the subcommand API it removed that "argc < 2" check, but we
were still checking the wrong "argc" in parse_options_cmd_bundle(), we
need to check the "newargc". The "argc" will always be >= 1, as it
will necessarily contain at least the subcommand name
itself (e.g. "create").

As an aside, this could be safely squashed into this, but let's not do
that for this minimal segfault fix, as it's an unrelated refactoring:

--- a/builtin/bundle.c
+++ b/builtin/bundle.c
@@ -55,13 +55,12 @@ static int parse_options_cmd_bundle(int argc,
  const char * const usagestr[],
  const struct option options[],
  char **bundle_file) {
- int newargc;
- newargc = parse_options(argc, argv, NULL, options, usagestr,
+ argc = parse_options(argc, argv, NULL, options, usagestr,
       PARSE_OPT_STOP_AT_NON_OPTION);
- if (!newargc)
+ if (!argc)
  usage_with_options(usagestr, options);
  *bundle_file = prefix_filename(prefix, argv[0]);
- return newargc;
+ return argc;
 }

 static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {

Reported-by: Hubert Jasudowicz <hubertj@stmcyber.pl>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Tested-by: Hubert Jasudowicz <hubertj@stmcyber.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoci (check-whitespace): move to actions/checkout@v3
Chris. Webster [Tue, 20 Dec 2022 00:35:47 +0000 (00:35 +0000)] 
ci (check-whitespace): move to actions/checkout@v3

Get rid of deprecation warnings in the CI runs.  Also gets the latest
security patches.

Signed-off-by: Chris. Webster <chris@webstech.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoci (check-whitespace): add links to job output
Chris. Webster [Tue, 20 Dec 2022 00:35:46 +0000 (00:35 +0000)] 
ci (check-whitespace): add links to job output

A message in the step log will refer to the Summary output.

The job summary output is using markdown to improve readability.  The
git commands and commits with errors are now in ordered lists.
Commits and files in error are links to the user's repository.

Signed-off-by: Chris. Webster <chris@webstech.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoci (check-whitespace): suggest fixes for errors
Chris. Webster [Tue, 20 Dec 2022 00:35:45 +0000 (00:35 +0000)] 
ci (check-whitespace): suggest fixes for errors

Make the errors more visible by adding them to the job summary and
display the git commands that will usually fix the problem.

Signed-off-by: Chris. Webster <chris@webstech.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoci: only run win+VS build & tests in Git for Windows' fork
Johannes Schindelin [Mon, 19 Dec 2022 14:50:14 +0000 (14:50 +0000)] 
ci: only run win+VS build & tests in Git for Windows' fork

It has been a frequent matter of contention that the win+VS jobs not
only take a long time to run, but are also more easily broken than the
other jobs (because they do not use the same `Makefile`-based builds as
all other jobs), and to make matters worse, these breakages are also
much harder to diagnose and fix than other jobs', especially for
contributors who are happy to stay away from Windows.

The purpose of these win+VS jobs is to maintain the CMake-based build
of Git, with the target audience being Visual Studio users on Windows
who are typically quite unfamiliar with `make` and POSIX shell
scripting, but the benefit of whose expertise we want for the Git
project nevertheless.

The CMake support was introduced for that specific purpose, and already
early on concerns were raised that it would put an undue burden on
contributors to ensure that these jobs pass in CI, when they do not have
access to Windows machines (nor want to have that).

This developer's initial hope was that it would be enough to fix win+VS
failures and provide the changes to be squashed into contributors'
patches, and that it would be worth the benefit of attracting
Windows-based developers' contributions.

Neither of these hopes have panned out.

To lower the frustration, and incidentally benefit from using way less
build minutes, let's just not run the win+VS jobs by default, which
appears to be the consensus of the mail thread leading up to
https://lore.kernel.org/git/xmqqk0311blt.fsf@gitster.g/

Since the Git for Windows project still needs to at least try to attract
more of said Windows-based developers, let's keep the jobs, but disable
them everywhere except in Git for Windows' fork. This will help because
Git for Windows' branch thicket is "continuously rebased" via automation
to the `shears/maint`, `shears/main`, `shears/next` and `shears/seen`
branches at https://github.com/git-for-windows/git. That way, the Git
for Windows project will still be notified early on about potential
breakages, but the Git project won't be burdened with fixing them
anymore, which seems to be the best compromise we can get on this issue.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoline-range: fix infinite loop bug with '$' regex
Lars Kellogg-Stedman [Mon, 19 Dec 2022 22:48:50 +0000 (17:48 -0500)] 
line-range: fix infinite loop bug with '$' regex

When the -L argument to "git log" is passed the zero-width regular
expression "$" (as in "-L :$:line-range.c"), this results in an
infinite loop in find_funcname_matching_regexp().

Modify find_funcname_matching_regexp to correctly match the entire line
instead of the zero-width match at eol and update the loop condition to
prevent an infinite loop in the event of other undiscovered corner cases.

The primary change is that we pre-decrement the beginning-of-line marker
('bol') before comparing it to '\n'. In the case of '$', where we match the
'\n' at the end of the line and start the loop with bol == eol, this
ensures that bol will find the beginning of the line on which the match
occurred.

Originally reported in <https://stackoverflow.com/q/74690545/147356>.

Signed-off-by: Lars Kellogg-Stedman <lars@oddbit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoGit 2.39.1 v2.39.1
Junio C Hamano [Tue, 13 Dec 2022 12:25:28 +0000 (21:25 +0900)] 
Git 2.39.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoSync with 2.38.3
Junio C Hamano [Tue, 13 Dec 2022 12:25:15 +0000 (21:25 +0900)] 
Sync with 2.38.3

18 months agoGit 2.38.3 v2.38.3
Junio C Hamano [Tue, 13 Dec 2022 12:24:14 +0000 (21:24 +0900)] 
Git 2.38.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoSync with Git 2.37.5
Junio C Hamano [Tue, 13 Dec 2022 12:23:36 +0000 (21:23 +0900)] 
Sync with Git 2.37.5

18 months agoGit 2.37.5 v2.37.5
Junio C Hamano [Tue, 13 Dec 2022 12:20:47 +0000 (21:20 +0900)] 
Git 2.37.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoMerge branch 'maint-2.36' into maint-2.37
Junio C Hamano [Tue, 13 Dec 2022 12:20:35 +0000 (21:20 +0900)] 
Merge branch 'maint-2.36' into maint-2.37

18 months agoGit 2.36.4 v2.36.4
Junio C Hamano [Tue, 13 Dec 2022 12:19:24 +0000 (21:19 +0900)] 
Git 2.36.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoMerge branch 'maint-2.35' into maint-2.36
Junio C Hamano [Tue, 13 Dec 2022 12:19:11 +0000 (21:19 +0900)] 
Merge branch 'maint-2.35' into maint-2.36

18 months agoGit 2.35.6 v2.35.6
Junio C Hamano [Tue, 13 Dec 2022 12:17:26 +0000 (21:17 +0900)] 
Git 2.35.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoMerge branch 'maint-2.34' into maint-2.35
Junio C Hamano [Tue, 13 Dec 2022 12:17:10 +0000 (21:17 +0900)] 
Merge branch 'maint-2.34' into maint-2.35

18 months agoGit 2.34.6 v2.34.6
Junio C Hamano [Tue, 13 Dec 2022 12:15:39 +0000 (21:15 +0900)] 
Git 2.34.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoMerge branch 'maint-2.33' into maint-2.34
Junio C Hamano [Tue, 13 Dec 2022 12:15:22 +0000 (21:15 +0900)] 
Merge branch 'maint-2.33' into maint-2.34

18 months agoGit 2.33.6 v2.33.6
Junio C Hamano [Tue, 13 Dec 2022 12:13:48 +0000 (21:13 +0900)] 
Git 2.33.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoSync with Git 2.32.5
Junio C Hamano [Tue, 13 Dec 2022 12:13:11 +0000 (21:13 +0900)] 
Sync with Git 2.32.5

18 months agoGit 2.32.5 v2.32.5
Junio C Hamano [Tue, 13 Dec 2022 12:10:27 +0000 (21:10 +0900)] 
Git 2.32.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoMerge branch 'ps/attr-limits-with-fsck' into maint-2.32
Junio C Hamano [Tue, 13 Dec 2022 12:09:56 +0000 (21:09 +0900)] 
Merge branch 'ps/attr-limits-with-fsck' into maint-2.32

18 months agoSync with Git 2.31.6
Junio C Hamano [Tue, 13 Dec 2022 12:09:40 +0000 (21:09 +0900)] 
Sync with Git 2.31.6

18 months agoGit 2.31.6 v2.31.6
Junio C Hamano [Tue, 13 Dec 2022 12:04:03 +0000 (21:04 +0900)] 
Git 2.31.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoSync with Git 2.30.7
Junio C Hamano [Tue, 13 Dec 2022 12:02:20 +0000 (21:02 +0900)] 
Sync with Git 2.30.7

18 months agoGit 2.30.7 v2.30.7
Junio C Hamano [Tue, 13 Dec 2022 11:56:43 +0000 (20:56 +0900)] 
Git 2.30.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoGit 2.39 v2.39.0
Junio C Hamano [Mon, 12 Dec 2022 00:59:08 +0000 (09:59 +0900)] 
Git 2.39

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agoMerge tag 'l10n-2.39.0-rnd1' of https://github.com/git-l10n/git-po
Junio C Hamano [Mon, 12 Dec 2022 00:20:49 +0000 (09:20 +0900)] 
Merge tag 'l10n-2.39.0-rnd1' of https://github.com/git-l10n/git-po

l10n-2.39.0-rnd1

* tag 'l10n-2.39.0-rnd1' of https://github.com/git-l10n/git-po:
  l10n: zh_TW.po: Git 2.39-rc2
  l10n: tr: v2.39.0 updates
  l10n: Update Catalan translation
  l10n: bg.po: Updated Bulgarian translation (5501t)
  l10n: de.po: update German translation
  l10n: zh_CN v2.39.0 round 1
  l10n: fr: v2.39 rnd 1
  l10n: po-id for 2.39 (round 1)
  l10n: sv.po: Update Swedish translation (5501t0f0)

18 months agoSync with Git 2.38.2
Junio C Hamano [Sun, 11 Dec 2022 00:34:51 +0000 (09:34 +0900)] 
Sync with Git 2.38.2

18 months agoGit 2.38.2 v2.38.2
Junio C Hamano [Sun, 11 Dec 2022 00:32:48 +0000 (09:32 +0900)] 
Git 2.38.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 months agol10n: zh_TW.po: Git 2.39-rc2
pan93412 [Sat, 10 Dec 2022 17:16:20 +0000 (01:16 +0800)] 
l10n: zh_TW.po: Git 2.39-rc2

Signed-off-by: pan93412 <pan93412@gmail.com>
18 months agoci: use a newer `github-script` version
Johannes Schindelin [Tue, 8 Nov 2022 10:13:28 +0000 (10:13 +0000)] 
ci: use a newer `github-script` version

The old version we currently use runs in node.js v12.x, which is being
deprecated in GitHub Actions. The new version uses node.js v16.x.

Incidentally, this also avoids the warning about the deprecated
`::set-output::` workflow command because the newer version of the
`github-script` Action uses the recommended new way to specify outputs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
18 months agoMerge branch 'jx/ci-ubuntu-fix' into maint-2.38
Junio C Hamano [Sat, 10 Dec 2022 07:17:47 +0000 (16:17 +0900)] 
Merge branch 'jx/ci-ubuntu-fix' into maint-2.38

Adjust the GitHub CI to newer ubuntu release.

* jx/ci-ubuntu-fix:
  ci: install python on ubuntu
  ci: use the same version of p4 on both Linux and macOS
  ci: remove the pipe after "p4 -V" to catch errors
  github-actions: run gcc-8 on ubuntu-20.04 image

18 months agoSync with 'maint'
Junio C Hamano [Sat, 10 Dec 2022 05:02:22 +0000 (14:02 +0900)] 
Sync with 'maint'

18 months agoMerge branch 'js/ci-use-newer-up-down-artifact' into maint-2.38
Junio C Hamano [Sat, 10 Dec 2022 05:02:09 +0000 (14:02 +0900)] 
Merge branch 'js/ci-use-newer-up-down-artifact' into maint-2.38

CI fix.

* js/ci-use-newer-up-down-artifact:
  ci: avoid using deprecated {up,down}load-artifacts Action

18 months agoMerge branch 'ab/ci-use-macos-12' into maint-2.38
Junio C Hamano [Sat, 10 Dec 2022 05:02:09 +0000 (14:02 +0900)] 
Merge branch 'ab/ci-use-macos-12' into maint-2.38

CI fix.

* ab/ci-use-macos-12:
  CI: upgrade to macos-12, and pin OSX version

18 months agoMerge branch 'ab/ci-retire-set-output' into maint-2.38
Junio C Hamano [Sat, 10 Dec 2022 05:02:09 +0000 (14:02 +0900)] 
Merge branch 'ab/ci-retire-set-output' into maint-2.38

CI fix.

* ab/ci-retire-set-output:
  CI: migrate away from deprecated "set-output" syntax

18 months agoMerge branch 'ab/ci-musl-bash-fix' into maint-2.38
Junio C Hamano [Sat, 10 Dec 2022 05:02:09 +0000 (14:02 +0900)] 
Merge branch 'ab/ci-musl-bash-fix' into maint-2.38

CI fix.

* ab/ci-musl-bash-fix:
  CI: don't explicitly pick "bash" shell outside of Windows, fix regression