]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
9 months agoMerge branch 'ds/scalar-updates'
Junio C Hamano [Tue, 29 Aug 2023 20:51:44 +0000 (13:51 -0700)] 
Merge branch 'ds/scalar-updates'

Scalar updates.

* ds/scalar-updates:
  scalar reconfigure: help users remove buggy repos
  setup: add discover_git_directory_reason()
  scalar: add --[no-]src option

9 months agoMerge branch 'jc/mv-d-to-d-error-message-fix'
Junio C Hamano [Tue, 29 Aug 2023 20:51:43 +0000 (13:51 -0700)] 
Merge branch 'jc/mv-d-to-d-error-message-fix'

Typofix in an error message.

* jc/mv-d-to-d-error-message-fix:
  mv: fix error for moving directory to another

9 months agoMerge branch 'sl/sparse-check-attr'
Junio C Hamano [Tue, 29 Aug 2023 20:51:43 +0000 (13:51 -0700)] 
Merge branch 'sl/sparse-check-attr'

Teach "git check-attr" work better with sparse-index.

* sl/sparse-check-attr:
  check-attr: integrate with sparse-index
  attr.c: read attributes in a sparse directory
  t1092: add tests for 'git check-attr'

9 months agoThe extra batch to update credenthal helpers
Junio C Hamano [Mon, 28 Aug 2023 16:52:28 +0000 (09:52 -0700)] 
The extra batch to update credenthal helpers

These two topics did not see much interest and reviews while they
were on 'next'; let's "inflict" them to the general public and see
if anybody screams, which is much less nicer way than to merge
only topics that are well reviewed down in an orderly manner, but
that is the only thing we can do to these topics without any
development community help.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'mh/credential-erase-improvements-more'
Junio C Hamano [Mon, 28 Aug 2023 16:51:16 +0000 (09:51 -0700)] 
Merge branch 'mh/credential-erase-improvements-more'

Update two credential helpers to correctly match which credential
to erase; they dropped not the ones with stale password.

* mh/credential-erase-improvements-more:
  credential/wincred: erase matching creds only
  credential/libsecret: erase matching creds only

9 months agoMerge branch 'mh/credential-libsecret-attrs'
Junio C Hamano [Mon, 28 Aug 2023 16:51:15 +0000 (09:51 -0700)] 
Merge branch 'mh/credential-libsecret-attrs'

The way authentication related data other than passwords (e.g.
oath token and password expiration data) are stored in libsecret
keyrings has been rethought.

* mh/credential-libsecret-attrs:
  credential/libsecret: store new attributes

9 months agoscalar reconfigure: help users remove buggy repos
Derrick Stolee [Mon, 28 Aug 2023 13:52:26 +0000 (13:52 +0000)] 
scalar reconfigure: help users remove buggy repos

When running 'scalar reconfigure -a', Scalar has warning messages about
the repository missing (or not containing a .git directory). Failures
can also happen while trying to modify the repository-local config for
that repository.

These warnings may seem confusing to users who don't understand what
they mean or how to stop them.

Add a warning that instructs the user how to remove the warning in
future installations.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agosetup: add discover_git_directory_reason()
Derrick Stolee [Mon, 28 Aug 2023 13:52:25 +0000 (13:52 +0000)] 
setup: add discover_git_directory_reason()

There are many reasons why discovering a Git directory may fail. In
particular, 8959555cee7 (setup_git_directory(): add an owner check for
the top-level directory, 2022-03-02) added ownership checks as a
security precaution.

Callers attempting to set up a Git directory may want to inform the user
about the reason for the failure. For that, expose the enum
discovery_result from within setup.c and move it into cache.h where
discover_git_directory() is defined.

I initially wanted to change the return type of discover_git_directory()
to be this enum, but several callers rely upon the "zero means success".
The two problems with this are:

1. The zero value of the enum is actually GIT_DIR_NONE, so nonpositive
   results are errors.

2. There are multiple successful states; positive results are
   successful.

It is worth noting that GIT_DIR_NONE is not returned, so we remove this
option from the enum. We must be careful to keep the successful reasons
as positive values, so they are given explicit positive values.

Instead of updating all callers immediately, add a new method,
discover_git_directory_reason(), and convert discover_git_directory() to
be a thin shim on top of it.

One thing that is important to note is that discover_git_directory()
previously returned -1 on error, so let's continue that into the future.
There is only one caller (in scalar.c) that depends on that signedness
instead of a non-zero check, so clean that up, too.

Because there are extra checks that discover_git_directory_reason() does
after setup_git_directory_gently_1(), there are other modes that can be
returned for failure states. Add these modes to the enum, but be sure to
explicitly add them as BUG() states in the switch of
setup_git_directory_gently().

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoscalar: add --[no-]src option
Derrick Stolee [Mon, 28 Aug 2023 13:52:24 +0000 (13:52 +0000)] 
scalar: add --[no-]src option

Some users have strong aversions to Scalar's opinion that the repository
should be in a 'src' directory, even though this creates a clean slate
for placing build artifacts in adjacent directories.

The new --no-src option allows users to opt out of the default behavior.

While adding options, make sure the usage output by 'scalar clone -h'
reports the same as the SYNOPSIS line in Documentation/scalar.txt.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoThe second batch for 2.43
Junio C Hamano [Fri, 25 Aug 2023 16:55:09 +0000 (09:55 -0700)] 
The second batch for 2.43

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jk/function-pointer-mismatches-fix'
Junio C Hamano [Fri, 25 Aug 2023 17:37:37 +0000 (10:37 -0700)] 
Merge branch 'jk/function-pointer-mismatches-fix'

Code clean-up to please clang-18.

* jk/function-pointer-mismatches-fix:
  hashmap: use expected signatures for comparison functions

9 months agoMerge branch 'ob/t9001-indent-fix'
Junio C Hamano [Fri, 25 Aug 2023 17:37:37 +0000 (10:37 -0700)] 
Merge branch 'ob/t9001-indent-fix'

Test style fix.

* ob/t9001-indent-fix:
  t9001: fix indentation in test_no_confirm()

9 months agoMerge branch 'ja/worktree-orphan'
Junio C Hamano [Fri, 25 Aug 2023 17:37:37 +0000 (10:37 -0700)] 
Merge branch 'ja/worktree-orphan'

Typofix in an error message.

* ja/worktree-orphan:
  builtin/worktree.c: fix typo in "forgot fetch" msg

9 months agoMerge branch 'rs/parse-options-negation-help'
Junio C Hamano [Fri, 25 Aug 2023 17:37:37 +0000 (10:37 -0700)] 
Merge branch 'rs/parse-options-negation-help'

"git cmd -h" learned to signal which options can be negated by
listing such options like "--[no-]opt".

* rs/parse-options-negation-help:
  parse-options: simplify usage_padding()
  parse-options: no --[no-]no-...
  parse-options: factor out usage_indent() and usage_padding()
  parse-options: show negatability of options in short help
  t1502: test option negation
  t1502: move optionspec help output to a file
  t1502, docs: disallow --no-help
  subtree: disallow --no-{help,quiet,debug,branch,message}

9 months agoStart the 2.43 cycle
Junio C Hamano [Thu, 24 Aug 2023 16:31:49 +0000 (09:31 -0700)] 
Start the 2.43 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'ds/maintenance-schedule-fuzz'
Junio C Hamano [Thu, 24 Aug 2023 16:32:34 +0000 (09:32 -0700)] 
Merge branch 'ds/maintenance-schedule-fuzz'

Hourly and other schedule of "git maintenance" jobs are randomly
distributed now.

* ds/maintenance-schedule-fuzz:
  maintenance: update schedule before config
  maintenance: fix systemd schedule overlaps
  maintenance: use random minute in systemd scheduler
  maintenance: swap method locations
  maintenance: use random minute in cron scheduler
  maintenance: use random minute in Windows scheduler
  maintenance: use random minute in launchctl scheduler
  maintenance: add get_random_minute()

9 months agoMerge branch 'ob/test-lib-rebase-fake-editor-updates'
Junio C Hamano [Thu, 24 Aug 2023 16:32:34 +0000 (09:32 -0700)] 
Merge branch 'ob/test-lib-rebase-fake-editor-updates'

Test updates.

* ob/test-lib-rebase-fake-editor-updates:
  t/lib-rebase: improve documentation of set_fake_editor()
  t/lib-rebase: set_fake_editor(): handle FAKE_LINES more consistently
  t/lib-rebase: set_fake_editor(): fix recognition of reset's short command

9 months agoMerge branch 'mp/rebase-label-length-limit'
Junio C Hamano [Thu, 24 Aug 2023 16:32:33 +0000 (09:32 -0700)] 
Merge branch 'mp/rebase-label-length-limit'

Overly long label names used in the sequencer machinery are now
chopped to fit under filesystem limitation.

* mp/rebase-label-length-limit:
  rebase: allow overriding the maximal length of the generated labels
  sequencer: truncate labels to accommodate loose refs

9 months agoMerge branch 'ds/upload-pack-error-sequence-fix'
Junio C Hamano [Thu, 24 Aug 2023 16:32:33 +0000 (09:32 -0700)] 
Merge branch 'ds/upload-pack-error-sequence-fix'

Error message generation fix.

* ds/upload-pack-error-sequence-fix:
  upload-pack: fix exit code when denying fetch of unreachable object ID
  upload-pack: fix race condition in error messages

9 months agoMerge branch 'ws/git-push-doc-grammofix'
Junio C Hamano [Thu, 24 Aug 2023 16:32:33 +0000 (09:32 -0700)] 
Merge branch 'ws/git-push-doc-grammofix'

Doc update.

* ws/git-push-doc-grammofix:
  git-push.txt: fix grammar

9 months agoMerge branch 'tb/repack-geometry-cleanup'
Junio C Hamano [Thu, 24 Aug 2023 16:32:33 +0000 (09:32 -0700)] 
Merge branch 'tb/repack-geometry-cleanup'

Code clean-up.

* tb/repack-geometry-cleanup:
  repack: move `pack_geometry` struct to the stack

9 months agoMerge branch 'ob/sequencer-rearrange-cleanup'
Junio C Hamano [Thu, 24 Aug 2023 16:32:33 +0000 (09:32 -0700)] 
Merge branch 'ob/sequencer-rearrange-cleanup'

Code clean-up.

* ob/sequencer-rearrange-cleanup:
  sequencer: simplify allocation of result array in todo_list_rearrange_squash()

9 months agoMerge branch 'rj/branch-in-use-error-message'
Junio C Hamano [Thu, 24 Aug 2023 16:32:32 +0000 (09:32 -0700)] 
Merge branch 'rj/branch-in-use-error-message'

A message written in olden time prevented a branch from getting
checked out saying it is already checked out elsewhere, but these
days, we treat a branch that is being bisected or rebased just like
a branch that is checked out and protect it.  Rephrase the message
to say that the branch is in use.

* rj/branch-in-use-error-message:
  branch: error message checking out a branch in use
  branch: error message deleting a branch in use

10 months agoGit 2.42 v2.42.0
Junio C Hamano [Mon, 21 Aug 2023 16:34:58 +0000 (09:34 -0700)] 
Git 2.42

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agoMerge branch 'jk/function-pointer-mismatches-fix' (early part)
Junio C Hamano [Mon, 21 Aug 2023 16:27:44 +0000 (09:27 -0700)] 
Merge branch 'jk/function-pointer-mismatches-fix' (early part)

Fix a minor regression that some compiler might notice.

* 'jk/function-pointer-mismatches-fix' (early part):
  fsck: use enum object_type for fsck_walk callback

10 months agoMerge tag 'l10n-2.42.0-rnd2' of https://github.com/git-l10n/git-po
Junio C Hamano [Mon, 21 Aug 2023 15:43:46 +0000 (08:43 -0700)] 
Merge tag 'l10n-2.42.0-rnd2' of https://github.com/git-l10n/git-po

l10n-2.42.0-rnd2

* tag 'l10n-2.42.0-rnd2' of https://github.com/git-l10n/git-po:
  l10n: zh_TW.po: Git 2.42
  l10n: zh_CN: 2.42.0 round 2
  l10n: zh_CN: v2.42.0 round 1
  l10n: Update German translation
  l10n: Update Catalan translation
  l10n: tr: git 2.42.0
  l10n: fr v2.42.0 rnd 2
  l10n: fr v2.42.0 rnd 1
  l10n: sv.po: Update Swedish translation 5549t0f0u
  l10n: uk: update translation (2.42.0)
  l10n: po-id for 2.42 (round 1)
  l10n: ru.po: update Russian translation

10 months agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Sun, 20 Aug 2023 23:05:38 +0000 (07:05 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

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

10 months agol10n: zh_TW.po: Git 2.42
Yi-Jyun Pan [Sat, 5 Aug 2023 15:37:39 +0000 (23:37 +0800)] 
l10n: zh_TW.po: Git 2.42

Co-authored-by: Lumynous <lumynou5.tw@gmail.com>
Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
10 months agohashmap: use expected signatures for comparison functions
Jeff King [Sat, 19 Aug 2023 23:55:30 +0000 (19:55 -0400)] 
hashmap: use expected signatures for comparison functions

We prefer for callback functions to match the signature with which
they'll be called, rather than casting them to the correct type when
assigning function pointers. Even though casting often works in the real
world, it is a violation of the standard.

We did a mass conversion in 939af16eac (hashmap_cmp_fn takes
hashmap_entry params, 2019-10-06), but have grown a few new cases since
then. Because of the cast, the compiler does not complain. However, as
of clang-18, UBSan will catch these at run-time, and the case in
range-diff.c triggers when running t3206.

After seeing that one, I scanned the results of:

  git grep '_fn)[^(]' '*.c' | grep -v typedef

and found a similar case in compat/terminal.c (which presumably isn't
called in the test suite, since it doesn't trigger UBSan). There might
be other cases lurking if the cast is done using a typedef that doesn't
end in "_fn", but loosening it finds too many false positives. I also
looked for:

  git grep ' = ([a-z_]*) *[a-z]' '*.c'

to find assignments that cast, but nothing looked like a function.

The resulting code is unfortunately a little longer, but the bonus of
using container_of() is that we are no longer restricted to the
hashmap_entry being at the start of the struct.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agofsck: use enum object_type for fsck_walk callback
Jeff King [Sat, 19 Aug 2023 23:53:42 +0000 (19:53 -0400)] 
fsck: use enum object_type for fsck_walk callback

We switched the function interface for fsck callbacks in a1aad71601
(fsck.h: use "enum object_type" instead of "int", 2021-03-28). However,
we accidentally flipped the type back to "int" as part of 0b4e9013f1
(fsck: mark unused parameters in various fsck callbacks, 2023-07-03).
The mistake happened because that commit was written before a1aad71601
and rebased forward, and I screwed up while resolving the conflict.

Curiously, the compiler does not warn about this mismatch, at least not
when using gcc and clang on Linux (nor in any of our CI environments).
Based on 28abf260a5 (builtin/fsck.c: don't conflate "int" and "enum" in
callback, 2021-06-01), I'd guess that this would cause the AIX xlc
compiler to complain. I noticed because clang-18's UBSan now identifies
mis-matched function calls at runtime, and does complain of this case
when running the test suite.

I'm not entirely clear on whether this mismatch is a problem in
practice. Compilers are certainly free to make enums smaller than "int"
if they don't need the bits, but I suspect that they have to promote
back to int for function calls (though I didn't dig in the standard, and
I won't be surprised if I'm simply wrong and the real-world impact would
depend on the ABI).

Regardless, switching it back to enum is obviously the right thing to do
here; the switch to "int" was simply a mistake.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agoMerge branch 'l10n-de-2.42' of github.com:ralfth/git
Jiang Xin [Sat, 19 Aug 2023 13:09:31 +0000 (21:09 +0800)] 
Merge branch 'l10n-de-2.42' of github.com:ralfth/git

* 'l10n-de-2.42' of github.com:ralfth/git:
  l10n: Update German translation

10 months agoMerge branch 'catalan' of github.com:Softcatala/git-po
Jiang Xin [Sat, 19 Aug 2023 13:08:22 +0000 (21:08 +0800)] 
Merge branch 'catalan' of github.com:Softcatala/git-po

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

10 months agoMerge branch 'update-uk-l10n' of github.com:arkid15r/git-ukrainian-l10n
Jiang Xin [Sat, 19 Aug 2023 13:07:47 +0000 (21:07 +0800)] 
Merge branch 'update-uk-l10n' of github.com:arkid15r/git-ukrainian-l10n

* 'update-uk-l10n' of github.com:arkid15r/git-ukrainian-l10n:
  l10n: uk: update translation (2.42.0)

10 months agoMerge branch 'tl/zh_CN_2.42.0_rnd1' of github.com:dyrone/git
Jiang Xin [Sat, 19 Aug 2023 13:07:03 +0000 (21:07 +0800)] 
Merge branch 'tl/zh_CN_2.42.0_rnd1' of github.com:dyrone/git

* 'tl/zh_CN_2.42.0_rnd1' of github.com:dyrone/git:
  l10n: zh_CN: 2.42.0 round 2
  l10n: zh_CN: v2.42.0 round 1

10 months agoMerge branch 'master' of github.com:nafmo/git-l10n-sv
Jiang Xin [Sat, 19 Aug 2023 13:05:00 +0000 (21:05 +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 5549t0f0u

10 months agoMerge branch 'l10n-tr' of github.com:bitigchi/git-po
Jiang Xin [Sat, 19 Aug 2023 13:04:09 +0000 (21:04 +0800)] 
Merge branch 'l10n-tr' of github.com:bitigchi/git-po

* 'l10n-tr' of github.com:bitigchi/git-po:
  l10n: tr: git 2.42.0

10 months agol10n: zh_CN: 2.42.0 round 2
Teng Long [Fri, 18 Aug 2023 02:23:09 +0000 (10:23 +0800)] 
l10n: zh_CN: 2.42.0 round 2

Signed-off-by: Teng Long <dyroneteng@gmail.com>
10 months agol10n: zh_CN: v2.42.0 round 1
Teng Long [Wed, 9 Aug 2023 09:48:02 +0000 (17:48 +0800)] 
l10n: zh_CN: v2.42.0 round 1

Signed-off-by: Teng Long <dyroneteng@gmail.com>
10 months agoMerge branch 'ps/revision-stdin-with-options'
Junio C Hamano [Thu, 17 Aug 2023 22:50:05 +0000 (15:50 -0700)] 
Merge branch 'ps/revision-stdin-with-options'

Typofix to documentation added during this cycle.

* ps/revision-stdin-with-options:
  rev-list-options: fix typo in `--stdin` documentation

10 months agoMerge branch 'sa/doc-ls-remote'
Junio C Hamano [Thu, 17 Aug 2023 22:50:05 +0000 (15:50 -0700)] 
Merge branch 'sa/doc-ls-remote'

Mark-up fix to documentation added during this cycle.

* sa/doc-ls-remote:
  show-ref doc: fix carets in monospace

10 months agoMerge branch 'tl/notes-separator'
Junio C Hamano [Thu, 17 Aug 2023 22:50:05 +0000 (15:50 -0700)] 
Merge branch 'tl/notes-separator'

Typo/grammofix to documentation added during this cycle.

* tl/notes-separator:
  notes doc: tidy up `--no-stripspace` paragraph
  notes doc: split up run-on sentences

10 months agol10n: Update German translation
Ralf Thielow [Thu, 17 Aug 2023 15:00:36 +0000 (17:00 +0200)] 
l10n: Update German translation

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
10 months agorev-list-options: fix typo in `--stdin` documentation
Martin Ågren [Wed, 16 Aug 2023 14:24:36 +0000 (16:24 +0200)] 
rev-list-options: fix typo in `--stdin` documentation

With `--stdin`, we read *from* standard input, not *for*.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agoshow-ref doc: fix carets in monospace
Martin Ågren [Wed, 16 Aug 2023 14:24:35 +0000 (16:24 +0200)] 
show-ref doc: fix carets in monospace

When commit 00bf685975 (show-ref doc: update for internal consistency,
2023-05-19) switched from double quotes to backticks around our {caret}
macro, we started rendering "{caret}" literally. Fix this by replacing
by a "^" character.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agonotes doc: tidy up `--no-stripspace` paragraph
Martin Ågren [Wed, 16 Aug 2023 14:24:34 +0000 (16:24 +0200)] 
notes doc: tidy up `--no-stripspace` paragraph

Where we document the `--no-stripspace` option, remove a superfluous
"For" to fix the grammar. Mark option names and command names using
`backticks` to set them in monospace.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agonotes doc: split up run-on sentences
Martin Ågren [Wed, 16 Aug 2023 14:24:33 +0000 (16:24 +0200)] 
notes doc: split up run-on sentences

When commit c4e2aa7d45 (notes.c: introduce "--[no-]stripspace" option,
2023-05-27) mentioned the new `--no-stripspace` in the documentation for
`-m` and `-F`, it created run-on sentences. It also used slightly
different language in the two sections for no apparent reason. Split the
sentences in two to improve readability, and while touching the two
sites, make them more similar.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agol10n: Update Catalan translation
Jordi Mas [Wed, 16 Aug 2023 16:25:02 +0000 (18:25 +0200)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
10 months agoupload-pack: fix exit code when denying fetch of unreachable object ID
Patrick Steinhardt [Wed, 16 Aug 2023 06:06:59 +0000 (08:06 +0200)] 
upload-pack: fix exit code when denying fetch of unreachable object ID

In 7ba7c52d76 (upload-pack: fix race condition in error messages,
2023-08-10), we have fixed a race in t5516-fetch-push.sh where sometimes
error messages got intermingled. This was done by splitting up the call
to `die()` such that we print the error message before writing to the
remote side, followed by a call to `exit(1)` afterwards.

This causes a subtle regression though as `die()` causes us to exit with
exit code 128, whereas we now call `exit(1)`. It's not really clear
whether we want to guarantee any specific error code in this case, and
neither do we document anything like that. But on the other hand, it
seems rather clear that this is an unintended side effect of the change
given that this change in behaviour was not mentioned at all.

Restore the status-quo by exiting with 128.  The test in t5703 to
ensure that "git fetch" fails by using test_must_fail, which does
not care between exiting 1 and 128, so this changes will not affect
any test.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agol10n: tr: git 2.42.0
Emir SARI [Mon, 7 Aug 2023 15:40:16 +0000 (18:40 +0300)] 
l10n: tr: git 2.42.0

Signed-off-by: Emir SARI <emir_sari@icloud.com>
10 months agol10n: fr v2.42.0 rnd 2
Jean-Noël Avila [Wed, 16 Aug 2023 09:50:23 +0000 (11:50 +0200)] 
l10n: fr v2.42.0 rnd 2

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
10 months agol10n: fr v2.42.0 rnd 1
Jean-Noël Avila [Sun, 6 Aug 2023 08:01:50 +0000 (10:01 +0200)] 
l10n: fr v2.42.0 rnd 1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
10 months agol10n: sv.po: Update Swedish translation 5549t0f0u
Peter Krefting [Wed, 16 Aug 2023 06:42:51 +0000 (07:42 +0100)] 
l10n: sv.po: Update Swedish translation 5549t0f0u

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
10 months agol10n: uk: update translation (2.42.0)
Arkadii Yakovets [Wed, 16 Aug 2023 01:55:13 +0000 (18:55 -0700)] 
l10n: uk: update translation (2.42.0)

Co-authored-by: Kate Golovanova <kate@kgthreads.com>
Signed-off-by: Arkadii Yakovets <ark@cho.red>
Signed-off-by: Kate Golovanova <kate@kgthreads.com>
10 months agoMerge branch 'master' of github.com:git/git
Jiang Xin [Tue, 15 Aug 2023 23:24:56 +0000 (07:24 +0800)] 
Merge branch 'master' of github.com:git/git

* 'master' of github.com:git/git: (34 commits)
  Git 2.42-rc2
  t4053: avoid writing to unopened pipe
  t4053: avoid race when killing background processes
  Git 2.42-rc1
  git maintenance: avoid console window in scheduled tasks on Windows
  win32: add a helper to run `git.exe` without a foreground window
  t9001: remove excessive GIT_SEND_EMAIL_NOTTY=1
  mv: handle lstat() failure correctly
  parse-options: disallow negating OPTION_SET_INT 0
  repack: free geometry struct
  send-email: avoid creating more than one Term::ReadLine object
  send-email: drop FakeTerm hack
  t0040: declare non-tab indentation to be okay in this script
  advice: handle "rebase" in error_resolve_conflict()
  A few more topics before -rc1
  mailmap: change primary address for Glen Choo
  gitignore: ignore clangd .cache directory
  docs: update when `git bisect visualize` uses `gitk`
  compat/mingw: implement a native locate_in_PATH()
  run-command: conditionally define locate_in_PATH()
  ...

10 months agoGit 2.42-rc2 v2.42.0-rc2
Junio C Hamano [Tue, 15 Aug 2023 17:20:02 +0000 (10:20 -0700)] 
Git 2.42-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agoMerge branch 'pw/diff-no-index-from-named-pipes'
Junio C Hamano [Tue, 15 Aug 2023 17:19:47 +0000 (10:19 -0700)] 
Merge branch 'pw/diff-no-index-from-named-pipes'

Test updates.

* pw/diff-no-index-from-named-pipes:
  t4053: avoid writing to unopened pipe
  t4053: avoid race when killing background processes

10 months agoMerge branch 'st/mv-lstat-fix'
Junio C Hamano [Tue, 15 Aug 2023 17:19:47 +0000 (10:19 -0700)] 
Merge branch 'st/mv-lstat-fix'

Correct use of lstat() that assumed a failing call would not
clobber the statbuf.

* st/mv-lstat-fix:
  mv: handle lstat() failure correctly

10 months agoMerge branch 'jc/send-email-pre-process-fix'
Junio C Hamano [Tue, 15 Aug 2023 17:19:47 +0000 (10:19 -0700)] 
Merge branch 'jc/send-email-pre-process-fix'

Test fix.

* jc/send-email-pre-process-fix:
  t9001: remove excessive GIT_SEND_EMAIL_NOTTY=1

10 months agoMerge branch 'ds/maintenance-on-windows-fix'
Junio C Hamano [Tue, 15 Aug 2023 17:19:47 +0000 (10:19 -0700)] 
Merge branch 'ds/maintenance-on-windows-fix'

Windows updates.

* ds/maintenance-on-windows-fix:
  git maintenance: avoid console window in scheduled tasks on Windows
  win32: add a helper to run `git.exe` without a foreground window

10 months agoMerge branch 'js/allow-t4000-to-be-indented-with-spaces'
Junio C Hamano [Mon, 14 Aug 2023 20:26:41 +0000 (13:26 -0700)] 
Merge branch 'js/allow-t4000-to-be-indented-with-spaces'

File attribute update.

* js/allow-t4000-to-be-indented-with-spaces:
  t0040: declare non-tab indentation to be okay in this script

10 months agoMerge branch 'jk/send-email-with-new-readline'
Junio C Hamano [Mon, 14 Aug 2023 20:26:41 +0000 (13:26 -0700)] 
Merge branch 'jk/send-email-with-new-readline'

Adjust to newer Term::ReadLine to prevent it from breaking
the interactive prompt code in send-email.

* jk/send-email-with-new-readline:
  send-email: avoid creating more than one Term::ReadLine object
  send-email: drop FakeTerm hack

10 months agoMerge branch 'jk/repack-leakfix'
Junio C Hamano [Mon, 14 Aug 2023 20:26:40 +0000 (13:26 -0700)] 
Merge branch 'jk/repack-leakfix'

Leakfix.

* jk/repack-leakfix:
  repack: free geometry struct

10 months agoMerge branch 'rs/parse-opt-forbid-set-int-0-without-noneg'
Junio C Hamano [Mon, 14 Aug 2023 20:26:40 +0000 (13:26 -0700)] 
Merge branch 'rs/parse-opt-forbid-set-int-0-without-noneg'

Developer support to detect meaningless combination of options.

* rs/parse-opt-forbid-set-int-0-without-noneg:
  parse-options: disallow negating OPTION_SET_INT 0

10 months agoMerge branch 'ob/rebase-conflict-advice-i18n-fix'
Junio C Hamano [Mon, 14 Aug 2023 20:26:40 +0000 (13:26 -0700)] 
Merge branch 'ob/rebase-conflict-advice-i18n-fix'

i18n coverage improvement and avoidance of sentence lego.

* ob/rebase-conflict-advice-i18n-fix:
  advice: handle "rebase" in error_resolve_conflict()

10 months agobuiltin/worktree.c: fix typo in "forgot fetch" msg
Jacob Abel [Fri, 11 Aug 2023 23:39:51 +0000 (23:39 +0000)] 
builtin/worktree.c: fix typo in "forgot fetch" msg

Replace misspelled word "overide" with correctly spelled "override".

Reported-By: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Jacob Abel <jacobabel@nullpo.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agot9001: fix indentation in test_no_confirm()
Oswald Buddenhagen [Sun, 13 Aug 2023 10:46:49 +0000 (12:46 +0200)] 
t9001: fix indentation in test_no_confirm()

The continuations of the compound command were indented as if they were
continuations of the embedded pipe, which was misleading.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agot4053: avoid writing to unopened pipe
Jeff King [Sun, 13 Aug 2023 16:24:40 +0000 (12:24 -0400)] 
t4053: avoid writing to unopened pipe

This fixes an occasional hang I see when running t4053 with
--verbose-log using dash.

Commit 1e3f26542a (diff --no-index: support reading from named pipes,
2023-07-05) added a test that "diff --no-index" will complain when
comparing a named pipe and a directory. The minimum we need to test this
is to mkfifo the pipe, and then run "git diff --no-index pipe some_dir".
But the test does one thing more: it spawns a background shell process
that opens the pipe for writing, like this:

        {
                (>pipe) &
        } &&

This extra writer _could_ be useful if Git misbehaves and tries to open
the pipe for reading. Without the writer, Git would block indefinitely
and the test would never end. But since we do not have such a bug, Git
does not open the pipe and it is the writing process which will block
indefinitely, since there are no readers. The test addresses this by
running "kill $!" in a test_when_finished block. Since the writer should
be blocking forever, this kill command will reliably find it waiting.

However, this seems to be somewhat racy, in that the writing process
sometimes hangs around even after the "kill". In a normal run of the
test script without options, this doesn't have any effect; the
main test script completes anyway. But with --verbose-log, we spawn a
"tee" process that reads the script output, and it won't end until all
descriptors pointing to its input pipe are closed. And the background
process that is hanging around still has its stderr, etc, pointed into
that pipe.

You can reproduce the situation like this:

  cd t
  ./t4053-diff-no-index.sh --verbose-log --stress

Let that run for a few minutes, and then you'll find that some of the
runs have hung. For example, at 11:53, I ran:

  $ ps xk start o pid,start,command | grep tee | head
   713459 11:48:06 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-9.out
   713527 11:48:06 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-15.out
   719434 11:48:07 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-1.out
   728117 11:48:08 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-5.out
   738738 11:48:09 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-31.out
   739457 11:48:09 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-27.out
   744432 11:48:10 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-21.out
   744471 11:48:10 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-29.out
   761961 11:48:12 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-0.out
   812299 11:48:19 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-8.out

All of these have been hung for several minutes. We can investigate one
and see that it's waiting to get EOF on its input:

  $ strace -p 713459
  strace: Process 713459 attached
  read(0,
  ^C

Who else has that descriptor open?

  $ lsof -a -p 713459 -d 0 +E
  COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
  tee     713459 peff    0r  FIFO   0,13      0t0 3943636 pipe 719203,sh,5w 719203,sh,7w 719203,sh,12w 719203,sh,13w
  sh      719203 peff    5w  FIFO   0,13      0t0 3943636 pipe 713459,tee,0r 719203,sh,7w 719203,sh,12w 719203,sh,13w
  sh      719203 peff    7w  FIFO   0,13      0t0 3943636 pipe 713459,tee,0r 719203,sh,5w 719203,sh,12w 719203,sh,13w
  sh      719203 peff   12w  FIFO   0,13      0t0 3943636 pipe 713459,tee,0r 719203,sh,5w 719203,sh,7w 719203,sh,13w
  sh      719203 peff   13w  FIFO   0,13      0t0 3943636 pipe 713459,tee,0r 719203,sh,5w 719203,sh,7w 719203,sh,12w

It's a shell, presumably a subshell spawned by the main script. Though
it may seem odd, having the same descriptor open several times is not
unreasonable (they're all basically the original stdout/stderr of the
script that has been copied). And they should all close when the process
exits. So what's it doing? Curiously, it will exit as soon as we strace
it:

  $ strace -s 64 -p 719203
  strace: Process 719203 attached
  openat(AT_FDCWD, "pipe", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
  write(2, "./t4053-diff-no-index.sh: 7: eval: ", 35) = 35
  write(2, "cannot create pipe: Directory nonexistent", 41) = 41
  write(2, "\n", 1)                       = 1
  exit_group(2)                           = ?
  +++ exited with 2 +++

I think what happens is this:

  - it is blocking in the openat() call for the pipe, as we expect (so
    this is definitely the backgrounded subshell mentioned above)

  - strace sends signals (probably STOP/CONT); those cause the kernel to
    stop blocking, but libc will restart the system call automatically

  - by this time, the "pipe" fifo is gone, so we'll actually try to
    create a regular file. But of course the surrounding directory is
    gone, too! So we get ENOENT, and then exit as normal.

So the blocking is something we expect to happen. But what we didn't
expect is for the process to still exist at all! It should have been
killed earlier when the parent process called "kill", but it wasn't. And
we can't catch the race at this point, because it happened much earlier.

One can guess, though, that there is some race with the shell setting up
the signal handling in the backgrounded subshell, and possibly blocking
or ignoring signals at the time that the "kill" is received.  Curiously,
the race does not seem to happen if I use "bash" instead of "dash", so
presumably bash's setup here is more atomic.

One fix might be to try killing the subshell more aggressively, either
using SIGKILL, or looping on kill/wait. But that seems complex and
likely to introduce new problems/races. Instead, we can observe that the
writer is not needed at all. Git will notice the pipe via stat() before
it is ever opened. So we can simply drop the writer subshell entirely.

If we ever changed Git to open the path and fstat() it, this would
result in the test hanging. But we're not likely to do that. After all,
we have to stat() paths to see if they are openable at all (e.g., it
could be a directory), so this seems like a low risk. And anybody who
does make such a change will immediately see the issue, as Git would
hang consistently.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agomv: fix error for moving directory to another
Junio C Hamano [Sat, 12 Aug 2023 01:14:35 +0000 (18:14 -0700)] 
mv: fix error for moving directory to another

If both directories D1 and D2 already exists, and further there is a
filesystem entity D2/D1, "git mv D1 D2" would fail, and we get an
error message that says:

    "cannot move directory over file, source=D1, destination=D2/D1"

regardless of the type of existing "D2/D1".  If it is a file, the
message is correct, but if it is a directory, it is not (we could
make the D2/D1 directory a union of its original contents and what
was in D1/, but that is not what we do).

The code that decies to issue the error message only checks for
existence of "D2/D1" and does not care what kind of thing sits at
the path.

Rephrase the message to say

    "destination already exists, source=D1, destination=D2/D1"

that would be suitable for any kind of thing being in the way.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agocheck-attr: integrate with sparse-index
Shuqi Liang [Fri, 11 Aug 2023 14:22:11 +0000 (10:22 -0400)] 
check-attr: integrate with sparse-index

Set the requires-full-index to false for "check-attr".

Add a test to ensure that the index is not expanded whether the files
are outside or inside the sparse-checkout cone when the sparse index is
enabled.

The `p2000` tests demonstrate a ~63% execution time reduction for
'git check-attr' using a sparse index.

Test                                            before  after
-----------------------------------------------------------------------
2000.106: git check-attr -a f2/f4/a (full-v3)    0.05   0.05 +0.0%
2000.107: git check-attr -a f2/f4/a (full-v4)    0.05   0.05 +0.0%
2000.108: git check-attr -a f2/f4/a (sparse-v3)  0.04   0.02 -50.0%
2000.109: git check-attr -a f2/f4/a (sparse-v4)  0.04   0.01 -75.0%

Helped-by: Victoria Dye <vdye@github.com>
Signed-off-by: Shuqi Liang <cheskaqiqi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agoattr.c: read attributes in a sparse directory
Shuqi Liang [Fri, 11 Aug 2023 14:22:10 +0000 (10:22 -0400)] 
attr.c: read attributes in a sparse directory

Before this patch, git check-attr was unable to read the attributes from
a .gitattributes file within a sparse directory. The original comment
was operating under the assumption that users are only interested in
files or directories inside the cones. Therefore, in the original code,
in the case of a cone-mode sparse-checkout, we didn't load the
.gitattributes file.

However, this behavior can lead to missing attributes for files inside
sparse directories, causing inconsistencies in file handling.

To resolve this, revise 'git check-attr' to allow attribute reading for
files in sparse directories from the corresponding .gitattributes files:

1.Utilize path_in_cone_mode_sparse_checkout() and index_name_pos_sparse
to check if a path falls within a sparse directory.

2.If path is inside a sparse directory, employ the value of
index_name_pos_sparse() to find the sparse directory containing path and
path relative to sparse directory. Proceed to read attributes from the
tree OID of the sparse directory using read_attr_from_blob().

3.If path is not inside a sparse directory,ensure that attributes are
fetched from the index blob with read_blob_data_from_index().

Change the test 'check-attr with pathspec outside sparse definition' to
'test_expect_success' to reflect that the attributes inside a sparse
directory can now be read. Ensure that the sparse index case works
correctly for git check-attr to illustrate the successful handling of
attributes within sparse directories.

Helped-by: Victoria Dye <vdye@github.com>
Signed-off-by: Shuqi Liang <cheskaqiqi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agot1092: add tests for 'git check-attr'
Shuqi Liang [Fri, 11 Aug 2023 14:22:09 +0000 (10:22 -0400)] 
t1092: add tests for 'git check-attr'

Add tests for `git check-attr`, make sure attribute file does get read
from index when path is either inside or outside of sparse-checkout
definition.

Add a test named 'diff --check with pathspec outside sparse definition'.
It starts by disabling the trailing whitespace and space-before-tab
checks using the core. whitespace configuration option. Then, it
specifically re-enables the trailing whitespace check for a file located
in a sparse directory by adding a whitespace=trailing-space rule to the
.gitattributes file within that directory. Next, create and populate the
folder1 directory, and then add the .gitattributes file to the index.
Edit the contents of folder1/a, add it to the index, and proceed to
"re-sparsify" 'folder1/' with 'git sparse-checkout reapply'. Finally,
use 'git diff --check --cached' to compare the 'index vs. HEAD',
ensuring the correct application of the attribute rules even when the
file's path is outside the sparse-checkout definition.

Mark the two tests 'check-attr with pathspec outside sparse definition'
and 'diff --check with pathspec outside sparse definition' as
'test_expect_failure' to reflect an existing issue where the attributes
inside a sparse directory are ignored. Ensure that the 'check-attr'
command fails to read the required attributes to demonstrate this
expected failure.

Helped-by: Victoria Dye <vdye@github.com>
Signed-off-by: Shuqi Liang <cheskaqiqi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agomaintenance: update schedule before config
Derrick Stolee [Thu, 10 Aug 2023 20:39:47 +0000 (20:39 +0000)] 
maintenance: update schedule before config

When running 'git maintenance start', the current pattern is to
configure global config settings to enable maintenance on the current
repository and set 'maintenance.auto' to false and _then_ to set up the
schedule with the system scheduler.

This has a problematic error condition: if the scheduler fails to
initialize, the repository still will not use automatic maintenance due
to the 'maintenance.auto' setting.

Fix this gap by swapping the order of operations. If Git fails to
initialize maintenance, then the config changes should never happen.

Reported-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agomaintenance: fix systemd schedule overlaps
Derrick Stolee [Thu, 10 Aug 2023 20:39:46 +0000 (20:39 +0000)] 
maintenance: fix systemd schedule overlaps

The 'git maintenance run' command prevents concurrent runs in the same
repository using a 'maintenance.lock' file. However, when using systemd
the hourly maintenance runs the same time as the daily and weekly runs.
(Similarly, daily maintenance runs at the same time as weekly
maintenance.) These competing commands result in some maintenance not
actually being run.

This overlap was something we could not fix until we made the recent
change to not use the builting 'hourly', 'daily', and 'weekly' schedules
in systemd. We can adjust the schedules such that:

 1. Hourly runs avoid the 0th hour.
 2. Daily runs avoid Monday.

This will keep maintenance runs from colliding when using systemd.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agomaintenance: use random minute in systemd scheduler
Derrick Stolee [Thu, 10 Aug 2023 20:39:45 +0000 (20:39 +0000)] 
maintenance: use random minute in systemd scheduler

The get_random_minute() method was created to allow maintenance
schedules to be fixed to a random minute of the hour. This randomness is
only intended to spread out the load from a number of clients, but each
client should have an hour between each maintenance cycle.

Add this random minute to the systemd integration.

This integration is more complicated than similar changes for other
schedulers because of a neat trick that systemd allows: templating.

The previous implementation generated two template files with names
of the form 'git-maintenance@.(timer|service)'. The '.timer' or
'.service' indicates that this is a template that is picked up when we
later specify '...@<schedule>.timer' or '...@<schedule>.service'. The
'<schedule>' string is then used to insert into the template both the
'OnCalendar' schedule setting and the '--schedule' parameter of the
'git maintenance run' command.

In order to set these schedules to a given minute, we can no longer use
the 'hourly', 'daily', or 'weekly' strings for '<schedule>' and instead
need to abandon the template model for the .timer files. We can still
use templates for the .service files. For this reason, we split these
writes into two methods.

Modify the template with a custom schedule in the 'OnCalendar' setting.
This schedule has some interesting differences from cron-like patterns,
but is relatively easy to figure out from context. The one that might be
confusing is that '*-*-*' is a date-based pattern, but this must be
omitted when using 'Mon' to signal that we care about the day of the
week. Monday is used since that matches the day used for the 'weekly'
schedule used previously.

Now that the timer files are not templates, we might want to abandon the
'@' symbol in the file names. However, this would cause users with
existing schedules to get two competing schedules due to different
names. The work to remove the old schedule name is one thing that we can
avoid by keeping the '@' symbol in our unit names. Since we are locked
into this name, it makes sense that we keep the template model for the
.service files.

The rest of the change involves making sure we are writing these .timer
and .service files before initializing the schedule with 'systemctl' and
deleting the files when we are done. Some changes are also made to share
the random minute along with a single computation of the execution path
of the current Git executable.

In addition, older Git versions may have written a
'git-maintenance@.timer' template file. Be sure to remove this when
successfully enabling maintenance (or disabling maintenance).

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agomaintenance: swap method locations
Derrick Stolee [Thu, 10 Aug 2023 20:39:44 +0000 (20:39 +0000)] 
maintenance: swap method locations

The systemd_timer_write_unit_templates() method writes a single template
that is then used to start the hourly, daily, and weekly schedules with
systemd.

However, in order to schedule systemd maintenance on a given minute,
these templates need to be replaced with specific schedules for each of
these jobs.

Before modifying the schedules, move the writing method above the
systemd_timer_enable_unit() method, so we can write a specific schedule
for each unit.

The diff is computed smaller by showing systemd_timer_enable_unit() and
systemd_timer_delete_units()  move instead of
systemd_timer_write_unit_templates() and
systemd_timer_delete_unit_templates().

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agomaintenance: use random minute in cron scheduler
Derrick Stolee [Thu, 10 Aug 2023 20:39:43 +0000 (20:39 +0000)] 
maintenance: use random minute in cron scheduler

The get_random_minute() method was created to allow maintenance
schedules to be fixed to a random minute of the hour. This randomness is
only intended to spread out the load from a number of clients, but each
client should have an hour between each maintenance cycle.

Add this random minute to the cron integration.

The cron schedule specification starts with a minute indicator, which
was previously inserted as the "0" string but now takes the given minute
as an integer parameter.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agomaintenance: use random minute in Windows scheduler
Derrick Stolee [Thu, 10 Aug 2023 20:39:42 +0000 (20:39 +0000)] 
maintenance: use random minute in Windows scheduler

The get_random_minute() method was created to allow maintenance
schedules to be fixed to a random minute of the hour. This randomness is
only intended to spread out the load from a number of clients, but each
client should have an hour between each maintenance cycle.

Add this random minute to the Windows scheduler integration.

We need only to modify the minute value for the 'StartBoundary' tag
across the three schedules.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agomaintenance: use random minute in launchctl scheduler
Derrick Stolee [Thu, 10 Aug 2023 20:39:41 +0000 (20:39 +0000)] 
maintenance: use random minute in launchctl scheduler

The get_random_minute() method was created to allow maintenance
schedules to be fixed to a random minute of the hour. This randomness is
only intended to spread out the load from a number of clients, but each
client should have an hour between each maintenance cycle.

Use get_random_minute() when constructing the schedules for launchctl.

The format already includes a 'Minute' key which is modified from 0 to
the random minute.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agomaintenance: add get_random_minute()
Derrick Stolee [Thu, 10 Aug 2023 20:39:40 +0000 (20:39 +0000)] 
maintenance: add get_random_minute()

When we initially created background maintenance -- with its hourly,
daily, and weekly schedules -- we considered the effects of all clients
launching fetches to the server every hour on the hour. The worry of
DDoSing server hosts was noted, but left as something we would consider
for a future update.

As background maintenance has gained more adoption over the past three
years, our worries about DDoSing the big Git hosts has been unfounded.
Those systems, especially those serving public repositories, are already
resilient to thundering herds of much smaller scale.

However, sometimes organizations spin up specific custom server
infrastructure either in addition to or on top of their Git host. Some
of these technologies are built for a different range of scale, and can
hit concurrency limits sooner. Organizations with such custom
infrastructures are more likely to recommend tools like `scalar` which
furthers their adoption of background maintenance.

To help solve for this, create get_random_minute() as a method to help
Git select a random minute when creating schedules in the future. The
integrations with this method do not yet exist, but will follow in
future changes.

To avoid multiple sources of randomness in the Git codebase, create a
new helper function, git_rand(), that returns a random uint32_t. This is
similar to how rand() returns a random nonnegative value, except it is
based on csprng_bytes() which is cryptographic and will return values
larger than RAND_MAX.

One thing that is important for testability is that we notice when we
are under a test scenario and return a predictable result. The schedules
themselves are not checked for this value, but at least one launchctl
test checks that we do not unnecessarily reboot the schedule if it has
not changed from a previous version.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agorebase: allow overriding the maximal length of the generated labels
Johannes Schindelin [Thu, 10 Aug 2023 16:35:00 +0000 (16:35 +0000)] 
rebase: allow overriding the maximal length of the generated labels

With this change, users can override the compiled-in default for the
maximal length of the label names generated by `git rebase
--rebase-merges`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Mark Ruvald Pedersen <mped@demant.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agosequencer: truncate labels to accommodate loose refs
Mark Ruvald Pedersen [Thu, 10 Aug 2023 16:34:59 +0000 (16:34 +0000)] 
sequencer: truncate labels to accommodate loose refs

Some commits may have unusually long subject lines. When those subject
lines are used as labels in the `--rebase-merges` mode of `git rebase`,
they can cause errors when writing the corresponding loose refs because
most file systems have a maximal file name length of 255 (`NAME_MAX`).
The symptom looks like this:

$ git rebase --continue
error: cannot lock ref 'refs/rewritten/SANITIZED-SUBJECT': Unable to create '.git/refs/rewritten/SANITIZED-SUBJECT.lock': File name too long - where SANITIZED-SUBJECT is very long

Let's accommodate this situation by truncating the labels.

Care must be taken in case the subject line contains multi-byte
characters so as not to truncate in the middle of a character.

Signed-off-by: Mark Ruvald Pedersen <mped@demant.com>
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agot/lib-rebase: improve documentation of set_fake_editor()
Oswald Buddenhagen [Wed, 9 Aug 2023 17:15:31 +0000 (19:15 +0200)] 
t/lib-rebase: improve documentation of set_fake_editor()

Firstly, make it reflect better what actually happens. Not omitting some
possibilities makes it easier to fully exploit them, and not
contradicting the implementation makes it easier to grok and thus modify
the code.

Secondly, improve the overall structure, putting more general info
further up.

Thirdly, document `merge`, `fakesha`, and `break`, which were previously
omitted entirely.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agot4053: avoid race when killing background processes
Phillip Wood [Thu, 10 Aug 2023 14:33:13 +0000 (14:33 +0000)] 
t4053: avoid race when killing background processes

The test 'diff --no-index reads from pipes' starts a couple of
background processes that write to the pipes that are passed to "diff
--no-index". If the test passes then we expect these processes to exit
as all their output will have been read. However if the test fails
then we want to make sure they do not hang about on the users machine
and the test remembers they should be killed by calling

      test_when_finished  "! kill $!"

after each background process is created. Unfortunately there is a
race where test_when_finished may run before the background process
exits even when all its output has been read resulting in the kill
command succeeding which causes the test to fail. Fix this by ignoring
the exit status of the kill command. If the diff is successful we
could instead wait for the background process to exit and check their
status but that feels like it is testing the platform's printf
implementation rather than git's code.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agoupload-pack: fix race condition in error messages
Derrick Stolee [Thu, 10 Aug 2023 14:40:50 +0000 (14:40 +0000)] 
upload-pack: fix race condition in error messages

Test t5516-fetch-push.sh has a test 'deny fetch unreachable SHA1,
allowtipsha1inwant=true' that checks stderr for a specific error
string from the remote. In some build environments the error sent
over the remote connection gets mingled with the error from the
die() statement. Since both signals are being output to the same
file descriptor (but from parent and child processes), the output
we are matching with grep gets split.

To reduce the risk of this failure, follow this process instead:

1. Write an error message to stderr.
2. Write an error message across the connection.
3. exit(1).

This reorders the events so the error is written entirely before
the client receives a message from the remote, removing the race
condition.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agogit-push.txt: fix grammar
Wesley Schwengle [Thu, 10 Aug 2023 01:21:05 +0000 (21:21 -0400)] 
git-push.txt: fix grammar

While working on a blog post and using grammarly it suggested this
change.

Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agoGit 2.42-rc1 v2.42.0-rc1
Junio C Hamano [Wed, 9 Aug 2023 23:17:27 +0000 (16:17 -0700)] 
Git 2.42-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agoMerge branch 'pw/rebase-skip-commit-message-fix'
Junio C Hamano [Wed, 9 Aug 2023 23:18:16 +0000 (16:18 -0700)] 
Merge branch 'pw/rebase-skip-commit-message-fix'

"git rebase -i" with a series of squash/fixup, when one of the
steps stopped in conflicts and ended up getting skipped, did not
handle the accumulated commit log messages, which has been
corrected.

* pw/rebase-skip-commit-message-fix:
  rebase --skip: fix commit message clean up when skipping squash

10 months agoMerge branch 'ma/locate-in-path-for-windows'
Junio C Hamano [Wed, 9 Aug 2023 23:18:15 +0000 (16:18 -0700)] 
Merge branch 'ma/locate-in-path-for-windows'

"git bisect visualize" stopped running "gitk" on Git for Windows
when the command was reimplemented in C around Git 2.34 timeframe.
This has been corrected.

* ma/locate-in-path-for-windows:
  docs: update when `git bisect visualize` uses `gitk`
  compat/mingw: implement a native locate_in_PATH()
  run-command: conditionally define locate_in_PATH()

10 months agoMerge branch 'bc/ignore-clangd-cache'
Junio C Hamano [Wed, 9 Aug 2023 23:18:15 +0000 (16:18 -0700)] 
Merge branch 'bc/ignore-clangd-cache'

.gitignore update.

* bc/ignore-clangd-cache:
  gitignore: ignore clangd .cache directory

10 months agoMerge branch 'bc/ident-dot-is-no-longer-crud-letter'
Junio C Hamano [Wed, 9 Aug 2023 23:18:15 +0000 (16:18 -0700)] 
Merge branch 'bc/ident-dot-is-no-longer-crud-letter'

Exclude "." from the set of characters to be removed from the
beginning and the end of the human-readable name.

* bc/ident-dot-is-no-longer-crud-letter:
  ident: don't consider '.' a crud

10 months agoMerge branch 'ew/hash-with-openssl-evp'
Junio C Hamano [Wed, 9 Aug 2023 23:18:15 +0000 (16:18 -0700)] 
Merge branch 'ew/hash-with-openssl-evp'

Adjust to OpenSSL 3+, which deprecates its SHA-1 functions based on
its traditional API, by using its EVP API instead.

* ew/hash-with-openssl-evp:
  avoid SHA-1 functions deprecated in OpenSSL 3+
  sha256: avoid functions deprecated in OpenSSL 3+

10 months agorepack: move `pack_geometry` struct to the stack
Taylor Blau [Wed, 9 Aug 2023 20:32:42 +0000 (16:32 -0400)] 
repack: move `pack_geometry` struct to the stack

The `pack_geometry` struct is used to maintain and partition a list of
packfiles into a "frozen" set (to be left alone), and a non-frozen set
(to be combined into a single new pack). In the previous commit, we
removed a leak caused by neglecting to free() the heap allocated space
used to store the structure itself.

But there is no need for this structure to live on the heap anyway.
Instead, let's move it to be stack allocated, eliminating the
possibility of a direct leak like the one addressed in the previous
patch.

The one minor hitch is that we use the NULL-ness of the pack_geometry's
struct pointer to determine whether or not we are performing a geometric
repack with `--geometric=<d>`. But since we only initialize the
pack_geometry structure when the `geometric_factor` is non-zero, we can
use that variable (based on whether or not it is equal to zero) to
determine whether or not we are performing a geometric repack.

There are a couple of spots that have access to a pointer to the
pack_geometry struct, but not the geometric_factor itself. Instead of
passing in an additional variable, let's make the geometric_factor a
field of the pack_geometry struct.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agogit maintenance: avoid console window in scheduled tasks on Windows
Johannes Schindelin [Wed, 9 Aug 2023 16:54:47 +0000 (16:54 +0000)] 
git maintenance: avoid console window in scheduled tasks on Windows

We just introduced a helper to avoid showing a console window when the
scheduled task runs `git.exe`. Let's actually use it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agowin32: add a helper to run `git.exe` without a foreground window
Johannes Schindelin [Wed, 9 Aug 2023 16:54:46 +0000 (16:54 +0000)] 
win32: add a helper to run `git.exe` without a foreground window

On Windows, there are two kinds of executables, console ones and
non-console ones. Git's executables are all console ones.

When launching the former e.g. in a scheduled task, a CMD window pops
up. This is not what we want for the tasks installed via the `git
maintenance` command.

To work around this, let's introduce `headless-git.exe`, which is a
non-console program that does _not_ pop up any window. All it does is to
re-launch `git.exe`, suppressing that console window, passing through
all command-line arguments as-are.

Helped-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Helped-by: Yuyi Wang <Strawberry_Str@hotmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agosequencer: simplify allocation of result array in todo_list_rearrange_squash()
Oswald Buddenhagen [Wed, 9 Aug 2023 17:15:32 +0000 (19:15 +0200)] 
sequencer: simplify allocation of result array in todo_list_rearrange_squash()

The operation doesn't change the number of elements in the array, so we do
not need to allocate the result piecewise.

This moves the re-assignment of todo_list->alloc at the end slighly up,
so it's right after the newly added assert which also refers to `nr`
(and which indeed should come first). Also, the value is more likely to
be still in a register at that point.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agot9001: remove excessive GIT_SEND_EMAIL_NOTTY=1
Oswald Buddenhagen [Wed, 9 Aug 2023 17:15:31 +0000 (19:15 +0200)] 
t9001: remove excessive GIT_SEND_EMAIL_NOTTY=1

This was added by 3ece9bf0f9 (send-email: clear the $message_id after
validation, 2023-05-17) for no apparent reason, as this is required only
in cases when git's stdin is (must be) redirected, which isn't the case
here.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agomv: handle lstat() failure correctly
Sebastian Thiel [Wed, 9 Aug 2023 07:47:41 +0000 (07:47 +0000)] 
mv: handle lstat() failure correctly

When moving a directory onto another with `git mv` various checks are
performed. One of of these validates that the destination is not existing.

When calling `lstat` on the destination path and it fails as the path
doesn't exist, some environments seem to overwrite the passed  in
`stat` memory nonetheless (I observed this issue on debian 12 of x86_64,
running on OrbStack on ARM, emulated with Rosetta).

This would affect the code that followed as it would still acccess a now
modified `st` structure, which now seems to contain uninitialized memory.
`S_ISDIR(st_dir_mode)` would then typically return false causing the code
to run into a bad case.

The fix avoids overwriting the existing `st` structure, providing an
alternative that exists only for that purpose.

Note that this patch minimizes complexity instead of stack-frame size.

Signed-off-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agobranch: error message checking out a branch in use
Rubén Justo [Mon, 7 Aug 2023 20:42:40 +0000 (22:42 +0200)] 
branch: error message checking out a branch in use

Let's update the error message we show when the user tries to check out
a branch which is being used in another worktree, following the
guideline reasoned in 4970bedef2 (branch: update the message to refuse
touching a branch in-use, 2023-07-21).

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agoparse-options: disallow negating OPTION_SET_INT 0
René Scharfe [Tue, 8 Aug 2023 20:05:57 +0000 (22:05 +0200)] 
parse-options: disallow negating OPTION_SET_INT 0

An option of type OPTION_SET_INT can be defined to set its variable to
zero.  It's negated variant will do the same, though, which is
confusing.  Several such options were fixed by disabling negation,
changing the value to set or using a different option type:

991c552916 (ls-tree: fix --no-full-name, 2023-07-18)
e12cb98e1e (branch: reject "--no-all" and "--no-remotes" early, 2023-07-18)
68cbb20e73 (show-branch: reject --[no-](topo|date)-order, 2023-07-19)
3821eb6c3d (reset: reject --no-(mixed|soft|hard|merge|keep) option, 2023-07-19)
36f76d2a25 (pack-objects: fix --no-quiet, 2023-07-21)
3a5f308741 (pack-objects: fix --no-keep-true-parents, 2023-07-21)
c95ae3ff9c (describe: fix --no-exact-match, 2023-07-21)
d089a06421 (bundle: use OPT_PASSTHRU_ARGV, 2023-07-29)

Check for such options that allow negation in parse_options_check() and
report them to find future cases quicker.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agorepack: free geometry struct
Jeff King [Tue, 8 Aug 2023 18:50:23 +0000 (14:50 -0400)] 
repack: free geometry struct

When the program is ending, we call clear_pack_geometry() to free any
resources in the pack_geometry struct. But the struct itself is
allocated on the heap, and leak-checkers will complain about the
resulting small leak.

This one was marked by Coverity as a "new" leak, though it has existed
since 0fabafd0b9 (builtin/repack.c: add '--geometric' option,
2021-02-22). This might be because recent unrelated changes in the file
confused it about what is new and what is not. But regardless, it is
worth addressing.

We can fix it easily by free-ing the struct. We'll convert our "clear"
function to "free", since the allocation happens in the matching init()
function (though since there is only one call to each, and the struct is
local to this file, it's mostly academic).

Another option would be to put the struct on the stack rather than the
heap. However, this gets tricky, as we check the pointer against NULL in
several places to decide whether we're in geometric mode.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>