]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
16 months agoMerge branch 'sk/win32-pthread-exit-fix'
Junio C Hamano [Mon, 2 Jan 2023 12:37:19 +0000 (21:37 +0900)] 
Merge branch 'sk/win32-pthread-exit-fix'

An API emulation fix.

* sk/win32-pthread-exit-fix:
  win32: use _endthreadex to terminate threads, not ExitThread

16 months agoMerge branch 'ew/format-patch-mboxrd'
Junio C Hamano [Mon, 2 Jan 2023 12:37:19 +0000 (21:37 +0900)] 
Merge branch 'ew/format-patch-mboxrd'

"git format-patch" learned to honor format.mboxrd even when sending
patches to the standard output stream,

* ew/format-patch-mboxrd:
  format-patch: support format.mboxrd with --stdout

16 months agoMerge branch 'ds/bundle-uri-4'
Junio C Hamano [Mon, 2 Jan 2023 12:37:18 +0000 (21:37 +0900)] 
Merge branch 'ds/bundle-uri-4'

Bundle URIs part 4.

* ds/bundle-uri-4:
  clone: unbundle the advertised bundles
  bundle-uri: download bundles from an advertised list
  bundle-uri: allow relative URLs in bundle lists
  strbuf: introduce strbuf_strip_file_from_path()
  bundle-uri: serve bundle.* keys from config
  bundle-uri client: add helper for testing server
  transport: rename got_remote_heads
  bundle-uri client: add boolean transfer.bundleURI setting
  clone: request the 'bundle-uri' command when available
  t: create test harness for 'bundle-uri' command
  protocol v2: add server-side "bundle-uri" skeleton

16 months agoMerge branch 'lk/line-range-parsing-fix'
Junio C Hamano [Mon, 2 Jan 2023 12:37:18 +0000 (21:37 +0900)] 
Merge branch 'lk/line-range-parsing-fix'

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

17 months agoThe third batch
Junio C Hamano [Wed, 28 Dec 2022 01:53:44 +0000 (10:53 +0900)] 
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoMerge branch 'sa/git-var-sequence-editor'
Junio C Hamano [Wed, 28 Dec 2022 03:06:17 +0000 (12:06 +0900)] 
Merge branch 'sa/git-var-sequence-editor'

Just like "git var GIT_EDITOR" abstracts the complex logic to
choose which editor gets used behind it, "git var" now give support
to GIT_SEQUENCE_EDITOR.

* sa/git-var-sequence-editor:
  var: add GIT_SEQUENCE_EDITOR variable

17 months agoMerge branch 'ss/pull-v-recurse-fix'
Junio C Hamano [Wed, 28 Dec 2022 03:06:16 +0000 (12:06 +0900)] 
Merge branch 'ss/pull-v-recurse-fix'

"git pull -v --recurse-submodules" attempted to pass "-v" down to
underlying "git submodule update", which did not understand the
request and barfed, which has been corrected.

* ss/pull-v-recurse-fix:
  submodule: accept -v for the update command

17 months agoThe second batch
Junio C Hamano [Mon, 26 Dec 2022 02:42:31 +0000 (11:42 +0900)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoMerge branch 'ab/darwin-default-to-sha1dc'
Junio C Hamano [Mon, 26 Dec 2022 02:42:07 +0000 (11:42 +0900)] 
Merge branch 'ab/darwin-default-to-sha1dc'

Use the SHA1DC implementation on macOS, just like other platforms,
by default.

* ab/darwin-default-to-sha1dc:
  Makefile: use sha1collisiondetection by default on OSX and Darwin

17 months agoMerge branch 'sk/remove-duplicate-includes'
Junio C Hamano [Mon, 26 Dec 2022 02:42:07 +0000 (11:42 +0900)] 
Merge branch 'sk/remove-duplicate-includes'

Code clean-up.

* sk/remove-duplicate-includes:
  git: remove duplicate includes

17 months agoMerge branch 'pg/diff-stat-unmerged-regression-fix'
Junio C Hamano [Mon, 26 Dec 2022 02:42:07 +0000 (11:42 +0900)] 
Merge branch 'pg/diff-stat-unmerged-regression-fix'

The output from "git diff --stat" on an unmerged path lost the
terminating LF in Git 2.39, which has been corrected.

* pg/diff-stat-unmerged-regression-fix:
  diff: fix regression with --stat and unmerged file

17 months agoMerge branch 'jk/ref-filter-error-reporting-fix'
Junio C Hamano [Mon, 26 Dec 2022 02:42:06 +0000 (11:42 +0900)] 
Merge branch 'jk/ref-filter-error-reporting-fix'

Clean-ups in error messages produced by "git for-each-ref" and friends.

* jk/ref-filter-error-reporting-fix:
  ref-filter: convert email atom parser to use err_bad_arg()
  ref-filter: truncate atom names in error messages
  ref-filter: factor out "unrecognized %(foo) arg" errors
  ref-filter: factor out "%(foo) does not take arguments" errors
  ref-filter: reject arguments to %(HEAD)

17 months agoMerge branch 'rs/clarify-error-in-write-loose-object'
Junio C Hamano [Mon, 26 Dec 2022 02:42:06 +0000 (11:42 +0900)] 
Merge branch 'rs/clarify-error-in-write-loose-object'

Code clean-up.

* rs/clarify-error-in-write-loose-object:
  object-file: inline write_buffer()

17 months agoMerge branch 'rs/reflog-expiry-cleanup'
Junio C Hamano [Mon, 26 Dec 2022 02:42:06 +0000 (11:42 +0900)] 
Merge branch 'rs/reflog-expiry-cleanup'

Code clean-up.

* rs/reflog-expiry-cleanup:
  reflog: clear leftovers in reflog_expiry_cleanup()

17 months agoMerge branch 'rs/clear-commit-marks-cleanup'
Junio C Hamano [Mon, 26 Dec 2022 02:42:05 +0000 (11:42 +0900)] 
Merge branch 'rs/clear-commit-marks-cleanup'

Code clean-up.

* rs/clear-commit-marks-cleanup:
  commit: skip already cleared parents in clear_commit_marks_1()

17 months agoMerge branch 'rs/am-parse-options-cleanup'
Junio C Hamano [Mon, 26 Dec 2022 02:42:05 +0000 (11:42 +0900)] 
Merge branch 'rs/am-parse-options-cleanup'

Code clean-up.

* rs/am-parse-options-cleanup:
  am: don't pass strvec to apply_parse_options()

17 months agoMerge branch 'jk/server-supports-v2-cleanup'
Junio C Hamano [Mon, 26 Dec 2022 02:42:05 +0000 (11:42 +0900)] 
Merge branch 'jk/server-supports-v2-cleanup'

Code clean-up.

* jk/server-supports-v2-cleanup:
  server_supports_v2(): use a separate function for die_on_error

17 months agoMerge branch 'jk/unused-post-2.39'
Junio C Hamano [Mon, 26 Dec 2022 02:42:04 +0000 (11:42 +0900)] 
Merge branch 'jk/unused-post-2.39'

Code clean-up around unused function parameters.

* jk/unused-post-2.39:
  userdiff: mark unused parameter in internal callback
  list-objects-filter: mark unused parameters in virtual functions
  diff: mark unused parameters in callbacks
  xdiff: mark unused parameter in xdl_call_hunk_func()
  xdiff: drop unused parameter in def_ff()
  ws: drop unused parameter from ws_blank_line()
  list-objects: drop process_gitlink() function
  blob: drop unused parts of parse_blob_buffer()
  ls-refs: use repository parameter to iterate refs

17 months agoMerge branch 'jt/http-fetch-trace2-report-name'
Junio C Hamano [Mon, 26 Dec 2022 02:42:04 +0000 (11:42 +0900)] 
Merge branch 'jt/http-fetch-trace2-report-name'

"git http-fetch" (which is rarely used) forgot to identify itself
in the trace2 output.

* jt/http-fetch-trace2-report-name:
  http-fetch: invoke trace2_cmd_name()

17 months agoMerge branch 'sg/help-autocorrect-config-fix'
Junio C Hamano [Mon, 26 Dec 2022 02:42:04 +0000 (11:42 +0900)] 
Merge branch 'sg/help-autocorrect-config-fix'

The code to auto-correct a misspelt subcommand unnecessarily called
into git_default_config() from the early config codepath, which was
a no-no.  This has bee corrected.

* sg/help-autocorrect-config-fix:
  help.c: fix autocorrect in work tree for bare repository

17 months agowin32: use _endthreadex to terminate threads, not ExitThread
Seija Kijin [Sun, 25 Dec 2022 01:41:50 +0000 (01:41 +0000)] 
win32: use _endthreadex to terminate threads, not ExitThread

Because we use the C runtime and
use _beginthreadex to create pthreads,
pthread_exit MUST use _endthreadex.

Otherwise, according to Microsoft:
"Failure to do so results in small
memory leaks when the thread
calls ExitThread."

Simply put, this is not the same as ExitThread.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoformat-patch: support format.mboxrd with --stdout
Eric Wong [Thu, 22 Dec 2022 20:16:19 +0000 (20:16 +0000)] 
format-patch: support format.mboxrd with --stdout

mboxrd is a more robust output format when used with --stdout
and needs more exposure.  Introducing this config knob lets
users choose the more robust format for all their --stdout
uses.

Relying on --pretty=mboxrd and including all of pretty-formats.txt
in the `git format-patch' documentation would likely be
confusing to users.  Furthermore, this setting is useful across
multiple invocations.  So introduce `format.mboxrd' as a boolean
configuration knob that changes the default --pretty=email format
to --pretty=mboxrd when (and only when) --stdout is in use.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoclone: unbundle the advertised bundles
Derrick Stolee [Thu, 22 Dec 2022 15:14:17 +0000 (15:14 +0000)] 
clone: unbundle the advertised bundles

A previous change introduced the transport methods to acquire a bundle
list from the 'bundle-uri' protocol v2 command, when advertised _and_
when the client has chosen to enable the feature.

Teach Git to download and unbundle the data advertised by those bundles
during 'git clone'. This takes place between the ref advertisement and
the object data download, and stateful connections will linger while
the client downloads bundles. In the future, we should consider closing
the remote connection during this process.

Also, since the --bundle-uri option exists, we do not want to mix the
advertised bundles with the user-specified bundles.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agobundle-uri: download bundles from an advertised list
Derrick Stolee [Thu, 22 Dec 2022 15:14:16 +0000 (15:14 +0000)] 
bundle-uri: download bundles from an advertised list

The logic in fetch_bundle_uri() is useful for the --bundle-uri option of
'git clone', but is not helpful when the clone operation discovers a
list of URIs from the bundle-uri protocol v2 command. To actually
download and unbundle the advertised bundles, we need a different
mechanism.

Create the new fetch_bundle_list() method which is very similar to
fetch_bundle_uri() except that it relies on download_bundle_list()
instead of fetch_bundle_uri_internal(). The download_bundle_list()
method will recursively call fetch_bundle_uri_internal() if any of the
advertised URIs serve a bundle list instead of a bundle. This will also
follow the bundle.list.mode setting from the input list: "any" will
download only one such URI while "all" will download data from all of
the URIs.

In an identical way to fetch_bundle_uri(), the bundles are unbundled
after all of the bundle lists have been expanded and all necessary URIs.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agobundle-uri: allow relative URLs in bundle lists
Derrick Stolee [Thu, 22 Dec 2022 15:14:15 +0000 (15:14 +0000)] 
bundle-uri: allow relative URLs in bundle lists

Bundle providers may want to distribute that data across multiple CDNs.
This might require a change in the base URI, all the way to the domain
name. If all bundles require an absolute URI in their 'uri' value, then
every push to a CDN would require altering the table of contents to
match the expected domain and exact location within it.

Allow a bundle list to specify a relative URI for the bundles. This URI
is based on where the client received the bundle list. For a list
provided in the 'bundle-uri' protocol v2 command, the Git remote URI is
the base URI. Otherwise, the bundle list was provided from an HTTP URI
not using the Git protocol, and that URI is the base URI. This allows
easier distribution of bundle data.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agostrbuf: introduce strbuf_strip_file_from_path()
Derrick Stolee [Thu, 22 Dec 2022 15:14:14 +0000 (15:14 +0000)] 
strbuf: introduce strbuf_strip_file_from_path()

The strbuf_parent_directory() method was added as a static method in
contrib/scalar by d0feac4e8c0 (scalar: 'register' sets recommended
config and starts maintenance, 2021-12-03) and then removed in
65f6a9eb0b9 (scalar: constrain enlistment search, 2022-08-18), but now
there is a need for a similar method in the bundle URI feature.

Re-add the method, this time in strbuf.c, but with a new name:
strbuf_strip_file_from_path(). The method requirements are slightly
modified to allow a trailing slash, in which case nothing is done, which
makes the name change valuable.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agobundle-uri: serve bundle.* keys from config
Derrick Stolee [Thu, 22 Dec 2022 15:14:13 +0000 (15:14 +0000)] 
bundle-uri: serve bundle.* keys from config

Implement the "bundle-uri" protocol v2 capability by populating the
key=value packet lines from the local Git config. The list of bundles is
provided from the keys beginning with "bundle.".

In the future, we may want to filter this list to be more specific to
the exact known keys that the server intends to share, but for
flexibility at the moment we will assume that the config values are
well-formed.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agobundle-uri client: add helper for testing server
Ævar Arnfjörð Bjarmason [Thu, 22 Dec 2022 15:14:12 +0000 (15:14 +0000)] 
bundle-uri client: add helper for testing server

Add a 'test-tool bundle-uri ls-remote' command. This is a thin wrapper
for issuing protocol v2 "bundle-uri" commands to a server, and to the
parsing routines in bundle-uri.c.

In the "git clone" case we'll have already done the handshake(),
but not here. Add an extra case to check for this handshake in
get_bundle_uri() for ease of use for future callers.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agotransport: rename got_remote_heads
Derrick Stolee [Thu, 22 Dec 2022 15:14:11 +0000 (15:14 +0000)] 
transport: rename got_remote_heads

The 'got_remote_heads' member of 'struct git_transport_data' was used
historically to indicate that the initial server connection was made and
the ref advertisement was returned. With protocol v2, that initial
handshake does not necessarily include the ref advertisement, so this
member is not an accurate name. Thankfully, all uses of the member are
only checking to see if the handshake should take place, not whether or
not some local data has the ref advertisement.

Rename the member to 'finished_handshake' to represent the proper state.
Note that the variable is only set to 1 during the handshake() method.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agobundle-uri client: add boolean transfer.bundleURI setting
Ævar Arnfjörð Bjarmason [Thu, 22 Dec 2022 15:14:10 +0000 (15:14 +0000)] 
bundle-uri client: add boolean transfer.bundleURI setting

The yet-to-be introduced client support for bundle-uri will always
fall back on a full clone, but we'd still like to be able to ignore a
server's bundle-uri advertisement entirely.

The new transfer.bundleURI config option defaults to 'false', but a user
can set it to 'true' to enable checking for bundle URIs from the origin
Git server using protocol v2.

Co-authored-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoclone: request the 'bundle-uri' command when available
Ævar Arnfjörð Bjarmason [Thu, 22 Dec 2022 15:14:09 +0000 (15:14 +0000)] 
clone: request the 'bundle-uri' command when available

Set up all the needed client parts of the 'bundle-uri' protocol v2
command, without actually doing anything with the bundle URIs.

If the server says it supports 'bundle-uri' teach Git to issue the
'bundle-uri' command after the 'ls-refs' during 'git clone'. The
returned key=value pairs are passed to the bundle list code which is
tested using a different ingest mechanism in t5750-bundle-uri-parse.sh.

At this point, Git does nothing with that bundle list. It will not
download any of the bundles. That will come in a later change after
these protocol bits are finalized.

The no-op client is initially used only by 'git clone' to test the basic
functionality, and eventually will bootstrap the initial download of Git
objects during a fresh clone. The bundle URI client will not be
integrated into other fetches until a mechanism is created to select a
subset of bundles for download.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agot: create test harness for 'bundle-uri' command
Ævar Arnfjörð Bjarmason [Thu, 22 Dec 2022 15:14:08 +0000 (15:14 +0000)] 
t: create test harness for 'bundle-uri' command

The previous change allowed for a Git server to advertise the
'bundle-uri' command as a capability based on the
uploadPack.advertiseBundleURIs config option. Create a set of tests that
check that this capability is advertised using 'git ls-remote'.

In order to test this functionality across three protocols (file, git,
and http), create lib-bundle-uri-protocol.sh to generalize the tests,
allowing the other test scripts to set an environment variable and
otherwise inherit the setup and tests from this script.

The tests currently only test that the 'bundle-uri' command is
advertised or not. Other actions will be tested as the Git client learns
to request the 'bundle-uri' command and parse its response.

To help with URI escaping, specifically for file paths with a space in
them, extract a 'sed' invocation from t9199-git-svn-info.sh into a
helper function for use here, too.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoprotocol v2: add server-side "bundle-uri" skeleton
Ævar Arnfjörð Bjarmason [Thu, 22 Dec 2022 15:14:07 +0000 (15:14 +0000)] 
protocol v2: add server-side "bundle-uri" skeleton

Add a skeleton server-side implementation of a new "bundle-uri" command
to protocol v2. This will allow conforming clients to optionally seed
their initial clones or incremental fetches from URLs containing
"*.bundle" files created with "git bundle create".

This change only performs the basic boilerplate of advertising a new
protocol v2 capability. The new 'bundle-uri' capability allows a client
to request a list of bundles. Right now, the server only returns a flush
packet, which corresponds to an empty advertisement. The bundle.* config
namespace describes which key-value pairs will be communicated across
this interface in future updates.

The critical bit right now is that the new boolean
uploadPack.adverstiseBundleURIs config value signals whether or not this
capability should be advertised at all.

An earlier version of this patch [1] used a different transfer format
than the "key=value" pairs in the current implementation. The change was
made to unify the protocol v2 command with the bundle lists provided by
independent bundle servers. Further, the standard allows for the server
to advertise a URI that contains a bundle list. This allows users
automatically discovering bundle providers that are loosely associated
with the origin server, but without the origin server knowing exactly
which bundles are currently available.

[1] https://lore.kernel.org/git/RFC-patch-v2-01.13-2fc87ce092b-20220311T155841Z-avarab@gmail.com/

The very-deep headings needed to be modified to stop at level 4 due to
documentation build issues. These were not recognized in earlier builds
since the file was previously in the Documentation/technical/ directory
and was built in a different way. With its current location, the
heavily-nested details were causing build issues and they are now
replaced with a bulletted list of details.

Co-authored-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 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>
17 months agoThe first batch for 2.40
Junio C Hamano [Mon, 19 Dec 2022 02:04:40 +0000 (11:04 +0900)] 
The first batch for 2.40

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoMerge branch 'rj/branch-copy-and-rename'
Junio C Hamano [Mon, 19 Dec 2022 02:46:18 +0000 (11:46 +0900)] 
Merge branch 'rj/branch-copy-and-rename'

Fix a pair of bugs in 'git branch'.

* rj/branch-copy-and-rename:
  branch: force-copy a branch to itself via @{-1} is a no-op

17 months agoMerge branch 'rr/status-untracked-advice'
Junio C Hamano [Mon, 19 Dec 2022 02:46:18 +0000 (11:46 +0900)] 
Merge branch 'rr/status-untracked-advice'

The advice message given by "git status" when it takes long time to
enumerate untracked paths has been updated.

* rr/status-untracked-advice:
  status: modernize git-status "slow untracked files" advice

17 months agoMerge branch 'aw/complete-case-insensitive'
Junio C Hamano [Mon, 19 Dec 2022 02:46:18 +0000 (11:46 +0900)] 
Merge branch 'aw/complete-case-insensitive'

Introduce a case insensitive mode to the Bash completion helpers.

* aw/complete-case-insensitive:
  completion: add case-insensitive match of pseudorefs
  completion: add optional ignore-case when matching refs

17 months agoMerge branch 'sx/pthread-error-check-fix'
Junio C Hamano [Mon, 19 Dec 2022 02:46:17 +0000 (11:46 +0900)] 
Merge branch 'sx/pthread-error-check-fix'

Correct pthread API usage.

* sx/pthread-error-check-fix:
  maintenance: compare output of pthread functions for inequality with 0

17 months agoMerge branch 'rs/diff-parseopts'
Junio C Hamano [Mon, 19 Dec 2022 02:46:17 +0000 (11:46 +0900)] 
Merge branch 'rs/diff-parseopts'

The way the diff machinery prepares the options array for the
parse_options API has been refactored to avoid resource leaks.

* rs/diff-parseopts:
  diff: remove parseopts member from struct diff_options
  diff: use add_diff_options() in diff_opt_parse()
  diff: factor out add_diff_options()

17 months agoMerge branch 'jk/avoid-redef-system-functions'
Junio C Hamano [Mon, 19 Dec 2022 02:46:17 +0000 (11:46 +0900)] 
Merge branch 'jk/avoid-redef-system-functions'

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

* jk/avoid-redef-system-functions:

17 months agoMerge branch 'jk/avoid-redef-system-functions-2.30'
Junio C Hamano [Mon, 19 Dec 2022 02:46:16 +0000 (11:46 +0900)] 
Merge branch 'jk/avoid-redef-system-functions-2.30'

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

17 months agoMerge branch 'rs/t3920-crlf-eating-grep-fix'
Junio C Hamano [Mon, 19 Dec 2022 02:46:14 +0000 (11:46 +0900)] 
Merge branch 'rs/t3920-crlf-eating-grep-fix'

Test fix.

* rs/t3920-crlf-eating-grep-fix:
  t3920: support CR-eating grep

17 months agoMerge branch 'js/t3920-shell-and-or-fix'
Junio C Hamano [Mon, 19 Dec 2022 02:46:14 +0000 (11:46 +0900)] 
Merge branch 'js/t3920-shell-and-or-fix'

Test fix.

* js/t3920-shell-and-or-fix:
  t3920: don't ignore errors of more than one command with `|| true`

17 months agoMerge branch 'jh/fsmonitor-darwin-modernize'
Junio C Hamano [Mon, 19 Dec 2022 02:46:14 +0000 (11:46 +0900)] 
Merge branch 'jh/fsmonitor-darwin-modernize'

Stop using deprecated macOS API in fsmonitor.

* jh/fsmonitor-darwin-modernize:
  fsmonitor: eliminate call to deprecated FSEventStream function

17 months agoMerge branch 'ab/t4023-avoid-losing-exit-status-of-diff'
Junio C Hamano [Mon, 19 Dec 2022 02:46:13 +0000 (11:46 +0900)] 
Merge branch 'ab/t4023-avoid-losing-exit-status-of-diff'

Test fix.

* ab/t4023-avoid-losing-exit-status-of-diff:
  t4023: fix ignored exit codes of git

17 months agoMerge branch 'ab/t7600-avoid-losing-exit-status-of-git'
Junio C Hamano [Mon, 19 Dec 2022 02:46:13 +0000 (11:46 +0900)] 
Merge branch 'ab/t7600-avoid-losing-exit-status-of-git'

Test fix.

* ab/t7600-avoid-losing-exit-status-of-git:
  t7600: don't ignore "rev-parse" exit code in helper

17 months agoMerge branch 'ab/t5314-avoid-losing-exit-status'
Junio C Hamano [Mon, 19 Dec 2022 02:46:13 +0000 (11:46 +0900)] 
Merge branch 'ab/t5314-avoid-losing-exit-status'

Test fix.

* ab/t5314-avoid-losing-exit-status:
  t5314: check exit code of "git"

17 months agoMerge branch 'jh/t7527-unflake-by-forcing-cookie'
Junio C Hamano [Mon, 19 Dec 2022 02:46:13 +0000 (11:46 +0900)] 
Merge branch 'jh/t7527-unflake-by-forcing-cookie'

Make fsmonitor more robust to avoid the flakiness seen in t7527.

* jh/t7527-unflake-by-forcing-cookie:
  fsmonitor: fix race seen in t7527

17 months agoMerge branch 'rs/plug-pattern-list-leak-in-lof'
Junio C Hamano [Mon, 19 Dec 2022 02:46:12 +0000 (11:46 +0900)] 
Merge branch 'rs/plug-pattern-list-leak-in-lof'

Leak fix.

* rs/plug-pattern-list-leak-in-lof:
  list-objects-filter: plug pattern_list leak

17 months agoMerge branch 'rs/t4205-do-not-exit-in-test-script'
Junio C Hamano [Mon, 19 Dec 2022 02:46:12 +0000 (11:46 +0900)] 
Merge branch 'rs/t4205-do-not-exit-in-test-script'

Test fix.

* rs/t4205-do-not-exit-in-test-script:
  t4205: don't exit test script on failure

17 months agovar: add GIT_SEQUENCE_EDITOR variable
Sean Allred [Sat, 17 Dec 2022 23:09:59 +0000 (23:09 +0000)] 
var: add GIT_SEQUENCE_EDITOR variable

The editor program used by Git when editing the sequencer "todo" file
is determined by examining a few environment variables and also
affected by configuration variables. Introduce "git var
GIT_SEQUENCE_EDITOR" to give users access to the final result of the
logic without having to know the exact details.

This is very similar in spirit to 44fcb497 (Teach git var about
GIT_EDITOR, 2009-11-11) that introduced "git var GIT_EDITOR".

Signed-off-by: Sean Allred <allred.sean@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agosubmodule: accept -v for the update command
Sven Strickroth [Sat, 10 Dec 2022 13:06:37 +0000 (14:06 +0100)] 
submodule: accept -v for the update command

Since a56771a6 (builtin/pull: respect verbosity settings in
submodules, 2018-01-25), "git pull -v --recurse-submodules"
propagates the "-v" to the submodule command, but because the
latter command does not understand the option, it barfs.

Teach "git submodule update" to accept the option to fix it.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoMakefile: use sha1collisiondetection by default on OSX and Darwin
Ævar Arnfjörð Bjarmason [Thu, 15 Dec 2022 08:43:05 +0000 (09:43 +0100)] 
Makefile: use sha1collisiondetection by default on OSX and Darwin

When the sha1collisiondetection library was added and made the default
in [1] the interaction with APPLE_COMMON_CRYPTO added in [2] and [3]
seems to have been missed. On modern OSX and Darwin we are able to use
Apple's CommonCrypto both for SHA-1, and as a generic (but partial)
OpenSSL replacement.

This left OSX and Darwin without protection against the SHAttered
attack when building Git in its default configuration.

Let's also use sha1collisiondetection on OSX, to do so we'll need to
split up the "APPLE_COMMON_CRYPTO" flag into that flag and a new
"APPLE_COMMON_CRYPTO_SHA1".

Because of this we can stop conflating whether we want to use Apple's
CommonCrypto at all, and whether we want to use it for SHA-1.  This
makes the CI recipe added in [4] simpler.

1. e6b07da2780 (Makefile: make DC_SHA1 the default, 2017-03-17)
2. 4dcd7732db0 (Makefile: add support for Apple CommonCrypto facility, 2013-05-19)
3. 61067954ce1 (cache.h: eliminate SHA-1 deprecation warnings on Mac OS X, 2013-05-19)
4. 1ad5c3df35a (ci: use DC_SHA1=YesPlease on osx-clang job for CI,
   2022-10-20)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoref-filter: convert email atom parser to use err_bad_arg()
Jeff King [Wed, 14 Dec 2022 16:24:03 +0000 (11:24 -0500)] 
ref-filter: convert email atom parser to use err_bad_arg()

The error message for a bogus argument to %(authoremail), etc, is:

   $ git for-each-ref --format='%(authoremail:foo)'
   fatal: unrecognized email option: foo

Saying just "email" is a little vague; most of the other atom parsers
would use the full name "%(authoremail)", but we can't do that here
because the same function also handles %(taggeremail), etc. Until
recently, passing atom->name was a bad idea, because it erroneously
included the arguments in the atom name. But since the previous commit
taught err_bad_arg() to handle this, we can now do so and get:

  fatal: unrecognized %(authoremail) argument: foo

which is consistent with other atoms.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoref-filter: truncate atom names in error messages
Jeff King [Wed, 14 Dec 2022 16:23:53 +0000 (11:23 -0500)] 
ref-filter: truncate atom names in error messages

If you pass a bogus argument to %(refname), you may end up with a
message like this:

  $ git for-each-ref --format='%(refname:foo)'
  fatal: unrecognized %(refname:foo) argument: foo

which is confusing. It should just say:

  fatal: unrecognized %(refname) argument: foo

which is clearer, and is consistent with most other atom parsers. Those
other parsers do not have the same problem because they pass the atom
name from a string literal in the parser function. But because the
parser for %(refname) also handles %(upstream) and %(push), it instead
uses atom->name, which includes the arguments. The oid atom parser which
handles %(tree), %(parent), etc suffers from the same problem.

It seems like the cleanest fix would be for atom->name to be _just_ the
name, since there's already a separate "args" field. But since that
field is also used for other things, we can't change it easily (e.g.,
it's how we find things in the used_atoms array, and clearly %(refname)
and %(refname:short) are not the same thing).

Instead, we'll teach our error_bad_arg() function to stop at the first
":". This is a little hacky, as we're effectively re-parsing the name,
but the format is simple enough to do this as a one-liner, and this
localizes the change to the error-reporting code.

We'll give the same treatment to err_no_arg(). None of its callers use
this atom->name trick, but it's worth future-proofing it while we're
here.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoref-filter: factor out "unrecognized %(foo) arg" errors
Jeff King [Wed, 14 Dec 2022 16:20:19 +0000 (11:20 -0500)] 
ref-filter: factor out "unrecognized %(foo) arg" errors

Atom parsers that take arguments generally have a catch-all for "this
arg is not recognized". Most of them use the same printf template, which
is good, because it makes life easier for translators. Let's pull this
template into a helper function, which makes the code in the parsers
shorter and avoids any possibility of differences.

As with the previous commit, we'll pick an arbitrary atom to make sure
the test suite covers this code.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoref-filter: factor out "%(foo) does not take arguments" errors
Jeff King [Wed, 14 Dec 2022 16:19:43 +0000 (11:19 -0500)] 
ref-filter: factor out "%(foo) does not take arguments" errors

Many atom parsers give the same error message, differing only in the
name of the atom. If we use "%s does not take arguments", that should
make life easier for translators, as they only need to translate one
string. And in doing so, we can easily pull it into a helper function to
make sure they are all using the exact same string.

I've added a basic test here for %(HEAD), just to make sure this code is
exercised at all in the test suite. We could cover each such atom, but
the effort-to-reward ratio of trying to maintain an exhaustive list
doesn't seem worth it.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoref-filter: reject arguments to %(HEAD)
Jeff King [Wed, 14 Dec 2022 16:18:49 +0000 (11:18 -0500)] 
ref-filter: reject arguments to %(HEAD)

The %(HEAD) atom doesn't take any arguments, but unlike other atoms in
the same boat (objecttype, deltabase, etc), it does not detect this
situation and complain. Let's make it consistent with the others.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agodiff: fix regression with --stat and unmerged file
Peter Grayson [Wed, 14 Dec 2022 17:41:51 +0000 (12:41 -0500)] 
diff: fix regression with --stat and unmerged file

A regression was introduced in

  12fc4ad89e (diff.c: use utf8_strwidth() to count display width, 2022-09-14)

that causes missing newlines after "Unmerged" entries in `git diff
--cached --stat` output.

This problem affects v2.39.0-rc0 through v2.39.0.

Add the missing newline along with a new test to cover this
behavior.

Signed-off-by: Peter Grayson <pete@jpgrayson.net>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agogit: remove duplicate includes
Seija Kijin [Wed, 14 Dec 2022 16:52:23 +0000 (16:52 +0000)] 
git: remove duplicate includes

These files are already included; we do not need to include them again

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agofsmonitor: eliminate call to deprecated FSEventStream function
Jeff Hostetler [Wed, 14 Dec 2022 19:12:33 +0000 (19:12 +0000)] 
fsmonitor: eliminate call to deprecated FSEventStream function

Replace the call to `FSEventStreamScheduleWithRunLoop()` function with
the suggested `FSEventStreamSetDispatchQueue()` function.

The MacOS version of the builtin FSMonitor feature uses the
`FSEventStreamScheduleWithRunLoop()` function to drive the event loop
and process FSEvents from the system.  This routine has now been
deprecated by Apple.  The MacOS 13 (Ventura) compiler tool chain now
generates a warning when compiling calls to this function.  In
DEVELOPER=1 mode, this now causes a compile error.

The `FSEventStreamSetDispatchQueue()` function is conceptually similar
and is the suggested replacement.  However, there are some subtle
thread-related differences.

Previously, the event stream would be processed by the
`fsm_listen__loop()` thread while it was in the `CFRunLoopRun()`
method.  (Conceptually, this was a blocking call on the lifetime of
the event stream where our thread drove the event loop and individual
events were handled by the `fsevent_callback()`.)

With the change, a "dispatch queue" is created and FSEvents will be
processed by a hidden queue-related thread (that calls the
`fsevent_callback()` on our behalf).  Our `fsm_listen__loop()` thread
maintains the original blocking model by waiting on a mutex/condition
variable pair while the hidden thread does all of the work.

While the deprecated API used by the original were introduced in
macOS 10.5 (Oct 2007), the API used by the updated code were
introduced back in macOS 10.6 (Aug 2009) and has been available
since then.  So this change _could_ break those who have happily
been using 10.5 (if there were such people), but these two dates
both predate the oldest versions of macOS Apple seems to support
anyway, so we should be safe.

Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoStart the 2.40 cycle
Junio C Hamano [Wed, 14 Dec 2022 08:43:27 +0000 (17:43 +0900)] 
Start the 2.40 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoMerge branch 'js/t0021-windows-pwd'
Junio C Hamano [Wed, 14 Dec 2022 08:42:18 +0000 (17:42 +0900)] 
Merge branch 'js/t0021-windows-pwd'

Test fix.

* js/t0021-windows-pwd:
  t0021: use Windows-friendly `pwd`

17 months agoMerge branch 'sa/git-var-empty'
Junio C Hamano [Wed, 14 Dec 2022 06:55:47 +0000 (15:55 +0900)] 
Merge branch 'sa/git-var-empty'

"git var UNKNOWN_VARIABLE" and "git var VARIABLE" with the variable
given an empty value used to behave identically.  Now the latter
just gives an empty output, while the former still gives an error
message.

* sa/git-var-empty:
  var: allow GIT_EDITOR to return null
  var: do not print usage() with a correct invocation

17 months agoMerge branch 'rs/multi-filter-args'
Junio C Hamano [Wed, 14 Dec 2022 06:55:46 +0000 (15:55 +0900)] 
Merge branch 'rs/multi-filter-args'

Fix a bug where `pack-objects` would not respect multiple `--filter`
arguments when invoked directly.

* rs/multi-filter-args:
  list-objects-filter: remove OPT_PARSE_LIST_OBJECTS_FILTER_INIT()
  pack-objects: simplify --filter handling
  pack-objects: fix handling of multiple --filter options
  t5317: demonstrate failure to handle multiple --filter options
  t5317: stop losing return codes of git ls-files

17 months agoMerge branch 'tl/pack-bitmap-absolute-paths'
Junio C Hamano [Wed, 14 Dec 2022 06:55:46 +0000 (15:55 +0900)] 
Merge branch 'tl/pack-bitmap-absolute-paths'

The pack-bitmap machinery is taught to log the paths of redundant
bitmap(s) to trace2 instead of stderr.

* tl/pack-bitmap-absolute-paths:
  pack-bitmap.c: trace bitmap ignore logs when midx-bitmap is found
  pack-bitmap.c: break out of the bitmap loop early if not tracing
  pack-bitmap.c: avoid exposing absolute paths
  pack-bitmap.c: remove unnecessary "open_pack_index()" calls

17 months agoMerge branch 'yn/git-jump-emacs'
Junio C Hamano [Wed, 14 Dec 2022 06:55:46 +0000 (15:55 +0900)] 
Merge branch 'yn/git-jump-emacs'

"git jump" (in contrib/) learned to present the "quickfix list" to
its standard output (instead of letting it consumed by the editor
it invokes), and learned to also drive emacs/emacsclient.

* yn/git-jump-emacs:
  git-jump: invoke emacs/emacsclient
  git-jump: move valid-mode check earlier
  git-jump: add an optional argument '--stdout'

17 months agoMerge branch 'ab/various-leak-fixes'
Junio C Hamano [Wed, 14 Dec 2022 06:55:46 +0000 (15:55 +0900)] 
Merge branch 'ab/various-leak-fixes'

Various leak fixes.

* ab/various-leak-fixes:
  built-ins: use free() not UNLEAK() if trivial, rm dead code
  revert: fix parse_options_concat() leak
  cherry-pick: free "struct replay_opts" members
  rebase: don't leak on "--abort"
  connected.c: free the "struct packed_git"
  sequencer.c: fix "opts->strategy" leak in read_strategy_opts()
  ls-files: fix a --with-tree memory leak
  revision API: call graph_clear() in release_revisions()
  unpack-file: fix ancient leak in create_temp_file()
  built-ins & libs & helpers: add/move destructors, fix leaks
  dir.c: free "ident" and "exclude_per_dir" in "struct untracked_cache"
  read-cache.c: clear and free "sparse_checkout_patterns"
  commit: discard partial cache before (re-)reading it
  {reset,merge}: call discard_index() before returning
  tests: mark tests as passing with SANITIZE=leak

17 months agoMerge branch 'kz/merge-tree-merge-base'
Junio C Hamano [Wed, 14 Dec 2022 06:55:45 +0000 (15:55 +0900)] 
Merge branch 'kz/merge-tree-merge-base'

"merge-tree" learns a new `--merge-base` option.

* kz/merge-tree-merge-base:
  docs: fix description of the `--merge-base` option
  merge-tree.c: allow specifying the merge-base when --stdin is passed
  merge-tree.c: add --merge-base=<commit> option

17 months agoMerge branch 'dd/git-bisect-builtin'
Junio C Hamano [Wed, 14 Dec 2022 06:55:45 +0000 (15:55 +0900)] 
Merge branch 'dd/git-bisect-builtin'

`git bisect` becomes a builtin.

* dd/git-bisect-builtin:
  bisect; remove unused "git-bisect.sh" and ".gitignore" entry
  Turn `git bisect` into a full built-in
  bisect--helper: log: allow arbitrary number of arguments
  bisect--helper: handle states directly
  bisect--helper: emit usage for "git bisect"
  bisect test: test exit codes on bad usage
  bisect--helper: identify as bisect when report error
  bisect-run: verify_good: account for non-negative exit status
  bisect run: keep some of the post-v2.30.0 output
  bisect: fix output regressions in v2.30.0
  bisect: refactor bisect_run() to match CodingGuidelines
  bisect tests: test for v2.30.0 "bisect run" regressions

17 months agoobject-file: inline write_buffer()
René Scharfe [Tue, 13 Dec 2022 19:35:07 +0000 (20:35 +0100)] 
object-file: inline write_buffer()

write_buffer() reports the OS error if it is unable to write.  Its only
caller dies in that case, giving some more context in its last message.

Inline this function and show only a single error message that includes
both the context (writing a loose object file) and the OS error.  This
shortens the code and simplifies the output.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agouserdiff: mark unused parameter in internal callback
Jeff King [Tue, 13 Dec 2022 11:16:57 +0000 (06:16 -0500)] 
userdiff: mark unused parameter in internal callback

Since f12fa9ee6c (userdiff: add and use for_each_userdiff_driver(),
2021-04-08), lookup of userdiffs is done with a generic
for_each_userdiff_driver(). But the name lookup doesn't use the "type"
field, of course.

We can't get rid of that field from the generic interface because it is
used by t/helper/test-userdiff.c. So mark it as unused in this instance
to silence -Wunused-parameter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agolist-objects-filter: mark unused parameters in virtual functions
Jeff King [Tue, 13 Dec 2022 11:14:23 +0000 (06:14 -0500)] 
list-objects-filter: mark unused parameters in virtual functions

The "struct filter" abstract type defines several virtual function
pointers. Not all of the concrete functions need every parameter, but
they have to conform to the generic interface. Mark unused ones to
silence -Wunused-parameter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agodiff: mark unused parameters in callbacks
Jeff King [Tue, 13 Dec 2022 11:13:48 +0000 (06:13 -0500)] 
diff: mark unused parameters in callbacks

The diff code provides a format_callback interface, but not every
callback needs each parameter (e.g., the "opt" and "data" parameters are
frequently left unused). Likewise for the output_prefix callback, the
low-level change/add_remove interfaces, the callbacks used by
xdi_diff(), etc.

Mark unused arguments in the callback implementations to quiet
-Wunused-parameter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoxdiff: mark unused parameter in xdl_call_hunk_func()
Jeff King [Tue, 13 Dec 2022 11:13:24 +0000 (06:13 -0500)] 
xdiff: mark unused parameter in xdl_call_hunk_func()

This function is used interchangeably with xdl_emit via a function
pointer, so we can't just drop the unused parameter. Mark it to silence
-Wunused-parameter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoxdiff: drop unused parameter in def_ff()
Jeff King [Tue, 13 Dec 2022 11:13:08 +0000 (06:13 -0500)] 
xdiff: drop unused parameter in def_ff()

The def_ff() function is the default "find_func" for finding hunk
headers. It has never used its "priv" argument since it was introduced
in f258475a6e (Per-path attribute based hunk header selection.,
2007-07-06). But back then we used a function pointer to switch between
a caller-provided function and the default, so the two had to conform to
the same interface.

In ff2981f724 (xdiff: factor out match_func_rec(), 2016-05-28), that
pointer indirection went away in favor of code which directly calls
either of the two functions. So there's no need for def_ff() to retain
this unused parameter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agows: drop unused parameter from ws_blank_line()
Jeff King [Tue, 13 Dec 2022 11:12:58 +0000 (06:12 -0500)] 
ws: drop unused parameter from ws_blank_line()

We take a ws_rule parameter, but have never looked at it since the
function was added in 877f23ccb8 (Teach "diff --check" about new blank
lines at end, 2008-06-26). A comment in the function does mention how we
_could_ use it, but nobody has felt the need to do so for over a decade.

We could keep it around as reminder of what could be done, but the
comment serves that purpose. And in the meantime, it triggers
-Wunused-parameter.

So let's drop it, which in turn allows us to drop similar arguments
further up the callstack. I've left the comment intact. It does still
say "ws_rule", but that name is used consistently in the whitespace
code, so the meaning is clear.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agolist-objects: drop process_gitlink() function
Jeff King [Tue, 13 Dec 2022 11:12:09 +0000 (06:12 -0500)] 
list-objects: drop process_gitlink() function

Our object graph traversal code has a process_gitlink() function which
we call when we see a gitlink entry. The function does nothing; it was
added in the early days of gitlinks by 6e2f441bd4 (Teach git
list-objects logic to not follow gitlinks, 2007-04-13).

The comment above the function talks about some things we _could_ do.
But in the intervening 15 years, nobody has touched the function, and
the submodule code usually makes its own decisions about when and how to
examine the links. At the generic traversal layer, we can't assume that
the pointed-to commit is available.

Let's drop this placeholder that isn't really helping anything. This
silences some -Wunused-parameter warnings, and also gets rid of a crufty
use of "const unsigned char *" to pass a raw hash value.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoblob: drop unused parts of parse_blob_buffer()
Jeff King [Tue, 13 Dec 2022 11:11:57 +0000 (06:11 -0500)] 
blob: drop unused parts of parse_blob_buffer()

Our parse_blob_buffer() takes a ptr/len combo, just like
parse_tree_buffer(), etc, and returns success or failure. But it doesn't
actually do anything with them; we just set the "parsed" flag in the
object and return success, without even looking at the contents.

There could be some value to keeping these unused parameters:

  - it's consistent with the parse functions for other object types. But
    we already lost that consistency in 837d395a5c (Replace parse_blob()
    with an explanatory comment, 2010-01-18).

  - As the comment from 837d395a5c explains, callers are supposed to
    make sure they have the object content available. So in theory
    asking for these parameters could serve as a signal. But there are
    only two callers, and one of them always passes NULL (after doing a
    streaming check of the object hash).

    This shows that there aren't likely to be a lot of callers (since
    everyone either uses the type-generic parse functions, or handles
    blobs individually), and that they need to take special care anyway
    (because we usually want to avoid loading whole blobs in memory if
    we can avoid it).

So let's just drop these unused parameters, and likewise the useless
return value. While we're touching the header file, let's move the
declaration of parse_blob_buffer() right below that explanatory comment,
where it's more likely to be seen by people looking for the function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agols-refs: use repository parameter to iterate refs
Jeff King [Tue, 13 Dec 2022 11:11:10 +0000 (06:11 -0500)] 
ls-refs: use repository parameter to iterate refs

The ls_refs() function (for the v2 protocol command of the same name)
takes a repository parameter (like all v2 commands), but ignores it. It
should use it to access the refs.

This isn't a bug in practice, since we only call this function when
serving upload-pack from the main repository. But it's an awkward
gotcha, and it causes -Wunused-parameter to complain.

The main reason we don't use the repository parameter is that the ref
iteration interface we call doesn't have a "refs_" variant that takes a
ref_store. However we can easily add one. In fact, since there is only
one other caller (in ref-filter.c), there is no need to maintain the
non-repository wrapper; that caller can just use the_repository. It's
still a long way from consistently using a repository object, but it's
one small step in the right direction.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoserver_supports_v2(): use a separate function for die_on_error
Jeff King [Tue, 13 Dec 2022 10:52:58 +0000 (05:52 -0500)] 
server_supports_v2(): use a separate function for die_on_error

The server_supports_v2() helper lets a caller find out if the server
supports a feature, and will optionally die if it's not supported. This
makes the return value confusing, as it's only meaningful when the
function is not asked to die.

Coverity flagged a new call like:

  /* check that we support "foo" */
  server_supports_v2("foo", 1);

complaining that we usually checked the return value, but this time we
didn't. But this call is correct, and other ones that did:

  if (server_supports_v2("foo", 1))
          do_something_with_foo();

are "wrong", in the sense that we know the conditional will always be
true (but there's no bug; the code is simply misleading).

Let's split the "die" behavior into its own function which returns void,
and modify each caller to use the correct one.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoam: don't pass strvec to apply_parse_options()
René Scharfe [Tue, 13 Dec 2022 06:47:59 +0000 (07:47 +0100)] 
am: don't pass strvec to apply_parse_options()

apply_parse_options() passes the array of argument strings to
parse_options(), which removes recognized options.  The removed strings
are not freed, though.

Make a copy of the strvec to pass to the function to retain the pointers
of its strings, so we release them all at the end.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agocommit: skip already cleared parents in clear_commit_marks_1()
René Scharfe [Tue, 13 Dec 2022 06:27:10 +0000 (07:27 +0100)] 
commit: skip already cleared parents in clear_commit_marks_1()

Don't put clean parents on the pending list, as they and their ancestors
don't need any treatment and would be skipped later anyway.  This saves
the allocation and release of a commit list item in ca. 20% of the cases
during a run of the test suite.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agoreflog: clear leftovers in reflog_expiry_cleanup()
René Scharfe [Tue, 13 Dec 2022 06:20:09 +0000 (07:20 +0100)] 
reflog: clear leftovers in reflog_expiry_cleanup()

reflog_expiry_prepare() calls mark_reachable(), which recurively flags
commits as REACHABLE.  The traversal stops beyond a certain age
threshold; the boundary commits also marked as REACHABLE and put back
into mark_list at the end.  unreachable() finishes the traversal down to
the roots if necessary -- but if all interesting commits are younger
than the age threshold then only recent commits need to be visited.

When this optimization works then the boundary commits still sit there
in mark_list at the end.  Clear their REACHABLE flag and release the
commit list allocations.

While at it remove a duplicate code line from mark_reachable(); the same
flag is already set five lines up.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agohttp-fetch: invoke trace2_cmd_name()
Jonathan Tan [Mon, 12 Dec 2022 22:46:30 +0000 (14:46 -0800)] 
http-fetch: invoke trace2_cmd_name()

ee4512ed48 ("trace2: create new combined trace facility", 2019-02-
22) introduced trace2_cmd_name() and taught both the Git built-ins and
some non-built-ins to use it. However, http-fetch was not one of them
(perhaps due to its low usage at the time).

Teach http-fetch to invoke this function. After this patch, this
function will be invoked right after argument parsing, just like in
remote-curl.c.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 months agohelp.c: fix autocorrect in work tree for bare repository
Simon Gerber [Sat, 29 Oct 2022 19:56:14 +0000 (19:56 +0000)] 
help.c: fix autocorrect in work tree for bare repository

Currently, auto correction doesn't work reliably for commands which must
run in a work tree (e.g. `git status`) in Git work trees which are
created from a bare repository.

As far as I'm able to determine, this has been broken since commit
659fef199f (help: use early config when autocorrecting aliases,
2017-06-14), where the call to `git_config()` in `help_unknown_cmd()`
was replaced with a call to `read_early_config()`. From what I can tell,
the actual cause for the unexpected error is that we call
`git_default_config()` in the `git_unknown_cmd_config` callback instead
of simply returning `0` for config entries which we aren't interested
in.

Calling `git_default_config()` in this callback to `read_early_config()`
seems like a bad idea since those calls will initialize a bunch of state
in `environment.c` (among other things `is_bare_repository_cfg`) before
we've properly detected that we're running in a work tree.

All other callbacks provided to `read_early_config()` appear to only
extract their configurations while simply returning `0` for all other
config keys.

This commit changes the `git_unknown_cmd_config` callback to not call
`git_default_config()`. Instead we also simply return `0` for config
keys which we're not interested in.

Additionally the commit adds a new test case covering `help.autocorrect`
in a work tree created from a bare clone.

Signed-off-by: Simon Gerber <gesimu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 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>
17 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)

17 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

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

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

17 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

17 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

17 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

17 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

17 months agoMerge branch 'od/ci-use-checkout-v3-when-applicable' into maint-2.38
Junio C Hamano [Sat, 10 Dec 2022 05:02:09 +0000 (14:02 +0900)] 
Merge branch 'od/ci-use-checkout-v3-when-applicable' into maint-2.38

Update GitHub CI to use actions/checkout@v3; use of the older
checkout@v2 gets annoying deprecation notices.

* od/ci-use-checkout-v3-when-applicable:
  ci(main): upgrade actions/checkout to v3