]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years 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()

2 years 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()

2 years 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()

2 years 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

2 years 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

2 years 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()

2 years 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

2 years 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>
2 years 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

2 years 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

2 years 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

2 years 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

2 years 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()

2 years 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:

2 years 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

2 years 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

2 years 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`

2 years 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

2 years 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

2 years 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

2 years 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"

2 years 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

2 years 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

2 years 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

2 years 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>
2 years 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>
2 years 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`

2 years 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

2 years 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

2 years 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

2 years 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'

2 years 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

2 years 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

2 years 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

2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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)

2 years 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

2 years 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>
2 years 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>
2 years 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>
2 years 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

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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years agoMerge branch 'js/ci-use-newer-up-down-artifact'
Junio C Hamano [Sat, 10 Dec 2022 05:01:06 +0000 (14:01 +0900)] 
Merge branch 'js/ci-use-newer-up-down-artifact'

CI fix.

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

2 years agoMerge branch 'ab/ci-use-macos-12'
Junio C Hamano [Sat, 10 Dec 2022 05:01:06 +0000 (14:01 +0900)] 
Merge branch 'ab/ci-use-macos-12'

CI fix.

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

2 years agoMerge branch 'ab/ci-retire-set-output'
Junio C Hamano [Sat, 10 Dec 2022 05:01:05 +0000 (14:01 +0900)] 
Merge branch 'ab/ci-retire-set-output'

CI fix.

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

2 years agoMerge branch 'ab/ci-musl-bash-fix'
Junio C Hamano [Sat, 10 Dec 2022 05:01:05 +0000 (14:01 +0900)] 
Merge branch 'ab/ci-musl-bash-fix'

CI fix.

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

2 years agoMerge branch 'od/ci-use-checkout-v3-when-applicable'
Junio C Hamano [Sat, 10 Dec 2022 05:01:05 +0000 (14:01 +0900)] 
Merge branch 'od/ci-use-checkout-v3-when-applicable'

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

2 years agomailmap: update email address of Matheus Tavares
Matheus Tavares [Fri, 9 Dec 2022 23:35:16 +0000 (20:35 -0300)] 
mailmap: update email address of Matheus Tavares

I haven't been very active in the community lately, but I'm soon going
to lose access to my previous commit email (@usp.br); so add my current
personal address to mailmap for any future message exchanges or patch
contributions.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase --update-refs: avoid unintended ref deletion
Victoria Dye [Mon, 7 Nov 2022 17:47:52 +0000 (09:47 -0800)] 
rebase --update-refs: avoid unintended ref deletion

In b3b1a21d1a5 (sequencer: rewrite update-refs as user edits todo list,
2022-07-19), the 'todo_list_filter_update_refs()' step was added to handle
the removal of 'update-ref' lines from a 'rebase-todo'. Specifically, it
removes potential ref updates from the "update refs state" if a ref does not
have a corresponding 'update-ref' line.

However, because 'write_update_refs_state()' will not update the state if
the 'refs_to_oids' list was empty, removing *all* 'update-ref' lines will
result in the state remaining unchanged from how it was initialized (with
all refs' "after" OID being null). Then, when the ref update is applied, all
refs will be updated to null and consequently deleted.

To fix this, delete the 'update-refs' state file when 'refs_to_oids' is
empty. Additionally, add a tests covering "all update-ref lines removed"
cases.

Reported-by: herr.kaste <herr.kaste@gmail.com>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2 years agoRelNotes: a couple of typofixes
Johannes Schindelin [Thu, 8 Dec 2022 14:48:07 +0000 (14:48 +0000)] 
RelNotes: a couple of typofixes

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'turkish' of github.com:bitigchi/git-po
Jiang Xin [Thu, 8 Dec 2022 00:25:27 +0000 (08:25 +0800)] 
Merge branch 'turkish' of github.com:bitigchi/git-po

* 'turkish' of github.com:bitigchi/git-po:
  l10n: tr: v2.39.0 updates

2 years agoMerge branch 'catalan' of github.com:Softcatala/git-po
Jiang Xin [Thu, 8 Dec 2022 00:24:56 +0000 (08:24 +0800)] 
Merge branch 'catalan' of github.com:Softcatala/git-po

* 'catalan' of github.com:Softcatala/git-po:
  l10n: Update Catalan translation

2 years agoMerge branch 'fz/po-zh_CN' of github.com:fangyi-zhou/git-po
Jiang Xin [Thu, 8 Dec 2022 00:22:57 +0000 (08:22 +0800)] 
Merge branch 'fz/po-zh_CN' of github.com:fangyi-zhou/git-po

* 'fz/po-zh_CN' of github.com:fangyi-zhou/git-po:
  l10n: zh_CN v2.39.0 round 1

2 years agoCI: migrate away from deprecated "set-output" syntax
Ævar Arnfjörð Bjarmason [Wed, 7 Dec 2022 01:49:18 +0000 (02:49 +0100)] 
CI: migrate away from deprecated "set-output" syntax

As noted in [1] and the warnings the CI itself is spewing echoing
outputs to stdout is deprecated, and they should be written to
"$GITHUB_OUTPUT" instead.

1. https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoci: avoid using deprecated {up,down}load-artifacts Action
Johannes Schindelin [Wed, 7 Dec 2022 14:34:39 +0000 (14:34 +0000)] 
ci: avoid using deprecated {up,down}load-artifacts Action

The deprecated versions of these Actions still use node.js 12 whereas
workflows will need to use node.js 16 to avoid problems going forward.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoCI: don't explicitly pick "bash" shell outside of Windows, fix regression
Ævar Arnfjörð Bjarmason [Wed, 7 Dec 2022 12:03:15 +0000 (13:03 +0100)] 
CI: don't explicitly pick "bash" shell outside of Windows, fix regression

When the "js/ci-github-workflow-markup" topic was originally merged in
[1] it included a change to get rid of the "ci/print-test-failures.sh"
step[2]. This was then brought back in [3] as part of a fix-up patches
on top[4].

The problem was that [3] was not a revert of the relevant parts of
[2], but rather copy/pasted the "ci/print-test-failures.sh" step that
was present for the Windows job to all "ci/print-test-failures.sh"
steps. The Windows steps specified "shell: bash", but the non-Windows
ones did not.

This broke the "ci/print/test-failures.sh" step for the "linux-musl"
job, where we don't have a "bash" shell, just a "/bin/sh" (a
"dash"). This breakage was reported at the time[5], but hadn't been
fixed.

It would be sufficient to change this only for "linux-musl", but let's
change this for both "regular" and "dockerized" to omit the "shell"
line entirely, as we did before [2].

Let's also change undo the "name" change that [3] made while
copy/pasting the "print test failures" step for the Windows job. These
steps are now the same as they were before [2], except that the "if"
includes the "env.FAILED_TEST_ARTIFACTS" test.

1. fc5a070f591 (Merge branch 'js/ci-github-workflow-markup', 2022-06-07)
2. 08dccc8fc1f (ci: make it easier to find failed tests' logs in the
   GitHub workflow, 2022-05-21)
3. 5aeb145780f (ci(github): bring back the 'print test failures' step,
   2022-06-08)
4. d0d96b8280f (Merge branch 'js/ci-github-workflow-markup', 2022-06-17)
5. https://lore.kernel.org/git/220725.86sfmpneqp.gmgdl@evledraar.gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: tr: v2.39.0 updates
Emir SARI [Wed, 7 Dec 2022 15:00:57 +0000 (18:00 +0300)] 
l10n: tr: v2.39.0 updates

Signed-off-by: Emir SARI <emir_sari@icloud.com>
2 years agol10n: Update Catalan translation
Jordi Mas [Wed, 7 Dec 2022 06:35:32 +0000 (07:35 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
2 years agoCI: upgrade to macos-12, and pin OSX version
Ævar Arnfjörð Bjarmason [Tue, 6 Dec 2022 19:57:56 +0000 (20:57 +0100)] 
CI: upgrade to macos-12, and pin OSX version

Per [1] and the warnings our CI is emitting GitHub is phasing in
"macos-12" as their "macos-latest".

As with [2], let's pin our image to a specific version so that we're
not having it swept from under us, and our upgrade cycle can be more
predictable than whenever GitHub changes their images.

1. https://github.com/actions/runner-images/issues/6384
2. 0178420b9ca (github-actions: run gcc-8 on ubuntu-20.04 image,
   2022-11-25)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot3920: support CR-eating grep
René Scharfe [Fri, 2 Dec 2022 16:51:13 +0000 (17:51 +0100)] 
t3920: support CR-eating grep

grep(1) converts CRLF line endings to LF on current MinGW:

   $ uname -sr
   MINGW64_NT-10.0-22621 3.3.6-341.x86_64

   $ printf 'a\r\n' | hexdump.exe -C
   00000000  61 0d 0a                                          |a..|
   00000003

   $ printf 'a\r\n' | grep . | hexdump.exe -C
   00000000  61 0a                                             |a.|
   00000002

Create the intended test file by grepping the original file with LF
line endings and adding CRs explicitly.

The missing CRs went unnoticed because test_cmp on MinGW ignores line
endings since 4d715ac05c (Windows: a test_cmp that is agnostic to random
LF <> CRLF conversions, 2013-10-26).  Fix this test anyway to avoid
depending on that special test_cmp behavior, especially since this is
the only test that needs it.

Piping the output of grep(1) through append_cr has the side-effect of
ignoring its return value.  That means we no longer need the explicit
"|| true" to support commit messages without a body.

Signed-off-by: René Scharfe <l.s.r@web.de>
Acked-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot0021: use Windows-friendly `pwd`
Johannes Schindelin [Tue, 6 Dec 2022 15:07:46 +0000 (15:07 +0000)] 
t0021: use Windows-friendly `pwd`

In Git for Windows, when passing paths from shell scripts to regular
Win32 executables, thanks to the MSYS2 runtime a somewhat magic path
conversion happens that lets the shell script think that there is a file
at `/git/Makefile` and the Win32 process it spawned thinks that the
shell script said `C:/git-sdk-64/git/Makefile` instead.

This conversion is documented in detail over here:
https://www.msys2.org/docs/filesystem-paths/#automatic-unix-windows-path-conversion

As all automatic conversions, there are gaps. For example, to avoid
mistaking command-line options like `/LOG=log.txt` (which are quite
common in the Windows world) from being mistaken for a Unix-style
absolute path, the MSYS2 runtime specifically exempts arguments
containing a `=` character from that conversion.

We are about to change `test_cmp` to use `git diff --no-index`, which
involves spawning precisely such a Win32 process.

In combination, this would cause a failure in `t0021-conversion.sh`
where we pass an absolute path containing an equal character to the
`test_cmp` function.

Seeing as the Unix tools like `cp` and `diff` that are used by Git's
test suite in the Git for Windows SDK (thanks to the MSYS2 project)
understand both Unix-style as well as Windows-style paths, we can stave
off this problem by simply switching to Windows-style paths and
side-stepping the need for any automatic path conversion.

Note: The `PATH` variable is obviously special, as it is colon-separated
in the MSYS2 Bash used by Git for Windows, and therefore _cannot_
contain absolute Windows-style paths, lest the colon after the drive
letter is mistaken for a path separator. Therefore, we need to be
careful to keep the Unix-style when modifying the `PATH` variable.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'master' of github.com:alshopov/git-po
Jiang Xin [Wed, 7 Dec 2022 01:23:49 +0000 (09:23 +0800)] 
Merge branch 'master' of github.com:alshopov/git-po

* 'master' of github.com:alshopov/git-po:
  l10n: bg.po: Updated Bulgarian translation (5501t)

2 years agoMerge branch 'l10n-de-2.39' of github.com:ralfth/git
Jiang Xin [Wed, 7 Dec 2022 01:23:24 +0000 (09:23 +0800)] 
Merge branch 'l10n-de-2.39' of github.com:ralfth/git

* 'l10n-de-2.39' of github.com:ralfth/git:
  l10n: de.po: update German translation

2 years agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Wed, 7 Dec 2022 01:22:17 +0000 (09:22 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.39 (round 1)

2 years agoMerge branch 'master' of github.com:nafmo/git-l10n-sv
Jiang Xin [Wed, 7 Dec 2022 01:21:49 +0000 (09:21 +0800)] 
Merge branch 'master' of github.com:nafmo/git-l10n-sv

* 'master' of github.com:nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (5501t0f0)

2 years agoMerge branch 'fr_v2.39_rnd1' of github.com:jnavila/git
Jiang Xin [Wed, 7 Dec 2022 01:21:25 +0000 (09:21 +0800)] 
Merge branch 'fr_v2.39_rnd1' of github.com:jnavila/git

* 'fr_v2.39_rnd1' of github.com:jnavila/git:
  l10n: fr: v2.39 rnd 1

2 years agol10n: bg.po: Updated Bulgarian translation (5501t)
Alexander Shopov [Tue, 6 Dec 2022 15:00:37 +0000 (16:00 +0100)] 
l10n: bg.po: Updated Bulgarian translation (5501t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2 years agoGit 2.39-rc2 v2.39.0-rc2
Junio C Hamano [Tue, 6 Dec 2022 00:49:31 +0000 (09:49 +0900)] 
Git 2.39-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoci(main): upgrade actions/checkout to v3
Oscar Dominguez [Mon, 5 Dec 2022 10:01:14 +0000 (10:01 +0000)] 
ci(main): upgrade actions/checkout to v3

To be up to date with actions/checkout opens the door to use the latest
features if necessary and get the latest security patches.

This also avoids a couple of deprecation warnings in the CI runs.

Note: The `actions/checkout` Action has been known to be broken in i686
containers as of v2, therefore we keep forcing it to v1 there. See
actions/runner#2115 for more details.

Signed-off-by: Oscar Dominguez <dominguez.celada@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jk/avoid-redef-system-functions-2.30' into jk/avoid-redef-system-functions
Junio C Hamano [Mon, 5 Dec 2022 03:16:00 +0000 (12:16 +0900)] 
Merge branch 'jk/avoid-redef-system-functions-2.30' into jk/avoid-redef-system-functions

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

2 years agogit-compat-util: undefine system names before redeclaring them
Jeff King [Fri, 2 Dec 2022 11:05:38 +0000 (06:05 -0500)] 
git-compat-util: undefine system names before redeclaring them

When we define a macro to point a system function (e.g., flockfile) to
our custom wrapper, we should make sure that the system did not already
define it as a macro. This is rarely a problem, but can cause
compilation failures if both of these are true:

  - we decide to define our own wrapper even though the system provides
    the function; we know this happens at least with uclibc, which may
    declare flockfile, etc, without _POSIX_THREAD_SAFE_FUNCTIONS

  - the system version is declared as a macro; we know this happens at
    least with uclibc's version of getc_unlocked()

So just handling getc_unlocked() would be sufficient to deal with the
real-world case we've seen. But since it's easy to do, we may as well be
defensive about the other macro wrappers added in the previous patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomaintenance: compare output of pthread functions for inequality with 0
Seija [Fri, 2 Dec 2022 17:02:58 +0000 (17:02 +0000)] 
maintenance: compare output of pthread functions for inequality with 0

The documentation for pthread_create and pthread_sigmask state that:

"On success, pthread_create() returns 0;
on error, it returns an error number"

As such, we ought to check for an error
by seeing if the output is not 0.

Checking for "less than" is a mistake
as the error code numbers can be greater than 0.

Signed-off-by: Seija <doremylover123@gmail.com>
Acked-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot3920: don't ignore errors of more than one command with `|| true`
Johannes Sixt [Mon, 21 Nov 2022 17:58:13 +0000 (18:58 +0100)] 
t3920: don't ignore errors of more than one command with `|| true`

It is customary to write `A || true` to ignore a potential error exit of
command A. But when we have a sequence `A && B && C || true && D`, then
a failure of any of A, B, or C skips to D right away. This is not
intended here. Turn the command whose failure is to be ignored into a
compound command to ensure it is the only one that is allowed to fail.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot4023: fix ignored exit codes of git
Ævar Arnfjörð Bjarmason [Fri, 2 Dec 2022 00:06:29 +0000 (01:06 +0100)] 
t4023: fix ignored exit codes of git

Change a "git diff-tree" command to be &&-chained so that we won't
ignore its exit code, see the ea05fd5fbf7 (Merge branch
'ab/keep-git-exit-codes-in-tests', 2022-03-16) topic for prior art.

This fixes code added in b45563a229f (rename: Break filepairs with
different types., 2007-11-30). Due to hiding the exit code we hid a
memory leak under SANITIZE=leak.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot7600: don't ignore "rev-parse" exit code in helper
Ævar Arnfjörð Bjarmason [Fri, 2 Dec 2022 11:52:34 +0000 (12:52 +0100)] 
t7600: don't ignore "rev-parse" exit code in helper

Change the verify_mergeheads() helper the check the exit code of "git
rev-parse".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: de.po: update German translation
Ralf Thielow [Fri, 2 Dec 2022 16:28:32 +0000 (17:28 +0100)] 
l10n: de.po: update German translation

Reviewed-by: Matthias Rüster <matthias.ruester@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2 years agol10n: zh_CN v2.39.0 round 1
Fangyi Zhou [Fri, 2 Dec 2022 14:04:41 +0000 (14:04 +0000)] 
l10n: zh_CN v2.39.0 round 1

- Revise translation of 'stale'

Reviewed-by: 依云 <lilydjwg@gmail.com>
Signed-off-by: Fangyi Zhou <me@fangyi.io>
2 years agot5314: check exit code of "git"
Ævar Arnfjörð Bjarmason [Mon, 28 Nov 2022 14:18:55 +0000 (15:18 +0100)] 
t5314: check exit code of "git"

Amend the test added in [1] to check the exit code of the "git"
invocations. An in-flight change[2] introduced a memory leak in these
invocations, which went undetected unless we were running under
"GIT_TEST_SANITIZE_LEAK_LOG=true".

Note that the in-flight change made 8 test files fail, but as far as I
can tell only this one would have had its exit code hidden unless
under "GIT_TEST_SANITIZE_LEAK_LOG=true". The rest would be caught
without it.

We could pick other variable names here than "ln%d", e.g. "commit",
"dummy_blob" and "file_blob", but having the "rev-parse" invocations
aligned makes the difference between them more readable, so let's pick
"ln%d".

1. 4cf2143e029 (pack-objects: break delta cycles before delta-search
   phase, 2016-08-11)
2. https://lore.kernel.org/git/221128.868rjvmi3l.gmgdl@evledraar.gmail.com/
3. faececa53f9 (test-lib: have the "check" mode for SANITIZE=leak
   consider leak logs, 2022-07-28)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor: fix race seen in t7527
Jeff Hostetler [Thu, 1 Dec 2022 23:32:14 +0000 (23:32 +0000)] 
fsmonitor: fix race seen in t7527

Fix racy tests in t7527 by forcing the use of cookie files during all
types of queries.  There were originaly observed on M1 macs with file
system encryption enabled.

There were a series of simple tests, such as "edit some files" and
"create some files", that started the daemon with GIT_TRACE_FSMONITOR
enabled so that the daemon would emit "event: <path>" messages to the
trace log.  The test would make worktree modifications and then grep
the log file to confirm it contained the expected trace messages.
The greps would occasionally racily-fail.  The expected messages
were always present in the log file, just not yet always present
when the greps ran.

NEEDSWORK: One could argue that the tests should use the `test-tool
fsmonitor-client query` and search for the expected pathnames in the
output rather than grepping the trace log, but I'll leave that for a
later exercise.

The racy tests called `test-tool fsmonitor-client query --token 0`
before grepping the log file.  (Presumably to introduce a small delay
and/or to let the daemon sync with the file system following the last
modification, but that was not always sufficient and hence the race.)

When the query arg is just "0", the daemon treated it as a V1
(aka timestamp-relative request) and responded with a "trivial
response" and a new token, but without trying to catch up to the
the file system event stream.  So the "event: <path>" messages
may or may not yet be in the log file when the grep commands
started.

FWIW, if the tests had sent `--token builtin:0:0` instead, it would
have forced a slightly different code path in the daemon that would
cause the daemon to use a cookie file and let it catch up with the
file system event stream.  I did not see any test failures with this
change.

Instead of modifying the test, I updated the fsmonitor--daemon to
always use a cookie file and catch up to the file system on any
query operation, regardless of the format of the request token.
This is safer.

FWIW, I think the effect of the race was limited to the test.
Commands like `git status` would always do a full scan when getting a
trivial response.  The fact that the daemon was slighly behind the
file system when it generated the response token would cause a second
`git status` to get a few extra paths that the client would have to
examine, but it would not be missing paths.

FWIW, I also think that an earlier version of the code always did
the cookie file for all types of queries, but it was optimized out
during a round of reviews or rework and we didn't notice the race.

Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agolist-objects-filter: plug pattern_list leak
René Scharfe [Thu, 1 Dec 2022 17:49:41 +0000 (18:49 +0100)] 
list-objects-filter: plug pattern_list leak

filter_sparse_oid__init() uses add_patterns_from_blob_to_list() to
populate the struct pattern_list member of struct filter_sparse_data.
Release it in the complementing filter_sparse_free().

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>