]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agoconfig: respect includes in protected config
Glen Choo [Thu, 13 Oct 2022 17:43:47 +0000 (17:43 +0000)] 
config: respect includes in protected config

Protected config is implemented by reading a fixed set of paths,
which ignores config [include]-s. Replace this implementation with a
call to config_with_options(), which handles [include]-s and saves us
from duplicating the logic of 1) identifying which paths to read and 2)
reading command line config.

As a result, git_configset_add_parameters() is unused, so remove it. It
was introduced alongside protected config in 5b3c650777 (config: learn
`git_protected_config()`, 2022-07-14) as a way to handle command line
config.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoconfig.c: NULL check when reading protected config
Glen Choo [Tue, 26 Jul 2022 22:21:06 +0000 (22:21 +0000)] 
config.c: NULL check when reading protected config

In read_protected_config(), check whether each file name is NULL before
attempting to read it, and add a BUG() call to
git_config_from_file_with_options() to make this error easier to catch
in the future.

The NULL checks mirror what do_git_config_sequence() does (which
read_protected_config() is modeled after). Without these NULL checks,
multiple tests fail with "make SANITIZE=address", e.g. in the final test
of t4010, xdg_config is NULL causing us to call fopen(NULL).

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosetup.c: create `safe.bareRepository`
Glen Choo [Thu, 14 Jul 2022 21:28:01 +0000 (21:28 +0000)] 
setup.c: create `safe.bareRepository`

There is a known social engineering attack that takes advantage of the
fact that a working tree can include an entire bare repository,
including a config file. A user could run a Git command inside the bare
repository thinking that the config file of the 'outer' repository would
be used, but in reality, the bare repository's config file (which is
attacker-controlled) is used, which may result in arbitrary code
execution. See [1] for a fuller description and deeper discussion.

A simple mitigation is to forbid bare repositories unless specified via
`--git-dir` or `GIT_DIR`. In environments that don't use bare
repositories, this would be minimally disruptive.

Create a config variable, `safe.bareRepository`, that tells Git whether
or not to die() when working with a bare repository. This config is an
enum of:

- "all": allow all bare repositories (this is the default)
- "explicit": only allow bare repositories specified via --git-dir
  or GIT_DIR.

If we want to protect users from such attacks by default, neither value
will suffice - "all" provides no protection, but "explicit" is
impractical for bare repository users. A more usable default would be to
allow only non-embedded bare repositories ([2] contains one such
proposal), but detecting if a repository is embedded is potentially
non-trivial, so this work is not implemented in this series.

[1]: https://lore.kernel.org/git/kl6lsfqpygsj.fsf@chooglen-macbookpro.roam.corp.google.com
[2]: https://lore.kernel.org/git/5b969c5e-e802-c447-ad25-6acc0b784582@github.com

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosafe.directory: use git_protected_config()
Glen Choo [Thu, 14 Jul 2022 21:28:00 +0000 (21:28 +0000)] 
safe.directory: use git_protected_config()

Use git_protected_config() to read `safe.directory` instead of
read_very_early_config(), making it 'protected configuration only'.

As a result, `safe.directory` now respects "-c", so update the tests and
docs accordingly. It used to ignore "-c" due to how it was implemented,
not because of security or correctness concerns [1].

[1] https://lore.kernel.org/git/xmqqlevabcsu.fsf@gitster.g/

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoconfig: learn `git_protected_config()`
Glen Choo [Thu, 14 Jul 2022 21:27:59 +0000 (21:27 +0000)] 
config: learn `git_protected_config()`

`uploadpack.packObjectsHook` is the only 'protected configuration only'
variable today, but we've noted that `safe.directory` and the upcoming
`safe.bareRepository` should also be 'protected configuration only'. So,
for consistency, we'd like to have a single implementation for protected
configuration.

The primary constraints are:

1. Reading from protected configuration should be fast. Nearly all "git"
   commands inside a bare repository will read both `safe.directory` and
   `safe.bareRepository`, so we cannot afford to be slow.

2. Protected configuration must be readable when the gitdir is not
   known. `safe.directory` and `safe.bareRepository` both affect
   repository discovery and the gitdir is not known at that point [1].

The chosen implementation in this commit is to read protected
configuration and cache the values in a global configset. This is
similar to the caching behavior we get with the_repository->config.

Introduce git_protected_config(), which reads protected configuration
and caches them in the global configset protected_config. Then, refactor
`uploadpack.packObjectsHook` to use git_protected_config().

The protected configuration functions are named similarly to their
non-protected counterparts, e.g. git_protected_config_check_init() vs
git_config_check_init().

In light of constraint 1, this implementation can still be improved.
git_protected_config() iterates through every variable in
protected_config, which is wasteful, but it makes the conversion simple
because it matches existing patterns. We will likely implement constant
time lookup functions for protected configuration in a future series
(such functions already exist for non-protected configuration, i.e.
repo_config_get_*()).

An alternative that avoids introducing another configset is to continue
to read all config using git_config(), but only accept values that have
the correct config scope [2]. This technically fulfills constraint 2,
because git_config() simply ignores the local and worktree config when
the gitdir is not known. However, this would read incomplete config into
the_repository->config, which would need to be reset when the gitdir is
known and git_config() needs to read the local and worktree config.
Resetting the_repository->config might be reasonable while we only have
these 'protected configuration only' variables, but it's not clear
whether this extends well to future variables.

[1] In this case, we do have a candidate gitdir though, so with a little
refactoring, it might be possible to provide a gitdir.
[2] This is how `uploadpack.packObjectsHook` was implemented prior to
this commit.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoDocumentation: define protected configuration
Glen Choo [Thu, 14 Jul 2022 21:27:58 +0000 (21:27 +0000)] 
Documentation: define protected configuration

For security reasons, there are config variables that are only trusted
when they are specified in certain configuration scopes, which are
sometimes referred to on-list as 'protected configuration' [1]. A future
commit will introduce another such variable, so let's define our terms
so that we can have consistent documentation and implementation.

In our documentation, define 'protected configuration' as the system,
global and command config scopes. As a shorthand, I will refer to
variables that are only respected in protected configuration as
'protected configuration only', but this term is not used in the
documentation.

This definition of protected configuration is based on whether or not
Git can reasonably protect the user by ignoring the configuration scope:

- System, global and command line config are considered protected
  because an attacker who has control over any of those can do plenty of
  harm without Git, so we gain very little by ignoring those scopes.

- On the other hand, local (and similarly, worktree) config are not
  considered protected because it is relatively easy for an attacker to
  control local config, e.g.:

  - On some shared user environments, a non-admin attacker can create a
    repository high up the directory hierarchy (e.g. C:\.git on
    Windows), and a user may accidentally use it when their PS1
    automatically invokes "git" commands.

    `safe.directory` prevents attacks of this form by making sure that
    the user intended to use the shared repository. It obviously
    shouldn't be read from the repository, because that would end up
    trusting the repository that Git was supposed to reject.

  - "git upload-pack" is expected to run in repositories that may not be
    controlled by the user. We cannot ignore all config in that
    repository (because "git upload-pack" would fail), but we can limit
    the risks by ignoring `uploadpack.packObjectsHook`.

Only `uploadpack.packObjectsHook` is 'protected configuration only'. The
following variables are intentionally excluded:

- `safe.directory` should be 'protected configuration only', but it does
  not technically fit the definition because it is not respected in the
  "command" scope. A future commit will fix this.

- `trace2.*` happens to read the same scopes as `safe.directory` because
  they share an implementation. However, this is not for security
  reasons; it is because we want to start tracing so early that
  repository-level config and "-c" are not available [2].

  This requirement is unique to `trace2.*`, so it does not makes sense
  for protected configuration to be subject to the same constraints.

[1] For example,
https://lore.kernel.org/git/6af83767-576b-75c4-c778-0284344a8fe7@github.com/
[2] https://lore.kernel.org/git/a0c89d0d-669e-bf56-25d2-cbb09b012e70@jeffhostetler.com/

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoDocumentation/git-config.txt: add SCOPES section
Glen Choo [Thu, 14 Jul 2022 21:27:57 +0000 (21:27 +0000)] 
Documentation/git-config.txt: add SCOPES section

In a subsequent commit, we will introduce "protected configuration",
which is easiest to describe in terms of configuration scopes (i.e. it's
the union of the 'system', 'global', and 'command' scopes). This
description is fine for ML discussions, but it's inadequate for end
users because we don't provide a good description of "configuration
scopes" in the public docs.

145d59f482 (config: add '--show-scope' to print the scope of a config
value, 2020-02-10) introduced the word "scope" to our public docs, but
that only enumerates the scopes and assumes the user can figure out
what those values mean.

Add a SCOPES section to Documentation/git-config.txt that describes the
configuration scopes, their corresponding CLI options, and mentions that
some configuration options are only respected in certain scopes. Then,
use the word "scope" to simplify the FILES section and change some
confusing wording.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe second batch
Junio C Hamano [Wed, 13 Jul 2022 21:44:29 +0000 (14:44 -0700)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ds/git-rebase-doc-markup'
Junio C Hamano [Wed, 13 Jul 2022 21:54:56 +0000 (14:54 -0700)] 
Merge branch 'ds/git-rebase-doc-markup'

References to commands-to-be-typed-literally in "git rebase"
documentation mark-up have been corrected.

* ds/git-rebase-doc-markup:
  git-rebase.txt: use back-ticks consistently

2 years agoMerge branch 'tk/rev-parse-doc-clarify-at-u'
Junio C Hamano [Wed, 13 Jul 2022 21:54:55 +0000 (14:54 -0700)] 
Merge branch 'tk/rev-parse-doc-clarify-at-u'

Doc update.

* tk/rev-parse-doc-clarify-at-u:
  rev-parse: documentation adjustment - mention remote tracking with @{u}

2 years agoMerge branch 'cl/grep-max-count'
Junio C Hamano [Wed, 13 Jul 2022 21:54:55 +0000 (14:54 -0700)] 
Merge branch 'cl/grep-max-count'

"git grep -m<max-hits>" is a way to limit the hits shown per file.

* cl/grep-max-count:
  grep: add --max-count command line option

2 years agoMerge branch 'dr/i18n-die-warn-error-usage'
Junio C Hamano [Wed, 13 Jul 2022 21:54:54 +0000 (14:54 -0700)] 
Merge branch 'dr/i18n-die-warn-error-usage'

Give _() markings to fatal/warning/usage: labels that are shown in
front of these messages.

* dr/i18n-die-warn-error-usage:
  i18n: mark message helpers prefix for translation

2 years agoMerge branch 'zk/push-use-bitmaps'
Junio C Hamano [Wed, 13 Jul 2022 21:54:54 +0000 (14:54 -0700)] 
Merge branch 'zk/push-use-bitmaps'

"git push" sometimes perform poorly when reachability bitmaps are
used, even in a repository where other operations are helped by
bitmaps.  The push.useBitmaps configuration variable is introduced
to allow disabling use of reachability bitmaps only for "git push".

* zk/push-use-bitmaps:
  send-pack.c: add config push.useBitmaps

2 years agoMerge branch 'jk/remote-show-with-negative-refspecs'
Junio C Hamano [Wed, 13 Jul 2022 21:54:53 +0000 (14:54 -0700)] 
Merge branch 'jk/remote-show-with-negative-refspecs'

"git remote show [-n] frotz" now pays attention to negative
pathspec.

* jk/remote-show-with-negative-refspecs:
  remote: handle negative refspecs in git remote show

2 years agoMerge branch 'ro/mktree-allow-missing-fix'
Junio C Hamano [Wed, 13 Jul 2022 21:54:53 +0000 (14:54 -0700)] 
Merge branch 'ro/mktree-allow-missing-fix'

"git mktree --missing" lazily fetched objects that are missing from
the local object store, which was totally unnecessary for the purpose
of creating the tree object(s) from its input.

* ro/mktree-allow-missing-fix:
  mktree: do not check type of remote objects

2 years agoMerge branch 'll/ls-files-tests-update'
Junio C Hamano [Wed, 13 Jul 2022 21:54:53 +0000 (14:54 -0700)] 
Merge branch 'll/ls-files-tests-update'

Test update.

* ll/ls-files-tests-update:
  ls-files: update test style

2 years agoMerge branch 'ab/test-quoting-fix'
Junio C Hamano [Wed, 13 Jul 2022 21:54:52 +0000 (14:54 -0700)] 
Merge branch 'ab/test-quoting-fix'

Fixes for tests when the source directory has unusual characters in
its path, e.g. whitespaces, double-quotes, etc.

* ab/test-quoting-fix:
  config tests: fix harmless but broken "rm -r" cleanup
  test-lib.sh: fix prepend_var() quoting issue
  tests: add missing double quotes to included library paths

2 years agoMerge branch 'ds/t5510-brokequote'
Junio C Hamano [Wed, 13 Jul 2022 21:54:52 +0000 (14:54 -0700)] 
Merge branch 'ds/t5510-brokequote'

Test fix.

* ds/t5510-brokequote:
  t5510: replace 'origin' with URL more carefully

2 years agoMerge branch 'tb/pack-objects-remove-pahole-comment'
Junio C Hamano [Wed, 13 Jul 2022 21:54:51 +0000 (14:54 -0700)] 
Merge branch 'tb/pack-objects-remove-pahole-comment'

Comment fix.

* tb/pack-objects-remove-pahole-comment:
  pack-objects.h: remove outdated pahole results

2 years agoMerge branch 'en/t6429-test-must-be-empty-fix'
Junio C Hamano [Wed, 13 Jul 2022 21:54:51 +0000 (14:54 -0700)] 
Merge branch 'en/t6429-test-must-be-empty-fix'

A test fix.

* en/t6429-test-must-be-empty-fix:
  t6429: fix use of non-existent function

2 years agoSync with Git 2.37.1
Junio C Hamano [Mon, 11 Jul 2022 23:08:49 +0000 (16:08 -0700)] 
Sync with Git 2.37.1

2 years agoThe first batch after Git 2.37
Junio C Hamano [Mon, 11 Jul 2022 22:37:53 +0000 (15:37 -0700)] 
The first batch after Git 2.37

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ds/vscode-settings'
Junio C Hamano [Mon, 11 Jul 2022 22:38:52 +0000 (15:38 -0700)] 
Merge branch 'ds/vscode-settings'

* ds/vscode-settings:
  vscode: improve tab size and wrapping

2 years agoMerge branch 'cr/setup-bug-typo'
Junio C Hamano [Mon, 11 Jul 2022 22:38:52 +0000 (15:38 -0700)] 
Merge branch 'cr/setup-bug-typo'

Typofix in a BUG() message.

* cr/setup-bug-typo:
  setup: fix function name in a BUG() message

2 years agoMerge branch 'rs/archive-with-internal-gzip'
Junio C Hamano [Mon, 11 Jul 2022 22:38:51 +0000 (15:38 -0700)] 
Merge branch 'rs/archive-with-internal-gzip'

Teach "git archive" to (optionally and then by default) avoid
spawning an external "gzip" process when creating ".tar.gz" (and
".tgz") archives.

* rs/archive-with-internal-gzip:
  archive-tar: use internal gzip by default
  archive-tar: use OS_CODE 3 (Unix) for internal gzip
  archive-tar: add internal gzip implementation
  archive-tar: factor out write_block()
  archive: rename archiver data field to filter_command
  archive: update format documentation

2 years agoMerge branch 'ds/branch-checked-out'
Junio C Hamano [Mon, 11 Jul 2022 22:38:51 +0000 (15:38 -0700)] 
Merge branch 'ds/branch-checked-out'

Introduce a helper to see if a branch is already being worked on
(hence should not be newly checked out in a working tree), which
performs much better than the existing find_shared_symref() to
replace many uses of the latter.

* ds/branch-checked-out:
  branch: drop unused worktrees variable
  fetch: stop passing around unused worktrees variable
  branch: fix branch_checked_out() leaks
  branch: use branch_checked_out() when deleting refs
  fetch: use new branch_checked_out() and add tests
  branch: check for bisects and rebases
  branch: add branch_checked_out() helper

2 years agoMerge branch 'jk/optim-promisor-object-enumeration'
Junio C Hamano [Mon, 11 Jul 2022 22:38:50 +0000 (15:38 -0700)] 
Merge branch 'jk/optim-promisor-object-enumeration'

Collection of what is referenced by objects in promisor packs have
been optimized to inspect these objects in the in-pack order.

* jk/optim-promisor-object-enumeration:
  is_promisor_object(): walk promisor packs in pack-order

2 years agoMerge branch 'ac/bitmap-format-doc'
Junio C Hamano [Mon, 11 Jul 2022 22:38:50 +0000 (15:38 -0700)] 
Merge branch 'ac/bitmap-format-doc'

Adjust technical/bitmap-format to be formatted by AsciiDoc, and
add some missing information to the documentation.

* ac/bitmap-format-doc:
  bitmap-format.txt: add information for trailing checksum
  bitmap-format.txt: fix some formatting issues
  bitmap-format.txt: feed the file to asciidoc to generate html

2 years agoMerge branch 'pb/diff-doc-raw-format'
Junio C Hamano [Mon, 11 Jul 2022 22:38:49 +0000 (15:38 -0700)] 
Merge branch 'pb/diff-doc-raw-format'

Update "git diff/log --raw" format documentation.

* pb/diff-doc-raw-format:
  diff-index.txt: update raw output format in examples
  diff-format.txt: correct misleading wording
  diff-format.txt: dst can be 0* SHA-1 when path is deleted, too

2 years agoMerge branch 'jk/revisions-doc-markup-fix'
Junio C Hamano [Mon, 11 Jul 2022 22:38:49 +0000 (15:38 -0700)] 
Merge branch 'jk/revisions-doc-markup-fix'

Documentation mark-up fix.

* jk/revisions-doc-markup-fix:
  revisions.txt: escape "..." to avoid asciidoc horizontal ellipsis

2 years agoMerge branch 'rs/combine-diff-with-incompatible-options'
Junio C Hamano [Mon, 11 Jul 2022 22:38:48 +0000 (15:38 -0700)] 
Merge branch 'rs/combine-diff-with-incompatible-options'

Certain diff options are currently ignored when combined-diff is
shown; mark them as incompatible with the feature.

* rs/combine-diff-with-incompatible-options:
  combine-diff: abort if --output is given
  combine-diff: abort if --ignore-matching-lines is given

2 years agols-files: update test style
Li Linchao [Sun, 3 Jul 2022 15:49:09 +0000 (15:49 +0000)] 
ls-files: update test style

Update test style in t/t30[*].sh for uniformity, that's to
keep test title the same line with helper function itself,
and fix some indentions.

Add a new section "recommended style" in t/README to
encourage people to use more modern style in test.

Signed-off-by: Li Linchao <lilinchao@oschina.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.37.1 v2.37.1
Junio C Hamano [Mon, 4 Jul 2022 20:45:08 +0000 (13:45 -0700)] 
Git 2.37.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge 'js/add-i-delete' into maint-2.37
Junio C Hamano [Mon, 4 Jul 2022 20:40:31 +0000 (13:40 -0700)] 
Merge 'js/add-i-delete' into maint-2.37

Rewrite of "git add -i" in C that appeared in Git 2.25 didn't
correctly record a removed file to the index, which is an old
regression but has become widely known because the C version
has become the default in the latest release.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoA regression fix for 2.37
Junio C Hamano [Sun, 3 Jul 2022 00:01:34 +0000 (17:01 -0700)] 
A regression fix for 2.37

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'js/add-i-delete'
Junio C Hamano [Sun, 3 Jul 2022 04:56:08 +0000 (21:56 -0700)] 
Merge branch 'js/add-i-delete'

Rewrite of "git add -i" in C that appeared in Git 2.25 didn't
correctly record a removed file to the index, which was fixed.

* js/add-i-delete:
  add --interactive: allow `update` to stage deleted files

2 years agot6429: fix use of non-existent function
Elijah Newren [Fri, 1 Jul 2022 05:19:59 +0000 (05:19 +0000)] 
t6429: fix use of non-existent function

This test had a line reading

    ! test_file_is_empty actual

which was meant to be

    ! test_must_be_empty actual

The test worked despite the error, because even though
test_file_is_empty is a non-existent function, the '!' negated the
return value and made it pass.  It'd be better to avoid the negation,
so something like

    test_file_not_empty actual

would be better, but perhaps it makes even more sense to specify the
number of lines of expected output to make the test a bit tighter.

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Elijah Newren <newren@palantir.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoconfig tests: fix harmless but broken "rm -r" cleanup
Ævar Arnfjörð Bjarmason [Thu, 30 Jun 2022 10:18:36 +0000 (12:18 +0200)] 
config tests: fix harmless but broken "rm -r" cleanup

The "test_when_finished" cleanup phase added in 4179b4897f2 (config:
allow overriding of global and system configuration, 2021-04-19) has
never worked as intended, firstly the ".config/git" is a directory, so
we'd need the "-r" flag, but more importantly the $HOME variable
wasn't properly quoted.

We'd thus end up trying to remove the "trash" part of "trash
directory", which wouldn't fail with "-f", since "rm -f" won't fail on
non-existing files.

It's possible that this would have caused an actual failure if someone
had a $HOME with a space character in it, such that our "rm -f" would
fail to remove an existing directory, but in practice that probably
never happened.

Let's fix both the quoting issue, and the other issue cleanup issue in
4179b4897f2, which is that we were attempting to clean up
~/.config/git, but weren't cleaing up ~/.gitconfig.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-lib.sh: fix prepend_var() quoting issue
Ævar Arnfjörð Bjarmason [Thu, 30 Jun 2022 10:18:35 +0000 (12:18 +0200)] 
test-lib.sh: fix prepend_var() quoting issue

Fix a quoting issue in the function introduced in
b9638d7286f (test-lib: make $GIT_BUILD_DIR an absolute path,
2022-02-27), running the test suite where the git checkout was on a
path with e.g. a space in it would fail.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotests: add missing double quotes to included library paths
Ævar Arnfjörð Bjarmason [Thu, 30 Jun 2022 10:18:34 +0000 (12:18 +0200)] 
tests: add missing double quotes to included library paths

Fix inclusion errors which would occur if the $TEST_DIRECTORY had $IFS
whitespace in it.

See d42bab442d7 (core.fsyncmethod: tests for batch mode, 2022-04-04)
and a242c150ebb (vimdiff: integrate layout tests in the unit tests
framework ('t' folder), 2022-03-30) for the two relevant commits. Both
were first released with v2.37.0-rc0 (and were also part of v2.37.0).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-rebase.txt: use back-ticks consistently
Derrick Stolee [Wed, 29 Jun 2022 13:21:07 +0000 (13:21 +0000)] 
git-rebase.txt: use back-ticks consistently

While inspecting the 'git rebase' documentation, I noticed that it is
inconsistent with how it uses back-ticks (or other punctuation) for
identifying Git commands, command-line arguments, or values for those
arguments.

Sometimes, an argument (like '--interactive') would appear without any
punctuation, causing the argument to not have any special formatting.
Other times, arguments or 'git rebase' itself would have single-quotes
giving a bold look (in the HTML documentation at least).

By consistently using back-ticks, these types of strings appear in a
monospace font with special highlighting to appear more clearly as text
that exists in a command-line invocation of a Git command.

This rather-large diff is the result of scanning git-rebase.txt and
adding back-ticks as appropriate. Some are adding back-ticks where there
was no punctuation. Others are replacing single quotes.

There are also a few minor cleanups in the process, including those
found by reviewers.

Helped-by: Phillip Wood <phillip.wood123@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopack-objects.h: remove outdated pahole results
Taylor Blau [Tue, 28 Jun 2022 18:30:20 +0000 (14:30 -0400)] 
pack-objects.h: remove outdated pahole results

The size and padding of `struct object_entry` is an important factor in
determining the memory usage of `pack-objects`. For this reason,
3b13a5f263 (pack-objects: reorder members to shrink struct object_entry,
2018-04-14) added a comment containing some information from pahole
indicating the size and padding of that struct.

Unfortunately, this comment hasn't been updated since 9ac3f0e5b3
(pack-objects: fix performance issues on packing large deltas,
2018-07-22), despite the size of this struct changing many times since
that commit.

To see just how often the size of object_entry changes, I skimmed the
first-parent history with this script:

    for sha in $(git rev-list --first-parent --reverse 9ac3f0e..)
    do
      echo -n "$sha "
      git checkout -q $sha
      make -s pack-objects.o 2>/dev/null
      pahole -C object_entry pack-objects.o | sed -n \
        -e 's/\/\* size: \([0-9]*\).*/size \1/p' \
        -e 's/\/\*.*padding: \([0-9]*\).*/padding \1/p' | xargs
    done | uniq -f1

In between each merge, the size of object_entry changes too often to
record every instance here. But the important merges (along with their
corresponding sizes and bit paddings) in chronological order are:

    ad635e82d6 (Merge branch 'nd/pack-objects-pack-struct', 2018-05-23) size 80 padding 4
    29d9e3e2c4 (Merge branch 'nd/pack-deltify-regression-fix', 2018-08-22) size 80 padding 9
    3ebdef2e1b (Merge branch 'jk/pack-delta-reuse-with-bitmap', 2018-09-17) size 80 padding 8
    33e4ae9c50 (Merge branch 'bc/sha-256', 2019-01-29) size 96 padding 8

(indicating that the current size of the struct is 96 bytes, with 8
padding bits).

Even though this comment was written in a good spirit, it is updated
infrequently enough that it serves to confuse rather than to encourage
contributors to update the appropriate values when the modify the
definition of object_entry.

For that reason, eliminate the confusion by removing the comment
altogether.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoadd --interactive: allow `update` to stage deleted files
Johannes Schindelin [Tue, 28 Jun 2022 22:22:44 +0000 (22:22 +0000)] 
add --interactive: allow `update` to stage deleted files

The scripted version of `git add -i` used `git update-index --add
--remove`, but the built-in version implemented only the `--add` part.

This fixes https://github.com/msys2/MSYS2-packages/issues/3066

Reported-by: Christoph Reiter <reiter.christoph@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agovscode: improve tab size and wrapping
Derrick Stolee [Mon, 27 Jun 2022 18:29:47 +0000 (18:29 +0000)] 
vscode: improve tab size and wrapping

The contrib/vscode/init.sh script initializes the .vscode directory with
some helpful metadata so VS Code handles Git code better.

One big issue that VS Code has is detecting the tab width based on file
type. ".txt" files were not covered by this script before, so add them
with the appropriate tab widths. This prevents inserting spaces instead
of tabs and keeps the tab width to eight instead of four or two.

While we are here, remove the "editor.wordWrap" settings. The editor's
word wrap is only cosmetic: it does not actually insert newlines when
your typing goes over the column limit. This can make it appear like you
have properly wrapped code, but it is incorrect. Further, existing code
that is over the column limit is wrapped even if your editor window is
wider than the limit. This can make reading such code more difficult.
Without these lines, VS Code renders the lines accurately, without
"ghost" newlines.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoSync with Git 2.36.2
Junio C Hamano [Mon, 27 Jun 2022 19:36:11 +0000 (12:36 -0700)] 
Sync with Git 2.36.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.37 v2.37.0
Junio C Hamano [Mon, 27 Jun 2022 16:17:55 +0000 (09:17 -0700)] 
Git 2.37

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jc/revert-show-parent-info'
Junio C Hamano [Mon, 27 Jun 2022 16:13:41 +0000 (09:13 -0700)] 
Merge branch 'jc/revert-show-parent-info'

* jc/revert-show-parent-info:
  revert: config documentation fixes

3 years agoMerge tag 'l10n-2.37.0-rnd1' of https://github.com/git-l10n/git-po
Junio C Hamano [Mon, 27 Jun 2022 15:39:10 +0000 (08:39 -0700)] 
Merge tag 'l10n-2.37.0-rnd1' of https://github.com/git-l10n/git-po

l10n-2.37.0-rnd1

* tag 'l10n-2.37.0-rnd1' of https://github.com/git-l10n/git-po:
  l10n: sv.po: Update Swedish translation (5367t0f0u)
  l10n: ru.po: update Russian translation
  l10n: zh_TW: v2.37.0 round 1
  l10n: vi(5367t): Updated translation
  l10n: fr v2.37 round 1
  l10n: Update Catalan translation
  l10n: po-id for 2.37 (first batch)
  l10n: tr: v2.37.0 round #1
  l10n: README: fix typo
  l10n: TEAMS: Change German translation team leader
  l10n: de.po: Update German translation
  l10n: bg.po: Updated Bulgarian translation (5367t)
  l10n: zh_CN: v2.37.0 round 1
  l10n: es: update translation

3 years agorevert: config documentation fixes
René Scharfe [Sun, 26 Jun 2022 09:29:35 +0000 (11:29 +0200)] 
revert: config documentation fixes

43966ab315 (revert: optionally refer to commit in the "reference"
format, 2022-05-26) added the documentation file config/revert.txt.
Actually include it in config.txt.

Make is used with a bare infinitive after the object; remove the "to".

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: sv.po: Update Swedish translation (5367t0f0u)
Peter Krefting [Fri, 24 Jun 2022 20:23:54 +0000 (21:23 +0100)] 
l10n: sv.po: Update Swedish translation (5367t0f0u)

Run msgmerge with --no-location to drop file locations to decrease the
size of future patches. Also removed old translations.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
3 years agol10n: ru.po: update Russian translation
Dimitriy Ryazantcev [Mon, 20 Jun 2022 13:02:39 +0000 (16:02 +0300)] 
l10n: ru.po: update Russian translation

Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
3 years agoMerge branch 'l10n/zh_TW/220623' of github.com:l10n-tw/git-po
Jiang Xin [Sun, 26 Jun 2022 05:54:26 +0000 (13:54 +0800)] 
Merge branch 'l10n/zh_TW/220623' of github.com:l10n-tw/git-po

* 'l10n/zh_TW/220623' of github.com:l10n-tw/git-po:
  l10n: zh_TW: v2.37.0 round 1

3 years agol10n: zh_TW: v2.37.0 round 1
Yi-Jyun Pan [Thu, 23 Jun 2022 13:08:28 +0000 (21:08 +0800)] 
l10n: zh_TW: v2.37.0 round 1

Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
3 years agoMerge branch 'master' of github.com:vnwildman/git
Jiang Xin [Sat, 25 Jun 2022 03:01:20 +0000 (11:01 +0800)] 
Merge branch 'master' of github.com:vnwildman/git

* 'master' of github.com:vnwildman/git:
  l10n: vi(5367t): Updated translation

3 years agol10n: vi(5367t): Updated translation
Tran Ngoc Quan [Sat, 25 Jun 2022 01:40:42 +0000 (08:40 +0700)] 
l10n: vi(5367t): Updated translation

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
3 years agol10n: fr v2.37 round 1
Jean-Noël Avila [Fri, 24 Jun 2022 09:04:25 +0000 (11:04 +0200)] 
l10n: fr v2.37 round 1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
3 years agol10n: Update Catalan translation
Jordi Mas [Fri, 24 Jun 2022 11:30:45 +0000 (13:30 +0200)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
3 years agoMerge branch 'ab/credentials-in-url-more'
Junio C Hamano [Thu, 23 Jun 2022 20:22:35 +0000 (13:22 -0700)] 
Merge branch 'ab/credentials-in-url-more'

* ab/credentials-in-url-more:
  Documentation/config/transfer.txt: fix typo

3 years agoDocumentation/config/transfer.txt: fix typo
Taylor Blau [Thu, 23 Jun 2022 19:02:01 +0000 (15:02 -0400)] 
Documentation/config/transfer.txt: fix typo

Commit 7281c196b1 (transfer doc: move fetch.credentialsInUrl to
"transfer" config namespace, 2022-06-15) propagates a typo from
6dcbdc0d66 (remote: create fetch.credentialsInUrl config, 2022-06-06),
where "other" is misspelled as "oher". Fix the typo accordingly.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorev-parse: documentation adjustment - mention remote tracking with @{u}
Tao Klerks [Thu, 23 Jun 2022 05:01:52 +0000 (05:01 +0000)] 
rev-parse: documentation adjustment - mention remote tracking with @{u}

The documentation explained the conversion from remote branch path to
local tracking ref path for @{push}, but not for @{upstream}.

Add the explanation to @{upstream}, and reference it in @{push} to avoid
undue repetition.

Signed-off-by: Tao Klerks <tao@klerks.biz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Thu, 23 Jun 2022 13:01:47 +0000 (21:01 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.37 (first batch)

3 years agoGit 2.36.2 v2.36.2
Johannes Schindelin [Thu, 23 Jun 2022 10:36:14 +0000 (12:36 +0200)] 
Git 2.36.2

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
3 years agoSync with 2.35.4
Johannes Schindelin [Thu, 23 Jun 2022 10:36:12 +0000 (12:36 +0200)] 
Sync with 2.35.4

* maint-2.35:
  Git 2.35.4
  Git 2.34.4
  Git 2.33.4
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo

3 years agoGit 2.35.4 v2.35.4
Johannes Schindelin [Thu, 23 Jun 2022 10:36:05 +0000 (12:36 +0200)] 
Git 2.35.4

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
3 years agoSync with 2.34.4
Johannes Schindelin [Thu, 23 Jun 2022 10:36:03 +0000 (12:36 +0200)] 
Sync with 2.34.4

* maint-2.34:
  Git 2.34.4
  Git 2.33.4
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo

3 years agoGit 2.34.4 v2.34.4
Johannes Schindelin [Thu, 23 Jun 2022 10:35:49 +0000 (12:35 +0200)] 
Git 2.34.4

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
3 years agoSync with 2.33.4
Johannes Schindelin [Thu, 23 Jun 2022 10:35:47 +0000 (12:35 +0200)] 
Sync with 2.33.4

* maint-2.33:
  Git 2.33.4
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo

3 years agoGit 2.33.4 v2.33.4
Johannes Schindelin [Thu, 23 Jun 2022 10:35:41 +0000 (12:35 +0200)] 
Git 2.33.4

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
3 years agoSync with 2.32.3
Johannes Schindelin [Thu, 23 Jun 2022 10:35:38 +0000 (12:35 +0200)] 
Sync with 2.32.3

* maint-2.32:
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo

3 years agoGit 2.32.3 v2.32.3
Johannes Schindelin [Thu, 23 Jun 2022 10:35:32 +0000 (12:35 +0200)] 
Git 2.32.3

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
3 years agoSync with 2.31.4
Johannes Schindelin [Thu, 23 Jun 2022 10:35:30 +0000 (12:35 +0200)] 
Sync with 2.31.4

* maint-2.31:
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo

3 years agoGit 2.31.4 v2.31.4
Johannes Schindelin [Thu, 23 Jun 2022 10:35:25 +0000 (12:35 +0200)] 
Git 2.31.4

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
3 years agoSync with 2.30.5
Johannes Schindelin [Thu, 23 Jun 2022 10:35:23 +0000 (12:35 +0200)] 
Sync with 2.30.5

* maint-2.30:
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo

3 years agoGit 2.30.5 v2.30.5
Johannes Schindelin [Fri, 27 May 2022 21:38:36 +0000 (23:38 +0200)] 
Git 2.30.5

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
3 years agosetup: tighten ownership checks post CVE-2022-24765
Carlo Marcelo Arenas Belón [Tue, 10 May 2022 19:35:29 +0000 (12:35 -0700)] 
setup: tighten ownership checks post CVE-2022-24765

8959555cee7 (setup_git_directory(): add an owner check for the top-level
directory, 2022-03-02), adds a function to check for ownership of
repositories using a directory that is representative of it, and ways to
add exempt a specific repository from said check if needed, but that
check didn't account for owership of the gitdir, or (when used) the
gitfile that points to that gitdir.

An attacker could create a git repository in a directory that they can
write into but that is owned by the victim to work around the fix that
was introduced with CVE-2022-24765 to potentially run code as the
victim.

An example that could result in privilege escalation to root in *NIX would
be to set a repository in a shared tmp directory by doing (for example):

  $ git -C /tmp init

To avoid that, extend the ensure_valid_ownership function to be able to
check for all three paths.

This will have the side effect of tripling the number of stat() calls
when a repository is detected, but the effect is expected to be likely
minimal, as it is done only once during the directory walk in which Git
looks for a repository.

Additionally make sure to resolve the gitfile (if one was used) to find
the relevant gitdir for checking.

While at it change the message printed on failure so it is clear we are
referring to the repository by its worktree (or gitdir if it is bare) and
not to a specific directory.

Helped-by: Junio C Hamano <junio@pobox.com>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
3 years agoMerge branch 'cb/path-owner-check-with-sudo'
Junio C Hamano [Thu, 26 May 2022 21:51:32 +0000 (14:51 -0700)] 
Merge branch 'cb/path-owner-check-with-sudo'

With a recent update to refuse access to repositories of other
people by default, "sudo make install" and "sudo git describe"
stopped working.  This series intends to loosen it while keeping
the safety.

* cb/path-owner-check-with-sudo:
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
3 years agol10n: po-id for 2.37 (first batch)
Bagas Sanjaya [Wed, 15 Jun 2022 07:33:28 +0000 (14:33 +0700)] 
l10n: po-id for 2.37 (first batch)

Update following components:

  - apply.c
  - builtin/bisect--helper.c
  - builtin/fetch.c
  - builtin/fsck.c
  - builtin/log.c
  - builtin/notes.c
  - builtin/push.c
  - builtin/submodule--helper.c
  - builtin/worktree.c
  - index-pack.c
  - init-db.c
  - remote.c

Translate following new components:

  - attr.c
  - builtin/name-rev.c
  - builtin/pack-objects.c
  - builtin/pack-refs.c
  - builtin/prune.c
  - builtin/update-server-info.c
  - object-file.c
  - object-name.c
  - object.c
  - pack-bitmap.c
  - pack-mtimes.c
  - pack-revindex.c
  - pack-write.c
  - packfile.c

Besides above, fix minor grammatical issues.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
3 years agol10n: tr: v2.37.0 round #1
Emir SARI [Wed, 15 Jun 2022 14:48:40 +0000 (17:48 +0300)] 
l10n: tr: v2.37.0 round #1

Signed-off-by: Emir SARI <emir_sari@icloud.com>
3 years agoMerge branch 'master' of github.com:ruester/git-po-de
Jiang Xin [Thu, 23 Jun 2022 02:45:03 +0000 (10:45 +0800)] 
Merge branch 'master' of github.com:ruester/git-po-de

* 'master' of github.com:ruester/git-po-de:
  l10n: TEAMS: Change German translation team leader
  l10n: de.po: Update German translation

3 years agoMerge branch 'master' of github.com:alshopov/git-po
Jiang Xin [Thu, 23 Jun 2022 02:44:43 +0000 (10:44 +0800)] 
Merge branch 'master' of github.com:alshopov/git-po

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

3 years agoMerge branch 'fz/po-zh_CN' of github.com:fangyi-zhou/git-po
Jiang Xin [Thu, 23 Jun 2022 02:44:30 +0000 (10:44 +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.37.0 round 1

3 years agol10n: README: fix typo
Arthur Milchior [Wed, 22 Jun 2022 19:50:44 +0000 (19:50 +0000)] 
l10n: README: fix typo

This 10-year old typo was introduced at 75b182ae (Update l10n guide:
change the repository URL, etc, 2012-03-02). The word "l10" should be
"l10n".

Signed-off-by: Arthur Milchior <arthur@milchior.fr>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
3 years agorevisions.txt: escape "..." to avoid asciidoc horizontal ellipsis
Jeff King [Wed, 22 Jun 2022 23:33:04 +0000 (19:33 -0400)] 
revisions.txt: escape "..." to avoid asciidoc horizontal ellipsis

In asciidoc's HTML output of the "gitrevisions" and "git-rev-parse"
documentation, the header:

  The ... (three-dot) Symmetric Difference Notation

is rendered using "&8230;", a horizontal ellipsis. This is visually
ugly, but also hard to search for or cut-and-paste. We really mean three
ascii dots (0x2e) here, so let's make sure it renders as such.

The simplest way to do that is just escaping the leading dot, as the
instances in the rest of the section do. Arguably this should all be
converted to use backticks, which would let us drop the quoting here and
elsewhere (e.g., {carat}). But that does change the rendering slightly.
So let's fix the bug first, and we can decide on migrating the whole
section separately.

Note that this produces an empty doc-diff of the manpages. Curiously,
asciidoc produces the same ellipsis entity in the XML file, but docbook
then converts it back into three literal dots for the roff output! So
the roff manpages have been correct all along (which may be a reason
nobody noticed this until now).

Reported-by: Arthur Milchior
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogrep: add --max-count command line option
Carlos López [Wed, 22 Jun 2022 19:47:32 +0000 (19:47 +0000)] 
grep: add --max-count command line option

This patch adds a command line option analogous to that of GNU
grep(1)'s -m / --max-count, which users might already be used to.
This makes it possible to limit the amount of matches shown in the
output while keeping the functionality of other options such as -C
(show code context) or -p (show containing function), which would be
difficult to do with a shell pipeline (e.g. head(1)).

Signed-off-by: Carlos López 00xc@protonmail.com
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: TEAMS: Change German translation team leader
Matthias Rüster [Tue, 21 Jun 2022 18:24:14 +0000 (20:24 +0200)] 
l10n: TEAMS: Change German translation team leader

Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
3 years agol10n: de.po: Update German translation
Matthias Rüster [Sun, 19 Jun 2022 18:55:59 +0000 (20:55 +0200)] 
l10n: de.po: Update German translation

Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
3 years agoGit 2.37-rc2 v2.37.0-rc2
Junio C Hamano [Wed, 22 Jun 2022 16:07:56 +0000 (09:07 -0700)] 
Git 2.37-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'tb/cruft-packs'
Junio C Hamano [Wed, 22 Jun 2022 16:06:37 +0000 (09:06 -0700)] 
Merge branch 'tb/cruft-packs'

Docfix.

* tb/cruft-packs:
  gc: simplify --cruft description

3 years agol10n: bg.po: Updated Bulgarian translation (5367t)
Alexander Shopov [Sun, 12 Jun 2022 08:56:04 +0000 (10:56 +0200)] 
l10n: bg.po: Updated Bulgarian translation (5367t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
3 years agol10n: zh_CN: v2.37.0 round 1
Fangyi Zhou [Wed, 22 Jun 2022 09:28:36 +0000 (10:28 +0100)] 
l10n: zh_CN: v2.37.0 round 1

Reviewed-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Fangyi Zhou <me@fangyi.io>
3 years agoMerge branch 'master' of github.com:git/git
Jiang Xin [Wed, 22 Jun 2022 07:46:22 +0000 (15:46 +0800)] 
Merge branch 'master' of github.com:git/git

* 'master' of github.com:git/git:
  name-rev: prefix annotate-stdin with '--' in message
  git-prompt: fix expansion of branch colour codes
  git-prompt: make colourization consistent

3 years agot5510: replace 'origin' with URL more carefully
Derrick Stolee [Mon, 20 Jun 2022 19:52:09 +0000 (15:52 -0400)] 
t5510: replace 'origin' with URL more carefully

The many test_configured_prune tests in t5510-fetch.sh test many
combinations of --prune, --prune-tags, and using 'origin' or an explicit
URL. Some machinery was introduced in e1790f9245f (fetch tests: fetch
<url> <spec> as well as fetch [<remote>], 2018-02-09) to replace
'origin' with this explicit URL. This URL is a "file:///" URL for the
root of the $TRASH_DIRECTORY.

However, if the current build tree has an '@' symbol, the
replacement using perl fails. It drops the '@' as well as anything
else in that directory name.  You can observe this locally by
cloning git.git into a "victim@03" directory and running the test
script.

As we are writing in Perl anyway, pass in the shell variables involved
to the script as arguments and perform necessary string transformations
inside it, instead of assuming that it is sufficient to enclose the
$remote_url variable inside a pair of single quotes.

Reported-by: Randall Becker <rsbecker@nexbridge.com>
Original-patch-by: Derrick Stolee <derrickstolee@github.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomktree: do not check type of remote objects
Richard Oliver [Tue, 21 Jun 2022 13:59:39 +0000 (14:59 +0100)] 
mktree: do not check type of remote objects

With 31c8221a (mktree: validate entry type in input, 2009-05-14), we
called the sha1_object_info() API to obtain the type information, but
allowed the call to silently fail when the object was missing locally,
so that we can sanity-check the types opportunistically when the
object did exist.

The implementation is understandable because back then there was no
lazy/on-demand downloading of individual objects from the promisor
remotes that causes a long delay and materializes the object, hence
defeating the point of using "--missing".  The design is hurting us
now.

We could bypass the opportunistic type/mode consistency check
altogether when "--missing" is given, but instead, use the
oid_object_info_extended() API and tell it that we are only interested
in objects that locally exist and are immediately available by passing
OBJECT_INFO_SKIP_FETCH_OBJECT bit to it.  That way, we will still
retain the cheap and opportunistic sanity check for local objects.

Signed-off-by: Richard Oliver <roliver@roku.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jp/prompt-clear-before-upstream-mark'
Junio C Hamano [Tue, 21 Jun 2022 17:07:50 +0000 (10:07 -0700)] 
Merge branch 'jp/prompt-clear-before-upstream-mark'

Bash command line prompt (in contrib/) update.

* jp/prompt-clear-before-upstream-mark:
  git-prompt: fix expansion of branch colour codes
  git-prompt: make colourization consistent

3 years agoi18n: mark message helpers prefix for translation
Dimitriy Ryazantcev [Tue, 21 Jun 2022 13:57:57 +0000 (13:57 +0000)] 
i18n: mark message helpers prefix for translation

Some messages prefixes like 'usage:'/'fatal:'/'warning:'/'error:'
were not translated.

Signed-off-by: Dimiytriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocombine-diff: abort if --output is given
René Scharfe [Sat, 18 Jun 2022 11:12:34 +0000 (13:12 +0200)] 
combine-diff: abort if --output is given

The code for combined diffs currently only writes to stdout.  Abort and
report that fact instead of silently ignoring the --output option.  The
(empty) output file has already been created at that point, though.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocombine-diff: abort if --ignore-matching-lines is given
René Scharfe [Sat, 18 Jun 2022 11:12:28 +0000 (13:12 +0200)] 
combine-diff: abort if --ignore-matching-lines is given

The code for combined diffs doesn't currently support ignoring changes
that match a regex.  Abort and report that fact instead of running into
a segfault.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogc: simplify --cruft description
René Scharfe [Sun, 19 Jun 2022 05:38:50 +0000 (07:38 +0200)] 
gc: simplify --cruft description

Remove duplicate "loose objects".

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobranch: drop unused worktrees variable
Jeff King [Sun, 19 Jun 2022 03:55:16 +0000 (23:55 -0400)] 
branch: drop unused worktrees variable

After b489b9d9aa (branch: use branch_checked_out() when deleting refs,
2022-06-14), we no longer look at our local "worktrees" variable, since
branch_checked_out() handles it under the hood. The compiler didn't
notice the unused variable because we call functions to initialize and
free it (so it's not totally unused, it just doesn't do anything
useful).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofetch: stop passing around unused worktrees variable
Jeff King [Sun, 19 Jun 2022 03:53:19 +0000 (23:53 -0400)] 
fetch: stop passing around unused worktrees variable

In 12d47e3b1f (fetch: use new branch_checked_out() and add tests,
2022-06-14), fetch's update_local_ref() function stopped using its
"worktrees" parameter. It doesn't need it, since the
branch_checked_out() function examines the global worktrees under the
hood.

So we can not only drop the unused parameter from that function, but
also from its entire call chain. And as we do so all the way up to
do_fetch(), we can see that nobody uses it at all, and we can drop the
local variable there entirely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>