]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agoleak tests: mark some misc tests as passing with SANITIZE=leak
Ævar Arnfjörð Bjarmason [Sat, 30 Oct 2021 22:24:13 +0000 (00:24 +0200)] 
leak tests: mark some misc tests as passing with SANITIZE=leak

As in 7ff24785cb7 (leak tests: mark some misc tests as passing with
SANITIZE=leak, 2021-10-12) continue marking various miscellaneous
tests as passing when git is compiled with SANITIZE=leak. They'll now
be listed as running under the "GIT_TEST_PASSING_SANITIZE_LEAK=true"
test mode (the "linux-leaks" CI target).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoleak tests: mark most gettext tests as passing with SANITIZE=leak
Ævar Arnfjörð Bjarmason [Sat, 30 Oct 2021 22:24:12 +0000 (00:24 +0200)] 
leak tests: mark most gettext tests as passing with SANITIZE=leak

Mark all but one tests that match "*gettext*" as passing when git is compiled
with SANITIZE=leak. They'll now be listed as running under the
"GIT_TEST_PASSING_SANITIZE_LEAK=true" test mode (the "linux-leaks" CI
target).

In the case of "t0202-gettext-perl.sh" this isn't very meaningful as
most of the work is on the Perl side, but let's mark it anyway.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoleak tests: mark "sort" test as passing SANITIZE=leak
Ævar Arnfjörð Bjarmason [Sat, 30 Oct 2021 22:24:11 +0000 (00:24 +0200)] 
leak tests: mark "sort" test as passing SANITIZE=leak

Mark a test that was recently added in e031e9719d2 (test-mergesort:
add test subcommand, 2021-10-01) as passing with SANITIZE=leak. It
will now be listed as running under the
"GIT_TEST_PASSING_SANITIZE_LEAK=true" test mode (the "linux-leaks" CI
target).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoleak tests: mark a read-tree test as passing SANITIZE=leak
Ævar Arnfjörð Bjarmason [Sat, 30 Oct 2021 22:24:10 +0000 (00:24 +0200)] 
leak tests: mark a read-tree test as passing SANITIZE=leak

The "t1002-read-tree-m-u-2way.sh" test has passed under SANITIZE=leak
since 04988c8d182 (unpack-trees: introduce preserve_ignored to
unpack_trees_options, 2021-09-27) was combined with
e5a917fcf42 (unpack-trees: don't leak memory in
verify_clean_subdirectory(), 2021-10-07), but as both were in-flight
at the time neither could mark it as passing.

It will now be listed as running under the
"GIT_TEST_PASSING_SANITIZE_LEAK=true" test mode (the "linux-leaks" CI
target).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoi18n: fix typos found during l10n for git 2.34.0
Jiang Xin [Mon, 1 Nov 2021 02:14:17 +0000 (10:14 +0800)] 
i18n: fix typos found during l10n for git 2.34.0

Emir and Jean-Noël reported typos in some i18n messages when preparing
l10n for git 2.34.0.

* Fix unstable spelling of config variable "gpg.ssh.defaultKeyCommand"
  which was introduced in commit fd9e226776 (ssh signing: retrieve a
  default key from ssh-agent, 2021-09-10).

* Add missing space between "with" and "--python" which was introduced
  in commit bd0708c7eb (ref-filter: add %(raw) atom, 2021-07-26).

* Fix unmatched single quote in 'builtin/index-pack.c' which was
  introduced in commit 8737dab346 (index-pack: refactor renaming in
  final(), 2021-09-09)

[1] https://github.com/git-l10n/git-po/pull/567

Reported-by: Emir Sarı <bitigchi@me.com>
Reported-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.34-rc0 v2.34.0-rc0
Junio C Hamano [Fri, 29 Oct 2021 22:43:50 +0000 (15:43 -0700)] 
Git 2.34-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 're/completion-fix-test-equality'
Junio C Hamano [Fri, 29 Oct 2021 22:43:16 +0000 (15:43 -0700)] 
Merge branch 're/completion-fix-test-equality'

Fix long-standing shell syntax error in the completion script.

* re/completion-fix-test-equality:
  completion: fix incorrect bash/zsh string equality check

2 years agoMerge branch 'mt/fix-add-rm-with-sparse-index'
Junio C Hamano [Fri, 29 Oct 2021 22:43:16 +0000 (15:43 -0700)] 
Merge branch 'mt/fix-add-rm-with-sparse-index'

Fix-up to a topic already merged to 'master'.

* mt/fix-add-rm-with-sparse-index:
  add, rm, mv: fix bug that prevents the update of non-sparse dirs

2 years agoMerge branch 'cm/drop-xunsetenv'
Junio C Hamano [Fri, 29 Oct 2021 22:43:15 +0000 (15:43 -0700)] 
Merge branch 'cm/drop-xunsetenv'

Drop a helper function that has never been used since its addition.

* cm/drop-xunsetenv:
  wrapper: remove xunsetenv()

2 years agoMerge branch 'jk/log-warn-on-bogus-encoding'
Junio C Hamano [Fri, 29 Oct 2021 22:43:15 +0000 (15:43 -0700)] 
Merge branch 'jk/log-warn-on-bogus-encoding'

Squelch over-eager warning message added during this cycle.

* jk/log-warn-on-bogus-encoding:
  log: document --encoding behavior on iconv() failure
  Revert "logmsg_reencode(): warn when iconv() fails"

2 years agoMerge branch 'ab/unbundle-progress'
Junio C Hamano [Fri, 29 Oct 2021 22:43:15 +0000 (15:43 -0700)] 
Merge branch 'ab/unbundle-progress'

Doc clarification.

* ab/unbundle-progress:
  git-bundle.txt: add missing words and punctuation

2 years agoMerge branch 'jc/branch-copy-doc'
Junio C Hamano [Fri, 29 Oct 2021 22:43:15 +0000 (15:43 -0700)] 
Merge branch 'jc/branch-copy-doc'

"git branch -c/-m new old" was not described to copy config, which
has been corrected.

* jc/branch-copy-doc:
  branch (doc): -m/-c copies config and reflog

2 years agoMerge branch 'ma/doc-folder-to-directory'
Junio C Hamano [Fri, 29 Oct 2021 22:43:15 +0000 (15:43 -0700)] 
Merge branch 'ma/doc-folder-to-directory'

Consistently use 'directory', not 'folder', to call the filesystem
entity that collects a group of files and, eh, directories.

* ma/doc-folder-to-directory:
  gitweb.txt: change "folder" to "directory"
  gitignore.txt: change "folder" to "directory"
  git-multi-pack-index.txt: change "folder" to "directory"

2 years agoMerge branch 'sg/sparse-index-not-that-common-a-command'
Junio C Hamano [Fri, 29 Oct 2021 22:43:14 +0000 (15:43 -0700)] 
Merge branch 'sg/sparse-index-not-that-common-a-command'

Drop "git sparse-index" from the list of common commands.

* sg/sparse-index-not-that-common-a-command:
  command-list.txt: remove 'sparse-index' from main help

2 years agoMerge branch 'ma/doc-git-version'
Junio C Hamano [Fri, 29 Oct 2021 22:43:14 +0000 (15:43 -0700)] 
Merge branch 'ma/doc-git-version'

Typofix.

* ma/doc-git-version:
  git.txt: fix typo

2 years agoMerge branch 'js/expand-runtime-prefix'
Junio C Hamano [Fri, 29 Oct 2021 22:43:14 +0000 (15:43 -0700)] 
Merge branch 'js/expand-runtime-prefix'

Typofix.

* js/expand-runtime-prefix:
  config.txt: fix typo

2 years agoMerge branch 'bs/archive-doc-compression-level'
Junio C Hamano [Fri, 29 Oct 2021 22:43:14 +0000 (15:43 -0700)] 
Merge branch 'bs/archive-doc-compression-level'

Update "git archive" documentation and give explicit mention on the
compression level for both zip and tar.gz format.

* bs/archive-doc-compression-level:
  archive: describe compression level option

2 years agoMerge branch 'ks/submodule-add-message-fix'
Junio C Hamano [Fri, 29 Oct 2021 22:43:14 +0000 (15:43 -0700)] 
Merge branch 'ks/submodule-add-message-fix'

Message regression fix.

* ks/submodule-add-message-fix:
  submodule: drop unused sm_name parameter from append_fetch_remotes()
  submodule--helper: fix incorrect newlines in an error message

2 years agoMerge branch 'ab/fix-make-lint-docs'
Junio C Hamano [Fri, 29 Oct 2021 22:43:13 +0000 (15:43 -0700)] 
Merge branch 'ab/fix-make-lint-docs'

Hotfix for a topic recently merged to 'master'.

* ab/fix-make-lint-docs:
  Documentation/Makefile: fix lint-docs mkdir dependency

2 years agoMerge branch 'ab/sh-retire-rebase-preserve-merges'
Junio C Hamano [Fri, 29 Oct 2021 22:43:13 +0000 (15:43 -0700)] 
Merge branch 'ab/sh-retire-rebase-preserve-merges'

Code clean-up to remove unused helpers.

* ab/sh-retire-rebase-preserve-merges:
  git-sh-setup: remove messaging supporting --preserve-merges
  git-sh-i18n: remove unused eval_ngettext()

2 years agoMerge branch 'ab/plug-random-leaks'
Junio C Hamano [Fri, 29 Oct 2021 22:43:13 +0000 (15:43 -0700)] 
Merge branch 'ab/plug-random-leaks'

Leakfix.

* ab/plug-random-leaks:
  reflog: free() ref given to us by dwim_log()
  submodule--helper: fix small memory leaks
  clone: fix a memory leak of the "git_dir" variable
  grep: fix a "path_list" memory leak
  grep: use object_array_clear() in cmd_grep()
  grep: prefer "struct grep_opt" over its "void *" equivalent

2 years agoMerge branch 'ab/plug-handle-path-exclude-leak'
Junio C Hamano [Fri, 29 Oct 2021 22:43:12 +0000 (15:43 -0700)] 
Merge branch 'ab/plug-handle-path-exclude-leak'

Leakfix.

* ab/plug-handle-path-exclude-leak:
  config.c: don't leak memory in handle_path_include()

2 years agoMerge branch 'ab/ref-filter-leakfix'
Junio C Hamano [Fri, 29 Oct 2021 22:43:12 +0000 (15:43 -0700)] 
Merge branch 'ab/ref-filter-leakfix'

"git for-each-ref" family of commands were leaking the ref_sorting
instances that hold sorting keys specified by the user; this has
been corrected.

* ab/ref-filter-leakfix:
  branch: use ref_sorting_release()
  ref-filter API user: add and use a ref_sorting_release()
  tag: use a "goto cleanup" pattern, leak less memory

2 years agoMerge branch 'jk/http-push-status-fix'
Junio C Hamano [Fri, 29 Oct 2021 22:43:12 +0000 (15:43 -0700)] 
Merge branch 'jk/http-push-status-fix'

"git push" client talking to an HTTP server did not diagnose the
lack of the final status report from the other side correctly,
which has been corrected.

* jk/http-push-status-fix:
  transport-helper: recognize "expecting report" error from send-pack
  send-pack: complain about "expecting report" with --helper-status

2 years agoMerge branch 'ab/test-bail'
Junio C Hamano [Fri, 29 Oct 2021 22:43:12 +0000 (15:43 -0700)] 
Merge branch 'ab/test-bail'

A new feature has been added to abort early in the test framework.

* ab/test-bail:
  test-lib.sh: use "Bail out!" syntax on bad SANITIZE=leak use
  test-lib.sh: de-duplicate error() teardown code

2 years agoMerge branch 'ab/make-sparse-for-real'
Junio C Hamano [Fri, 29 Oct 2021 22:43:12 +0000 (15:43 -0700)] 
Merge branch 'ab/make-sparse-for-real'

Fix-up for a recent topic.

* ab/make-sparse-for-real:
  Makefile: remove redundant GIT-CFLAGS dependency from "sparse"

2 years agoMerge branch 'bs/doc-blame-color-lines'
Junio C Hamano [Fri, 29 Oct 2021 22:43:12 +0000 (15:43 -0700)] 
Merge branch 'bs/doc-blame-color-lines'

Doc fix.

* bs/doc-blame-color-lines:
  git config doc: fix recent ASCIIDOC formatting regression

2 years agowrapper: remove xunsetenv()
Carlo Marcelo Arenas Belón [Fri, 29 Oct 2021 21:27:05 +0000 (14:27 -0700)] 
wrapper: remove xunsetenv()

Remove the unused wrapper function.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agolog: document --encoding behavior on iconv() failure
Jeff King [Fri, 29 Oct 2021 21:10:03 +0000 (17:10 -0400)] 
log: document --encoding behavior on iconv() failure

We already note that we may produce invalid output when we skip calling
iconv() altogether. But we may also do so if iconv() fails, and we have
no good alternative. Let's document this to avoid surprising users.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoRevert "logmsg_reencode(): warn when iconv() fails"
Junio C Hamano [Fri, 29 Oct 2021 20:48:58 +0000 (13:48 -0700)] 
Revert "logmsg_reencode(): warn when iconv() fails"

This reverts commit fd680bc5 (logmsg_reencode(): warn when iconv()
fails, 2021-08-27).  Throwing a warning for each and every commit
that gets reencoded, without allowing a way to squelch, would make
it unpleasant for folks who have to deal with an ancient part of the
history in an old project that used wrong encoding in the commits.

2 years agocompletion: fix incorrect bash/zsh string equality check
Robert Estelle [Mon, 25 Oct 2021 22:29:33 +0000 (22:29 +0000)] 
completion: fix incorrect bash/zsh string equality check

In the basic `[`/`test` command, the string equality operator is a
single `=`. The `==` operator is only available in `[[`, which is a
bash-ism also supported by zsh.

This mix-up was causing the following completion error in zsh:
> __git_ls_files_helper:7: = not found

(That message refers to the extraneous symbol in `==` ← `=`).

This updates that comparison to use a single `=` inside the
basic `[ … ]` test conditional.

Although this fix is inconsistent with the other comparisons in this
file, which use `[[ … == … ]]`, and the two expressions are functionally
identical in this context, that approach was rejected due to a
preference for `[`.

Signed-off-by: Robert Estelle <robertestelle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoadd, rm, mv: fix bug that prevents the update of non-sparse dirs
Matheus Tavares [Thu, 28 Oct 2021 14:21:11 +0000 (11:21 -0300)] 
add, rm, mv: fix bug that prevents the update of non-sparse dirs

These three commands recently learned to avoid updating paths outside
the sparse checkout even if they are missing the SKIP_WORKTREE bit. This
is done using path_in_sparse_checkout(), which checks whether a given
path matches the current list of sparsity rules, similar to what
clear_ce_flags() does when we run "git sparse checkout init" or "git
sparse-checkout reapply". However, clear_ce_flags() uses a recursive
approach, applying the match results from parent directories on paths
that get the UNDECIDED result, whereas path_in_sparse_checkout() only
attempts to match the full path and immediately considers UNDECIDED as
NOT_MATCHED. This makes the function miss matches with leading
directories. For example, if the user has the sparsity patterns "!/a"
and "b/", add, rm, and mv will fail to update the path "a/b/c" and end
up displaying a warning about it being outside the sparse checkout even
though it isn't. This problem only occurs in full pattern mode as the
pattern matching functions never return UNDECIDED for cone mode.

To fix this, replicate the recursive behavior of clear_ce_flags() in
path_in_sparse_checkout(), falling back to the parent directory match
when a path gets the UNDECIDED result. (If this turns out to be too
expensive in some cases, we may want to later add some form of caching
to accelerate multiple queries within the same directory. This is not
implemented in this patch, though.) Also add two tests for each affected
command (add, rm, and mv) to check that they behave correctly with the
recursive pattern matching. The first test would previously fail without
this patch while the second already succeeded. It is added mostly to
make sure that we are not breaking the existing pattern matching for
directories that are really sparse, and also as a protection against any
future regressions.

Two other existing tests had to be changed as well: one test in t3602
checks that "git rm -r <dir>" won't remove sparse entries, but it didn't
allow the non-sparse entries inside <dir> to be removed. The other one,
in t7002, tested that "git mv" would correctly display a warning message
for sparse paths, but it accidentally expected the message to include
two non-sparse paths as well.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-bundle.txt: add missing words and punctuation
Martin Ågren [Sun, 24 Oct 2021 17:08:21 +0000 (19:08 +0200)] 
git-bundle.txt: add missing words and punctuation

Add an "and" to separate the two halves of the first sentence of the
paragraph more. Add a comma to similarly separate the two halves of the
second sentence a bit better. Add a period at the end of the paragraph.

Further down in the file, add the missing "be" in "must be accompanied".

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoDocumentation/Makefile: fix lint-docs mkdir dependency
Jeff King [Tue, 26 Oct 2021 07:31:44 +0000 (03:31 -0400)] 
Documentation/Makefile: fix lint-docs mkdir dependency

Since 8650c6298c (doc lint: make "lint-docs" non-.PHONY, 2021-10-15), we
put the output for gitlink linter into .build/lint-docs/gitlink. There
are order-only dependencies to create the sequence of subdirs like:

  .build/lint-docs: | .build
          $(QUIET)mkdir $@
  .build/lint-docs/gitlink: | .build/lint-docs
          $(QUIET)mkdir $@

where each level has to depend on the prior one (since the parent
directory must exist for us to create something inside it). But the
"howto" and "config" subdirectories of gitlink have the wrong
dependency; they depend on "lint-docs", not "lint-docs/gitlink".

This usually works out, because the LINT_DOCS_GITLINK targets which
depend on "gitlink/howto" also depend on just "gitlink", so the
directory gets created anyway. But since we haven't given make an
explicit ordering, things can racily happen out of order.

If you stick a "sleep 1" in the rule to build "gitlink" like this:

   ## Lint: gitlink
   .build/lint-docs/gitlink: | .build/lint-docs
  - $(QUIET)mkdir $@
  + $(QUIET)sleep 1 && mkdir $@

then "make clean; make lint-docs" will fail reliably. Or you can see it
as-is just by building the directory in isolation:

  $ make clean
  [...]
  $ make .build/lint-docs/gitlink/howto
      GEN mergetools-list.made
      GEN cmd-list.made
      GEN doc.dep
      SUBDIR ../
  make[1]: 'GIT-VERSION-FILE' is up to date.
      SUBDIR ../
  make[1]: 'GIT-VERSION-FILE' is up to date.
  mkdir: cannot create directory ‘.build/lint-docs/gitlink/howto’: No such file or directory
  make: *** [Makefile:476: .build/lint-docs/gitlink/howto] Error 1

The fix is easy: we just need to depend on the correct parent directory.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosubmodule: drop unused sm_name parameter from append_fetch_remotes()
Jeff King [Tue, 26 Oct 2021 05:25:10 +0000 (01:25 -0400)] 
submodule: drop unused sm_name parameter from append_fetch_remotes()

Commit c21fb4676f (submodule--helper: fix incorrect newlines in an error
message, 2021-10-23) accidentally added a new, unused parameter while
changing the name and signature of show_fetch_remotes() to
append_fetch_remotes(). We can drop this to keep things simpler (and
satisfy -Wunused-parameter).

The error is likely because c21fb4676f is fixing a problem from
8c8195e9c3 (submodule--helper: introduce add-clone subcommand,
2021-07-10). An earlier iteration of that second commit introduced the
same unused parameter (though it was dropped before it finally made it
to 'next'), and the fix on top accidentally carried forward the extra
parameter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe fifteenth batch
Junio C Hamano [Mon, 25 Oct 2021 23:07:12 +0000 (16:07 -0700)] 
The fifteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ab/test-lib-diff-cleanup'
Junio C Hamano [Mon, 25 Oct 2021 23:07:01 +0000 (16:07 -0700)] 
Merge branch 'ab/test-lib-diff-cleanup'

Test clean-up.

* ab/test-lib-diff-cleanup:
  tests: stop using top-level "README" and "COPYING" files
  "lib-diff" tests: make "README" and "COPYING" test data smaller

2 years agoMerge branch 'ab/fix-make-lint-docs'
Junio C Hamano [Mon, 25 Oct 2021 23:07:01 +0000 (16:07 -0700)] 
Merge branch 'ab/fix-make-lint-docs'

Build fix.

* ab/fix-make-lint-docs:
  doc lint: make "lint-docs" non-.PHONY
  doc build: speed up "make lint-docs"
  doc lint: emit errors on STDERR
  doc lint: fix error-hiding regression

2 years agoMerge branch 'ab/pkt-line-cleanup'
Junio C Hamano [Mon, 25 Oct 2021 23:07:00 +0000 (16:07 -0700)] 
Merge branch 'ab/pkt-line-cleanup'

Code clean-up.

* ab/pkt-line-cleanup:
  pkt-line.[ch]: remove unused packet_read_line_buf()
  pkt-line.[ch]: remove unused packet_buf_write_len()

2 years agoMerge branch 'tb/fix-midx-rename-while-mapped'
Junio C Hamano [Mon, 25 Oct 2021 23:07:00 +0000 (16:07 -0700)] 
Merge branch 'tb/fix-midx-rename-while-mapped'

The codepath to write a new version of .midx multi-pack index files
has learned to release the mmaped memory holding the current
version of .midx before removing them from the disk, as some
platforms do not allow removal of a file that still has mapping.

* tb/fix-midx-rename-while-mapped:
  midx.c: guard against commit_lock_file() failures
  midx.c: lookup MIDX by object directory during repack
  midx.c: lookup MIDX by object directory during expire
  midx.c: extract MIDX lookup by object_dir

2 years agoMerge branch 'ab/test-cleanly-recreate-trash-directory'
Junio C Hamano [Mon, 25 Oct 2021 23:07:00 +0000 (16:07 -0700)] 
Merge branch 'ab/test-cleanly-recreate-trash-directory'

Improve test framework around unwritable directories.

* ab/test-cleanly-recreate-trash-directory:
  test-lib.sh: try to re-chmod & retry on failed trash removal

2 years agoMerge branch 'jc/doc-commit-header-continuation-line'
Junio C Hamano [Mon, 25 Oct 2021 23:07:00 +0000 (16:07 -0700)] 
Merge branch 'jc/doc-commit-header-continuation-line'

Doc update.

* jc/doc-commit-header-continuation-line:
  signature-format.txt: explain and illustrate multi-line headers

2 years agoMerge branch 'ab/mark-leak-free-tests-more'
Junio C Hamano [Mon, 25 Oct 2021 23:06:59 +0000 (16:06 -0700)] 
Merge branch 'ab/mark-leak-free-tests-more'

Bunch of tests are marked as "passing leak check".

* ab/mark-leak-free-tests-more:
  merge: add missing strbuf_release()
  ls-files: add missing string_list_clear()
  ls-files: fix a trivial dir_clear() leak
  tests: fix test-oid-array leak, test in SANITIZE=leak
  tests: fix a memory leak in test-oidtree.c
  tests: fix a memory leak in test-parse-options.c
  tests: fix a memory leak in test-prio-queue.c

2 years agoMerge branch 'ab/mark-leak-free-tests'
Junio C Hamano [Mon, 25 Oct 2021 23:06:59 +0000 (16:06 -0700)] 
Merge branch 'ab/mark-leak-free-tests'

Bunch of tests are marked as "passing leak check".

* ab/mark-leak-free-tests:
  leak tests: mark some misc tests as passing with SANITIZE=leak
  leak tests: mark various "generic" tests as passing with SANITIZE=leak
  leak tests: mark some read-tree tests as passing with SANITIZE=leak
  leak tests: mark some ls-files tests as passing with SANITIZE=leak
  leak tests: mark all checkout-index tests as passing with SANITIZE=leak
  leak tests: mark all trace2 tests as passing with SANITIZE=leak
  leak tests: mark all ls-tree tests as passing with SANITIZE=leak
  leak tests: run various "test-tool" tests in t00*.sh SANITIZE=leak
  leak tests: run various built-in tests in t00*.sh SANITIZE=leak

2 years agoMerge branch 'ab/parse-options-cleanup'
Junio C Hamano [Mon, 25 Oct 2021 23:06:59 +0000 (16:06 -0700)] 
Merge branch 'ab/parse-options-cleanup'

Random changes to parse-options implementation.

* ab/parse-options-cleanup:
  parse-options: change OPT_{SHORT,UNSET} to an enum
  parse-options tests: test optname() output
  parse-options.[ch]: make opt{bug,name}() "static"
  commit-graph: stop using optname()
  parse-options.c: move optname() earlier in the file
  parse-options.h: make the "flags" in "struct option" an enum
  parse-options.c: use exhaustive "case" arms for "enum parse_opt_result"
  parse-options.[ch]: consistently use "enum parse_opt_result"
  parse-options.[ch]: consistently use "enum parse_opt_flags"
  parse-options.h: move PARSE_OPT_SHELL_EVAL between enums

2 years agoMerge branch 'js/userdiff-cpp'
Junio C Hamano [Mon, 25 Oct 2021 23:06:59 +0000 (16:06 -0700)] 
Merge branch 'js/userdiff-cpp'

Userdiff patterns for the C++ language has been updated.

* js/userdiff-cpp:
  userdiff-cpp: back out the digit-separators in numbers
  userdiff-cpp: learn the C++ spaceship operator
  userdiff-cpp: permit the digit-separating single-quote in numbers
  userdiff-cpp: prepare test cases with yet unsupported features
  userdiff-cpp: tighten word regex
  t4034: add tests showing problematic cpp tokenizations
  t4034/cpp: actually test that operator tokens are not split

2 years agoMerge branch 'da/mergetools-special-case-xxdiff-exit-128'
Junio C Hamano [Mon, 25 Oct 2021 23:06:58 +0000 (16:06 -0700)] 
Merge branch 'da/mergetools-special-case-xxdiff-exit-128'

The xxdiff difftool backend can exit with status 128, which the
difftool-helper that launches the backend takes as a significant
failure, when it is not significant at all.  Work it around.

* da/mergetools-special-case-xxdiff-exit-128:
  mergetools/xxdiff: prevent segfaults from stopping difftool

2 years agoMerge branch 'fs/ssh-signing-fix'
Junio C Hamano [Mon, 25 Oct 2021 23:06:58 +0000 (16:06 -0700)] 
Merge branch 'fs/ssh-signing-fix'

Fix-up for the other topic already in 'next'.

* fs/ssh-signing-fix:
  gpg-interface: fix leak of strbufs in get_ssh_key_fingerprint()
  gpg-interface: fix leak of "line" in parse_ssh_output()
  ssh signing: clarify trustlevel usage in docs
  ssh signing: fmt-merge-msg tests & config parse

2 years agoMerge branch 'fs/ssh-signing'
Junio C Hamano [Mon, 25 Oct 2021 23:06:58 +0000 (16:06 -0700)] 
Merge branch 'fs/ssh-signing'

Use ssh public crypto for object and push-cert signing.

* fs/ssh-signing:
  ssh signing: test that gpg fails for unknown keys
  ssh signing: tests for logs, tags & push certs
  ssh signing: duplicate t7510 tests for commits
  ssh signing: verify signatures using ssh-keygen
  ssh signing: provide a textual signing_key_id
  ssh signing: retrieve a default key from ssh-agent
  ssh signing: add ssh key format and signing code
  ssh signing: add test prereqs
  ssh signing: preliminary refactoring and clean-up

2 years agoMerge branch 'pw/sparse-cache-tree-verify-fix'
Junio C Hamano [Mon, 25 Oct 2021 23:06:57 +0000 (16:06 -0700)] 
Merge branch 'pw/sparse-cache-tree-verify-fix'

Recent sparse-index addition, namely any use of index_name_pos(),
can expand sparse index entries and breaks any code that walks
cache-tree or existing index entries.  One such instance of such a
breakage has been corrected.

* pw/sparse-cache-tree-verify-fix:
  t1092: run "rebase --apply" without "-q" in testing
  sparse index: fix use-after-free bug in cache_tree_verify()

2 years agoMerge branch 'ab/fix-commit-error-message-upon-unwritable-object-store'
Junio C Hamano [Mon, 25 Oct 2021 23:06:57 +0000 (16:06 -0700)] 
Merge branch 'ab/fix-commit-error-message-upon-unwritable-object-store'

"git commit" gave duplicated error message when the object store
was unwritable, which has been corrected.

* ab/fix-commit-error-message-upon-unwritable-object-store:
  commit: fix duplication regression in permission error output
  unwritable tests: assert exact error output

2 years agoMerge branch 'rs/add-dry-run-without-objects'
Junio C Hamano [Mon, 25 Oct 2021 23:06:57 +0000 (16:06 -0700)] 
Merge branch 'rs/add-dry-run-without-objects'

Stop "git add --dry-run" from creating new blob and tree objects.

* rs/add-dry-run-without-objects:
  add: don't write objects with --dry-run

2 years agoMerge branch 'rs/disable-gc-during-perf-tests'
Junio C Hamano [Mon, 25 Oct 2021 23:06:57 +0000 (16:06 -0700)] 
Merge branch 'rs/disable-gc-during-perf-tests'

Avoid performance measurements from getting ruined by gc and other
housekeeping pauses interfering in the middle.

* rs/disable-gc-during-perf-tests:
  perf: disable automatic housekeeping

2 years agoMerge branch 'jt/no-abuse-alternate-odb-for-submodules'
Junio C Hamano [Mon, 25 Oct 2021 23:06:56 +0000 (16:06 -0700)] 
Merge branch 'jt/no-abuse-alternate-odb-for-submodules'

Follow through the work to use the repo interface to access
submodule objects in-process, instead of abusing the alternate
object database interface.

* jt/no-abuse-alternate-odb-for-submodules:
  submodule: trace adding submodule ODB as alternate
  submodule: pass repo to check_has_commit()
  object-file: only register submodule ODB if needed
  merge-{ort,recursive}: remove add_submodule_odb()
  refs: peeling non-the_repository iterators is BUG
  refs: teach arbitrary repo support to iterators
  refs: plumb repo into ref stores

2 years agoMerge branch 'ab/unpack-trees-leakfix'
Junio C Hamano [Mon, 25 Oct 2021 23:06:56 +0000 (16:06 -0700)] 
Merge branch 'ab/unpack-trees-leakfix'

Leakfix.

* ab/unpack-trees-leakfix:
  sequencer: fix a memory leak in do_reset()
  sequencer: add a "goto cleanup" to do_reset()
  unpack-trees: don't leak memory in verify_clean_subdirectory()

2 years agoMerge branch 'jh/perf-remove-test-times'
Junio C Hamano [Mon, 25 Oct 2021 23:06:56 +0000 (16:06 -0700)] 
Merge branch 'jh/perf-remove-test-times'

Perf test fix.

* jh/perf-remove-test-times:
  t/perf/perf-lib.sh: remove test_times.* at the end test_perf_()

2 years agoMerge branch 'ab/fsck-unexpected-type'
Junio C Hamano [Mon, 25 Oct 2021 23:06:56 +0000 (16:06 -0700)] 
Merge branch 'ab/fsck-unexpected-type'

"git fsck" has been taught to report mismatch between expected and
actual types of an object better.

* ab/fsck-unexpected-type:
  fsck: report invalid object type-path combinations
  fsck: don't hard die on invalid object types
  object-file.c: stop dying in parse_loose_header()
  object-file.c: return ULHR_TOO_LONG on "header too long"
  object-file.c: use "enum" return type for unpack_loose_header()
  object-file.c: simplify unpack_loose_short_header()
  object-file.c: make parse_loose_header_extended() public
  object-file.c: return -1, not "status" from unpack_loose_header()
  object-file.c: don't set "typep" when returning non-zero
  cat-file tests: test for current --allow-unknown-type behavior
  cat-file tests: add corrupt loose object test
  cat-file tests: test for missing/bogus object with -t, -s and -p
  cat-file tests: move bogus_* variable declarations earlier
  fsck tests: test for garbage appended to a loose object
  fsck tests: test current hash/type mismatch behavior
  fsck tests: refactor one test to use a sub-repo
  fsck tests: add test for fsck-ing an unknown type

2 years agogitweb.txt: change "folder" to "directory"
Martin Ågren [Sun, 24 Oct 2021 17:09:17 +0000 (19:09 +0200)] 
gitweb.txt: change "folder" to "directory"

We prefer "directory" over "folder" when discussing the file system
concept. Change this instance for consistency.

After this, the only hits for '\<folder\>' in Documentation/ relate to
IMAP folders.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogitignore.txt: change "folder" to "directory"
Martin Ågren [Sun, 24 Oct 2021 17:09:16 +0000 (19:09 +0200)] 
gitignore.txt: change "folder" to "directory"

We prefer "directory" over "folder" when discussing the file system
concept. Change this instance for consistency -- indeed, even within
this paragraph, we already use "directory".

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-multi-pack-index.txt: change "folder" to "directory"
Martin Ågren [Sun, 24 Oct 2021 17:09:15 +0000 (19:09 +0200)] 
git-multi-pack-index.txt: change "folder" to "directory"

We prefer "directory" over "folder" when discussing the file system
concept. In all of our documentation, these are the only spots where we
refer to the `.git` directory as a folder. Switch to "directory", and
while doing so, add backticks to the ".git" filename to set it in
monospace.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit.txt: fix typo
Martin Ågren [Sun, 24 Oct 2021 17:08:20 +0000 (19:08 +0200)] 
git.txt: fix typo

Fix the spelling of "internally".

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoarchive: describe compression level option
Bagas Sanjaya [Fri, 22 Oct 2021 06:45:44 +0000 (13:45 +0700)] 
archive: describe compression level option

Describe the only <extra> option in `git archive`, that is the compression
level option. Previously this option is only described for zip backend;
add description also for tar backend.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoconfig.txt: fix typo
Martin Ågren [Sun, 24 Oct 2021 17:07:43 +0000 (19:07 +0200)] 
config.txt: fix typo

Fix the spelling of "substituted".

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommand-list.txt: remove 'sparse-index' from main help
SZEDER Gábor [Sun, 24 Oct 2021 17:07:30 +0000 (19:07 +0200)] 
command-list.txt: remove 'sparse-index' from main help

Ever since 'git sparse-checkout' was introduced [1] it is included in
'git --help' in the section "work on the current change" along with
the commands 'add', 'mv', 'restore', and 'rm'.  It clearly doesn't
belong to that group, moreover it can't be considered such a common
command to belong to 'git --help' in the first place, so remove it
from there.

[1] 94c0956b60 (sparse-checkout: create builtin with 'list'
                subcommand, 2019-11-21)

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agouserdiff-cpp: back out the digit-separators in numbers
Johannes Sixt [Sun, 24 Oct 2021 09:56:43 +0000 (11:56 +0200)] 
userdiff-cpp: back out the digit-separators in numbers

The implementation of digit-separating single-quotes introduced a
note-worthy regression: the change of a character literal with a
digit would splice the digit and the closing single-quote. For
example, the change from 'a' to '2' is now tokenized as
'[-a'-]{+2'+} instead of '[-a-]{+2+}'.

The options to fix the regression are:

- Tighten the regular expression such that the single-quote can only
  occur between digits (that would match the official syntax).

- Remove support for digit separators.

I chose to remove support, because

- I have not seen a lot of code make use of digit separators.

- If code does use digit separators, then the numbers are typically
  long. If a change in one of the segments occurs, it is actually
  better visible if only that segment is highlighted as the word
  that changed instead of the whole long number.

This choice does introduce another minor regression, though, which
is highlighted in the test case: when a change occurs in the second
or later segment of a hexadecimal number where the segment begins
with a digit, but also has letters, the segment is mistaken as
consisting of a number and an identifier. I can live with that.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosubmodule--helper: fix incorrect newlines in an error message
Kaartic Sivaraam [Sat, 23 Oct 2021 12:57:22 +0000 (18:27 +0530)] 
submodule--helper: fix incorrect newlines in an error message

A refactoring[1] done as part of the recent conversion of
'git submodule add' to builtin, changed the error message
shown when a Git directory already exists locally for a submodule
name. Before the refactoring, the error used to appear like so:

  --- START OF OUTPUT ---
  $ git submodule add ../sub/ subm
  A git directory for 'subm' is found locally with remote(s):
    origin        /me/git-repos-for-test/sub
  If you want to reuse this local git directory instead of cloning again from
    /me/git-repos-for-test/sub
  use the '--force' option. If the local git directory is not the correct repo
  or you are unsure what this means choose another name with the '--name' option.
  ---  END OF OUTPUT  ---

After the refactoring the error started appearing like so:

  --- START OF OUTPUT ---
  $ git submodule add ../sub/ subm
  A git directory for 'subm' is found locally with remote(s):  origin     /me/git-repos-for-test/sub
  fatal: If you want to reuse this local git directory instead of cloning again from
  /me/git-repos-for-test/sub
  use the '--force' option. If the local git directory is not the correct repo
  or if you are unsure what this means, choose another name with the '--name' option.

  ---  END OF OUTPUT  ---

As one could observe the remote information is printed along with the
first line rather than on its own line. Also, there's an additional
newline following output.

Make the error message consistent with the error message that used to be
printed before the refactoring.

This also moves the 'fatal:' prefix that appears in the middle of the
error message to the first line as it would more appropriate to have
it in the first line. The output after the change would look like:

  --- START OF OUTPUT ---
  $ git submodule add ../sub/ subm
  fatal: A git directory for 'subm' is found locally with remote(s):
    origin        /me/git-repos-for-test/sub
  If you want to reuse this local git directory instead of cloning again from
    /me/git-repos-for-test/sub
  use the '--force' option. If the local git directory is not the correct repo
  or you are unsure what this means choose another name with the '--name' option.
  ---  END OF OUTPUT  ---

[1]: https://lore.kernel.org/git/20210710074801.19917-5-raykar.ath@gmail.com/#t

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobranch (doc): -m/-c copies config and reflog
Junio C Hamano [Sat, 23 Oct 2021 23:57:30 +0000 (16:57 -0700)] 
branch (doc): -m/-c copies config and reflog

The description section for the command mentions config and reflog
are moved or copied by these options, but the description for these
options did not.  Make them match.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreflog: free() ref given to us by dwim_log()
Ævar Arnfjörð Bjarmason [Fri, 22 Oct 2021 08:55:44 +0000 (10:55 +0200)] 
reflog: free() ref given to us by dwim_log()

When dwim_log() returns the "ref" is always ether NULL or an
xstrdup()'d string.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosubmodule--helper: fix small memory leaks
Ævar Arnfjörð Bjarmason [Fri, 22 Oct 2021 08:55:43 +0000 (10:55 +0200)] 
submodule--helper: fix small memory leaks

Add a missing strbuf_release() and a clear_pathspec() to the
submodule--helper.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoclone: fix a memory leak of the "git_dir" variable
Ævar Arnfjörð Bjarmason [Fri, 22 Oct 2021 08:55:42 +0000 (10:55 +0200)] 
clone: fix a memory leak of the "git_dir" variable

At this point in cmd_clone the "git_dir" is always either an
xstrdup()'d string, or something we got from mkpathdup(). Let's free()
it before we clobber it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogrep: fix a "path_list" memory leak
Ævar Arnfjörð Bjarmason [Fri, 22 Oct 2021 08:55:41 +0000 (10:55 +0200)] 
grep: fix a "path_list" memory leak

Free the "path_list" used in builtin/grep.c, it was declared as
STRING_LIST_INIT_NODUP, let's change it to a STRING_LIST_INIT_DUP
since an early user in cmd_grep() appends a string passed via
parse-options.c to it, which needs to be duplicated.

Let's then convert the remaining callers to use
string_list_append_nodup() instead, allowing us to free the list.

This makes all the tests in t7811-grep-open.sh pass, 6/10 would fail
before this change. The only remaining failure would have been due to
a stray "git checkout" (which still leaks memory). In this case we can
use a "git reset --hard" instead, so let's do that, and move the
test_when_finished() above the code that would modify the relevant
file.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogrep: use object_array_clear() in cmd_grep()
Ævar Arnfjörð Bjarmason [Fri, 22 Oct 2021 08:55:40 +0000 (10:55 +0200)] 
grep: use object_array_clear() in cmd_grep()

Free the "struct object_array" before exiting. This makes grep tests
(e.g.  "t7815-grep-binary.sh") a bit happer under SANITIZE=leak.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogrep: prefer "struct grep_opt" over its "void *" equivalent
Ævar Arnfjörð Bjarmason [Fri, 22 Oct 2021 08:55:39 +0000 (10:55 +0200)] 
grep: prefer "struct grep_opt" over its "void *" equivalent

Stylistically fix up code added in bfac23d9534 (grep: Fix two memory
leaks, 2010-01-30). We usually don't use the "arg" at all once we've
casted it to the struct we want, let's not do that here when we're
freeing it. Perhaps it was thought that a cast to "void *" would
otherwise be needed?

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoconfig.c: don't leak memory in handle_path_include()
Ævar Arnfjörð Bjarmason [Thu, 21 Oct 2021 19:54:14 +0000 (21:54 +0200)] 
config.c: don't leak memory in handle_path_include()

Fix a memory leak in the error() path in handle_path_include(), this
allows us to run t1305-config-include.sh under SANITIZE=leak,
previously 4 tests there would fail. This fixes up a leak in
9b25a0b52e0 (config: add include directive, 2012-02-06).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: remove redundant GIT-CFLAGS dependency from "sparse"
Ævar Arnfjörð Bjarmason [Thu, 21 Oct 2021 20:00:14 +0000 (22:00 +0200)] 
Makefile: remove redundant GIT-CFLAGS dependency from "sparse"

The "sparse" target needed the GIT-CFLAGS dependency before my
c234e8a0ecf (Makefile: make the "sparse" target non-.PHONY,
2021-09-23), but since then it depends on the corresponding *.o files,
which in turn depend on the correct header files, as well as on
GIT-CFLAGS. There's no need to re-state this dependency here.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-sh-setup: remove messaging supporting --preserve-merges
Ævar Arnfjörð Bjarmason [Thu, 21 Oct 2021 18:37:33 +0000 (20:37 +0200)] 
git-sh-setup: remove messaging supporting --preserve-merges

Remove messages that were last used by the code removed in
a74b35081c5 (rebase: drop support for `--preserve-merges`,
2021-09-07).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-sh-i18n: remove unused eval_ngettext()
Ævar Arnfjörð Bjarmason [Thu, 21 Oct 2021 18:37:32 +0000 (20:37 +0200)] 
git-sh-i18n: remove unused eval_ngettext()

The "eval_ngettext()" function has been orphaned since its last user
was removed in a74b35081c5 (rebase: drop support for
`--preserve-merges`, 2021-09-07).

See b8fc9e43a7d (i18n: rebase-interactive: mark here-doc strings for
translation, 2016-06-17) for the commit that added these
eval_ngettext() wrappers.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobranch: use ref_sorting_release()
Ævar Arnfjörð Bjarmason [Wed, 20 Oct 2021 18:27:21 +0000 (20:27 +0200)] 
branch: use ref_sorting_release()

Use a ref_sorting_release() in branch.c to free the memory from the
ref_sorting_options(). This plugs the final in-tree memory leak of
that API.

In the preceding commit the "sorting" variable was left in the
cmd_branch() scope, even though that wasn't needed anymore. Move it to
the "else if (list)" scope instead. We can also move the "struct
string_list" only used for that branch to be declared in that block

That "struct ref_sorting" does not need to be "static" (and isn't
re-used). The "ref_sorting_options()" will return a valid one, we
don't need to make it "static" to have it zero'd out. That it was
static was another artifact of the pre-image of the preceding commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoref-filter API user: add and use a ref_sorting_release()
Ævar Arnfjörð Bjarmason [Wed, 20 Oct 2021 18:27:20 +0000 (20:27 +0200)] 
ref-filter API user: add and use a ref_sorting_release()

Add a ref_sorting_release() and use it for some of the current API
users, the ref_sorting_default() function and its siblings will do a
malloc() which wasn't being free'd previously.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotag: use a "goto cleanup" pattern, leak less memory
Ævar Arnfjörð Bjarmason [Wed, 20 Oct 2021 18:27:19 +0000 (20:27 +0200)] 
tag: use a "goto cleanup" pattern, leak less memory

Change cmd_tag() to free its "struct strbuf"'s instead of using an
UNLEAK() pattern. This changes code added in 886e1084d78 (builtin/:
add UNLEAKs, 2017-10-01).

As shown in the context of the declaration of the "struct
msg_arg" (which I'm changing to use a designated initializer while at
it, and to show the context in this change), that struct is just a
thin wrapper around an int and "struct strbuf".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit config doc: fix recent ASCIIDOC formatting regression
Ævar Arnfjörð Bjarmason [Tue, 19 Oct 2021 12:31:34 +0000 (14:31 +0200)] 
git config doc: fix recent ASCIIDOC formatting regression

Fix a regression in 8c328561332 (blame: document --color-* options,
2021-10-08), which added an extra newline before the "+" syntax.

The "Documentation/doc-diff HEAD~ HEAD" output with this applied is:

    [...]
    @@ -1815,13 +1815,13 @@ CONFIGURATION FILE
                specified colors if the line was introduced before the given
                timestamp, overwriting older timestamped colors.

    -       + Instead of an absolute timestamp relative timestamps work as well,
    -       e.g. 2.weeks.ago is valid to address anything older than 2 weeks.
    +           Instead of an absolute timestamp relative timestamps work as well,
    +           e.g.  2.weeks.ago is valid to address anything older than 2 weeks.

    -       + It defaults to blue,12 month ago,white,1 month ago,red, which colors
    -       everything older than one year blue, recent changes between one month
    -       and one year old are kept white, and lines introduced within the last
    -       month are colored red.
    +           It defaults to blue,12 month ago,white,1 month ago,red, which
    +           colors everything older than one year blue, recent changes between
    +           one month and one year old are kept white, and lines introduced
    +           within the last month are colored red.

            color.blame.repeatedLines
                Use the specified color to colorize line annotations for git blame

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe fourteenth batch
Junio C Hamano [Mon, 18 Oct 2021 22:48:10 +0000 (15:48 -0700)] 
The fourteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'tz/doc-link-to-bundle-format-fix'
Junio C Hamano [Mon, 18 Oct 2021 22:47:59 +0000 (15:47 -0700)] 
Merge branch 'tz/doc-link-to-bundle-format-fix'

Doc update.

* tz/doc-link-to-bundle-format-fix:
  doc: add bundle-format to TECH_DOCS

2 years agoMerge branch 'js/windows-ci-path-fix'
Junio C Hamano [Mon, 18 Oct 2021 22:47:58 +0000 (15:47 -0700)] 
Merge branch 'js/windows-ci-path-fix'

The PATH used in CI job may be too wide and let incompatible dlls
to be grabbed, which can cause the build&test to fail.  Tighten it.

* js/windows-ci-path-fix:
  ci(windows): ensure that we do not pick up random executables

2 years agoMerge branch 'bs/doc-blame-color-lines'
Junio C Hamano [Mon, 18 Oct 2021 22:47:58 +0000 (15:47 -0700)] 
Merge branch 'bs/doc-blame-color-lines'

The "--color-lines" and "--color-by-age" options of "git blame"
have been missing, which are now documented.

* bs/doc-blame-color-lines:
  blame: document --color-* options
  blame: describe default output format

2 years agoMerge branch 'rs/make-verify-path-really-verify-again'
Junio C Hamano [Mon, 18 Oct 2021 22:47:58 +0000 (15:47 -0700)] 
Merge branch 'rs/make-verify-path-really-verify-again'

Recent sparse-index work broke safety against attempts to add paths
with trailing slashes to the index, which has been corrected.

* rs/make-verify-path-really-verify-again:
  read-cache: let verify_path() reject trailing dir separators again
  read-cache: add verify_path_internal()
  t3905: show failure to ignore sub-repo

2 years agoMerge branch 'jk/cat-file-batch-all-wo-replace'
Junio C Hamano [Mon, 18 Oct 2021 22:47:57 +0000 (15:47 -0700)] 
Merge branch 'jk/cat-file-batch-all-wo-replace'

"git cat-file --batch" with the "--batch-all-objects" option is
supposed to iterate over all the objects found in a repository, but
it used to translate these object names using the replace mechanism,
which defeats the point of enumerating all objects in the repository.
This has been corrected.

* jk/cat-file-batch-all-wo-replace:
  cat-file: use packed_object_info() for --batch-all-objects
  cat-file: split ordered/unordered batch-all-objects callbacks
  cat-file: disable refs/replace with --batch-all-objects
  cat-file: mention --unordered along with --batch-all-objects
  t1006: clean up broken objects

2 years agoMerge branch 'cm/save-restore-terminal'
Junio C Hamano [Mon, 18 Oct 2021 22:47:57 +0000 (15:47 -0700)] 
Merge branch 'cm/save-restore-terminal'

An editor session launched during a Git operation (e.g. during 'git
commit') can leave the terminal in a funny state.  The code path
has updated to save the terminal state before, and restore it
after, it spawns an editor.

* cm/save-restore-terminal:
  editor: save and reset terminal after calling EDITOR
  terminal: teach git how to save/restore its terminal settings

2 years agoMerge branch 'ab/designated-initializers-more'
Junio C Hamano [Mon, 18 Oct 2021 22:47:57 +0000 (15:47 -0700)] 
Merge branch 'ab/designated-initializers-more'

Code clean-up.

* ab/designated-initializers-more:
  builtin/remote.c: add and use SHOW_INFO_INIT
  builtin/remote.c: add and use a REF_STATES_INIT
  urlmatch.[ch]: add and use URLMATCH_CONFIG_INIT
  builtin/blame.c: refactor commit_info_init() to COMMIT_INFO_INIT macro
  daemon.c: refactor hostinfo_init() to HOSTINFO_INIT macro

2 years agoMerge branch 'tb/repack-write-midx'
Junio C Hamano [Mon, 18 Oct 2021 22:47:57 +0000 (15:47 -0700)] 
Merge branch 'tb/repack-write-midx'

"git repack" has been taught to generate multi-pack reachability
bitmaps.

* tb/repack-write-midx:
  test-read-midx: fix leak of bitmap_index struct
  builtin/repack.c: pass `--refs-snapshot` when writing bitmaps
  builtin/repack.c: make largest pack preferred
  builtin/repack.c: support writing a MIDX while repacking
  builtin/repack.c: extract showing progress to a variable
  builtin/repack.c: rename variables that deal with non-kept packs
  builtin/repack.c: keep track of existing packs unconditionally
  midx: preliminary support for `--refs-snapshot`
  builtin/multi-pack-index.c: support `--stdin-packs` mode
  midx: expose `write_midx_file_only()` publicly

2 years agoMerge branch 'js/retire-preserve-merges'
Junio C Hamano [Mon, 18 Oct 2021 22:47:56 +0000 (15:47 -0700)] 
Merge branch 'js/retire-preserve-merges'

The "--preserve-merges" option of "git rebase" has been removed.

* js/retire-preserve-merges:
  sequencer: restrict scope of a formerly public function
  rebase: remove a no-longer-used function
  rebase: stop mentioning the -p option in comments
  rebase: remove obsolete code comment
  rebase: drop the internal `rebase--interactive` command
  git-svn: drop support for `--preserve-merges`
  rebase: drop support for `--preserve-merges`
  pull: remove support for `--rebase=preserve`
  tests: stop testing `git rebase --preserve-merges`
  remote: warn about unhandled branch.<name>.rebase values
  t5520: do not use `pull.rebase=preserve`

2 years agoMerge branch 'rs/mergesort'
Junio C Hamano [Mon, 18 Oct 2021 22:47:56 +0000 (15:47 -0700)] 
Merge branch 'rs/mergesort'

The mergesort implementation used to sort linked list has been
optimized.

* rs/mergesort:
  test-mergesort: use repeatable random numbers
  mergesort: use ranks stack
  p0071: test performance of llist_mergesort()
  p0071: measure sorting of already sorted and reversed files
  test-mergesort: add unriffle_skewed mode
  test-mergesort: add unriffle mode
  test-mergesort: add generate subcommand
  test-mergesort: add test subcommand
  test-mergesort: add sort subcommand
  test-mergesort: use strbuf_getline()

2 years agotransport-helper: recognize "expecting report" error from send-pack
Jeff King [Mon, 18 Oct 2021 19:45:56 +0000 (15:45 -0400)] 
transport-helper: recognize "expecting report" error from send-pack

When a transport helper pushes via send-pack, it passes --helper-status
to get a machine-readable status back for each ref. The previous commit
taught the send-pack code to hand back "error expecting report" if the
server did not send us the proper ref-status. And that's enough to cause
us to recognize that an error occurred for the ref and print something
sensible in our final status table.

But we do interpret these messages on the remote-helper side to turn
them back into REF_STATUS_* enum values.  Recognizing this token to turn
it back into REF_STATUS_EXPECTING_REPORT has two advantages:

  1. We now print exactly the same message in the human-readable (and
     machine-readable --porcelain) output for this situation whether the
     transport went through a helper (e.g., http) or not (e.g., ssh).

  2. If any code in the helper really cares about distinguishing
     EXPECT_REPORT from more generic error conditions, it could now do
     so. I didn't find any, so this is mostly future-proofing.

So this is mostly cosmetic for now, but it seems like the
least-surprising thing for the transport-helper code to be doing.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosend-pack: complain about "expecting report" with --helper-status
Jeff King [Mon, 18 Oct 2021 19:43:47 +0000 (15:43 -0400)] 
send-pack: complain about "expecting report" with --helper-status

When pushing to a server which erroneously omits the final ref-status
report, the client side should complain about the refs for which we
didn't receive the status (because we can't just assume they were
updated). This works over most transports like ssh, but for http we'll
print a very misleading "Everything up-to-date".

It works for ssh because send-pack internally sets the status of each
ref to REF_STATUS_EXPECTING_REPORT, and then if the server doesn't tell
us about a particular ref, it will stay at that value. When we print the
final status table, we'll see that we're still on EXPECTING_REPORT and
complain then.

But for http, we go through remote-curl, which invokes send-pack with
"--stateless-rpc --helper-status". The latter option causes send-pack to
return a machine-readable list of ref statuses to the remote helper. But
ever since its inception in de1a2fdd38 (Smart push over HTTP: client
side, 2009-10-30), the send-pack code has simply omitted mention of any
ref which ended up in EXPECTING_REPORT.

In the remote helper, we then take the absence of any status report
from send-pack to mean that the ref was not even something we tried to
send, and thus it prints "Everything up-to-date". Fortunately it does
detect the eventual non-zero exit from send-pack, and propagates that in
its own non-zero exit code. So at least a careful script invoking "git
push" would notice the failure.  But sending the misleading message on
stderr is certainly confusing for humans (not to mention the
machine-readable "push --porcelain" output, though again, any careful
script should be checking the exit code from push, too).

Nobody seems to have noticed because the server in this instance has to
be misbehaving: it has promised to support the ref-status capability
(otherwise the client will not set EXPECTING_REPORT at all), but didn't
send us any. If the connection were simply cut, then send-pack would
complain about getting EOF while trying to read the status. But if the
server actually sends a flush packet (i.e., saying "now you have all of
the ref statuses" without actually sending any), then the client ends up
in this confused situation.

The fix is simple: we should return an error message from "send-pack
--helper-status", just like we would for any other error per-ref error
condition (in the test I included, the server simply omits all ref
status responses, but a more insidious version of this would skip only
some of them).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogpg-interface: fix leak of strbufs in get_ssh_key_fingerprint()
Jeff King [Mon, 18 Oct 2021 17:15:37 +0000 (13:15 -0400)] 
gpg-interface: fix leak of strbufs in get_ssh_key_fingerprint()

We read stdout from gpg into a strbuf, then split it into a list of
strbufs, pull out one element, and return it. But we don't free either
the original stdout buffer, nor the list returned from strbuf_split().

This patch fixes both. Note that we have to detach the returned string
from its strbuf before calling strbuf_list_free(), as that would
otherwise throw it away.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogpg-interface: fix leak of "line" in parse_ssh_output()
Jeff King [Mon, 18 Oct 2021 17:15:00 +0000 (13:15 -0400)] 
gpg-interface: fix leak of "line" in parse_ssh_output()

We xmemdupz() this buffer, but never free it. Let's do so. We'll use a
cleanup label, since there are multiple exits from the function.

Note that it was also declared a "const char *". We could switch that to
"char *" to indicate that it's allocated, but that make it awkward to
use with skip_prefix(). So instead, we'll introduce an extra non-const
pointer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot1092: run "rebase --apply" without "-q" in testing
Phillip Wood [Sat, 16 Oct 2021 09:07:09 +0000 (09:07 +0000)] 
t1092: run "rebase --apply" without "-q" in testing

We run a few operations and make sure they produce identical results
with and without sparse-index; the version we merged to the "next"
branch used the "-q" option to work around a breakage caused by a
version used at Microsoft with some unreleased changes, but since
we would want to make sure the commands produce identical results,
including reports given to the output that lists which commits were
picked, use of "-q" loses too much interesting information.

Let's drop "-q" from the command invocation and revisit the issue
when the problematic changes are upstreamed.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopkt-line.[ch]: remove unused packet_read_line_buf()
Ævar Arnfjörð Bjarmason [Thu, 14 Oct 2021 20:15:12 +0000 (22:15 +0200)] 
pkt-line.[ch]: remove unused packet_read_line_buf()

This function was added in 4981fe750b1 (pkt-line: share
buffer/descriptor reading implementation, 2013-02-23), but in
01f9ec64c8a (Use packet_reader instead of packet_read_line,
2018-12-29) the code that was using it was removed.

Since it's being removed we can in turn remove the "src" and "src_len"
arguments to packet_read(), all the remaining users just passed a
NULL/NULL pair to it.

That function is only a thin wrapper for packet_read_with_status()
which still needs those arguments, but for the thin packet_read()
convenience wrapper we can do away with it for now.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopkt-line.[ch]: remove unused packet_buf_write_len()
Ævar Arnfjörð Bjarmason [Thu, 14 Oct 2021 20:15:11 +0000 (22:15 +0200)] 
pkt-line.[ch]: remove unused packet_buf_write_len()

This function was added in f1f4d8acf40 (pkt-line: add
packet_buf_write_len function, 2018-03-15) for use in
0f1dc53f45d (remote-curl: implement stateless-connect command,
2018-03-15).

In a97d00799a1 (remote-curl: use post_rpc() for protocol v2 also,
2019-02-21) that only user of it went away, let's remove it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomidx.c: guard against commit_lock_file() failures
Taylor Blau [Fri, 8 Oct 2021 21:46:38 +0000 (17:46 -0400)] 
midx.c: guard against commit_lock_file() failures

When writing a MIDX, we atomically move the new MIDX into place via
commit_lock_file(), but do not check to see if that call was successful.

Make sure that we do check in order to prevent us from incorrectly
reporting that we wrote a new MIDX if we actually encountered an error.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>