]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoci: make it easier to find failed tests' logs in the GitHub workflow
Johannes Schindelin [Sat, 21 May 2022 22:18:49 +0000 (22:18 +0000)] 
ci: make it easier to find failed tests' logs in the GitHub workflow

When investigating a test failure, the time that matters most is the
time it takes from getting aware of the failure to displaying the output
of the failing test case.

You currently have to know a lot of implementation details when
investigating test failures in the CI runs. The first step is easy: the
failed job is marked quite clearly, but when opening it, the failed step
is expanded, which in our case is the one running
`ci/run-build-and-tests.sh`. This step, most notably, only offers a
high-level view of what went wrong: it prints the output of `prove`
which merely tells the reader which test script failed.

The actually interesting part is in the detailed log of said failed
test script. But that log is shown in the CI run's step that runs
`ci/print-test-failures.sh`. And that step is _not_ expanded in the web
UI by default. It is even marked as "successful", which makes it very
easy to miss that there is useful information hidden in there.

Let's help the reader by showing the failed tests' detailed logs in the
step that is expanded automatically, i.e. directly after the test suite
failed.

This also helps the situation where the _build_ failed and the
`print-test-failures` step was executed under the assumption that the
_test suite_ failed, and consequently failed to find any failed tests.

An alternative way to implement this patch would be to source
`ci/print-test-failures.sh` in the `handle_test_failures` function to
show these logs. However, over the course of the next few commits, we
want to introduce some grouping which would be harder to achieve that
way (for example, we do want a leaner, and colored, preamble for each
failed test script, and it would be trickier to accommodate the lack of
nested groupings in GitHub workflows' output).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci/run-build-and-tests: take a more high-level view
Johannes Schindelin [Sat, 21 May 2022 22:18:48 +0000 (22:18 +0000)] 
ci/run-build-and-tests: take a more high-level view

In the web UI of GitHub workflows, failed runs are presented with the
job step that failed auto-expanded. In the current setup, this is not
helpful at all because that shows only the output of `prove`, which says
which test failed, but not in what way.

What would help understand the reader what went wrong is the verbose
test output of the failed test.

The logs of the failed runs do contain that verbose test output, but it
is shown in the _next_ step (which is marked as succeeding, and is
therefore _not_ auto-expanded). Anyone not intimately familiar with this
would completely miss the verbose test output, being left mostly
puzzled with the test failures.

We are about to show the failed test cases' output in the _same_ step,
so that the user has a much easier time to figure out what was going
wrong.

But first, we must partially revert the change that tried to improve the
CI runs by combining the `Makefile` targets to build into a single
`make` invocation. That might have sounded like a good idea at the time,
but it does make it rather impossible for the CI script to determine
whether the _build_ failed, or the _tests_. If the tests were run at
all, that is.

So let's go back to calling `make` for the build, and call `make test`
separately so that we can easily detect that _that_ invocation failed,
and react appropriately.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotest(junit): avoid line feeds in XML attributes
Johannes Schindelin [Sat, 21 May 2022 22:18:47 +0000 (22:18 +0000)] 
test(junit): avoid line feeds in XML attributes

In the test case's output, we do want newline characters, but in the XML
attributes we do not want them.

However, the `xml_attr_encode` function always adds a Line Feed at the
end (which are then encoded as `&#x0a;`, even for XML attributes.

This seems not to faze Azure Pipelines' XML parser, but it still is
incorrect, so let's fix it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotests: refactor --write-junit-xml code
Johannes Schindelin [Sat, 21 May 2022 22:18:46 +0000 (22:18 +0000)] 
tests: refactor --write-junit-xml code

The code writing JUnit XML is interspersed directly with all the code in
`t/test-lib.sh`, and it is therefore not only ill-separated, but
introducing yet another output format would make the situation even
worse.

Let's introduce an abstraction layer by hiding the JUnit XML code behind
four new functions that are supposed to be called before and after each
test and test case.

This is not just an academic exercise, refactoring for refactoring's
sake. We _actually_ want to introduce such a new output format, to
make it substantially easier to diagnose test failures in our GitHub
workflow, therefore we do need this refactoring.

This commit is best viewed with `git show --color-moved
--color-moved-ws=allow-indentation-change <commit>`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: fix code style
Johannes Schindelin [Sat, 21 May 2022 22:18:45 +0000 (22:18 +0000)] 
ci: fix code style

In b92cb86ea14 (travis-ci: check that all build artifacts are
.gitignore-d, 2017-12-31), a function was introduced with a code style
that is different from the surrounding code: it added the opening curly
brace on its own line, when all the existing functions in the same file
cuddle that brace on the same line as the function name.

Let's make the code style consistent again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoFirst batch for 2.37
Junio C Hamano [Fri, 20 May 2022 22:23:57 +0000 (15:23 -0700)] 
First batch for 2.37

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'cb/ci-make-p4-optional'
Junio C Hamano [Fri, 20 May 2022 22:27:00 +0000 (15:27 -0700)] 
Merge branch 'cb/ci-make-p4-optional'

macOS CI jobs have been occasionally flaky due to tentative version
skew between perforce and the homebrew packager.  Instead of
failing the whole CI job, just let it skip the p4 tests when this
happens.

* cb/ci-make-p4-optional:
  ci: use https, not http to download binaries from perforce.com
  ci: reintroduce prevention from perforce being quarantined in macOS
  ci: avoid brew for installing perforce
  ci: make failure to find perforce more user friendly

3 years agoMerge branch 'tk/p4-metadata-coding-strategies'
Junio C Hamano [Fri, 20 May 2022 22:27:00 +0000 (15:27 -0700)] 
Merge branch 'tk/p4-metadata-coding-strategies'

"git p4" updates.

* tk/p4-metadata-coding-strategies:
  git-p4: improve encoding handling to support inconsistent encodings

3 years agoMerge branch 'ep/equals-null-cocci'
Junio C Hamano [Fri, 20 May 2022 22:26:59 +0000 (15:26 -0700)] 
Merge branch 'ep/equals-null-cocci'

Merges up ep/maint-equals-null-cocci to the current codebase.

* ep/equals-null-cocci:
  tree-wide: apply equals-null.cocci

3 years agoMerge branch 'ep/maint-equals-null-cocci'
Junio C Hamano [Fri, 20 May 2022 22:26:59 +0000 (15:26 -0700)] 
Merge branch 'ep/maint-equals-null-cocci'

Introduce and apply coccinelle rule to discourage an explicit
comparison between a pointer and NULL, and applies the clean-up to
the maintenance track.

* ep/maint-equals-null-cocci:
  tree-wide: apply equals-null.cocci
  tree-wide: apply equals-null.cocci
  contrib/coccinnelle: add equals-null.cocci

3 years agoMerge branch 'ds/sparse-colon-path'
Junio C Hamano [Fri, 20 May 2022 22:26:58 +0000 (15:26 -0700)] 
Merge branch 'ds/sparse-colon-path'

"git show :<path>" learned to work better with the sparse-index
feature.

* ds/sparse-colon-path:
  rev-parse: integrate with sparse index
  object-name: diagnose trees in index properly
  object-name: reject trees found in the index
  show: integrate with the sparse index
  t1092: add compatibility tests for 'git show'

3 years agoMerge branch 'vd/sparse-stash'
Junio C Hamano [Fri, 20 May 2022 22:26:58 +0000 (15:26 -0700)] 
Merge branch 'vd/sparse-stash'

Teach "git stash" to work better with sparse index entries.

* vd/sparse-stash:
  unpack-trees: preserve index sparsity
  stash: apply stash using 'merge_ort_nonrecursive()'
  read-cache: set sparsity when index is new
  sparse-index: expose 'is_sparse_index_allowed()'
  stash: integrate with sparse index
  stash: expand sparse-checkout compatibility testing

3 years agoMerge branch 'cd/bisect-messages-from-pre-flight-states'
Junio C Hamano [Fri, 20 May 2022 22:26:58 +0000 (15:26 -0700)] 
Merge branch 'cd/bisect-messages-from-pre-flight-states'

"git bisect" was too silent before it is ready to start computing
the actual bisection, which has been corrected.

* cd/bisect-messages-from-pre-flight-states:
  bisect: output bisect setup status in bisect log
  bisect: output state before we are ready to compute bisection

3 years agoMerge branch 'jc/update-ozlabs-url'
Junio C Hamano [Fri, 20 May 2022 22:26:58 +0000 (15:26 -0700)] 
Merge branch 'jc/update-ozlabs-url'

* jc/update-ozlabs-url:
  SubmittingPatches: use more stable git.ozlabs.org URL

3 years agoMerge branch 'gc/pull-recurse-submodules'
Junio C Hamano [Fri, 20 May 2022 22:26:57 +0000 (15:26 -0700)] 
Merge branch 'gc/pull-recurse-submodules'

"git pull" without "--recurse-submodules=<arg>" made
submodule.recurse take precedence over fetch.recurseSubmodules by
mistake, which has been corrected.

* gc/pull-recurse-submodules:
  pull: do not let submodule.recurse override fetch.recurseSubmodules

3 years agoMerge branch 'mg/detect-compiler-in-c-locale'
Junio C Hamano [Fri, 20 May 2022 22:26:56 +0000 (15:26 -0700)] 
Merge branch 'mg/detect-compiler-in-c-locale'

Build procedure fixup.

* mg/detect-compiler-in-c-locale:
  detect-compiler: make detection independent of locale

3 years agoMerge branch 'js/trace2-doc-fixes'
Junio C Hamano [Fri, 20 May 2022 22:26:56 +0000 (15:26 -0700)] 
Merge branch 'js/trace2-doc-fixes'

Trace2 documentation updates.

* js/trace2-doc-fixes:
  trace2 docs: add missing full stop
  trace2 docs: clarify what `varargs` is all about
  trace2 docs: fix a JSON formatted example
  trace2 docs: surround more terms in backticks
  trace2 docs: "printf" is not an English word
  trace2 docs: a couple of grammar fixes

3 years agoMerge branch 'mv/log-since-as-filter'
Junio C Hamano [Fri, 20 May 2022 22:26:56 +0000 (15:26 -0700)] 
Merge branch 'mv/log-since-as-filter'

"git log --since=X" will stop traversal upon seeing a commit that
is older than X, but there may be commits behind it that is younger
than X when the commit was created with a faulty clock.  A new
option is added to keep digging without stopping, and instead
filter out commits with timestamp older than X.

* mv/log-since-as-filter:
  log: "--since-as-filter" option is a non-terminating "--since" variant

3 years agoMerge branch 'rs/external-diff-tempfile'
Junio C Hamano [Fri, 20 May 2022 22:26:55 +0000 (15:26 -0700)] 
Merge branch 'rs/external-diff-tempfile'

The temporary files fed to external diff command are now generated
inside a new temporary directory under the same basename.

* rs/external-diff-tempfile:
  diff: use mks_tempfile_dt()
  tempfile: add mks_tempfile_dt()

3 years agoMerge branch 'kf/p4-multiple-remotes'
Junio C Hamano [Fri, 20 May 2022 22:26:55 +0000 (15:26 -0700)] 
Merge branch 'kf/p4-multiple-remotes'

"git p4" update.

* kf/p4-multiple-remotes:
  git-p4: fix issue with multiple perforce remotes

3 years agoMerge branch 'tk/p4-with-explicity-sync'
Junio C Hamano [Fri, 20 May 2022 22:26:55 +0000 (15:26 -0700)] 
Merge branch 'tk/p4-with-explicity-sync'

"git p4" update.

* tk/p4-with-explicity-sync:
  git-p4: support explicit sync of arbitrary existing git-p4 refs

3 years agoMerge branch 'tk/p4-utf8-bom'
Junio C Hamano [Fri, 20 May 2022 22:26:54 +0000 (15:26 -0700)] 
Merge branch 'tk/p4-utf8-bom'

"git p4" update.

* tk/p4-utf8-bom:
  git-p4: preserve utf8 BOM when importing from p4 to git

3 years agoMerge branch 'cg/vscode-with-gdb'
Junio C Hamano [Fri, 20 May 2022 22:26:54 +0000 (15:26 -0700)] 
Merge branch 'cg/vscode-with-gdb'

VS code configuration updates.

* cg/vscode-with-gdb:
  contrib/vscode/: debugging with VS Code and gdb

3 years agoMerge branch 'sa/t1011-use-helpers'
Junio C Hamano [Fri, 20 May 2022 22:26:54 +0000 (15:26 -0700)] 
Merge branch 'sa/t1011-use-helpers'

A GSoC practice.

* sa/t1011-use-helpers:
  t1011: replace test -f with test_path_is_file

3 years agoMerge branch 'km/t3501-use-test-helpers'
Junio C Hamano [Fri, 20 May 2022 22:26:54 +0000 (15:26 -0700)] 
Merge branch 'km/t3501-use-test-helpers'

Test script updates.

* km/t3501-use-test-helpers:
  t3501: remove test -f and stop ignoring git <cmd> exit code

3 years agoMerge branch 'pb/submodule-recurse-mode-enum'
Junio C Hamano [Fri, 20 May 2022 22:26:53 +0000 (15:26 -0700)] 
Merge branch 'pb/submodule-recurse-mode-enum'

Small code clean-up.

* pb/submodule-recurse-mode-enum:
  submodule.h: use a named enum for RECURSE_SUBMODULES_*

3 years agoMerge branch 'ah/convert-warning-message'
Junio C Hamano [Fri, 20 May 2022 22:26:53 +0000 (15:26 -0700)] 
Merge branch 'ah/convert-warning-message'

Update a few end-user facing messages around eol conversion.

* ah/convert-warning-message:
  convert: clarify line ending conversion warning

3 years agoMerge branch 'gf/unused-includes'
Junio C Hamano [Fri, 20 May 2022 22:26:53 +0000 (15:26 -0700)] 
Merge branch 'gf/unused-includes'

Remove unused includes.

* gf/unused-includes:
  apply.c: remove unnecessary include
  serve.c: remove unnecessary include

3 years agoMerge branch 'gf/shorthand-version-and-help'
Junio C Hamano [Fri, 20 May 2022 22:26:52 +0000 (15:26 -0700)] 
Merge branch 'gf/shorthand-version-and-help'

"git -v" and "git -h" are now understood as "git --version" and
"git --help".

* gf/shorthand-version-and-help:
  cli: add -v and -h shorthands

3 years agoMerge branch 'rs/t7812-pcre2-ws-bug-test'
Junio C Hamano [Fri, 20 May 2022 22:26:52 +0000 (15:26 -0700)] 
Merge branch 'rs/t7812-pcre2-ws-bug-test'

A test to ensure workaround for an earlier pcre2 bug does work.

* rs/t7812-pcre2-ws-bug-test:
  t7812: test PCRE2 whitespace bug

3 years agoMerge branch 'ds/do-not-call-bug-on-bad-refs'
Junio C Hamano [Fri, 20 May 2022 22:26:52 +0000 (15:26 -0700)] 
Merge branch 'ds/do-not-call-bug-on-bad-refs'

Code clean-up.

* ds/do-not-call-bug-on-bad-refs:
  clone: die() instead of BUG() on bad refs

3 years agoMerge branch 'sg/safe-directory-tests-and-docs'
Junio C Hamano [Fri, 20 May 2022 22:26:52 +0000 (15:26 -0700)] 
Merge branch 'sg/safe-directory-tests-and-docs'

New tests for the safe.directory mechanism.

* sg/safe-directory-tests-and-docs:
  safe.directory: document and check that it's ignored in the environment
  t0033-safe-directory: check when 'safe.directory' is ignored
  t0033-safe-directory: check the error message without matching the trash dir

3 years agoci: use https, not http to download binaries from perforce.com
Ævar Arnfjörð Bjarmason [Thu, 12 May 2022 22:39:40 +0000 (15:39 -0700)] 
ci: use https, not http to download binaries from perforce.com

Since 522354d70f4 (Add Travis CI support, 2015-11-27) the CI has used
http://filehost.perforce.com/perforce/ to download binaries from
filehost.perforce.com, they were then moved to this script in
657343a602e (travis-ci: move Travis CI code into dedicated scripts,
2017-09-10).

Let's use https instead for good measure. I don't think we need to
worry about the DNS or network between the GitHub CI and perforce.com
being MitM'd, but using https gives us extra validation of the payload
at least, and is one less thing to worry about when checking where
else we rely on non-TLS'd http connections.

Also, use the same download site at perforce.com for Linux and macOS
tarballs for consistency.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: reintroduce prevention from perforce being quarantined in macOS
Carlo Marcelo Arenas Belón [Thu, 12 May 2022 22:39:39 +0000 (15:39 -0700)] 
ci: reintroduce prevention from perforce being quarantined in macOS

5ed9fc3fc86 (ci: prevent `perforce` from being quarantined, 2020-02-27)
introduces this prevention for brew, but brew has been removed in a
previous commit, so reintroduce an equivalent option to avoid a possible
regression.

This doesn't affect github actions (as configure now) and is therefore
done silently to avoid any possible scary irrelevant messages.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: avoid brew for installing perforce
Carlo Marcelo Arenas Belón [Thu, 12 May 2022 22:39:38 +0000 (15:39 -0700)] 
ci: avoid brew for installing perforce

Perfoce's cask in brew is meant[1] to be used only by humans, so replace
its use from the CI with a scripted binary download which is less likely
to fail, as it is done in Linux.

Kept the logic together so it will be less likely to break when moved
around as on the fly code changes in this area are settled, at which
point it will also feasable to ammend it to avoid some of the hardcoded
values by using similar variables to the ones Linux does.

In that same line, a POSIX sh syntax is used instead of the similar one
used in Linux in preparation for an unrelated future change that might
change the shell currently configured for it.

This change reintroduces the risk that the installed binaries might not
work because of being quarantined that was fixed with 5ed9fc3fc86 (ci:
prevent `perforce` from being quarantined, 2020-02-27) but fixing that
now was also punted for simplicity and since the affected cloud provider
is scheduled to be retired with an on the fly change, but should be
addressed if that other change is not integrated further.

The discussion on the need to keep 2 radically different versions of
the binaries to be tested with Linux vs macOS or how to upgrade to
newer versions now that brew won't do that automatically for us has
been punted for now as well.  On that line the now obsolete comment
about it in lib.sh was originally being updated by this change but
created conflicts as it is moved around by other on the fly changes,
so will be addressed independently as well.

[1] https://github.com/Homebrew/homebrew-cask/pull/122347#discussion_r856026584

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: make failure to find perforce more user friendly
Carlo Marcelo Arenas Belón [Thu, 12 May 2022 22:39:37 +0000 (15:39 -0700)] 
ci: make failure to find perforce more user friendly

In preparation for a future change that will make perforce installation
optional in macOS, make sure that the check for it is done without
triggering scary looking errors and add a user friendly message instead.

All other existing uses of 'type <cmd>' in our shell scripts that
check the availability of a command <cmd> send both standard output
and error stream to /dev/null to squelch "<cmd> not found" diagnostic
output, but this script left the standard error stream shown.

Redirect it just like everybody else to squelch this error message that
we fully expect to see.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopull: do not let submodule.recurse override fetch.recurseSubmodules
Glen Choo [Tue, 10 May 2022 19:25:47 +0000 (19:25 +0000)] 
pull: do not let submodule.recurse override fetch.recurseSubmodules

Fix a bug in "git pull" where `submodule.recurse` is preferred over
`fetch.recurseSubmodules` when performing a fetch
(Documentation/config/fetch.txt says that `fetch.recurseSubmodules`
should be preferred.). Do this by passing the value of the
"--recurse-submodules" CLI option to the underlying fetch, instead of
passing a value that combines the CLI option and config variables.

In other words, this bug occurred because builtin/pull.c is conflating
two similar-sounding, but different concepts:

- Whether "git pull" itself should care about submodules e.g. whether it
  should update the submodule worktrees after performing a merge.
- The value of "--recurse-submodules" to pass to the underlying "git
  fetch".

Thus, when `submodule.recurse` is set, the underlying "git fetch" gets
invoked with "--recurse-submodules[=value]", overriding the value of
`fetch.recurseSubmodules`.

An alternative (and more obvious) approach to fix the bug would be to
teach "git pull" to understand `fetch.recurseSubmodules`, but the
proposed solution works better because:

- We don't maintain two identical config-parsing implementions in "git
  pull" and "git fetch".
- It works better with other commands invoked by "git pull" e.g. "git
  merge" won't accidentally respect `fetch.recurseSubmodules`.

Reported-by: Huang Zou <huang.zou@schrodinger.com>
Helped-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosecond 0th batch of topics from the previous cycle
Junio C Hamano [Wed, 11 May 2022 20:56:07 +0000 (13:56 -0700)] 
second 0th batch of topics from the previous cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'rs/commit-summary-wo-break-rewrite'
Junio C Hamano [Wed, 11 May 2022 20:56:22 +0000 (13:56 -0700)] 
Merge branch 'rs/commit-summary-wo-break-rewrite'

The commit summary shown after making a commit is matched to what
is given in "git status" not to use the break-rewrite heuristics.

* rs/commit-summary-wo-break-rewrite:
  commit, sequencer: turn off break_opt for commit summary

3 years agoMerge branch 'pw/test-malloc-with-sanitize-address'
Junio C Hamano [Wed, 11 May 2022 20:56:22 +0000 (13:56 -0700)] 
Merge branch 'pw/test-malloc-with-sanitize-address'

Avoid problems from interaction between malloc_check and address
sanitizer.

* pw/test-malloc-with-sanitize-address:
  tests: make SANITIZE=address imply TEST_NO_MALLOC_CHECK

3 years agoMerge branch 'ea/rebase-code-simplify'
Junio C Hamano [Wed, 11 May 2022 20:56:22 +0000 (13:56 -0700)] 
Merge branch 'ea/rebase-code-simplify'

Code clean-up.

* ea/rebase-code-simplify:
  rebase: simplify an assignment of options.type in cmd_rebase

3 years agoMerge branch 'kt/commit-graph-plug-fp-leak-on-error'
Junio C Hamano [Wed, 11 May 2022 20:56:22 +0000 (13:56 -0700)] 
Merge branch 'kt/commit-graph-plug-fp-leak-on-error'

Fix a leak of FILE * in an error codepath.

* kt/commit-graph-plug-fp-leak-on-error:
  commit-graph: close file before returning NULL

3 years agoMerge branch 'ah/rebase-keep-base-fix'
Junio C Hamano [Wed, 11 May 2022 20:56:21 +0000 (13:56 -0700)] 
Merge branch 'ah/rebase-keep-base-fix'

"git rebase --keep-base <upstream> <branch-to-rebase>" computed the
commit to rebase onto incorrectly, which has been corrected.

* ah/rebase-keep-base-fix:
  rebase: use correct base for --keep-base when a branch is given

3 years agobisect: output bisect setup status in bisect log
Chris Down [Wed, 11 May 2022 18:00:14 +0000 (19:00 +0100)] 
bisect: output bisect setup status in bisect log

This allows seeing the current intermediate status without adding a new
good or bad commit:

    $ git bisect log | tail -1
    # status: waiting for bad commit, 1 good commit known

Signed-off-by: Chris Down <chris@chrisdown.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobisect: output state before we are ready to compute bisection
Chris Down [Wed, 11 May 2022 18:00:09 +0000 (19:00 +0100)] 
bisect: output state before we are ready to compute bisection

Commit 73c6de06aff8 ("bisect: don't use invalid oid as rev when
starting") changes the behaviour of `git bisect` to consider invalid
oids as pathspecs again, as in the old shell implementation.

While that behaviour may be desirable, it can also cause confusion. For
example, while bisecting in a particular repo I encountered this:

    $ git bisect start d93ff48803f0 v6.3
    $

...which led to me sitting for a few moments, wondering why there's no
printout stating the first rev to check.

It turns out that the tag was actually "6.3", not "v6.3", and thus the
bisect was still silently started with only a bad rev, because
d93ff48803f0 was a valid oid and "v6.3" was silently considered to be a
pathspec.

While this behaviour may be desirable, it can be confusing, especially
with different repo conventions either using or not using "v" before
release names, or when a branch name or tag is simply misspelled on the
command line.

In order to avoid situations like this, make it more clear what we're
waiting for:

    $ git bisect start d93ff48803f0 v6.3
    status: waiting for good commit(s), bad commit known

We already have good output once the bisect process has begun in
earnest, so we don't need to do anything more there.

Signed-off-by: Chris Down <chris@chrisdown.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'master' of git://git.ozlabs.org/~paulus/gitk
Junio C Hamano [Wed, 11 May 2022 15:25:02 +0000 (08:25 -0700)] 
Merge branch 'master' of git://git.ozlabs.org/~paulus/gitk

* 'master' of git://git.ozlabs.org/~paulus/gitk:
  gitk: include y coord in recorded sash position
  gitk: trivial indentation fix

3 years agoSubmittingPatches: use more stable git.ozlabs.org URL
Junio C Hamano [Wed, 11 May 2022 15:10:12 +0000 (08:10 -0700)] 
SubmittingPatches: use more stable git.ozlabs.org URL

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogitk: include y coord in recorded sash position
halilsen [Sun, 20 Feb 2022 19:47:36 +0000 (19:47 +0000)] 
gitk: include y coord in recorded sash position

6cd80496e9 ("gitk: Resize panes correctly when reducing window size",
2020-10-03) introduces a mechanism to record previously-set sash
positions to make sure that correct values are used while computing
resize proportions. However, if we are not using ttk, then sash
represents only the x coordinate and the recorded sash (`oldsash`) only
includes the x coordinate. When we need to access the y coordinate via
the recorded sash position, we generate the following Application Error
popup:

Error: expected integer but got ""

expected integer but got ""

expected integer but got ""

     while executing

"$win sash place 0 $sash0 [lindex $s0 1]"

     (procedure "resizeclistpanes" line 38)

     invoked from within

"resizeclistpanes .tf.histframe.pwclist 2818"

     (command bound to event)

To fix this, if we are not using ttk, we append the sash positions with
the y coordinates before recording them to match the use_ttk case.

Signed-off-by: Halil Sen <halil.sen@gmail.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
3 years agogitk: trivial indentation fix
halilsen [Sun, 20 Feb 2022 19:47:35 +0000 (19:47 +0000)] 
gitk: trivial indentation fix

No functional changes.

Signed-off-by: Halil Sen <halil.sen@gmail.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
3 years ago0th batch for topics from the previous cycle
Junio C Hamano [Wed, 11 May 2022 00:36:46 +0000 (17:36 -0700)] 
0th batch for topics from the previous cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ea/progress-partial-blame'
Junio C Hamano [Wed, 11 May 2022 00:41:11 +0000 (17:41 -0700)] 
Merge branch 'ea/progress-partial-blame'

The progress meter of "git blame" was showing incorrect numbers
when processing only parts of the file.

* ea/progress-partial-blame:
  blame: report correct number of lines in progress when using ranges

3 years agoMerge branch 'fr/vimdiff-layout'
Junio C Hamano [Wed, 11 May 2022 00:41:11 +0000 (17:41 -0700)] 
Merge branch 'fr/vimdiff-layout'

Reimplement "vimdiff[123]" mergetool drivers with a more generic
layout mechanism.

* fr/vimdiff-layout:
  mergetools: add description to all diff/merge tools
  vimdiff: add tool documentation
  vimdiff: integrate layout tests in the unit tests framework ('t' folder)
  vimdiff: new implementation with layout support

3 years agoMerge branch 'jh/p4-various-fixups'
Junio C Hamano [Wed, 11 May 2022 00:41:11 +0000 (17:41 -0700)] 
Merge branch 'jh/p4-various-fixups'

Various cleanups to "git p4".

* jh/p4-various-fixups: (22 commits)
  git-p4: sort imports
  git-p4: seperate multiple statements onto seperate lines
  git-p4: move inline comments to line above
  git-p4: only seperate code blocks by a single empty line
  git-p4: compare to singletons with "is" and "is not"
  git-p4: normalize indentation of lines in conditionals
  git-p4: ensure there is a single space around all operators
  git-p4: ensure every comment has a single #
  git-p4: remove spaces between dictionary keys and colons
  git-p4: remove redundant backslash-continuations inside brackets
  git-p4: remove extraneous spaces before function arguments
  git-p4: place a single space after every comma
  git-p4: removed brackets when assigning multiple return values
  git-p4: remove spaces around default arguments
  git-p4: remove padding from lists, tuples and function arguments
  git-p4: sort and de-duplcate pylint disable list
  git-p4: remove commented code
  git-p4: convert descriptive class and function comments into docstrings
  git-p4: improve consistency of docstring formatting
  git-p4: indent with 4-spaces
  ...

3 years agoMerge branch 'tk/untracked-cache-with-uall'
Junio C Hamano [Wed, 11 May 2022 00:41:10 +0000 (17:41 -0700)] 
Merge branch 'tk/untracked-cache-with-uall'

The performance of the "untracked cache" feature has been improved
when "--untracked-files=<mode>" and "status.showUntrackedFiles"
are combined.

* tk/untracked-cache-with-uall:
  untracked-cache: support '--untracked-files=all' if configured
  untracked-cache: test untracked-cache-bypassing behavior with -uall

3 years agoMerge branch 'ab/misc-cleanup'
Junio C Hamano [Wed, 11 May 2022 00:41:10 +0000 (17:41 -0700)] 
Merge branch 'ab/misc-cleanup'

Code clean-up.

* ab/misc-cleanup:
  alloc.[ch]: remove alloc_report() function
  object-store.h: remove unused has_sha1_file*()
  pack-bitmap-write: remove unused bitmap_reset() function
  xdiff/xmacros.h: remove unused XDL_PTRFREE
  configure.ac: remove USE_PIC comment
  run-command.h: remove always unused "clean_on_exit_handler_cbdata"

3 years agounpack-trees: preserve index sparsity
Victoria Dye [Tue, 10 May 2022 23:32:32 +0000 (23:32 +0000)] 
unpack-trees: preserve index sparsity

When unpacking trees, set the default sparsity of the resultant index based
on repo settings and 'is_sparse_index_allowed()'.

Normally, when executing 'unpack_trees', the output index is marked sparse
when (and only when) it unpacks a sparse directory. However, an index may be
"sparse" even if it contains no sparse directories - when all files fall
inside the sparse-checkout definition or otherwise have SKIP_WORKTREE
disabled. Therefore, the output index may be marked "full" even when it is
"sparse", resulting in unnecessary 'ensure_full_index' calls when writing to
disk. Avoid this by setting the "default" index sparsity to match what is
expected for the repository.

As a consequence of this fix, the (non-merge) 'read-tree' performed when
applying a stash with untracked files no longer expands the index. Update
the corresponding test in 't1092'.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostash: apply stash using 'merge_ort_nonrecursive()'
Victoria Dye [Tue, 10 May 2022 23:32:31 +0000 (23:32 +0000)] 
stash: apply stash using 'merge_ort_nonrecursive()'

Update 'stash' to use 'merge_ort_nonrecursive()' to apply a stash to the
current working tree. When 'git stash apply' was converted from its shell
script implementation to a builtin in 8a0fc8d19d (stash: convert apply to
builtin, 2019-02-25), 'merge_recursive_generic()' was used to merge a stash
into the working tree as part of 'git stash (apply|pop)'. However, with the
single merge base used in 'do_apply_stash()', the commit wrapping done by
'merge_recursive_generic()' is not only unnecessary, but misleading (the
*real* merge base is labeled "constructed merge base"). Therefore, a
non-recursive merge of the working tree, stashed tree, and stash base tree
is more appropriate.

There are two options for a non-recursive merge-then-update-worktree
function: 'merge_trees()' and 'merge_ort_nonrecursive()'. Use
'merge_ort_nonrecursive()' to align with the default merge strategy used by
'git merge' (6a5fb96672 (Change default merge backend from recursive to ort,
2021-08-04)) and, because merge-ort does not operate in-place on the index,
avoid unnecessary index expansion. Update tests in 't1092' verifying index
expansion for 'git stash' accordingly.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoread-cache: set sparsity when index is new
Victoria Dye [Tue, 10 May 2022 23:32:30 +0000 (23:32 +0000)] 
read-cache: set sparsity when index is new

When the index read in 'do_read_index()' does not exist on-disk, mark the
index "sparse" if the executing command does not require a full index and
sparse index is otherwise enabled.

Some commands (such as 'git stash -u') implicitly create a new index (when
the 'GIT_INDEX_FILE' variable points to a non-existent file) and perform
some operation on it. However, when this index is created, it isn't created
with the same sparsity settings as the repo index. As a result, while these
indexes may be sparse during the operation, they are always expanded before
being written to disk. We can avoid that expansion by defaulting the index
to "sparse", in which case it will only be expanded if the full index is
needed.

Note that the function 'set_new_index_sparsity()' is created despite having
only a single caller because additional callers will be added in a
subsequent patch.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosparse-index: expose 'is_sparse_index_allowed()'
Victoria Dye [Tue, 10 May 2022 23:32:29 +0000 (23:32 +0000)] 
sparse-index: expose 'is_sparse_index_allowed()'

Expose 'is_sparse_index_allowed()' publicly so that it may be used by
callers outside of 'sparse-index.c'. While no such callers exist yet, it
will be used in a subsequent commit.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostash: integrate with sparse index
Victoria Dye [Tue, 10 May 2022 23:32:28 +0000 (23:32 +0000)] 
stash: integrate with sparse index

Enable sparse index in 'git stash' by disabling
'command_requires_full_index'.

With sparse index enabled, some subcommands of 'stash' work without
expanding the index, e.g., 'git stash', 'git stash list', 'git stash drop',
etc. Others ensure the index is expanded either directly (as in the case of
'git stash [pop|apply]', where the call to 'merge_recursive_generic()' in
'do_apply_stash()' triggers the expansion), or in a command called
internally by stash (e.g., 'git update-index' in 'git stash -u'). So, in
addition to enabling sparse index, add tests to 't1092' demonstrating which
variants of 'git stash' expand the index, and which do not.

Finally, add the option to skip writing 'untracked.txt' in
'ensure_not_expanded', and use that option to successfully apply stashed
untracked files without a conflict in 'untracked.txt'.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostash: expand sparse-checkout compatibility testing
Victoria Dye [Tue, 10 May 2022 23:32:27 +0000 (23:32 +0000)] 
stash: expand sparse-checkout compatibility testing

Add tests verifying expected 'git stash' behavior in
't1092-sparse-checkout-compatibility'. These cases establish the expected
behavior of 'git stash' in a sparse-checkout and verify consistency both
with and without a sparse index. Although no sparse index compatibility has
been integrated into 'git stash' yet, the tests are all 'expect_success' -
we don't want the cone-mode sparse-checkout behavior to change depending on
whether it is using a sparse index or not. Therefore, we expect these tests
to continue passing once sparse index is integrated with 'git stash'.

Additionally, add performance test cases for 'git stash' both with and
without untracked files. Note that, unlike the other tests in
'p2000-sparse-operations.sh', the tests added for 'stash' are combination
operations. This is done to ensure the stash/unstash is not blocked by the
modification of '$SPARSE_CONE/a' performed as part of 'test_perf_on_all'.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodetect-compiler: make detection independent of locale
Michael J Gruber [Mon, 9 May 2022 11:22:02 +0000 (13:22 +0200)] 
detect-compiler: make detection independent of locale

`detect-compiler` has accumulated a few compiler dependent workarounds
lately for the more and more ubiquitious gcc12. This is intended to make
CI set-ups work across tool-chain updates, but also help those
developers who build with `DEVELOPER=1`.

Alas, `detect-compiler` uses the locale dependent output of `$(CC) -v`
to parse for the version string, which fails unless it literally
contains ` version`.

Use `LANG=C $(CC) -v` instead to grep for stable output.

Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSync with v2.36.1
Junio C Hamano [Thu, 5 May 2022 21:39:03 +0000 (14:39 -0700)] 
Sync with v2.36.1

3 years agoGit 2.36.1 v2.36.1
Junio C Hamano [Thu, 5 May 2022 21:36:37 +0000 (14:36 -0700)] 
Git 2.36.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ab/cc-package-fixes' into maint
Junio C Hamano [Thu, 5 May 2022 21:36:25 +0000 (14:36 -0700)] 
Merge branch 'ab/cc-package-fixes' into maint

Correct choices of C compilers used in various CI jobs.
source: <patch-v3-1.1-8b3444ecc87-20220422T092015Z-avarab@gmail.com>

* ab/cc-package-fixes:
  CI: select CC based on CC_PACKAGE (again)

3 years agoMerge branch 'jc/cocci-xstrdup-or-null-fix' into maint
Junio C Hamano [Thu, 5 May 2022 21:36:25 +0000 (14:36 -0700)] 
Merge branch 'jc/cocci-xstrdup-or-null-fix' into maint

Get rid of a bogus and over-eager coccinelle rule.
source: <xmqq1qxd6e4x.fsf@gitster.g>

* jc/cocci-xstrdup-or-null-fix:
  cocci: drop bogus xstrdup_or_null() rule

3 years agoMerge branch 'rs/format-patch-pathspec-fix' into maint
Junio C Hamano [Thu, 5 May 2022 21:36:25 +0000 (14:36 -0700)] 
Merge branch 'rs/format-patch-pathspec-fix' into maint

"git format-patch <args> -- <pathspec>" lost the pathspec when
showing the second and subsequent commits, which has been
corrected.
source: <c36896a1-6247-123b-4fa3-b7eb24af1897@web.de>

* rs/format-patch-pathspec-fix:
  2.36 format-patch regression fix

3 years agoMerge branch 'rs/fast-export-pathspec-fix' into maint
Junio C Hamano [Thu, 5 May 2022 21:36:25 +0000 (14:36 -0700)] 
Merge branch 'rs/fast-export-pathspec-fix' into maint

"git fast-export -- <pathspec>" lost the pathspec when showing the
second and subsequent commits, which has been corrected.
source: <2c988c7b-0efe-4222-4a43-8124fe1a9da6@web.de>

* rs/fast-export-pathspec-fix:
  2.36 fast-export regression fix

3 years agoMerge branch 'jc/show-pathspec-fix' into maint
Junio C Hamano [Thu, 5 May 2022 21:36:24 +0000 (14:36 -0700)] 
Merge branch 'jc/show-pathspec-fix' into maint

"git show <commit1> <commit2>... -- <pathspec>" lost the pathspec
when showing the second and subsequent commits, which has been
corrected.
source: <xmqqo80j87g0.fsf_-_@gitster.g>

* jc/show-pathspec-fix:
  2.36 show regression fix

3 years agoMerge branch 'rs/name-rev-fix-free-after-use' into maint
Junio C Hamano [Thu, 5 May 2022 21:36:24 +0000 (14:36 -0700)] 
Merge branch 'rs/name-rev-fix-free-after-use' into maint

Regression fix for 2.36 where "git name-rev" started to sometimes
reference strings after they are freed.

This fixes a regression in 2.36 and is slate to go to 2.36.1
source: <340c8810-d912-7b18-d46e-a9d43f20216a@web.de>

* rs/name-rev-fix-free-after-use:
  Revert "name-rev: release unused name strings"

3 years agoMerge branch 'jc/diff-tree-stdin-fix' into maint
Junio C Hamano [Thu, 5 May 2022 21:36:24 +0000 (14:36 -0700)] 
Merge branch 'jc/diff-tree-stdin-fix' into maint

"diff-tree --stdin" has been broken for about a year, but 2.36
release broke it even worse by breaking running the command with
<pathspec>, which in turn broke "gitk" and got noticed.  This has
been corrected by aligning its behaviour to that of "log".

This fixes a regression in 2.36 and is slate to go to 2.36.1
source: <xmqq7d7bsu2n.fsf@gitster.g>

* jc/diff-tree-stdin-fix:
  2.36 gitk/diff-tree --stdin regression fix

3 years agoMerge branch 'gc/submodule-update-part2' into maint
Junio C Hamano [Thu, 5 May 2022 21:36:24 +0000 (14:36 -0700)] 
Merge branch 'gc/submodule-update-part2' into maint

"git submodule update" without pathspec should silently skip an
uninitialized submodule, but it started to become noisy by mistake.

This fixes a regression in 2.36 and is slate to go to 2.36.1
source: <pull.1258.v2.git.git.1650890741430.gitgitgadget@gmail.com>

* gc/submodule-update-part2:
  submodule--helper: fix initialization of warn_if_uninitialized

3 years agotrace2 docs: add missing full stop
Johannes Schindelin [Tue, 3 May 2022 10:26:47 +0000 (10:26 +0000)] 
trace2 docs: add missing full stop

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotrace2 docs: clarify what `varargs` is all about
Johannes Schindelin [Tue, 3 May 2022 10:26:46 +0000 (10:26 +0000)] 
trace2 docs: clarify what `varargs` is all about

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotrace2 docs: fix a JSON formatted example
Johannes Schindelin [Tue, 3 May 2022 10:26:45 +0000 (10:26 +0000)] 
trace2 docs: fix a JSON formatted example

The example was not in valid JSON format due to a duplicate key "sid".

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotrace2 docs: surround more terms in backticks
Johannes Schindelin [Tue, 3 May 2022 10:26:44 +0000 (10:26 +0000)] 
trace2 docs: surround more terms in backticks

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotrace2 docs: "printf" is not an English word
Johannes Schindelin [Tue, 3 May 2022 10:26:43 +0000 (10:26 +0000)] 
trace2 docs: "printf" is not an English word

We append an ellipsis and enclose it in backticks to indicate that it is
a function elsewhere, let's also use that here.

While at it, ensure the same for `waitpid()`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotrace2 docs: a couple of grammar fixes
Johannes Schindelin [Tue, 3 May 2022 10:26:42 +0000 (10:26 +0000)] 
trace2 docs: a couple of grammar fixes

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-p4: improve encoding handling to support inconsistent encodings
Tao Klerks [Sat, 30 Apr 2022 19:26:52 +0000 (19:26 +0000)] 
git-p4: improve encoding handling to support inconsistent encodings

git-p4 is designed to run correctly under python2.7 and python3, but
its functional behavior wrt importing user-entered text differs across
these environments:

Under python2, git-p4 "naively" writes the Perforce bytestream into git
metadata (and does not set an "encoding" header on the commits); this
means that any non-utf-8 byte sequences end up creating invalidly-encoded
commit metadata in git.

Under python3, git-p4 attempts to decode the Perforce bytestream as utf-8
data, and fails badly (with an unhelpful error) when non-utf-8 data is
encountered.

Perforce clients (especially p4v) encourage user entry of changelist
descriptions (and user full names) in OS-local encoding, and store the
resulting bytestream to the server unmodified - such that different
clients can end up creating mutually-unintelligible messages. The most
common inconsistency, in many Perforce environments, is likely to be utf-8
(typical in linux) vs cp-1252 (typical in windows).

Make the changelist-description- and user-fullname-handling code
python-runtime-agnostic, introducing three "strategies" selectable via
config:
- 'passthrough', behaving as previously under python2,
- 'strict', behaving as previously under python3, and
- 'fallback', favoring utf-8 but supporting a secondary encoding when
utf-8 decoding fails, and finally escaping high-range bytes if the
decoding with the secondary encoding also fails.

Keep the python2 default behavior as-is ('legacy' strategy), but switch
the python3 default strategy to 'fallback' with default fallback encoding
'cp1252'.

Also include tests exercising these encoding strategies, documentation for
the new config, and improve the user-facing error messages when decoding
does fail.

Signed-off-by: Tao Klerks <tao@klerks.biz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoA bit more regression fixes for 2.36
Junio C Hamano [Wed, 4 May 2022 16:51:39 +0000 (09:51 -0700)] 
A bit more regression fixes for 2.36

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'cm/reftable-0-length-memset'
Junio C Hamano [Wed, 4 May 2022 16:51:29 +0000 (09:51 -0700)] 
Merge branch 'cm/reftable-0-length-memset'

Code clean-up.

* cm/reftable-0-length-memset:
  reftable: avoid undefined behaviour breaking t0032

3 years agoMerge branch 'ab/cc-package-fixes'
Junio C Hamano [Wed, 4 May 2022 16:51:29 +0000 (09:51 -0700)] 
Merge branch 'ab/cc-package-fixes'

Correct choices of C compilers used in various CI jobs.

* ab/cc-package-fixes:
  CI: select CC based on CC_PACKAGE (again)

3 years agoMerge branch 'ds/midx-normalize-pathname-before-comparison'
Junio C Hamano [Wed, 4 May 2022 16:51:29 +0000 (09:51 -0700)] 
Merge branch 'ds/midx-normalize-pathname-before-comparison'

The path taken by "git multi-pack-index" command from the end user
was compared with path internally prepared by the tool withut first
normalizing, which lead to duplicated paths not being noticed,
which has been corrected.

* ds/midx-normalize-pathname-before-comparison:
  cache: use const char * for get_object_directory()
  multi-pack-index: use --object-dir real path
  midx: use real paths in lookup_multi_pack_index()

3 years agoMerge branch 'jc/cocci-xstrdup-or-null-fix'
Junio C Hamano [Wed, 4 May 2022 16:51:28 +0000 (09:51 -0700)] 
Merge branch 'jc/cocci-xstrdup-or-null-fix'

Get rid of a bogus and over-eager coccinelle rule.

* jc/cocci-xstrdup-or-null-fix:
  cocci: drop bogus xstrdup_or_null() rule

3 years agoMerge branch 'jc/clone-remote-name-leak-fix'
Junio C Hamano [Wed, 4 May 2022 16:51:28 +0000 (09:51 -0700)] 
Merge branch 'jc/clone-remote-name-leak-fix'

"git clone --origin X" leaked piece of memory that held value read
from the clone.defaultRemoteName configuration variable, which has
been plugged.

* jc/clone-remote-name-leak-fix:
  clone: plug a miniscule leak

3 years agoMerge branch 'rs/format-patch-pathspec-fix'
Junio C Hamano [Wed, 4 May 2022 16:51:28 +0000 (09:51 -0700)] 
Merge branch 'rs/format-patch-pathspec-fix'

"git format-patch <args> -- <pathspec>" lost the pathspec when
showing the second and subsequent commits, which has been
corrected.

* rs/format-patch-pathspec-fix:
  2.36 format-patch regression fix

3 years agoMerge branch 'rs/fast-export-pathspec-fix'
Junio C Hamano [Wed, 4 May 2022 16:51:28 +0000 (09:51 -0700)] 
Merge branch 'rs/fast-export-pathspec-fix'

"git fast-export -- <pathspec>" lost the pathspec when showing the
second and subsequent commits, which has been corrected.

* rs/fast-export-pathspec-fix:
  2.36 fast-export regression fix

3 years agoMerge branch 'jc/show-pathspec-fix'
Junio C Hamano [Wed, 4 May 2022 16:51:28 +0000 (09:51 -0700)] 
Merge branch 'jc/show-pathspec-fix'

"git show <commit1> <commit2>... -- <pathspec>" lost the pathspec
when showing the second and subsequent commits, which has been
corrected.

* jc/show-pathspec-fix:
  2.36 show regression fix

3 years agotree-wide: apply equals-null.cocci
Junio C Hamano [Mon, 2 May 2022 17:18:22 +0000 (10:18 -0700)] 
tree-wide: apply equals-null.cocci

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ep/maint-equals-null-cocci' into ep/equals-null-cocci
Junio C Hamano [Mon, 2 May 2022 17:15:55 +0000 (10:15 -0700)] 
Merge branch 'ep/maint-equals-null-cocci' into ep/equals-null-cocci

* ep/maint-equals-null-cocci:
  tree-wide: apply equals-null.cocci
  tree-wide: apply equals-null.cocci
  contrib/coccinnelle: add equals-null.cocci

3 years agotree-wide: apply equals-null.cocci
Junio C Hamano [Mon, 2 May 2022 17:09:21 +0000 (10:09 -0700)] 
tree-wide: apply equals-null.cocci

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ep/maint-equals-null-cocci' for maint-2.35
Junio C Hamano [Mon, 2 May 2022 17:06:00 +0000 (10:06 -0700)] 
Merge branch 'ep/maint-equals-null-cocci' for maint-2.35

* ep/maint-equals-null-cocci:
  tree-wide: apply equals-null.cocci
  contrib/coccinnelle: add equals-null.cocci

3 years agotree-wide: apply equals-null.cocci
Junio C Hamano [Mon, 2 May 2022 16:50:37 +0000 (09:50 -0700)] 
tree-wide: apply equals-null.cocci

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocontrib/coccinnelle: add equals-null.cocci
Elia Pinto [Sat, 30 Apr 2022 04:13:44 +0000 (04:13 +0000)] 
contrib/coccinnelle: add equals-null.cocci

Add a coccinelle semantic patch necessary to reinforce the git coding style
guideline:

"Do not explicitly compute an integral value with constant 0 or '\ 0', or a
pointer value with constant NULL."

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agococci: drop bogus xstrdup_or_null() rule
Junio C Hamano [Sun, 1 May 2022 05:00:30 +0000 (22:00 -0700)] 
cocci: drop bogus xstrdup_or_null() rule

13092a91 (cocci: refactor common patterns to use xstrdup_or_null(),
2016-10-12) introduced a rule to rewrite this conditional call to
xstrdup(E) and an assignment to variable V:

    - if (E)
    -    V = xstrdup(E);

into an unconditional call to xstrdup_or_null(E) and an assignment
to variable V:

    + V = xstrdup_or_null(E);

which is utterly bogus.  The original code may already have an
acceptable value in V and the conditional assignment may be to
improve the value already in V with a copy of a better value E when
(and only when) E is not NULL.

The rewritten construct unconditionally discards the existing value
of V and replaces it with a copy of E, even when E is NULL, which
changes the meaning of the program.

By the way, if it were

-if (E && !V)
- V = xstrdup(E);
+V = xstrdup_or_null(E);

it would probably have been correct.  But there is no existing code
that would have been improved by such a rule, so let's just remove
the bogus one without replacing with the more specific one.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoclone: plug a miniscule leak
Junio C Hamano [Sun, 1 May 2022 05:17:15 +0000 (22:17 -0700)] 
clone: plug a miniscule leak

The remote_name variable is first assigned a copy of the value of
the "clone.defaultremotename" configuration variable and then by the
value of the "--origin" command line option.  The former is prepared
to see multiple instances of the configuration variable by freeing
the current value of the variable before a copy of the newly
discovered value gets assigned to it.  The latter however blindly
assigned a copy of the new value to the variable, thereby leaking
the value read from the configuration variable.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years ago2.36 fast-export regression fix
René Scharfe [Sat, 30 Apr 2022 14:31:43 +0000 (16:31 +0200)] 
2.36 fast-export regression fix

e900d494dc (diff: add an API for deferred freeing, 2021-02-11) added a
way to allow reusing diffopts: the no_free bit.  244c27242f (diff.[ch]:
have diff_free() call clear_pathspec(opts.pathspec), 2022-02-16) made
that mechanism mandatory.

git fast-export doesn't set no_free, so path limiting stopped working
after the first commit.  Set the flag and add a basic test to make sure
only changes to the specified files are exported.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years ago2.36 format-patch regression fix
René Scharfe [Sat, 30 Apr 2022 10:32:44 +0000 (12:32 +0200)] 
2.36 format-patch regression fix

e900d494dc (diff: add an API for deferred freeing, 2021-02-11) added a
way to allow reusing diffopts: the no_free bit.  244c27242f (diff.[ch]:
have diff_free() call clear_pathspec(opts.pathspec), 2022-02-16) made
that mechanism mandatory.

git format-patch only sets no_free when --output is given, causing it to
forget pathspecs after the first commit.  Set no_free unconditionally
instead.

The existing test was unable to detect this breakage because it checks
stderr for the absence of a certain string, but format-patch writes to
stdout.  Also the test was not checking the case of one commit modifying
multiple files and a pathspec limiting the diff.  Replace it with a more
thorough one.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years ago2.36 show regression fix
Junio C Hamano [Sat, 30 Apr 2022 05:29:51 +0000 (22:29 -0700)] 
2.36 show regression fix

This only surfaced as a regression after 2.36 release, but the
breakage was already there with us for at least a year.

e900d494 (diff: add an API for deferred freeing, 2021-02-11)
introduced a mechanism to delay freeing resources held in
diff_options struct that need to be kept as long as the struct will
be reused to compute diff.  "git log -p" was taught to utilize the
mechanism but it was done with an incorrect assumption that the
underlying helper function, cmd_log_walk(), is called only once,
and it is OK to do the freeing at the end of it.

Alas, for "git show A B", the function is called once for each
commit given, so it is not OK to free the resources until we finish
calling it for all the commits given from the command line.

During 2.36 release cycle, we started clearing the <pathspec> as
part of this freeing, which made the bug a lot more visible.

Fix this breakage by tweaking how cmd_log_walk() frees the resources
at the end and using a variant of it that does not immediately free
the resources to show each commit object from the command line in
"git show".

Protect the fix with a few new tests.

Reported-by: Daniel Li <dan@danielyli.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSome regression fixes for 2.36
Junio C Hamano [Thu, 28 Apr 2022 17:44:14 +0000 (10:44 -0700)] 
Some regression fixes for 2.36

Signed-off-by: Junio C Hamano <gitster@pobox.com>