]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agoxdiff: handle allocation failure in patience diff
Phillip Wood [Wed, 16 Feb 2022 10:15:07 +0000 (10:15 +0000)] 
xdiff: handle allocation failure in patience diff

Other users of libxdiff such as libgit2 need to be able to handle
allocation failures. As NULL is a valid return value the function
signature is changed to be able report allocation failures.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoxdiff: fix a memory leak
Phillip Wood [Wed, 16 Feb 2022 10:15:06 +0000 (10:15 +0000)] 
xdiff: fix a memory leak

Although the patience and histogram algorithms initialize the
environment they do not free it if there is an error. In contrast for
the Myers algorithm the environment is initalized in xdl_do_diff() and
it is freed if there is an error. Fix this by always initializing the
environment in xdl_do_diff() and freeing it there if there is an
error. Remove the comment in do_patience_diff() about the environment
being freed by xdl_diff() as it is not accurate because (a) xdl_diff()
does not do that if there is an error and (b) xdl_diff() is not the
only caller.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe second batch for 2.36
Junio C Hamano [Wed, 9 Feb 2022 22:21:18 +0000 (14:21 -0800)] 
The second batch for 2.36

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jc/mem-pool-alignment'
Junio C Hamano [Wed, 9 Feb 2022 22:21:01 +0000 (14:21 -0800)] 
Merge branch 'jc/mem-pool-alignment'

Update the logic to compute alignment requirement for our mem-pool.

* jc/mem-pool-alignment:
  mem-pool: don't assume uintmax_t is aligned enough for all types

2 years agoMerge branch 'js/sparse-vs-split-index'
Junio C Hamano [Wed, 9 Feb 2022 22:21:01 +0000 (14:21 -0800)] 
Merge branch 'js/sparse-vs-split-index'

Mark in various places in the code that the sparse index and the
split index features are mutually incompatible.

* js/sparse-vs-split-index:
  split-index: it really is incompatible with the sparse index
  t1091: disable split index
  sparse-index: sparse index is disallowed when split index is active

2 years agoMerge branch 'jt/clone-not-quite-empty'
Junio C Hamano [Wed, 9 Feb 2022 22:21:01 +0000 (14:21 -0800)] 
Merge branch 'jt/clone-not-quite-empty'

Cloning from a repository that does not yet have any branches or
tags but has other refs resulted in a "remote transport reported
error", which has been corrected.

* jt/clone-not-quite-empty:
  clone: support unusual remote ref configurations

2 years agoMerge branch 'jt/sparse-checkout-leading-dir-fix'
Junio C Hamano [Wed, 9 Feb 2022 22:21:00 +0000 (14:21 -0800)] 
Merge branch 'jt/sparse-checkout-leading-dir-fix'

"git sparse-checkout init" failed to write into $GIT_DIR/info
directory when the repository was created without one, which has
been corrected to auto-create it.

* jt/sparse-checkout-leading-dir-fix:
  sparse-checkout: create leading directory

2 years agoMerge branch 'en/plug-leaks-in-merge'
Junio C Hamano [Wed, 9 Feb 2022 22:21:00 +0000 (14:21 -0800)] 
Merge branch 'en/plug-leaks-in-merge'

Leakfix.

* en/plug-leaks-in-merge:
  merge: fix memory leaks in cmd_merge()
  merge-ort: fix memory leak in merge_ort_internal()

2 years agoMerge branch 'ab/config-based-hooks-2'
Junio C Hamano [Wed, 9 Feb 2022 22:21:00 +0000 (14:21 -0800)] 
Merge branch 'ab/config-based-hooks-2'

More "config-based hooks".

* ab/config-based-hooks-2:
  run-command: remove old run_hook_{le,ve}() hook API
  receive-pack: convert push-to-checkout hook to hook.h
  read-cache: convert post-index-change to use hook.h
  commit: convert {pre-commit,prepare-commit-msg} hook to hook.h
  git-p4: use 'git hook' to run hooks
  send-email: use 'git hook run' for 'sendemail-validate'
  git hook run: add an --ignore-missing flag
  hooks: convert worktree 'post-checkout' hook to hook library
  hooks: convert non-worktree 'post-checkout' hook to hook library
  merge: convert post-merge to use hook.h
  am: convert applypatch-msg to use hook.h
  rebase: convert pre-rebase to use hook.h
  hook API: add a run_hooks_l() wrapper
  am: convert {pre,post}-applypatch to use hook.h
  gc: use hook library for pre-auto-gc hook
  hook API: add a run_hooks() wrapper
  hook: add 'run' subcommand

2 years agoMerge branch 'fs/ssh-signing-crlf'
Junio C Hamano [Wed, 9 Feb 2022 22:21:00 +0000 (14:21 -0800)] 
Merge branch 'fs/ssh-signing-crlf'

The code path that verifies signatures made with ssh were made to
work better on a system with CRLF line endings.

* fs/ssh-signing-crlf:
  gpg-interface: trim CR from ssh-keygen

2 years agoMerge branch 'jc/name-rev-stdin'
Junio C Hamano [Wed, 9 Feb 2022 22:21:00 +0000 (14:21 -0800)] 
Merge branch 'jc/name-rev-stdin'

"git name-rev --stdin" does not behave like usual "--stdin" at
all.  Start the process of renaming it to "--annotate-stdin".

* jc/name-rev-stdin:
  name-rev.c: use strbuf_getline instead of limited size buffer
  name-rev: deprecate --stdin in favor of --annotate-stdin

2 years agoMerge branch 'gc/fetch-negotiate-only-early-return'
Junio C Hamano [Wed, 9 Feb 2022 22:20:59 +0000 (14:20 -0800)] 
Merge branch 'gc/fetch-negotiate-only-early-return'

"git fetch --negotiate-only" is an internal command used by "git
push" to figure out which part of our history is missing from the
other side.  It should never recurse into submodules even when
fetch.recursesubmodules configuration variable is set, nor it
should trigger "gc".  The code has been tightened up to ensure it
only does common ancestry discovery and nothing else.

* gc/fetch-negotiate-only-early-return:
  fetch: help translators by reusing the same message template
  fetch --negotiate-only: do not update submodules
  fetch: skip tasks related to fetching objects
  fetch: use goto cleanup in cmd_fetch()

2 years agoMerge branch 'pw/add-p-hunk-split-fix'
Junio C Hamano [Wed, 9 Feb 2022 22:20:59 +0000 (14:20 -0800)] 
Merge branch 'pw/add-p-hunk-split-fix'

"git add -p" rewritten in C regressed hunk splitting in some cases,
which has been corrected.

* pw/add-p-hunk-split-fix:
  builtin add -p: fix hunk splitting
  t3701: clean up hunk splitting tests

2 years agoMerge branch 'tl/doc-cli-options-first'
Junio C Hamano [Wed, 9 Feb 2022 22:20:59 +0000 (14:20 -0800)] 
Merge branch 'tl/doc-cli-options-first'

We explain that revs come first before the pathspec among command
line arguments, but did not spell out that dashed options come
before other args, which has been corrected.

* tl/doc-cli-options-first:
  git-cli.txt: clarify "options first and then args"

2 years agoMerge branch 'po/readme-mention-contributor-hints'
Junio C Hamano [Wed, 9 Feb 2022 22:20:59 +0000 (14:20 -0800)] 
Merge branch 'po/readme-mention-contributor-hints'

Doc update.

* po/readme-mention-contributor-hints:
  README.md: add CodingGuidelines and a link for Translators

2 years agoMerge branch 'jt/conditional-config-on-remote-url'
Junio C Hamano [Wed, 9 Feb 2022 22:20:58 +0000 (14:20 -0800)] 
Merge branch 'jt/conditional-config-on-remote-url'

The conditional inclusion mechanism of configuration files using
"[includeIf <condition>]" learns to base its decision on the
URL of the remote repository the repository interacts with.

* jt/conditional-config-on-remote-url:
  config: include file if remote URL matches a glob
  config: make git_config_include() static

2 years agoMerge branch 'en/merge-ort-restart-optim-fix'
Junio C Hamano [Wed, 9 Feb 2022 22:20:58 +0000 (14:20 -0800)] 
Merge branch 'en/merge-ort-restart-optim-fix'

The merge-ort misbehaved when merge.renameLimit configuration is
set too low and failed to find all renames.

* en/merge-ort-restart-optim-fix:
  merge-ort: avoid assuming all renames detected

2 years agoMerge branch 'js/test-unset-trace2-parents'
Junio C Hamano [Wed, 9 Feb 2022 22:20:58 +0000 (14:20 -0800)] 
Merge branch 'js/test-unset-trace2-parents'

Avoid tests that are run under GIT_TRACE2 set from failing
unnecessarily.

* js/test-unset-trace2-parents:
  test-lib: unset trace2 parent envvars

2 years agoThe first batch
Junio C Hamano [Sat, 5 Feb 2022 17:43:36 +0000 (09:43 -0800)] 
The first batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ms/update-index-racy'
Junio C Hamano [Sat, 5 Feb 2022 17:42:32 +0000 (09:42 -0800)] 
Merge branch 'ms/update-index-racy'

"git update-index --refresh" has been taught to deal better with
racy timestamps (just like "git status" already does).

* ms/update-index-racy:
  update-index: refresh should rewrite index in case of racy timestamps
  t7508: add tests capturing racy timestamp handling
  t7508: fix bogus mtime verification
  test-lib: introduce API for verifying file mtime

2 years agoMerge branch 'jc/reflog-parse-options'
Junio C Hamano [Sat, 5 Feb 2022 17:42:31 +0000 (09:42 -0800)] 
Merge branch 'jc/reflog-parse-options'

Use the parse-options API in "git reflog" command.

* jc/reflog-parse-options:
  builtin/reflog.c: use parse-options api for expire, delete subcommands

2 years agoMerge branch 'ab/cat-file'
Junio C Hamano [Sat, 5 Feb 2022 17:42:31 +0000 (09:42 -0800)] 
Merge branch 'ab/cat-file'

Assorted updates to "git cat-file", especially "-h".

* ab/cat-file:
  cat-file: s/_/-/ in typo'd usage_msg_optf() message
  cat-file: don't whitespace-pad "(...)" in SYNOPSIS and usage output
  cat-file: use GET_OID_ONLY_TO_DIE in --(textconv|filters)
  object-name.c: don't have GET_OID_ONLY_TO_DIE imply *_QUIETLY
  cat-file: correct and improve usage information
  cat-file: fix remaining usage bugs
  cat-file: make --batch-all-objects a CMDMODE
  cat-file: move "usage" variable to cmd_cat_file()
  cat-file docs: fix SYNOPSIS and "-h" output
  parse-options API: add a usage_msg_optf()
  cat-file tests: test messaging on bad objects/paths
  cat-file tests: test bad usage

2 years agoMerge branch 'jc/qsort-s-alignment-fix'
Junio C Hamano [Sat, 5 Feb 2022 17:42:31 +0000 (09:42 -0800)] 
Merge branch 'jc/qsort-s-alignment-fix'

Fix a hand-rolled alloca() imitation that may have violated
alignment requirement of data being sorted in compatibility
implementation of qsort_s() and stable qsort().

* jc/qsort-s-alignment-fix:
  stable-qsort: avoid using potentially unaligned access
  compat/qsort_s.c: avoid using potentially unaligned access

2 years agoMerge branch 'rs/apply-symlinks-use-strset'
Junio C Hamano [Sat, 5 Feb 2022 17:42:30 +0000 (09:42 -0800)] 
Merge branch 'rs/apply-symlinks-use-strset'

"git apply" (ab)used the util pointer of the string-list to keep
track of how each symbolic link needs to be handled, which has been
simplified by using strset.

* rs/apply-symlinks-use-strset:
  apply: use strsets to track symlinks

2 years agoMerge branch 'rs/grep-expr-cleanup'
Junio C Hamano [Sat, 5 Feb 2022 17:42:30 +0000 (09:42 -0800)] 
Merge branch 'rs/grep-expr-cleanup'

Code clean-up.

* rs/grep-expr-cleanup:
  grep: use grep_and_expr() in compile_pattern_and()
  grep: extract grep_binexp() from grep_or_expr()
  grep: use grep_not_expr() in compile_pattern_not()
  grep: use grep_or_expr() in compile_pattern_or()

2 years agoMerge branch 'jh/p4-spawning-external-commands-cleanup'
Junio C Hamano [Sat, 5 Feb 2022 17:42:29 +0000 (09:42 -0800)] 
Merge branch 'jh/p4-spawning-external-commands-cleanup'

* jh/p4-spawning-external-commands-cleanup:
  git-p4: don't print shell commands as python lists
  git-p4: pass command arguments as lists instead of using shell
  git-p4: don't select shell mode using the type of the command argument

2 years agoMerge branch 'jh/p4-fix-use-of-process-error-exception'
Junio C Hamano [Sat, 5 Feb 2022 17:42:29 +0000 (09:42 -0800)] 
Merge branch 'jh/p4-fix-use-of-process-error-exception'

* jh/p4-fix-use-of-process-error-exception:
  git-p4: fix instantiation of CalledProcessError

2 years agoMerge branch 'jc/find-header'
Junio C Hamano [Sat, 5 Feb 2022 17:42:29 +0000 (09:42 -0800)] 
Merge branch 'jc/find-header'

Code clean-up.

* jc/find-header:
  receive-pack.c: consolidate find header logic

2 years agoMerge branch 'pb/pull-rebase-autostash-fix'
Junio C Hamano [Sat, 5 Feb 2022 17:42:28 +0000 (09:42 -0800)] 
Merge branch 'pb/pull-rebase-autostash-fix'

"git pull --rebase" ignored the rebase.autostash configuration
variable when the remote history is a descendant of our history,
which has been corrected.

* pb/pull-rebase-autostash-fix:
  pull --rebase: honor rebase.autostash when fast-forwarding

2 years agoSync with Git 2.35.1
Junio C Hamano [Sat, 29 Jan 2022 00:58:04 +0000 (16:58 -0800)] 
Sync with Git 2.35.1

2 years agoName the next one 2.36 to prepare for 2.35.1
Junio C Hamano [Sat, 29 Jan 2022 00:57:10 +0000 (16:57 -0800)] 
Name the next one 2.36 to prepare for 2.35.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.35.1 v2.35.1
Junio C Hamano [Sat, 29 Jan 2022 00:48:42 +0000 (16:48 -0800)] 
Git 2.35.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'en/keep-cwd' into maint
Junio C Hamano [Sat, 29 Jan 2022 00:45:39 +0000 (16:45 -0800)] 
Merge branch 'en/keep-cwd' into maint

Fix a regression in 2.35 that roke the use of "rebase" and "stash"
in a secondary worktree.

* en/keep-cwd:
  sequencer, stash: fix running from worktree subdir

2 years agoMerge branch 'en/keep-cwd'
Junio C Hamano [Thu, 27 Jan 2022 06:22:24 +0000 (22:22 -0800)] 
Merge branch 'en/keep-cwd'

Fix a regression in 2.35 that roke the use of "rebase" and "stash"
in a secondary worktree.

* en/keep-cwd:
  sequencer, stash: fix running from worktree subdir

2 years agoStart post 2.35 cycle
Junio C Hamano [Thu, 27 Jan 2022 06:21:01 +0000 (22:21 -0800)] 
Start post 2.35 cycle

The tree is not open for new development yet, but let's mark the
beginning of the new cycle before we start merging down regression
fix topics.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosequencer, stash: fix running from worktree subdir
Elijah Newren [Wed, 26 Jan 2022 01:43:45 +0000 (01:43 +0000)] 
sequencer, stash: fix running from worktree subdir

In commits bc3ae46b42 ("rebase: do not attempt to remove
startup_info->original_cwd", 2021-12-09) and 0fce211ccc ("stash: do not
attempt to remove startup_info->original_cwd", 2021-12-09), we wanted to
allow the subprocess to know which directory the parent process was
running from, so that the subprocess could protect it.  However...

When run from a non-main worktree, setup_git_directory() will note
that the discovered git directory
(/PATH/TO/.git/worktree/non-main-worktree) does not match
DEFAULT_GIT_DIR_ENVIRONMENT (see setup_discovered_git_dir()), and
decide to set GIT_DIR in the environment.  This matters because...

Whenever git is run with the GIT_DIR environment variable set, and
GIT_WORK_TREE not set, it presumes that '.' is the working tree.  So...

This combination results in the subcommand being very confused about
the working tree.  Fix it by also setting the GIT_WORK_TREE environment
variable along with setting cmd.dir.

A possibly more involved fix we could consider for later would be to
make setup.c set GIT_WORK_TREE whenever (a) it discovers both the git
directory and the working tree and (b) it decides to set GIT_DIR in the
environment.  I did not attempt that here as such would be too big of a
change for a 2.35.1 release.

Test-case-by: Glen Choo <chooglen@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoclone: support unusual remote ref configurations
Jonathan Tan [Mon, 24 Jan 2022 18:09:09 +0000 (10:09 -0800)] 
clone: support unusual remote ref configurations

When cloning a branchless and tagless but not refless remote using
protocol v0 or v1, Git calls transport_fetch_refs() with an empty ref
list. This makes the clone fail with the message "remote transport
reported error".

Git should have refrained from calling transport_fetch_refs(), just like
it does in the case that the remote is refless. Therefore, teach Git to
do this.

In protocol v2, this does not happen because the client passes
ref-prefix arguments that filter out non-branches and non-tags in the
ref advertisement, making the remote appear empty.

Note that this bug concerns logic in builtin/clone.c and only affects
cloning, not fetching.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomem-pool: don't assume uintmax_t is aligned enough for all types
Jessica Clarke [Sun, 23 Jan 2022 20:33:47 +0000 (20:33 +0000)] 
mem-pool: don't assume uintmax_t is aligned enough for all types

mem_pool_alloc uses sizeof(uintmax_t) as a proxy for what should be
_Alignof(max_align_t) in C11. On most architectures this is sufficient
(though on m68k it is in fact overly strict, since the de-facto ABI,
which differs from the specified System V ABI, has the maximum alignment
of all types as 2 bytes), but on CHERI, and thus Arm's Morello
prototype, it is insufficient for any type that stores a pointer, which
must be aligned to 128 bits (on 64-bit architectures extended with
CHERI), whilst uintmax_t is a 64-bit integer.

Fix this by introducing our own approximation for max_align_t and a
means to compute _Alignof it without relying on C11. Currently this
union only contains uintmax_t and void *, but more types can be added as
needed.

Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.35 v2.35.0
Junio C Hamano [Mon, 24 Jan 2022 17:25:25 +0000 (09:25 -0800)] 
Git 2.35

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ab/checkout-branch-info-leakfix'
Junio C Hamano [Mon, 24 Jan 2022 17:14:46 +0000 (09:14 -0800)] 
Merge branch 'ab/checkout-branch-info-leakfix'

We added an unrelated sanity checking that leads to a BUG() while
plugging a leak, which triggered in a repository with symrefs in
the local branch namespace that point at a ref outside.  Partially
revert the change to avoid triggering the BUG().

* ab/checkout-branch-info-leakfix:
  checkout: avoid BUG() when hitting a broken repository

2 years agoMerge tag 'l10n-2.35.0-rnd2' of git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 24 Jan 2022 17:09:34 +0000 (09:09 -0800)] 
Merge tag 'l10n-2.35.0-rnd2' of git://github.com/git-l10n/git-po

l10n-2.35.0-rnd2

* tag 'l10n-2.35.0-rnd2' of git://github.com/git-l10n/git-po:
  l10n: Update Catalan translation
  l10n: zh_TW: v2.35.0 round 2 (0 untranslated)
  l10n: Update Catalan translation
  l10n: de.po: Update German translation
  l10n: de.po: Fix translation for "'%s' is aliased to '%s'"
  l10n: po-id for 2.35 (round 2)
  l10n: Update Catalan translation
  l10n: vi(5195t): Update for v2.35.0 round 2
  l10n: batch update to fix typo in branch.c
  l10n: git.pot: v2.35.0 round 2 (1 new, 1 removed)
  l10n: bg.po: Updated Bulgarian translation (5195t)
  l10n: zh_CN: v2.35.0 round 1
  l10n: fr: v2.35.0 round 1
  l10n: zh_TW: v2.35.0 round 1 (1 fuzzy)
  l10n: po-id for 2.35 (round 1)
  l10n: sv.po: Update Swedish translation (5196t0f0u)
  l10n: sv.po: Fix typo
  l10n: tr: v2.35.0 round 1
  l10n: git.pot: v2.35.0 round 1 (126 new, 142 removed)

2 years agosplit-index: it really is incompatible with the sparse index
Johannes Schindelin [Wed, 19 Jan 2022 17:29:39 +0000 (17:29 +0000)] 
split-index: it really is incompatible with the sparse index

... at least for now. So let's error out if we are even trying to
initialize the split index when the index is sparse, or when trying to
write the split index extension for a sparse index.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot1091: disable split index
Johannes Schindelin [Wed, 19 Jan 2022 17:29:38 +0000 (17:29 +0000)] 
t1091: disable split index

In 61feddcdf28 (tests: disable GIT_TEST_SPLIT_INDEX for sparse index
tests, 2021-08-26), it was already called out that the split index
feature is incompatible with the sparse index feature, and its commit
message wondered aloud whether more checks would be required to ensure
that the split index and sparse index features aren't enabled at the
same time.

We are about to introduce such additional checks, and indeed, t1091
would utterly fail with them. Therefore, let's preemptively disable the
split index for the entirety of t1091.

This partially reverts above-mentioned patch because it covered only one
test case whereas we want to cover the entire test script.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosparse-index: sparse index is disallowed when split index is active
Johannes Schindelin [Wed, 19 Jan 2022 17:29:37 +0000 (17:29 +0000)] 
sparse-index: sparse index is disallowed when split index is active

In 6e773527b6b (sparse-index: convert from full to sparse, 2021-03-30),
we introduced initial support for a sparse index, and were careful to
avoid converting to a sparse index in the presence of a split index.

However, when we _just_ read a freshly-initialized index, it might not
contain a split index even if _writing_ it will add one by virtue of
being asked for via the `GIT_TEST_SPLIT_INDEX` variable.

We did not notice any problems with checking _only_ for `split_index`
(and not `GIT_TEST_SPLIT_INDEX`) right until both
`vd/sparse-sparsity-fix-on-read` _and_ `vd/sparse-reset` were merged.

Those two topics' interplay triggers a bug in conjunction with running
t1091.15 when `GIT_TEST_SPLIT_INDEX=true` in the following way:
`vd/sparse-sparsity-fix-on-read` ensures that the index is made sparse
right after reading, and `vd/sparse-reset` ensures that the index is
made non-sparse again unless running in the `--soft` mode. Since the
split index feature is incompatible with the sparse index feature, we
see a symptom like this:

fatal: position for replacement 4 exceeds base index size 4

Let's fix this by avoiding the conversion to a sparse index when
`GIT_TEST_SPLIT_INDEX=true`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: Update Catalan translation
Jordi Mas [Sun, 23 Jan 2022 08:40:52 +0000 (09:40 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
2 years agoMerge branch 'l10n/zh_TW/220113' of github.com:l10n-tw/git-po
Jiang Xin [Sat, 22 Jan 2022 08:27:41 +0000 (16:27 +0800)] 
Merge branch 'l10n/zh_TW/220113' of github.com:l10n-tw/git-po

* 'l10n/zh_TW/220113' of github.com:l10n-tw/git-po:
  l10n: zh_TW: v2.35.0 round 2 (0 untranslated)
  l10n: zh_TW: v2.35.0 round 1 (1 fuzzy)

2 years agocheckout: avoid BUG() when hitting a broken repository
Junio C Hamano [Sat, 22 Jan 2022 00:58:30 +0000 (16:58 -0800)] 
checkout: avoid BUG() when hitting a broken repository

When 9081a421 (checkout: fix "branch info" memory leaks, 2021-11-16)
cleaned up existing memory leaks, we added an unrelated sanity check
to ensure that a local branch is truly local and not a symref to
elsewhere that dies with BUG() otherwise.  This was misguided in two
ways.  First of all, such a tightening did not belong to a leak-fix
patch.  And the condition it detected was *not* a bug in our program
but a problem in user data, where warning() or die() would have been
more appropriate.

As the condition is not fatal (the result of computing the local
branch name in the code that is involved in the faulty check is only
used as a textual label for the commit), let's revert the code to
the original state, i.e. strip "refs/heads/" to compute the local
branch name if possible, and otherwise leave it NULL.  The consumer
of the information in merge_working_tree() is prepared to see NULL
in there and act accordingly.

cf. https://bugzilla.redhat.com/show_bug.cgi?id=2042920

Reported-by: Petr Šplíchal <psplicha@redhat.com>
Reported-by: Todd Zullinger <tmz@pobox.com>
Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomerge: fix memory leaks in cmd_merge()
Elijah Newren [Thu, 20 Jan 2022 07:47:15 +0000 (07:47 +0000)] 
merge: fix memory leaks in cmd_merge()

There were two commit_lists created in cmd_merge() that were only
conditionally free()'d.  Add a quick conditional call to
free_commit_list() for each of them at the end of the function.

Testing this commit against t6404 under valgrind shows that this patch
fixes the following two leaks:

    16 bytes in 1 blocks are definitely lost in loss record 16 of 126
       at 0x484086F: malloc (vg_replace_malloc.c:380)
       by 0x69FFEB: do_xmalloc (wrapper.c:41)
       by 0x6A0073: xmalloc (wrapper.c:62)
       by 0x52A72D: commit_list_insert (commit.c:556)
       by 0x47FC93: reduce_parents (merge.c:1114)
       by 0x4801EE: collect_parents (merge.c:1214)
       by 0x480B56: cmd_merge (merge.c:1465)
       by 0x40686E: run_builtin (git.c:464)
       by 0x406C51: handle_builtin (git.c:716)
       by 0x406E96: run_argv (git.c:783)
       by 0x40730A: cmd_main (git.c:914)
       by 0x4E7DFA: main (common-main.c:56)

    8 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in \
    loss record 61 of 126
       at 0x484086F: malloc (vg_replace_malloc.c:380)
       by 0x69FFEB: do_xmalloc (wrapper.c:41)
       by 0x6A0073: xmalloc (wrapper.c:62)
       by 0x52A72D: commit_list_insert (commit.c:556)
       by 0x52A8F2: commit_list_insert_by_date (commit.c:620)
       by 0x5270AC: get_merge_bases_many_0 (commit-reach.c:413)
       by 0x52716C: repo_get_merge_bases (commit-reach.c:438)
       by 0x480E5A: cmd_merge (merge.c:1520)
       by 0x40686E: run_builtin (git.c:464)
       by 0x406C51: handle_builtin (git.c:716)
       by 0x406E96: run_argv (git.c:783)
       by 0x40730A: cmd_main (git.c:914)

There are still 3 leaks in chdir_notify_register() after this, but
chdir_notify_register() has been brought up on the list before and folks
were not a fan of fixing those, so I'm not touching them.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomerge-ort: fix memory leak in merge_ort_internal()
Elijah Newren [Thu, 20 Jan 2022 07:47:14 +0000 (07:47 +0000)] 
merge-ort: fix memory leak in merge_ort_internal()

The documentation for merge_incore_recursive(), modelled after
merge_recursive(), notes that

   merge_bases will be consumed (emptied) so make a copy if you need it

However, in merge_ort_internal() (which merge_incore_recursive() calls),
it runs

   merged_merge_bases = pop_commit(&merge_bases);
   ...
   for (iter = merge_bases; iter; iter = iter->next) {
      ...
   }

In other words, it only consumes the *first* entry of merge_bases, and
the rest it iterates through.  If it iterated through all of them, the
caller could be responsible for free'ing the memory.  If it consumed all
of them, the current documentation would be correct and the callers
would need to do nothing.  The current middle ground makes it impossible
for callers to avoid memory leaks, since any attempt to use the
merge_bases it passes in would result in a use-after-free.

It turns out this part of the code was copied from merge-recursive.c,
which has had the same bug for 15.5 years.  However, since we are trying
to keep merge-recursive.c stable as we sunset it, let's just fix the
leak in in merge_ort_internal() by having it actually consume all the
elements of the merge_bases commit_list.

Testing this commit against t6404 (the first testcase specifically
about recursive merges) under valgrind shows that this patch fixes
the following leak:

    32 (16 direct, 16 indirect) bytes in 1 blocks are definitely lost \
    in loss record 49 of 126
       at 0x484086F: malloc (vg_replace_malloc.c:380)
       by 0x69FFEB: do_xmalloc (wrapper.c:41)
       by 0x6A0073: xmalloc (wrapper.c:62)
       by 0x52A72D: commit_list_insert (commit.c:556)
       by 0x47EC86: try_merge_strategy (merge.c:751)
       by 0x48143B: cmd_merge (merge.c:1679)
       by 0x40686E: run_builtin (git.c:464)
       by 0x406C51: handle_builtin (git.c:716)
       by 0x406E96: run_argv (git.c:783)
       by 0x40730A: cmd_main (git.c:914)
       by 0x4E7DFA: main (common-main.c:56)

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: zh_TW: v2.35.0 round 2 (0 untranslated)
Yi-Jyun Pan [Fri, 21 Jan 2022 23:06:36 +0000 (07:06 +0800)] 
l10n: zh_TW: v2.35.0 round 2 (0 untranslated)

Used 1 translation from zh_CN. Thanks to zh_CN translation team!

Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
2 years agosparse-checkout: create leading directory
Jonathan Tan [Fri, 21 Jan 2022 17:44:41 +0000 (09:44 -0800)] 
sparse-checkout: create leading directory

When creating the sparse-checkout file, Git does not create the leading
directory, "$GIT_DIR/info", if it does not exist. This causes problems
if the repository does not have that directory. Therefore, ensure that
the leading directory is created.

This is the only "open" in builtin/sparse-checkout.c that does not have
a leading directory check. (The other one in write_patterns_and_update()
does.)

Note that the test needs to explicitly specify a template when running
"git init" because the default template used in the tests has the
"info/" directory included.

Helped-by: Jose Lopes <jabolopes@google.com>
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: Update Catalan translation
Jordi Mas [Fri, 21 Jan 2022 06:56:02 +0000 (07:56 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
2 years agoMerge branch 'js/branch-track-inherit'
Junio C Hamano [Thu, 20 Jan 2022 23:25:38 +0000 (15:25 -0800)] 
Merge branch 'js/branch-track-inherit'

"git branch -h" incorrectly said "--track[=direct|inherit]",
implying that "--trackinherit" is a valid option, which has been
corrected.
source: <3de40324bea6a1dd9bca2654721471e3809e87d8.1642538935.git.steadmon@google.com>
source: <c3c26192-aee9-185a-e559-b8735139e49c@web.de>

* js/branch-track-inherit:
  branch,checkout: fix --track documentation

2 years agofetch: help translators by reusing the same message template
Junio C Hamano [Thu, 20 Jan 2022 21:58:43 +0000 (13:58 -0800)] 
fetch: help translators by reusing the same message template

Follow the example set by 12909b6b (i18n: turn "options are
incompatible" into "cannot be used together", 2022-01-05) and use
the same message string to reduce the need for translation.

Reported-by: Jiang Xin <worldhello.net@gmail.com>
Helped-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobranch,checkout: fix --track documentation
René Scharfe [Thu, 20 Jan 2022 12:35:54 +0000 (13:35 +0100)] 
branch,checkout: fix --track documentation

Document that the accepted variants of the --track option are --track,
--track=direct, and --track=inherit.  The equal sign in the latter two
cannot be replaced with whitespace; in general optional arguments need
to be attached firmly to their option.

Put "direct" consistently before "inherit", if only for the reasons
that the former is the default, explained first in the documentation,
and comes before the latter alphabetically.

Mention both modes in the short help so that readers don't have to look
them up in the full documentation.  They are literal strings and thus
untranslatable.  PARSE_OPT_LITERAL_ARGHELP is inferred due to the pipe
and parenthesis characters, so we don't have to provide that flag
explicitly.

Mention that -t has the same effect as --track and --track=direct.
There is no way to specify inherit mode using the short option, because
short options generally don't accept optional arguments.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-lib: unset trace2 parent envvars
Josh Steadmon [Fri, 14 Jan 2022 03:33:36 +0000 (19:33 -0800)] 
test-lib: unset trace2 parent envvars

The trace2 subsystem can inherit certain information from parent
processes via environment variables; e.g., the parent command name and
session ID. This allows trace2 to note when a command is the child
process of another Git process, and to adjust various pieces of output
accordingly.

This behavior breaks certain tests that examine trace2 output when the
tests run as a child of another git process, such as in `git rebase -x
"make test"`.

While we could fix this by unsetting the relevant variables in the
affected tests (currently t0210, t0211, t0212, and t6421), this would
leave other tests vulnerable to similar breakage if new test cases are
added which inspect trace2 output. So fix this in general by unsetting
GIT_TRACE2_PARENT_NAME and GIT_TRACE2_PARENT_SID in test-lib.sh.

Reported-by: Emily Shaffer <emilyshaffer@google.com>
Helped-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: de.po: Update German translation
Matthias Rüster [Sat, 15 Jan 2022 15:36:51 +0000 (16:36 +0100)] 
l10n: de.po: Update German translation

Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
2 years agol10n: de.po: Fix translation for "'%s' is aliased to '%s'"
Jürgen Krämer [Thu, 18 Nov 2021 15:25:48 +0000 (16:25 +0100)] 
l10n: de.po: Fix translation for "'%s' is aliased to '%s'"

The German translation for "'%s' is aliased to '%s'" is incorrect. It
switches the order of alias name and alias definition.

A better translation would be "'%s' ist ein Alias für '%s'". (Full stop
removed intentionally, because the original does not use one either.)

Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
2 years agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Thu, 20 Jan 2022 02:40:08 +0000 (10:40 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

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

2 years agoGit 2.35-rc2 v2.35.0-rc2
Junio C Hamano [Wed, 19 Jan 2022 20:48:46 +0000 (12:48 -0800)] 
Git 2.35-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogetcwd(mingw): handle the case when there is no cwd
Johannes Schindelin [Wed, 19 Jan 2022 18:56:01 +0000 (18:56 +0000)] 
getcwd(mingw): handle the case when there is no cwd

A recent upstream topic introduced checks for certain Git commands that
prevent them from deleting the current working directory, introducing
also a regression test that ensures that commands such as `git version`
_can_ run without a current working directory.

While technically not possible on Windows via the regular Win32 API, we
do run the regression tests in an MSYS2 Bash which uses a POSIX
emulation layer (the MSYS2/Cygwin runtime) where a really evil hack
_does_ allow to delete a directory even if it is the current working
directory.

Therefore, Git needs to be prepared for a missing working directory,
even on Windows.

This issue was not noticed in upstream Git because there was no caller
that tried to discover a Git directory with a deleted current working
directory in the test suite. But in the microsoft/git fork, we do want
to run `pre-command`/`post-command` hooks for every command, even for
`git version`, which means that we make precisely such a call. The bug
is not in that `pre-command`/`post-command` feature, though, but in
`mingw_getcwd()` and needs to be addressed there.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: po-id for 2.35 (round 2)
Bagas Sanjaya [Tue, 18 Jan 2022 08:27:07 +0000 (15:27 +0700)] 
l10n: po-id for 2.35 (round 2)

Translate following new components:

  * advice.c
  * alias.c
  * sequencer.c
  * sparse-index.c
  * builtin/sparse-checkout.c

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
2 years agol10n: Update Catalan translation
Jordi Mas [Wed, 19 Jan 2022 06:50:14 +0000 (07:50 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
2 years agofetch --negotiate-only: do not update submodules
Glen Choo [Wed, 19 Jan 2022 00:00:56 +0000 (16:00 -0800)] 
fetch --negotiate-only: do not update submodules

`git fetch --negotiate-only` is an implementation detail of push
negotiation and, unlike most `git fetch` invocations, does not actually
update the main repository. Thus it should not update submodules even
if submodule recursion is enabled.

This is not just slow, it is wrong e.g. push negotiation with
"submodule.recurse=true" will cause submodules to be updated because it
invokes `git fetch --negotiate-only`.

Fix this by disabling submodule recursion if --negotiate-only was given.
Since this makes --negotiate-only and --recurse-submodules incompatible,
check for this invalid combination and die.

This does not use the "goto cleanup" introduced in the previous commit
because we want to recurse through submodules whenever a ref is fetched,
and this can happen without introducing new objects.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofetch: skip tasks related to fetching objects
Glen Choo [Wed, 19 Jan 2022 00:00:55 +0000 (16:00 -0800)] 
fetch: skip tasks related to fetching objects

cmd_fetch() does the following with the assumption that objects are
fetched:

* Run gc
* Write commit graphs (if enabled by fetch.writeCommitGraph=true)

However, neither of these tasks makes sense if objects are not fetched
e.g. `git fetch --negotiate-only` never fetches objects.

Speed up cmd_fetch() by bailing out early if we know for certain that
objects will not be fetched. cmd_fetch() can bail out early whenever
objects are not fetched, but for now this only considers
--negotiate-only.

The same optimization does not apply to `git fetch --dry-run` because
that actually fetches objects; the dry run refers to not updating refs.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofetch: use goto cleanup in cmd_fetch()
Glen Choo [Wed, 19 Jan 2022 00:00:54 +0000 (16:00 -0800)] 
fetch: use goto cleanup in cmd_fetch()

Replace an early return with 'goto cleanup' in cmd_fetch() so that the
string_list is always cleared (the string_list_clear() call is purely
cleanup; the string_list is not reused). This makes cleanup consistent
so that a subsequent commit can use 'goto cleanup' to bail out early.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'js/branch-track-inherit'
Junio C Hamano [Wed, 19 Jan 2022 00:02:23 +0000 (16:02 -0800)] 
Merge branch 'js/branch-track-inherit'

"git branch -h" incorrectly said "--track[=direct|inherit]",
implying that "--trackinherit" is a valid option, which has been
corrected.

* js/branch-track-inherit:
  branch,checkout: fix --track usage strings

2 years agoMerge branch 'jc/freebsd-without-c99-only-build'
Junio C Hamano [Wed, 19 Jan 2022 00:02:23 +0000 (16:02 -0800)] 
Merge branch 'jc/freebsd-without-c99-only-build'

FreeBSD 13.0 headers have unconditional dependency on C11 language
features, and adding -std=gnu99 to DEVELOPER_CFLAGS would just
break the developer build.

* jc/freebsd-without-c99-only-build:
  Makefile: FreeBSD cannot do C99-or-below build

2 years agobranch,checkout: fix --track usage strings
Josh Steadmon [Tue, 18 Jan 2022 20:49:46 +0000 (12:49 -0800)] 
branch,checkout: fix --track usage strings

As Ævar pointed out in [1], the use of PARSE_OPT_LITERAL_ARGHELP with a
list of allowed parameters is not recommended. Both git-branch and
git-checkout were changed in d311566 (branch: add flags and config to
inherit tracking, 2021-12-20) to use this discouraged combination for
their --track flags.

Fix this by removing PARSE_OPT_LITERAL_ARGHELP, and changing the arghelp
to simply be "mode". Users may discover allowed values in the manual
pages.

[1]: https://lore.kernel.org/git/220111.86a6g3yqf9.gmgdl@evledraar.gmail.com/

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoconfig: include file if remote URL matches a glob
Jonathan Tan [Tue, 18 Jan 2022 17:47:40 +0000 (09:47 -0800)] 
config: include file if remote URL matches a glob

This is a feature that supports config file inclusion conditional on
whether the repo has a remote with a URL that matches a glob.

Similar to my previous work on remote-suggested hooks [1], the main
motivation is to allow remote repo administrators to provide recommended
configs in a way that can be consumed more easily (e.g. through a
package installable by a package manager - it could, for example,
contain a file to be included conditionally and a post-install script
that adds the include directive to the system-wide config file).

In order to do this, Git reruns the config parsing mechanism upon
noticing the first URL-conditional include in order to find all remote
URLs, and these remote URLs are then used to determine if that first and
all subsequent includes are executed. Remote URLs are not allowed to be
configued in any URL-conditionally-included file.

[1] https://lore.kernel.org/git/cover.1623881977.git.jonathantanmy@google.com/

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoconfig: make git_config_include() static
Jonathan Tan [Tue, 18 Jan 2022 17:47:39 +0000 (09:47 -0800)] 
config: make git_config_include() static

It is not used from outside the file in which it is declared.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: FreeBSD cannot do C99-or-below build
Junio C Hamano [Tue, 18 Jan 2022 17:47:39 +0000 (09:47 -0800)] 
Makefile: FreeBSD cannot do C99-or-below build

In "make DEVELOPER=YesPlease" builds, we try to help developers to
catch as many potential issues as they can by using -Wall and
turning compilation warnings into errors.  In the same spirit, we
recently started adding -std=gnu99 to their CFLAGS, so that they can
notice when they accidentally used language features beyond C99.

It however turns out that FreeBSD 13.0 mistakenly uses C11 extension
in its system header files regardless of what __STDC_VERSION__ says,
which means that the platform (unless we tweak their system headers)
cannot be used for this purpose.

It seems that -std=gnu99 is only added conditionally even in today's
config.mak.dev, so it is fine if we dropped -std=gnu99 from there.
Which means that developers on FreeBSD cannot participate in vetting
use of features beyond C99, but there are developers on other
platforms who will, so it's not too bad.

We might want a more "fundamental" fix to make the platform capable
of taking -std=gnu99, like working around the use of unconditional
C11 extension in its system header files by supplying a set of
"replacement" definitions in our header files.  We chose not to
pursue such an approach for two reasons at this point:

 (1) The fix belongs to the FreeBSD project, not this project, and
     such an upstream fix may happen hopefully in a not-too-distant
     future.

 (2) Fixing such a bug in system header files and working it around
     can lead to unexpected breakages (other parts of their system
     header files may not be expecting to see and do not work well
     with our "replacement" definitions).  This close to the final
     release of this cycle, we have no time for that.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'da/rhel7-lacks-uncompress2-and-c99'
Junio C Hamano [Mon, 17 Jan 2022 23:15:59 +0000 (15:15 -0800)] 
Merge branch 'da/rhel7-lacks-uncompress2-and-c99'

Adjust build on RHEL 7 to explicitly ask C99 support and use
the fallback implementation of uncompress2 we ship.

* da/rhel7-lacks-uncompress2-and-c99:
  build: centos/RHEL 7 ships with an older gcc and zlib

2 years agomerge-ort: avoid assuming all renames detected
Elijah Newren [Mon, 17 Jan 2022 18:25:55 +0000 (18:25 +0000)] 
merge-ort: avoid assuming all renames detected

In commit 8b09a900a1 ("merge-ort: restart merge with cached renames to
reduce process entry cost", 2021-07-16), we noted that in the merge-ort
steps of
    collect_merge_info()
    detect_and_process_renames()
    process_entries()
that process_entries() was expensive, and we could often make it cheaper
by changing this to
    collect_merge_info()
    detect_and_process_renames()
    <cache all the renames, and restart>
    collect_merge_info()
    detect_and_process_renames()
    process_entries()
because the second collect_merge_info() would be cheaper (we could avoid
traversing into some directories), the second
detect_and_process_renames() would be free since we had already detected
all renames, and then process_entries() has far fewer entries to handle.

However, this was built on the assumption that the first
detect_and_process_renames() actually detected all potential renames.
If someone has merge.renameLimit set to some small value, that
assumption is violated which manifests later with the following message:

    $ git -c merge.renameLimit=1 rebase upstream
    ...
    git: merge-ort.c:546: clear_or_reinit_internal_opts: Assertion
    `renames->cached_pairs_valid_side == 0' failed.

Turn off this cache-renames-and-restart whenever we cannot detect all
renames, and add a testcase that would have caught this problem.

Reported-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Tested-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoREADME.md: add CodingGuidelines and a link for Translators
Philip Oakley [Mon, 17 Jan 2022 18:18:11 +0000 (18:18 +0000)] 
README.md: add CodingGuidelines and a link for Translators

Before being told how to submit patches, new contributors need
to be told how to code for, or how to contribute translation to,
the project.  Add references to the CodingGuidelines and the
README document on localization.

Also, split out the instructions to join the list and clarify
that subscription is via the majordomo address.

We use GitHub Markdown reference [2,3] with trailing empty square
brackets, to match existing text in the file.  On GitHub/GitLab
pages, the footer references matching the empty [] are not shown
on the web page. We could switch to using [text](url) form [1]
if we wanted to, but that is not done as part of this patch.

[1] https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#links
[2] https://gist.github.com/ChrisTollefson/a3af6d902a74a0afd1c2d79aadc9bb3f#reference-links
[3] https://github.github.com/gfm/#example-561 (and the para aboveit)

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-cli.txt: clarify "options first and then args"
Teng Long [Mon, 17 Jan 2022 08:21:01 +0000 (16:21 +0800)] 
git-cli.txt: clarify "options first and then args"

There are some commands permit the user whether to provide options
first before args, or the reverse order. For example:

    git push --dry-run <remote> <ref>

And:

    git push <remote> <ref> --dry-run

Both of them is supported, but some commands do not, for instance:

     git ls-remote --heads <remote>

And:

     git ls-remote <remote> --heads

If <remote> only has one ref and it's name is "refs/heads/--heads", you
will get the same result, otherwise will not.This is because the former
in the second example will parse "--heads" as an "option" which means
to limit to only "refs/heads" when listing the remote references, the
latter treat "--heads" as an argument which means to filter the result
list with the given pattern.

Therefore, we want to specify a bit more in "gitcli.txt" about the way
we recommend and help to resolve the ambiguity around some git command
usage. The related disscussions locate at [1].

By the way, there are some issues with lowercase letters in the document,
which have been modified together.

[1] https://public-inbox.org/git/cover.1642129840.git.dyroneteng@gmail.com/

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: vi(5195t): Update for v2.35.0 round 2
Tran Ngoc Quan [Mon, 17 Jan 2022 07:15:31 +0000 (14:15 +0700)] 
l10n: vi(5195t): Update for v2.35.0 round 2

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2 years agol10n: batch update to fix typo in branch.c
Jiang Xin [Mon, 17 Jan 2022 00:50:41 +0000 (08:50 +0800)] 
l10n: batch update to fix typo in branch.c

In git 2.35 l10n round 1, a space between two words was missing in the
message from "branch.c", and it was fixed by commit 68d924e1de (branch:
missing space fix at line 313, 2022-01-11).

Do a batch update for teams (bg, fr, id, sv, tr and zh_CN) that have
already completed their works on l10n round 1.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 years agol10n: git.pot: v2.35.0 round 2 (1 new, 1 removed)
Jiang Xin [Mon, 17 Jan 2022 00:32:09 +0000 (08:32 +0800)] 
l10n: git.pot: v2.35.0 round 2 (1 new, 1 removed)

Generate po/git.pot from v2.35.0-rc1 for git v2.35.0 l10n round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 years agoMerge tag 'v2.35.0-rc1'
Jiang Xin [Mon, 17 Jan 2022 00:30:45 +0000 (08:30 +0800)] 
Merge tag 'v2.35.0-rc1'

Git 2.35-rc1

* tag 'v2.35.0-rc1':
  Git 2.35-rc1
  reftable tests: avoid "int" overflow, use "uint64_t"
  reftable: avoid initializing structs from structs
  t1450-fsck: exec-bit is not needed to make loose object writable
  refs API: use "failure_errno", not "errno"
  Last minute fixes before -rc1
  build: NonStop ships with an older zlib
  packfile: fix off-by-one error in decoding logic
  t/gpg: simplify test for unknown key
  branch: missing space fix at line 313
  fmt-merge-msg: prevent use-after-free with signed tags
  cache.h: drop duplicate `ensure_full_index()` declaration
  lazyload: use correct calling conventions
  fetch: fix deadlock when cleaning up lockfiles in async signals

2 years agobuild: centos/RHEL 7 ships with an older gcc and zlib
David Aguilar [Sun, 16 Jan 2022 02:05:20 +0000 (18:05 -0800)] 
build: centos/RHEL 7 ships with an older gcc and zlib

GCC 4.8.5 is the default system compiler on centos7/RHEL7.
This version requires -std=c99 to enable c99 support.

zlib 1.2.7 on centos7/rhel7 lacks uncompress2().

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: bg.po: Updated Bulgarian translation (5195t)
Alexander Shopov [Sat, 15 Jan 2022 22:35:45 +0000 (23:35 +0100)] 
l10n: bg.po: Updated Bulgarian translation (5195t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2 years agoGit 2.35-rc1 v2.35.0-rc1
Junio C Hamano [Fri, 14 Jan 2022 23:26:53 +0000 (15:26 -0800)] 
Git 2.35-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'js/t1450-making-it-writable-does-not-need-full-posixperm'
Junio C Hamano [Fri, 14 Jan 2022 23:25:15 +0000 (15:25 -0800)] 
Merge branch 'js/t1450-making-it-writable-does-not-need-full-posixperm'

Test fix.

* js/t1450-making-it-writable-does-not-need-full-posixperm:
  t1450-fsck: exec-bit is not needed to make loose object writable

2 years agoMerge branch 'ab/reftable-build-fixes'
Junio C Hamano [Fri, 14 Jan 2022 23:25:15 +0000 (15:25 -0800)] 
Merge branch 'ab/reftable-build-fixes'

A few portability tweaks.

* ab/reftable-build-fixes:
  reftable tests: avoid "int" overflow, use "uint64_t"
  reftable: avoid initializing structs from structs

2 years agoMerge branch 'ab/refs-errno-cleanup'
Junio C Hamano [Fri, 14 Jan 2022 23:25:14 +0000 (15:25 -0800)] 
Merge branch 'ab/refs-errno-cleanup'

A brown-paper-bag fix on top of a topic that was merged during this
cycle.

* ab/refs-errno-cleanup:
  refs API: use "failure_errno", not "errno"

2 years agopull --rebase: honor rebase.autostash when fast-forwarding
Philippe Blain [Fri, 14 Jan 2022 03:14:51 +0000 (22:14 -0500)] 
pull --rebase: honor rebase.autostash when fast-forwarding

"pull --rebase" internally uses the merge machinery when the other
history is a descendant of ours (i.e. perform fast-forward).  This
came from [1], where the discussion was started from a feature
request to do so.  It is a bit hard to read the rationale behind it
in the discussion, but it seems that it was an established fact for
everybody involved that does not even need to be mentioned that
fast-forwarding done with "rebase" was much undesirable than done
with "merge", and more importantly, the result left by "merge" is as
good as (or better than) that by "rebase".

Except for one thing.  Because "git merge" does not (and should not)
honor rebase.autostash, "git pull" needs to read it and forward it
when we use "git merge" as a (hopefully better) substitute for "git
rebase" during the fast-forwarding.  But we forgot to do so (we only
add "--[no-]autostash" to the "git merge" command when "git pull" itself
was invoked with "--[no-]autostash" command line option.

Make sure "git merge" is run with "--autostash" when
rebase.autostash is set and used to fast-forward the history on
behalf of "git rebase".  Incidentally this change also takes care of
the case where

 - "git pull --rebase" (without other command line options) is run
 - "rebase.autostash" is not set
 - The history fast-forwards

In such a case, "git merge" is run with an explicit "--no-autostash"
to prevent it from honoring merge.autostash configuration, which is
what we want.  After all, we want the "git merge" to pretend as if
it is "git rebase" while being used for this purpose.

[1] https://lore.kernel.org/git/xmqqa8cfbkeq.fsf_-_@gitster.mtv.corp.google.com/

Reported-by: Tilman Vogel <tilman.vogel@web.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreftable tests: avoid "int" overflow, use "uint64_t"
Ævar Arnfjörð Bjarmason [Tue, 11 Jan 2022 16:40:23 +0000 (17:40 +0100)] 
reftable tests: avoid "int" overflow, use "uint64_t"

Change code added in 1ae2b8cda84 (reftable: add merged table view,
2021-10-07) to consistently use the "uint64_t" type. These "min" and
"max" variables get passed in the body of this function to a function
whose prototype is:

    [...] reftable_writer_set_limits([...], uint64_t min, uint64_t max

This avoids the following warning on SunCC 12.5 on
gcc211.fsffrance.org:

    "reftable/merged_test.c", line 27: warning: initializer does not fit or is out of range: 0xffffffff

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreftable: avoid initializing structs from structs
Han-Wen Nienhuys [Thu, 13 Jan 2022 16:55:34 +0000 (16:55 +0000)] 
reftable: avoid initializing structs from structs

Apparently, the IBM xlc compiler doesn't like this.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot1450-fsck: exec-bit is not needed to make loose object writable
Johannes Sixt [Thu, 13 Jan 2022 20:28:45 +0000 (21:28 +0100)] 
t1450-fsck: exec-bit is not needed to make loose object writable

A test case wants to append stuff to a loose object file to ensure
that this kind of corruption is detected. To make a read-only loose
object file writable with chmod, it is not necessary to also make
it executable. Replace the bitmask 755 with the instruction +w to
request only the write bit and to also heed the umask. And get rid
of a POSIXPERM prerequisite, which is unnecessary for the test.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorefs API: use "failure_errno", not "errno"
Ævar Arnfjörð Bjarmason [Wed, 12 Jan 2022 12:36:46 +0000 (13:36 +0100)] 
refs API: use "failure_errno", not "errno"

Fix a logic error in refs_resolve_ref_unsafe() introduced in a recent
series of mine to abstract the refs API away from errno. See
96f6623ada0 (Merge branch 'ab/refs-errno-cleanup', 2021-11-29)for that
series.

In that series introduction of "failure_errno" to
refs_resolve_ref_unsafe came in ef18119dec8 (refs API: add a version
of refs_resolve_ref_unsafe() with "errno", 2021-10-16). There we'd set
"errno = 0" immediately before refs_read_raw_ref(), and then set
"failure_errno" to "errno" if errno was non-zero afterwards.

Then in the next commit 8b72fea7e91 (refs API: make
refs_read_raw_ref() not set errno, 2021-10-16) we started expecting
"refs_read_raw_ref()" to set "failure_errno". It would do that if
refs_read_raw_ref() failed, but it wouldn't be the same errno.

So we might set the "errno" here to any arbitrary bad value, and end
up e.g. returning NULL when we meant to return the refname from
refs_resolve_ref_unsafe(), or the other way around. Instrumenting this
code will reveal cases where refs_read_raw_ref() will fail, and
"errno" and "failure_errno" will be set to different values.

In practice I haven't found a case where this scary bug changed
anything in practice. The reason for that is that we'll not care about
the actual value of "errno" here per-se, but only whether:

 1. We have an errno
 2. If it's one of ENOENT, EISDIR or ENOTDIR. See the adjacent code
    added in a1c1d8170db (refs_resolve_ref_unsafe: handle d/f
    conflicts for writes, 2017-10-06)

I.e. if we clobber "failure_errno" with "errno", but it happened to be
one of those three, and we'll clobber it with another one of the three
we were OK.

Perhaps there are cases where the difference ended up mattering, but I
haven't found them. Instrumenting the test suite to fail if "errno"
and "failure_errno" are different shows a lot of failures, checking if
they're different *and* one is but not the other is outside that list
of three "errno" values yields no failures.

But let's fix the obvious bug. We should just stop paying attention to
"errno" in refs_resolve_ref_unsafe(). In addition let's change the
partial resetting of "errno" in files_read_raw_ref() to happen just
before the "return", to ensure that any such bug will be more easily
spotted in the future.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: zh_CN: v2.35.0 round 1
Fangyi Zhou [Tue, 11 Jan 2022 16:42:06 +0000 (16:42 +0000)] 
l10n: zh_CN: v2.35.0 round 1

- Translate new messages
- Translate the word 'cone' instead of leaving it verbatim
  (in the context of sparse checkout)
- Make translations of 'failed to' consistent

Signed-off-by: Fangyi Zhou <me@fangyi.io>
Reviewed-by: Teng Long <dyroneteng@gmail.com>
Reviewed-by: 依云 <lilydjwg@gmail.com>
Reviewed-by: Jiang Xin <worldhello.net@gmail.com>
2 years agoMerge branch 'fr_2.35.0_rnd1' of github.com:jnavila/git
Jiang Xin [Thu, 13 Jan 2022 01:11:17 +0000 (09:11 +0800)] 
Merge branch 'fr_2.35.0_rnd1' of github.com:jnavila/git

* 'fr_2.35.0_rnd1' of github.com:jnavila/git:
  l10n: fr: v2.35.0 round 1

2 years agoLast minute fixes before -rc1
Junio C Hamano [Thu, 13 Jan 2022 00:27:08 +0000 (16:27 -0800)] 
Last minute fixes before -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ps/lockfile-cleanup-fix'
Junio C Hamano [Wed, 12 Jan 2022 23:11:43 +0000 (15:11 -0800)] 
Merge branch 'ps/lockfile-cleanup-fix'

Some lockfile code called free() in signal-death code path, which
has been corrected.

* ps/lockfile-cleanup-fix:
  fetch: fix deadlock when cleaning up lockfiles in async signals

2 years agoMerge branch 'ma/header-dup-cleanup'
Junio C Hamano [Wed, 12 Jan 2022 23:11:43 +0000 (15:11 -0800)] 
Merge branch 'ma/header-dup-cleanup'

Code clean-up.

* ma/header-dup-cleanup:
  cache.h: drop duplicate `ensure_full_index()` declaration

2 years agoMerge branch 'fs/gpg-unknown-key-test-fix'
Junio C Hamano [Wed, 12 Jan 2022 23:11:42 +0000 (15:11 -0800)] 
Merge branch 'fs/gpg-unknown-key-test-fix'

Test simplification.

* fs/gpg-unknown-key-test-fix:
  t/gpg: simplify test for unknown key

2 years agoMerge branch 'ak/protect-any-current-branch'
Junio C Hamano [Wed, 12 Jan 2022 23:11:41 +0000 (15:11 -0800)] 
Merge branch 'ak/protect-any-current-branch'

* ak/protect-any-current-branch:
  branch: missing space fix at line 313

2 years agoMerge branch 'jt/pack-header-lshift-overflow'
Junio C Hamano [Wed, 12 Jan 2022 23:11:41 +0000 (15:11 -0800)] 
Merge branch 'jt/pack-header-lshift-overflow'

* jt/pack-header-lshift-overflow:
  packfile: fix off-by-one error in decoding logic

2 years agoMerge branch 'rb/nonstop-lacks-uncompress2'
Junio C Hamano [Wed, 12 Jan 2022 23:11:41 +0000 (15:11 -0800)] 
Merge branch 'rb/nonstop-lacks-uncompress2'

* rb/nonstop-lacks-uncompress2:
  build: NonStop ships with an older zlib