]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
5 years agotest-date: drop unused parameter to getnanos()
Jeff King [Wed, 6 Feb 2019 19:35:52 +0000 (14:35 -0500)] 
test-date: drop unused parameter to getnanos()

The getnanos() helper always gets the current time from our
getnanotime() facility. The caller cannot override it via TEST_DATE_NOW,
and hence we simply ignore the "now" parameter to the function. Let's
remove it, as it may mislead callers into thinking it does something.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoci: parallelize testing on Windows
Johannes Schindelin [Tue, 29 Jan 2019 14:19:38 +0000 (06:19 -0800)] 
ci: parallelize testing on Windows

The fact that Git's test suite is implemented in Unix shell script that
is as portable as we can muster, combined with the fact that Unix shell
scripting is foreign to Windows (and therefore has to be emulated),
results in pretty abysmal speed of the test suite on that platform, for
pretty much no other reason than that language choice.

For comparison: while the Linux build & test is typically done within
about 8 minutes, the Windows build & test typically lasts about 80
minutes in Azure Pipelines.

To help with that, let's use the Azure Pipeline feature where you can
parallelize jobs, make jobs depend on each other, and pass artifacts
between them.

The tests are distributed using the following heuristic: listing all
test scripts ordered by size in descending order (as a cheap way to
estimate the overall run time), every Nth script is run (where N is the
total number of parallel jobs), starting at the index corresponding to
the parallel job. This slicing is performed by a new function that is
added to the `test-tool`.

To optimize the overall runtime of the entire Pipeline, we need to move
the Windows jobs to the beginning (otherwise there would be a very
decent chance for the Pipeline to be run only the Windows build, while
all the parallel Windows test jobs wait for this single one).

We use Azure Pipelines Artifacts for both the minimal Git for Windows
SDK as well as the built executables, as deduplication and caching close
to the agents makes that really fast. For comparison: while downloading
and unpacking the minimal Git for Windows SDK via PowerShell takes only
one minute (down from anywhere between 2.5 to 7 when using a shallow
clone), uploading it as Pipeline Artifact takes less than 30s and
downloading and unpacking less than 20s (sometimes even as little as
only twelve seconds).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoci: speed up Windows phase
Johannes Schindelin [Tue, 29 Jan 2019 14:19:38 +0000 (06:19 -0800)] 
ci: speed up Windows phase

As Unix shell scripting comes at a hefty price on Windows, we have to
see where we can save some time to run the test suite.

Let's skip the chain linting and the bin-wrappers/ redirection on
Windows; this seems to shave of anywhere between 10-30% from the overall
runtime.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotests: optionally skip bin-wrappers/
Johannes Schindelin [Tue, 29 Jan 2019 14:19:37 +0000 (06:19 -0800)] 
tests: optionally skip bin-wrappers/

This speeds up the tests by a bit on Windows, where running Unix shell
scripts (and spawning processes) is not exactly a cheap operation.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot0061: workaround issues with --with-dashes and RUNTIME_PREFIX
Johannes Schindelin [Tue, 29 Jan 2019 14:19:36 +0000 (06:19 -0800)] 
t0061: workaround issues with --with-dashes and RUNTIME_PREFIX

When building Git with RUNTIME_PREFIX and starting a test helper from
t/helper/, it fails to detect a system prefix. The reason is that the
RUNTIME_PREFIX feature wants to use the location of the Git executable
to determine where the support files can be found, e.g. system-wide Git
config or the translations. This does not make any sense for the test
helpers, though, as they are distinctly not in a directory structure
resembling the final installation location of Git.

That is the reason why the test helpers rely on environment variables to
indicate the location of the needed support files, e.g.
GIT_TEXTDOMAINDIR. If this information is missing, the output will
contain warnings like this one:

RUNTIME_PREFIX requested, but prefix computation failed. [...]

In t0061, we did not expect that to happen, and it actually does not
happen in the regular case, because bin-wrappers/test-tool specifically
sets GIT_TEXTDOMAINDIR (and as a consequence, nothing in test-tool needs
to know anything about any runtime prefix).

However, with --with-dashes, bin-wrappers/test-tool is no longer called,
but t/helper/test-tool is called directly instead.

So let's just ignore the RUNTIME_PREFIX warning.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotests: add t/helper/ to the PATH with --with-dashes
Johannes Schindelin [Tue, 29 Jan 2019 14:19:35 +0000 (06:19 -0800)] 
tests: add t/helper/ to the PATH with --with-dashes

We really need to be able to find the test helpers... Really. This
change was forgotten when we moved the test helpers into t/helper/

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agomingw: try to work around issues with the test cleanup
Johannes Schindelin [Tue, 29 Jan 2019 14:19:35 +0000 (06:19 -0800)] 
mingw: try to work around issues with the test cleanup

It seems that every once in a while in the Git for Windows SDK, there
are some transient file locking issues preventing the test clean up to
delete the trash directory. Let's be gentle and try again five seconds
later, and only error out if it still fails the second time.

This change helps Windows, and does not hurt any other platform
(normally, it is highly unlikely that said deletion fails, and if it
does, normally it will fail again even 5 seconds later).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotests: include detailed trace logs with --write-junit-xml upon failure
Johannes Schindelin [Tue, 29 Jan 2019 14:19:34 +0000 (06:19 -0800)] 
tests: include detailed trace logs with --write-junit-xml upon failure

The JUnit XML format lends itself to be presented in a powerful UI,
where you can drill down to the information you are interested in very
quickly.

For test failures, this usually means that you want to see the detailed
trace of the failing tests.

With Travis CI, we passed the `--verbose-log` option to get those
traces. However, that seems excessive, as we do not need/use the logs in
almost all of those cases: only when a test fails do we have a way to
include the trace.

So let's do something different when using Azure DevOps: let's run all
the tests with `--quiet` first, and only if a failure is encountered,
try to trace the commands as they are executed.

Of course, we cannot turn on `--verbose-log` after the fact. So let's
just re-run the test with all the same options, adding `--verbose-log`.
And then munging the output file into the JUnit XML on the fly.

Note: there is an off chance that re-running the test in verbose mode
"fixes" the failures (and this does happen from time to time!). That is
a possibility we should be able to live with. Ideally, we would label
this as "Passed upon rerun", and Azure Pipelines even know about that
outcome, but it is not available when using the JUnit XML format for
now:
https://github.com/Microsoft/azure-pipelines-agent/blob/master/src/Agent.Worker/TestResults/JunitResultReader.cs

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotests: avoid calling Perl just to determine file sizes
Johannes Schindelin [Tue, 29 Jan 2019 14:19:33 +0000 (06:19 -0800)] 
tests: avoid calling Perl just to determine file sizes

It is a bit ridiculous to spin up a full-blown Perl instance (especially
on Windows, where that means spinning up a full POSIX emulation layer,
AKA the MSYS2 runtime) just to tell how large a given file is.

So let's just use the test-tool to do that job instead.

This command will also be used over the next commits, to allow for
cutting out individual test cases' verbose log from the file generated
via --verbose-log.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoREADME: add a build badge (status of the Azure Pipelines build)
Johannes Schindelin [Tue, 29 Jan 2019 14:19:32 +0000 (06:19 -0800)] 
README: add a build badge (status of the Azure Pipelines build)

Just like so many other OSS projects, we now also have a build badge.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agomingw: be more generous when wrapping up the setitimer() emulation
Johannes Schindelin [Tue, 29 Jan 2019 14:19:31 +0000 (06:19 -0800)] 
mingw: be more generous when wrapping up the setitimer() emulation

Every once in a while, the Azure Pipeline fails with some semi-random

error: timer thread did not terminate timely

This error message means that the thread that is used to emulate the
setitimer() function did not terminate within 1,000 milliseconds.

The most likely explanation (and therefore the one we should assume to
be true, according to Occam's Razor) is that the timeout of one second
is simply not enough because we try to run so many tasks in parallel.

So let's give it ten seconds instead of only one. That should be enough.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoci: use git-sdk-64-minimal build artifact
Johannes Schindelin [Tue, 29 Jan 2019 14:19:31 +0000 (06:19 -0800)] 
ci: use git-sdk-64-minimal build artifact

Instead of a shallow fetch followed by a sparse checkout, we are
better off by using a separate, dedicated Pipeline that bundles
the SDK as a build artifact, and then consuming that build artifact
here.

In fact, since this artifact will be used a lot, we spent substantial
time on figuring out a minimal subset of the Git for Windows SDK, just
enough to build and test Git. The result is a size reduction from around
1GB (compressed) to around 55MB (compressed). This also comes with the
change where we now call `usr\bin\bash.exe` directly, as `git-cmd.exe`
is not included in the minimal SDK.

That reduces the time to initialize Git for Windows' SDK from anywhere
between 2m30s-7m to a little over 1m.

Note: in theory, we could also use the DownloadBuildArtifacts@0 task
here. However, restricted permissions that are in effect when building
from forks would let this fail for PR builds, defeating the whole
purpose of the Azure Pipelines support for git.git.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoci: add a Windows job to the Azure Pipelines definition
Johannes Schindelin [Tue, 29 Jan 2019 14:19:30 +0000 (06:19 -0800)] 
ci: add a Windows job to the Azure Pipelines definition

Previously, we did not have robust support for Windows in our CI
definition, simply because Travis cannot accommodate our needs (even
after Travis added experimental Windows support very recently, it takes
longer than Travis' 50 minute timeout to build Git and run the test
suite on Windows). Instead, we used a hack that started a dedicated
Azure Pipeline from Travis and waited for the output, often timing out
(which is quite fragile, as we found out).

With this commit, we finally have first-class support for Windows in our
CI definition (in the Azure Pipelines one, that is).

Due to our reliance on Unix shell scripting in the test suite, combined
with the challenges on executing such scripts on Windows, the Windows
job currently takes a whopping ~1h20m to complete. Which is *far* longer
than the next-longest job takes (linux-gcc, ~35m).

Now, Azure Pipelines's free tier for open source projects (such as Git)
offers up to 10 concurrent jobs for free, meaning that the overall run
time will be dominated by the slowest job(s).

Therefore, it makes sense to start the Windows job first, to minimize
the time the entire build takes from start to end (which is now pretty
safely the run time of the Windows job).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoAdd a build definition for Azure DevOps
Johannes Schindelin [Tue, 29 Jan 2019 14:19:29 +0000 (06:19 -0800)] 
Add a build definition for Azure DevOps

This commit adds an azure-pipelines.yml file which is Azure DevOps'
equivalent to Travis CI's .travis.yml.

The main idea is to replicate the Travis configuration as faithfully as
possible, to make it easy to compare the Azure Pipeline builds to the
Travis ones (spoiler: some parts, especially the macOS jobs, are way
faster in Azure Pileines). Meaning: the number and the order of the jobs
added in this commit faithfully replicates what we have in .travis.yml.

Note: Our .travis.yml configuration has a Windows part that is *not*
replicated in the Azure Pipelines definition. The reason is easy to see:
As Travis cannot support our Windws needs (even with the preliminary
Windows support that was recently added to Travis after waiting for
*years* for that feature, our test suite would simply hit Travis'
timeout every single time).

To make things a bit easier to understand, we refrain from using the
`matrix` feature here because (while it is powerful) it can be a bit
confusing to users who are not familiar with CI setups. Therefore, we
use a separate phase even for similar configurations (such as GCC vs
Clang on Linux, GCC vs Clang on macOS).

Also, we make use of the shiny new feature we just introduced where the
test suite can output JUnit-style .xml files. This information is made
available in a nice UI that allows the viewer to filter by phase and/or
test number, and to see trends such as: number of (failing) tests, time
spent running the test suite, etc. (While this seemingly contradicts the
intention to replicate the Travis configuration as faithfully as
possible, it is just too nice to show off that capability here already.)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoci/lib.sh: add support for Azure Pipelines
Johannes Schindelin [Tue, 29 Jan 2019 14:19:28 +0000 (06:19 -0800)] 
ci/lib.sh: add support for Azure Pipelines

This patch introduces a conditional arm that defines some environment
variables and a function that displays the URL given the job id (to
identify previous runs for known-good trees).

Because Azure Pipeline's macOS agents already have git-lfs and gettext
installed, we can leave `BREW_INSTALL_PACKAGES` empty (unlike in
Travis' case).

Note: this patch does not introduce an Azure Pipelines definition yet;
That is left for the next patch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotests: optionally write results as JUnit-style .xml
Johannes Schindelin [Tue, 29 Jan 2019 14:19:27 +0000 (06:19 -0800)] 
tests: optionally write results as JUnit-style .xml

This will come in handy when publishing the results of Git's test suite
during an automated Azure DevOps run.

Note: we need to make extra sure that invalid UTF-8 encoding is turned
into valid UTF-8 (using the Replacement Character, \uFFFD) because
t9902's trace contains such invalid byte sequences, and the task in the
Azure Pipeline that uploads the test results would refuse to do anything
if it was asked to parse an .xml file with invalid UTF-8 in it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest-date: add a subcommand to measure times in shell scripts
Johannes Schindelin [Sun, 27 Jan 2019 23:26:54 +0000 (15:26 -0800)] 
test-date: add a subcommand to measure times in shell scripts

In the next commit, we want to teach Git's test suite to optionally
output test results in JUnit-style .xml files. These files contain
information about the time spent. So we need a way to measure time.

While we could use `date +%s` for that, this will give us only seconds,
i.e. very coarse-grained timings.

GNU `date` supports `date +%s.%N` (i.e. nanosecond-precision output),
but there is no equivalent in BSD `date` (read: on macOS, we would not
be able to obtain precise timings).

So let's introduce `test-tool date getnanos`, with an optional start
time, that outputs preciser values. Note that this might not actually
give us nanosecond precision on some platforms, but it will give us as
precise information as possible, without the portability issues of shell
commands.

Granted, it is a bit pointless to try measuring times accurately in
shell scripts, certainly to nanosecond precision. But it is better than
second-granularity.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoci: use a junction on Windows instead of a symlink
Johannes Schindelin [Sun, 27 Jan 2019 23:26:53 +0000 (15:26 -0800)] 
ci: use a junction on Windows instead of a symlink

Symbolic links are still not quite as easy to use on Windows as on Linux
(for example, on versions older than Windows 10, only administrators can
create symlinks, and on Windows 10 you still need to be in developer
mode for regular users to have permission), but NTFS junctions can give
us a way out.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoci: inherit --jobs via MAKEFLAGS in run-build-and-tests
Johannes Schindelin [Sun, 27 Jan 2019 23:26:52 +0000 (15:26 -0800)] 
ci: inherit --jobs via MAKEFLAGS in run-build-and-tests

Let's not decide in the generic ci/ part how many jobs to run in
parallel; different CI configurations would favor a different number of
parallel jobs, and it is easy enough to hand that information down via
the `MAKEFLAGS` variable.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoci/lib.sh: encapsulate Travis-specific things
Johannes Schindelin [Sun, 27 Jan 2019 23:26:51 +0000 (15:26 -0800)] 
ci/lib.sh: encapsulate Travis-specific things

The upcoming patches will allow building git.git via Azure Pipelines
(i.e. Azure DevOps' Continuous Integration), where variable names and
URLs look a bit different than in Travis CI.

Also, the configurations of the available agents are different. For
example, Travis' and Azure Pipelines' macOS agents are set up
differently, so that on Travis, we have to install the git-lfs and
gettext Homebrew packages, and on Azure Pipelines we do not need to.
Likewise, Azure Pipelines' Ubuntu agents already have asciidoctor
installed.

Finally, on Azure Pipelines the natural way is not to base64-encode tar
files of the trash directories of failed tests, but to publish build
artifacts instead. Therefore, that code to log those base64-encoded tar
files is guarded to be Travis-specific.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoci: rename the library of common functions
Johannes Schindelin [Sun, 27 Jan 2019 23:26:50 +0000 (15:26 -0800)] 
ci: rename the library of common functions

The name is hard-coded to reflect that we use Travis CI for continuous
testing.

In the next commits, we will extend this to be able use Azure DevOps,
too.

So let's adjust the name to make it more generic.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotravis: fix skipping tagged releases
Johannes Schindelin [Sun, 27 Jan 2019 23:26:49 +0000 (15:26 -0800)] 
travis: fix skipping tagged releases

When building a PR, TRAVIS_BRANCH refers to the *target branch*.
Therefore, if a PR targets `master`, and `master` happened to be tagged,
we skipped the build by mistake.

Fix this by using TRAVIS_PULL_REQUEST_BRANCH (i.e. the *source branch*)
when available, falling back to TRAVIS_BRANCH (i.e. for CI builds, also
known as "push builds").

Let's give it a new variable name, too: CI_BRANCH (as it is different
from TRAVIS_BRANCH). This also prepares for the upcoming patches which
will make our ci/* code a bit more independent from Travis and open it
to other CI systems (in particular to Azure Pipelines).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoThird batch after 2.20
Junio C Hamano [Fri, 18 Jan 2019 21:56:54 +0000 (13:56 -0800)] 
Third batch after 2.20

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'js/gc-repack-close-before-remove'
Junio C Hamano [Fri, 18 Jan 2019 21:49:57 +0000 (13:49 -0800)] 
Merge branch 'js/gc-repack-close-before-remove'

"git gc" and "git repack" did not close the open packfiles that
they found unneeded before removing them, which didn't work on a
platform incapable of removing an open file.  This has been
corrected.

* js/gc-repack-close-before-remove:
  gc/repack: release packs when needed

5 years agoMerge branch 'en/show-ref-doc-fix'
Junio C Hamano [Fri, 18 Jan 2019 21:49:56 +0000 (13:49 -0800)] 
Merge branch 'en/show-ref-doc-fix'

Doc update.

* en/show-ref-doc-fix:
  git-show-ref.txt: fix order of flags

5 years agoMerge branch 'ot/ref-filter-object-info'
Junio C Hamano [Fri, 18 Jan 2019 21:49:56 +0000 (13:49 -0800)] 
Merge branch 'ot/ref-filter-object-info'

The "--format=<placeholder>" option of for-each-ref, branch and tag
learned to show a few more traits of objects that can be learned by
the object_info API.

* ot/ref-filter-object-info:
  ref-filter: give uintmax_t to format with %PRIuMAX
  ref-filter: add docs for new options
  ref-filter: add tests for deltabase
  ref-filter: add deltabase option
  ref-filter: add tests for objectsize:disk
  ref-filter: add check for negative file size
  ref-filter: add objectsize:disk option

5 years agoMerge branch 'sg/stress-test'
Junio C Hamano [Fri, 18 Jan 2019 21:49:56 +0000 (13:49 -0800)] 
Merge branch 'sg/stress-test'

Flaky tests can now be repeatedly run under load with the
"--stress" option.

* sg/stress-test:
  test-lib: add the '--stress' option to run a test repeatedly under load
  test-lib-functions: introduce the 'test_set_port' helper function
  test-lib: set $TRASH_DIRECTORY earlier
  test-lib: consolidate naming of test-results paths
  test-lib: parse command line options earlier
  test-lib: parse options in a for loop to keep $@ intact
  test-lib: extract Bash version check for '-x' tracing
  test-lib: translate SIGTERM and SIGHUP to an exit

5 years agoMerge branch 'rs/sha1-file-close-mapped-file-on-error'
Junio C Hamano [Fri, 18 Jan 2019 21:49:56 +0000 (13:49 -0800)] 
Merge branch 'rs/sha1-file-close-mapped-file-on-error'

Code clean-up.

* rs/sha1-file-close-mapped-file-on-error:
  sha1-file: close fd of empty file in map_sha1_file_1()

5 years agoMerge branch 'rs/loose-object-cache-perffix'
Junio C Hamano [Fri, 18 Jan 2019 21:49:56 +0000 (13:49 -0800)] 
Merge branch 'rs/loose-object-cache-perffix'

The loose object cache used to optimize existence look-up has been
updated.

* rs/loose-object-cache-perffix:
  object-store: retire odb_load_loose_cache()
  object-store: use one oid_array per subdirectory for loose cache
  object-store: factor out odb_clear_loose_cache()
  object-store: factor out odb_loose_cache()

5 years agoMerge branch 'po/git-p4-wo-login'
Junio C Hamano [Fri, 18 Jan 2019 21:49:55 +0000 (13:49 -0800)] 
Merge branch 'po/git-p4-wo-login'

"git p4" update.

* po/git-p4-wo-login:
  git-p4: fix problem when p4 login is not necessary

5 years agoMerge branch 'mm/multimail-1.5'
Junio C Hamano [Fri, 18 Jan 2019 21:49:55 +0000 (13:49 -0800)] 
Merge branch 'mm/multimail-1.5'

Update "git multimail" from the upstream.

* mm/multimail-1.5:
  git-multimail: update to release 1.5.0

5 years agoMerge branch 'tg/t5570-drop-racy-test'
Junio C Hamano [Fri, 18 Jan 2019 21:49:55 +0000 (13:49 -0800)] 
Merge branch 'tg/t5570-drop-racy-test'

An inherently racy test that caused intermittent failures has been
removed.

* tg/t5570-drop-racy-test:
  Revert "t/lib-git-daemon: record daemon log"
  t5570: drop racy test

5 years agoMerge branch 'jk/dev-build-format-security'
Junio C Hamano [Fri, 18 Jan 2019 21:49:55 +0000 (13:49 -0800)] 
Merge branch 'jk/dev-build-format-security'

Earlier we added "-Wformat-security" to developer builds, assuming
that "-Wall" (which includes "-Wformat" which in turn is required
to use "-Wformat-security") is always in effect.  This is not true
when config.mak.autogen is in use, unfortunately.  This has been
fixed by unconditionally adding "-Wall" to developer builds.

* jk/dev-build-format-security:
  config.mak.dev: add -Wall, primarily for -Wformat, to help autoconf users

5 years agoMerge branch 'so/cherry-pick-always-allow-m1'
Junio C Hamano [Fri, 18 Jan 2019 21:49:54 +0000 (13:49 -0800)] 
Merge branch 'so/cherry-pick-always-allow-m1'

"git cherry-pick -m1" was forbidden when picking a non-merge
commit, even though there _is_ parent number 1 for such a commit.
This was done to avoid mistakes back when "cherry-pick" was about
picking a single commit, but is no longer useful with "cherry-pick"
that can pick a range of commits.  Now the "-m$num" option is
allowed when picking any commit, as long as $num names an existing
parent of the commit.

Technically this is a backward incompatible change; hopefully
nobody is relying on the error-checking behaviour.

* so/cherry-pick-always-allow-m1:
  t3506: validate '-m 1 -ff' is now accepted for non-merge commits
  t3502: validate '-m 1' argument is now accepted for non-merge commits
  cherry-pick: do not error on non-merge commits when '-m 1' is specified
  t3510: stop using '-m 1' to force failure mid-sequence of cherry-picks

5 years agoMerge branch 'nd/worktree-remove-with-uninitialized-submodules'
Junio C Hamano [Fri, 18 Jan 2019 21:49:54 +0000 (13:49 -0800)] 
Merge branch 'nd/worktree-remove-with-uninitialized-submodules'

"git worktree remove" and "git worktree move" refused to work when
there is a submodule involved.  This has been loosened to ignore
uninitialized submodules.

* nd/worktree-remove-with-uninitialized-submodules:
  worktree: allow to (re)move worktrees with uninitialized submodules

5 years agoMerge branch 'sg/test-bash-version-fix'
Junio C Hamano [Fri, 18 Jan 2019 21:49:54 +0000 (13:49 -0800)] 
Merge branch 'sg/test-bash-version-fix'

The test suite tried to see if it is run under bash, but the check
itself failed under some other implementations of shell (notably
under NetBSD).  This has been corrected.

* sg/test-bash-version-fix:
  test-lib: check Bash version for '-x' without using shell arrays

5 years agoMerge branch 'rb/hpe'
Junio C Hamano [Fri, 18 Jan 2019 21:49:54 +0000 (13:49 -0800)] 
Merge branch 'rb/hpe'

Portability updates for the HPE NonStop platform.

* rb/hpe:
  compat/regex/regcomp.c: define intptr_t and uintptr_t on NonStop
  git-compat-util.h: add FLOSS headers for HPE NonStop
  config.mak.uname: support for modern HPE NonStop config.
  transport-helper: drop read/write errno checks
  transport-helper: use xread instead of read

5 years agoMerge branch 'ed/simplify-setup-git-dir'
Junio C Hamano [Fri, 18 Jan 2019 21:49:54 +0000 (13:49 -0800)] 
Merge branch 'ed/simplify-setup-git-dir'

Code simplification.

* ed/simplify-setup-git-dir:
  Simplify handling of setup_git_directory_gently() failure cases.

5 years agoMerge branch 'cy/zsh-completion-SP-in-path'
Junio C Hamano [Fri, 18 Jan 2019 21:49:54 +0000 (13:49 -0800)] 
Merge branch 'cy/zsh-completion-SP-in-path'

With zsh, "git cmd path<TAB>" was completed to "git cmd path name"
when the completed path has a special character like SP in it,
without any attempt to keep "path name" a single filename.  This
has been fixed to complete it to "git cmd path\ name" just like
Bash completion does.

* cy/zsh-completion-SP-in-path:
  completion: treat results of git ls-tree as file paths
  zsh: complete unquoted paths with spaces correctly

5 years agoMerge branch 'cy/completion-typofix'
Junio C Hamano [Fri, 18 Jan 2019 21:49:53 +0000 (13:49 -0800)] 
Merge branch 'cy/completion-typofix'

Typofix.

* cy/completion-typofix:
  completion: fix typo in git-completion.bash

5 years agoMerge branch 'ew/ban-strncat'
Junio C Hamano [Fri, 18 Jan 2019 21:49:53 +0000 (13:49 -0800)] 
Merge branch 'ew/ban-strncat'

The "strncat()" function is now among the banned functions.

* ew/ban-strncat:
  banned.h: mark strncat() as banned

5 years agoMerge branch 'ds/commit-graph-assert-missing-parents'
Junio C Hamano [Fri, 18 Jan 2019 21:49:53 +0000 (13:49 -0800)] 
Merge branch 'ds/commit-graph-assert-missing-parents'

Tightening error checking in commit-graph writer.

* ds/commit-graph-assert-missing-parents:
  commit-graph: writing missing parents is a BUG

5 years agoMerge branch 'es/doc-worktree-guessremote-config'
Junio C Hamano [Fri, 18 Jan 2019 21:49:53 +0000 (13:49 -0800)] 
Merge branch 'es/doc-worktree-guessremote-config'

Doc clarification.

* es/doc-worktree-guessremote-config:
  doc/config: do a better job of introducing 'worktree.guessRemote'

5 years agoMerge branch 'sb/submodule-unset-core-worktree-when-worktree-is-lost'
Junio C Hamano [Fri, 18 Jan 2019 21:49:53 +0000 (13:49 -0800)] 
Merge branch 'sb/submodule-unset-core-worktree-when-worktree-is-lost'

The core.worktree setting in a submodule repository should not be
pointing at a directory when the submodule loses its working tree
(e.g. getting deinit'ed), but the code did not properly maintain
this invariant.

* sb/submodule-unset-core-worktree-when-worktree-is-lost:
  submodule deinit: unset core.worktree
  submodule--helper: fix BUG message in ensure_core_worktree
  submodule: unset core.worktree if no working tree is present
  submodule update: add regression test with old style setups

5 years agoMerge branch 'ma/asciidoctor'
Junio C Hamano [Fri, 18 Jan 2019 21:49:53 +0000 (13:49 -0800)] 
Merge branch 'ma/asciidoctor'

Some of the documentation pages formatted incorrectly with
Asciidoctor, which have been fixed.

* ma/asciidoctor:
  git-status.txt: render tables correctly under Asciidoctor
  Documentation: do not nest open blocks
  git-column.txt: fix section header

5 years agoMerge branch 'jn/stripspace-wo-repository'
Junio C Hamano [Fri, 18 Jan 2019 21:49:53 +0000 (13:49 -0800)] 
Merge branch 'jn/stripspace-wo-repository'

"git stripspace" should be usable outside a git repository, but
under the "-s" or "-c" mode, it didn't.

* jn/stripspace-wo-repository:
  stripspace: allow -s/-c outside git repository

5 years agoMerge branch 'sb/submodule-fetchjobs-default-to-one'
Junio C Hamano [Fri, 18 Jan 2019 21:49:52 +0000 (13:49 -0800)] 
Merge branch 'sb/submodule-fetchjobs-default-to-one'

"git submodule update" ought to use a single job unless asked, but
by mistake used multiple jobs, which has been fixed.

* sb/submodule-fetchjobs-default-to-one:
  submodule update: run at most one fetch job unless otherwise set

5 years agoMerge branch 'la/quiltimport-keep-non-patch'
Junio C Hamano [Fri, 18 Jan 2019 21:49:52 +0000 (13:49 -0800)] 
Merge branch 'la/quiltimport-keep-non-patch'

"git quiltimport" learned "--keep-non-patch" option.

* la/quiltimport-keep-non-patch:
  git-quiltimport: add --keep-non-patch option

5 years agoMerge branch 'nd/style-opening-brace'
Junio C Hamano [Fri, 18 Jan 2019 21:49:52 +0000 (13:49 -0800)] 
Merge branch 'nd/style-opening-brace'

Code clean-up.

* nd/style-opening-brace:
  style: the opening '{' of a function is in a separate line

5 years agoMerge branch 'ds/gc-doc-typofix'
Junio C Hamano [Fri, 18 Jan 2019 21:49:52 +0000 (13:49 -0800)] 
Merge branch 'ds/gc-doc-typofix'

Typofix.

* ds/gc-doc-typofix:
  git-gc.txt: fix typo about gc.writeCommitGraph

5 years agoSecond batch after 2.20
Junio C Hamano [Mon, 14 Jan 2019 23:33:36 +0000 (15:33 -0800)] 
Second batch after 2.20

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'do/gitweb-strict-export-conf-doc'
Junio C Hamano [Mon, 14 Jan 2019 23:29:33 +0000 (15:29 -0800)] 
Merge branch 'do/gitweb-strict-export-conf-doc'

Doc update.

* do/gitweb-strict-export-conf-doc:
  docs: fix $strict_export text in gitweb.conf.txt

5 years agoMerge branch 'nd/indentation-fix'
Junio C Hamano [Mon, 14 Jan 2019 23:29:32 +0000 (15:29 -0800)] 
Merge branch 'nd/indentation-fix'

Code cleanup.

* nd/indentation-fix:
  Indent code with TABs

5 years agoMerge branch 'en/directory-renames-nothanks-doc-update'
Junio C Hamano [Mon, 14 Jan 2019 23:29:32 +0000 (15:29 -0800)] 
Merge branch 'en/directory-renames-nothanks-doc-update'

Doc update.

* en/directory-renames-nothanks-doc-update:
  git-rebase.txt: update note about directory rename detection and am

5 years agoMerge branch 'bw/mailmap'
Junio C Hamano [Mon, 14 Jan 2019 23:29:32 +0000 (15:29 -0800)] 
Merge branch 'bw/mailmap'

* bw/mailmap:
  mailmap: update brandon williams's email address

5 years agoMerge branch 'fd/gitweb-snapshot-conf-doc-fix'
Junio C Hamano [Mon, 14 Jan 2019 23:29:32 +0000 (15:29 -0800)] 
Merge branch 'fd/gitweb-snapshot-conf-doc-fix'

Doc update.

* fd/gitweb-snapshot-conf-doc-fix:
  docs/gitweb.conf: config variable typo

5 years agoMerge branch 'tb/use-common-win32-pathfuncs-on-cygwin'
Junio C Hamano [Mon, 14 Jan 2019 23:29:32 +0000 (15:29 -0800)] 
Merge branch 'tb/use-common-win32-pathfuncs-on-cygwin'

Cygwin update.

* tb/use-common-win32-pathfuncs-on-cygwin:
  git clone <url> C:\cygwin\home\USER\repo' is working (again)

5 years agoMerge branch 'km/rebase-doc-typofix'
Junio C Hamano [Mon, 14 Jan 2019 23:29:32 +0000 (15:29 -0800)] 
Merge branch 'km/rebase-doc-typofix'

Doc update.

* km/rebase-doc-typofix:
  rebase docs: drop stray word in merge command description

5 years agoMerge branch 'md/exclude-promisor-objects-fix-cleanup'
Junio C Hamano [Mon, 14 Jan 2019 23:29:31 +0000 (15:29 -0800)] 
Merge branch 'md/exclude-promisor-objects-fix-cleanup'

Code clean-up.

* md/exclude-promisor-objects-fix-cleanup:
  revision.c: put promisor option in specialized struct

5 years agoMerge branch 'tb/log-G-binary'
Junio C Hamano [Mon, 14 Jan 2019 23:29:31 +0000 (15:29 -0800)] 
Merge branch 'tb/log-G-binary'

"git log -G<regex>" looked for a hunk in the "git log -p" patch
output that contained a string that matches the given pattern.
Optimize this code to ignore binary files, which by default will
not show any hunk that would match any pattern (unless textconv or
the --text option is in effect, that is).

* tb/log-G-binary:
  log -G: ignore binary files

5 years agoMerge branch 'sb/diff-color-moved-config-option-fixup'
Junio C Hamano [Mon, 14 Jan 2019 23:29:31 +0000 (15:29 -0800)] 
Merge branch 'sb/diff-color-moved-config-option-fixup'

Minor inconsistency fix.

* sb/diff-color-moved-config-option-fixup:
  diff: align move detection error handling with other options

5 years agoMerge branch 'hn/highlight-sideband-keywords'
Junio C Hamano [Mon, 14 Jan 2019 23:29:30 +0000 (15:29 -0800)] 
Merge branch 'hn/highlight-sideband-keywords'

Lines that begin with a certain keyword that come over the wire, as
well as lines that consist only of one of these keywords, ought to
be painted in color for easier eyeballing, but the latter was
broken ever since the feature was introduced in 2.19, which has
been corrected.

* hn/highlight-sideband-keywords:
  sideband: color lines with keyword only

5 years agoMerge branch 'cb/test-lint-cp-a'
Junio C Hamano [Mon, 14 Jan 2019 23:29:30 +0000 (15:29 -0800)] 
Merge branch 'cb/test-lint-cp-a'

BSD port update.

* cb/test-lint-cp-a:
  tests: add lint for non portable cp -a

5 years agoMerge branch 'cb/t5004-empty-tar-archive-fix'
Junio C Hamano [Mon, 14 Jan 2019 23:29:30 +0000 (15:29 -0800)] 
Merge branch 'cb/t5004-empty-tar-archive-fix'

BSD port update.

* cb/t5004-empty-tar-archive-fix:
  t5004: avoid using tar for empty packages

5 years agoMerge branch 'cb/openbsd-allows-reading-directory'
Junio C Hamano [Mon, 14 Jan 2019 23:29:30 +0000 (15:29 -0800)] 
Merge branch 'cb/openbsd-allows-reading-directory'

BSD port update.

* cb/openbsd-allows-reading-directory:
  config.mak.uname: OpenBSD uses BSD semantics with fread for directories

5 years agoMerge branch 'hb/t0061-dot-in-path-fix'
Junio C Hamano [Mon, 14 Jan 2019 23:29:29 +0000 (15:29 -0800)] 
Merge branch 'hb/t0061-dot-in-path-fix'

Test update.

* hb/t0061-dot-in-path-fix:
  t0061: do not fail test if '.' is part of $PATH

5 years agoMerge branch 'nd/checkout-noisy'
Junio C Hamano [Mon, 14 Jan 2019 23:29:28 +0000 (15:29 -0800)] 
Merge branch 'nd/checkout-noisy'

"git checkout [<tree-ish>] path..." learned to report the number of
paths that have been checked out of the index or the tree-ish,
which gives it the same degree of noisy-ness as the case in which
the command checks out a branch.

* nd/checkout-noisy:
  t0027: squelch checkout path run outside test_expect_* block
  checkout: print something when checking out paths

5 years agoMerge branch 'ab/commit-graph-progress-fix'
Junio C Hamano [Mon, 14 Jan 2019 23:29:28 +0000 (15:29 -0800)] 
Merge branch 'ab/commit-graph-progress-fix'

* ab/commit-graph-progress-fix:
  commit-graph: split up close_reachable() progress output

5 years agoMerge branch 'nd/attr-pathspec-in-tree-walk'
Junio C Hamano [Mon, 14 Jan 2019 23:29:28 +0000 (15:29 -0800)] 
Merge branch 'nd/attr-pathspec-in-tree-walk'

The traversal over tree objects has learned to honor
":(attr:label)" pathspec match, which has been implemented only for
enumerating paths on the filesystem.

* nd/attr-pathspec-in-tree-walk:
  tree-walk: support :(attr) matching
  dir.c: move, rename and export match_attrs()
  pathspec.h: clean up "extern" in function declarations
  tree-walk.c: make tree_entry_interesting() take an index
  tree.c: make read_tree*() take 'struct repository *'

5 years agoMerge branch 'md/list-lazy-objects-fix'
Junio C Hamano [Mon, 14 Jan 2019 23:29:28 +0000 (15:29 -0800)] 
Merge branch 'md/list-lazy-objects-fix'

"git rev-list --exclude-promisor-objects" had to take an object
that does not exist locally (and is lazily available) from the
command line without barfing, but the code dereferenced NULL.

* md/list-lazy-objects-fix:
  list-objects.c: don't segfault for missing cmdline objects

5 years agogc/repack: release packs when needed
Johannes Schindelin [Sat, 15 Dec 2018 22:04:01 +0000 (14:04 -0800)] 
gc/repack: release packs when needed

On Windows, files cannot be removed nor renamed if there are still
handles held by a process. To remedy that, we introduced the
close_all_packs() function.

Earlier, we made sure that the packs are released just before `git gc`
is spawned, in case that gc wants to remove no-longer needed packs.

But this developer forgot that gc itself also needs to let go of packs,
e.g. when consolidating all packs via the --aggressive option.

Likewise, `git repack -d` wants to delete obsolete packs and therefore
needs to close all pack handles, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogit-show-ref.txt: fix order of flags
Elijah Newren [Wed, 9 Jan 2019 19:58:47 +0000 (11:58 -0800)] 
git-show-ref.txt: fix order of flags

When the explanatory text uses the term "respectively", the order of
flags is important.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoref-filter: give uintmax_t to format with %PRIuMAX
Junio C Hamano [Thu, 10 Jan 2019 18:15:49 +0000 (10:15 -0800)] 
ref-filter: give uintmax_t to format with %PRIuMAX

As long as we are casting to a wider type, we should cast to the one
with the correct signed-ness.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogit-gc.txt: fix typo about gc.writeCommitGraph
Derrick Stolee [Tue, 8 Jan 2019 16:52:20 +0000 (08:52 -0800)] 
git-gc.txt: fix typo about gc.writeCommitGraph

Reported-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoobject-store: retire odb_load_loose_cache()
René Scharfe [Mon, 7 Jan 2019 17:29:16 +0000 (18:29 +0100)] 
object-store: retire odb_load_loose_cache()

Inline odb_load_loose_cache() into its only remaining caller,
odb_loose_cache().  The latter offers a nicer interface for loading the
cache, as it doesn't require callers to deal with fanout directory
numbers directly.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoobject-store: use one oid_array per subdirectory for loose cache
René Scharfe [Sun, 6 Jan 2019 16:45:52 +0000 (17:45 +0100)] 
object-store: use one oid_array per subdirectory for loose cache

The loose objects cache is filled one subdirectory at a time as needed.
It is stored in an oid_array, which has to be resorted after each add
operation.  So when querying a wide range of objects, the partially
filled array needs to be resorted up to 255 times, which takes over 100
times longer than sorting once.

Use one oid_array for each subdirectory.  This ensures that entries have
to only be sorted a single time.  It also avoids eight binary search
steps for each cache lookup as a small bonus.

The cache is used for collision checks for the log placeholders %h, %t
and %p, and we can see the change speeding them up in a repository with
ca. 100 objects per subdirectory:

$ git count-objects
26733 objects, 68808 kilobytes

Test                        HEAD^             HEAD
--------------------------------------------------------------------
4205.1: log with %H         0.51(0.47+0.04)   0.51(0.49+0.02) +0.0%
4205.2: log with %h         0.84(0.82+0.02)   0.60(0.57+0.03) -28.6%
4205.3: log with %T         0.53(0.49+0.04)   0.52(0.48+0.03) -1.9%
4205.4: log with %t         0.84(0.80+0.04)   0.60(0.59+0.01) -28.6%
4205.5: log with %P         0.52(0.48+0.03)   0.51(0.50+0.01) -1.9%
4205.6: log with %p         0.85(0.78+0.06)   0.61(0.56+0.05) -28.2%
4205.7: log with %h-%h-%h   0.96(0.92+0.03)   0.69(0.64+0.04) -28.1%

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoobject-store: factor out odb_clear_loose_cache()
René Scharfe [Sun, 6 Jan 2019 16:45:39 +0000 (17:45 +0100)] 
object-store: factor out odb_clear_loose_cache()

Add and use a function for emptying the loose object cache, so callers
don't have to know any of its implementation details.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoobject-store: factor out odb_loose_cache()
René Scharfe [Sun, 6 Jan 2019 16:45:30 +0000 (17:45 +0100)] 
object-store: factor out odb_loose_cache()

Add and use a function for loading the entries of a loose object
subdirectory for a given object ID.  It frees callers from deriving the
fanout key; they can use the returned oid_array reference for lookups or
forward range scans.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogit-quiltimport: add --keep-non-patch option
Laura Abbott [Wed, 12 Dec 2018 22:32:27 +0000 (14:32 -0800)] 
git-quiltimport: add --keep-non-patch option

git-am has the --keep-non-patch option to pass -b to
git-mailinfo for keeping subject prefixes intact. Allow
this option to be used with quiltimport as well.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogit-p4: fix problem when p4 login is not necessary
Peter Osterlund [Mon, 7 Jan 2019 20:51:38 +0000 (21:51 +0100)] 
git-p4: fix problem when p4 login is not necessary

In a perforce setup where login is not required, communication fails
because p4_check_access does not understand the response from the p4
client. Fixed by detecting and ignoring the "info" response.

Signed-off-by: Peter Osterlund <peterosterlund2@gmail.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogit-multimail: update to release 1.5.0
Matthieu Moy [Mon, 7 Jan 2019 17:48:38 +0000 (18:48 +0100)] 
git-multimail: update to release 1.5.0

Changes are described in CHANGES.

Contributions-by: Matthieu Moy <git@matthieu-moy.fr>
Contributions-by: William Stewart <william.stewart@booking.com>
Contributions-by: Ville Skyttä <ville.skytta@iki.fi>
Contributions-by: Dirk Olmes <dirk.olmes@codedo.de>
Contributions-by: Björn Kautler <Bjoern@Kautler.net>
Contributions-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Contributions-by: Gareth Pye <garethp@gpsatsys.com.au>
Contributions-by: David Lazar <lazard@csail.mit.edu>
Signed-off-by: Matthieu Moy <git@matthieu-moy.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoworktree: allow to (re)move worktrees with uninitialized submodules
Nguyễn Thái Ngọc Duy [Sat, 5 Jan 2019 05:08:40 +0000 (12:08 +0700)] 
worktree: allow to (re)move worktrees with uninitialized submodules

Uninitialized submodules have nothing valueable for us to be worried
about. They are just SHA-1. Let "worktree remove" and "worktree move"
continue in this case so that people can still use multiple worktrees
on repos with optional submodules that are never populated, like
sha1collisiondetection in git.git when checked out by doc-diff script.

Note that for "worktree remove", it is possible that a user
initializes a submodule (*), makes some commits (but not push), then
deinitializes it. At that point, the submodule is unpopulated, but the
precious new commits are still in

    $GIT_COMMON_DIR/worktrees/<worktree>/modules/<submodule>

directory and we should not allow removing the worktree or we lose
those commits forever. The new directory check is added to prevent
this.

(*) yes they are screwed anyway by doing this since "git submodule"
    would add submodule.* in $GIT_COMMON_DIR/config, which is shared
    across multiple worktrees. But it does not mean we let them be
    screwed even more.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest-lib: add the '--stress' option to run a test repeatedly under load
SZEDER Gábor [Sat, 5 Jan 2019 01:08:59 +0000 (02:08 +0100)] 
test-lib: add the '--stress' option to run a test repeatedly under load

Unfortunately, we have a few flaky tests, whose failures tend to be
hard to reproduce.  We've found that the best we can do to reproduce
such a failure is to run the test script repeatedly while the machine
is under load, and wait in the hope that the load creates enough
variance in the timing of the test's commands that a failure is
evenually triggered.  I have a command to do that, and I noticed that
two other contributors have rolled their own scripts to do the same,
all choosing slightly different approaches.

To help reproduce failures in flaky tests, introduce the '--stress'
option to run a test script repeatedly in multiple parallel jobs until
one of them fails, thereby using the test script itself to increase
the load on the machine.

The number of parallel jobs is determined by, in order of precedence:
the number specified as '--stress=<N>', or the value of the
GIT_TEST_STRESS_LOAD environment variable, or twice the number of
available processors (as reported by the 'getconf' utility), or 8.

Make '--stress' imply '--verbose -x --immediate' to get the most
information about rare failures; there is really no point in spending
all the extra effort to reproduce such a failure, and then not know
which command failed and why.

To prevent the several parallel invocations of the same test from
interfering with each other:

  - Include the parallel job's number in the name of the trash
    directory and the various output files under 't/test-results/' as
    a '.stress-<Nr>' suffix.

  - Add the parallel job's number to the port number specified by the
    user or to the test number, so even tests involving daemons
    listening on a TCP socket can be stressed.

  - Redirect each parallel test run's verbose output to
    't/test-results/$TEST_NAME.stress-<nr>.out', because dumping the
    output of several parallel running tests to the terminal would
    create a big ugly mess.

For convenience, print the output of the failed test job at the end,
and rename its trash directory to end with the '.stress-failed'
suffix, so it's easy to find in a predictable path (OTOH, all absolute
paths recorded in the trash directory become invalid; we'll see
whether this causes any issues in practice).  If, in an unlikely case,
more than one jobs were to fail nearly at the same time, then print
the output of all failed jobs, and rename the trash directory of only
the last one (i.e. with the highest job number), as it is the trash
directory of the test whose output will be at the bottom of the user's
terminal.

Based on Jeff King's 'stress' script.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest-lib-functions: introduce the 'test_set_port' helper function
SZEDER Gábor [Sat, 5 Jan 2019 01:08:58 +0000 (02:08 +0100)] 
test-lib-functions: introduce the 'test_set_port' helper function

Several test scripts run daemons like 'git-daemon' or Apache, and
communicate with them through TCP sockets.  To have unique ports where
these daemons are accessible, the ports are usually the number of the
corresponding test scripts, unless the user overrides them via
environment variables, and thus all those tests and test libs contain
more or less the same bit of one-liner boilerplate code to find out
the port.  The last patch in this series will make this a bit more
complicated.

Factor out finding the port for a daemon into the common helper
function 'test_set_port' to avoid repeating ourselves.

Take special care of test scripts with "low" numbers:

  - Test numbers below 1024 would result in a port that's only usable
    as root, so set their port to '10000 + test-nr' to make sure it
    doesn't interfere with other tests in the test suite.  This makes
    the hardcoded port number in 't0410-partial-clone.sh' unnecessary,
    remove it.

  - The shell's arithmetic evaluation interprets numbers with leading
    zeros as octal values, which means that test number below 1000 and
    containing the digits 8 or 9 will trigger an error.  Remove all
    leading zeros from the test numbers to prevent this.

Note that the 'git p4' tests are unlike the other tests involving
daemons in that:

  - 'lib-git-p4.sh' doesn't use the test's number for unique port as
    is, but does a bit of additional arithmetic on top [1].

  - The port is not overridable via an environment variable.

With this patch even 'git p4' tests will use the test's number as
default port, and it will be overridable via the P4DPORT environment
variable.

[1] Commit fc00233071 (git-p4 tests: refactor and cleanup, 2011-08-22)
    introduced that "unusual" unique port computation without
    explaining why it was necessary (as opposed to simply using the
    test number as is).  It seems to be just unnecessary complication,
    and in any case that commit came way before the "test nr as unique
    port" got "standardized" for other daemons in commits c44132fcf3
    (tests: auto-set git-daemon port, 2014-02-10), 3bb486e439 (tests:
    auto-set LIB_HTTPD_PORT from test name, 2014-02-10), and
    bf9d7df950 (t/lib-git-svn.sh: improve svnserve tests with parallel
    make test, 2017-12-01).

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest-lib: set $TRASH_DIRECTORY earlier
SZEDER Gábor [Sat, 5 Jan 2019 01:08:57 +0000 (02:08 +0100)] 
test-lib: set $TRASH_DIRECTORY earlier

A later patch in this series will need to know the path to the trash
directory early in 'test-lib.sh', but $TRASH_DIRECTORY is set much
later.

Set $TRASH_DIRECTORY earlier, where the other test-specific path
variables are set.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest-lib: consolidate naming of test-results paths
SZEDER Gábor [Sat, 5 Jan 2019 01:08:56 +0000 (02:08 +0100)] 
test-lib: consolidate naming of test-results paths

There are two places where we strip off any leading path components
and the '.sh' suffix from the test script's pathname, and there are
four places where we construct the name of the 't/test-results'
directory or the name of various test-specific files in there.  The
last patch in this series will add even more.

Factor these out into helper variables to avoid repeating ourselves.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest-lib: parse command line options earlier
SZEDER Gábor [Sat, 5 Jan 2019 01:08:55 +0000 (02:08 +0100)] 
test-lib: parse command line options earlier

'test-lib.sh' looks for the presence of certain options like '--tee'
and '--verbose-log', so it can execute the test script again to save
its standard output and error.  It looks for '--valgrind' as well, to
set up some Valgrind-specific stuff.  These all happen before the
actual option parsing loop, and the conditions looking for these
options look a bit odd, too.  They are not completely correct, either,
because in a bogus invocation like './t1234-foo.sh -r --tee' they
recognize '--tee', although it should be handled as the required
argument of the '-r' option.  This patch series will add two more
options to look out for early, and, in addition, will have to extract
these options' stuck arguments (i.e. '--opt=arg') as well.

So let's move the option parsing loop and the couple of related
conditions following it earlier in 'test-lib.sh', before the place
where the test script is executed again for '--tee' and its friends.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest-lib: parse options in a for loop to keep $@ intact
SZEDER Gábor [Sat, 5 Jan 2019 01:08:54 +0000 (02:08 +0100)] 
test-lib: parse options in a for loop to keep $@ intact

'test-lib.sh' looks for the presence of certain options like '--tee'
and '--verbose-log', so it can execute the test script again to save
its standard output and error, and to do so it needs the original
command line options the test was invoked with.

The next patch is about to move the option parsing loop earlier in
'test-lib.sh', but it is implemented using 'shift' in a while loop,
effecively destroying "$@" by the end of the option parsing.  Not
good.

As a preparatory step, turn that option parsing loop into a 'for opt
in "$@"' loop to preserve "$@" intact while iterating over the
options, and taking extra care to handle the '-r' option's required
argument (or the lack thereof).

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest-lib: extract Bash version check for '-x' tracing
SZEDER Gábor [Sat, 5 Jan 2019 01:08:53 +0000 (02:08 +0100)] 
test-lib: extract Bash version check for '-x' tracing

One of our test scripts, 't1510-repo-setup.sh' [1], still can't be
reliably run with '-x' tracing enabled, unless it's executed with a
Bash version supporting BASH_XTRACEFD (since v4.1).  We have a lengthy
condition to check the version of the shell running the test script,
and disable tracing if it's not executed with a suitable Bash version
[2].

Move this check out from the option parsing loop, so other options can
imply '-x' by setting 'trace=t', without missing this Bash version
check.

[1] 5827506928 (t1510-repo-setup: mark as untraceable with '-x',
    2018-02-24)
[2] 5fc98e79fc (t: add means to disable '-x' tracing for individual
    test scripts, 2018-02-24)

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoconfig.mak.dev: add -Wall, primarily for -Wformat, to help autoconf users
Thomas Gummerer [Fri, 12 Oct 2018 18:40:37 +0000 (19:40 +0100)] 
config.mak.dev: add -Wall, primarily for -Wformat, to help autoconf users

801fa63a90 ("config.mak.dev: add -Wformat-security", 2018-09-08)
added the "-Wformat-security" to the flags set in config.mak.dev.
In the gcc man page this is documented as:

         If -Wformat is specified, also warn about uses of format
         functions that represent possible security problems.  [...]

The commit did however not add the "-Wformat" flag, but instead
relied on the fact that "-Wall" is set in the Makefile by default
and that "-Wformat" is part of "-Wall".

Unfortunately, those who use config.mak.autogen generated with the
autoconf to configure toolchain do *not* get "-Wall" in their CFLAGS
and the added -Wformat-security had no effect.  Worse yet, newer
versions of gcc (gcc 8.2.1 in this particular case) warn about the
lack of "-Wformat" and thus compilation fails only with this option
set.

We could fix it by adding "-Wformat", but in general we do want all
checks included in "-Wall", so let's add it to config.mak.dev to
cover more cases.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosha1-file: close fd of empty file in map_sha1_file_1()
René Scharfe [Mon, 7 Jan 2019 16:48:02 +0000 (17:48 +0100)] 
sha1-file: close fd of empty file in map_sha1_file_1()

map_sha1_file_1() checks if the file it is about to mmap() is empty and
errors out in that case and explains the situation in an error message.
It leaks the private handle to that empty file, though.

Have the function clean up after itself and close the file descriptor
before exiting early.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot3506: validate '-m 1 -ff' is now accepted for non-merge commits
Sergey Organov [Fri, 14 Dec 2018 04:53:51 +0000 (07:53 +0300)] 
t3506: validate '-m 1 -ff' is now accepted for non-merge commits

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot3502: validate '-m 1' argument is now accepted for non-merge commits
Sergey Organov [Fri, 14 Dec 2018 04:53:51 +0000 (07:53 +0300)] 
t3502: validate '-m 1' argument is now accepted for non-merge commits

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoRevert "t/lib-git-daemon: record daemon log"
Thomas Gummerer [Sun, 6 Jan 2019 17:53:10 +0000 (17:53 +0000)] 
Revert "t/lib-git-daemon: record daemon log"

This reverts commit 314a73d658 (t/lib-git-daemon: record daemon log,
2018-01-25), which let tests use the output of git-daemon.

The previous commit removed the last user of deamon.log in the tests,
there's no good way to make checking for output in the log
race-proof.  Revert this commit as well, to make sure others are not
tempted to use daemon.log in tests in the future, which would lead to
racy tests.

The original commit had one change that still makes sense, namely
switching read/echo for "read -r" and "printf", which relays the data
more faithfully.  Don't revert that piece here, as it is still a
useful change.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoFirst batch after 2.20.1
Junio C Hamano [Fri, 4 Jan 2019 21:39:39 +0000 (13:39 -0800)] 
First batch after 2.20.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'mk/http-backend-kill-children-before-exit'
Junio C Hamano [Fri, 4 Jan 2019 21:33:34 +0000 (13:33 -0800)] 
Merge branch 'mk/http-backend-kill-children-before-exit'

The http-backend CGI process did not correctly clean up the child
processes it spawns to run upload-pack etc. when it dies itself,
which has been corrected.

* mk/http-backend-kill-children-before-exit:
  http-backend: enable cleaning up forked upload/receive-pack on exit

5 years agoMerge branch 'sd/stash-wo-user-name'
Junio C Hamano [Fri, 4 Jan 2019 21:33:34 +0000 (13:33 -0800)] 
Merge branch 'sd/stash-wo-user-name'

A properly configured username/email is required under
user.useConfigOnly in order to create commits; now "git stash"
(even though it creates commit objects to represent stash entries)
command is exempt from the requirement.

* sd/stash-wo-user-name:
  stash: tolerate missing user identity

5 years agoMerge branch 'sg/clone-initial-fetch-configuration'
Junio C Hamano [Fri, 4 Jan 2019 21:33:34 +0000 (13:33 -0800)] 
Merge branch 'sg/clone-initial-fetch-configuration'

Refspecs configured with "git -c var=val clone" did not propagate
to the resulting repository, which has been corrected.

* sg/clone-initial-fetch-configuration:
  Documentation/clone: document ignored configuration variables
  clone: respect additional configured fetch refspecs during initial fetch
  clone: use a more appropriate variable name for the default refspec

5 years agoMerge branch 'nd/checkout-dwim-fix'
Junio C Hamano [Fri, 4 Jan 2019 21:33:34 +0000 (13:33 -0800)] 
Merge branch 'nd/checkout-dwim-fix'

"git checkout frotz" (without any double-dash) avoids ambiguity by
making sure 'frotz' cannot be interpreted as a revision and as a
path at the same time.  This safety has been updated to check also
a unique remote-tracking branch 'frotz' in a remote, when dwimming
to create a local branch 'frotz' out of a remote-tracking branch
'frotz' from a remote.

* nd/checkout-dwim-fix:
  checkout: disambiguate dwim tracking branches and local files

5 years agoMerge branch 'ab/push-dwim-dst'
Junio C Hamano [Fri, 4 Jan 2019 21:33:33 +0000 (13:33 -0800)] 
Merge branch 'ab/push-dwim-dst'

"git push $there $src:$dst" rejects when $dst is not a fully
qualified refname and not clear what the end user meant.  The
codepath has been taught to give a clearer error message, and also
guess where the push should go by taking the type of the pushed
object into account (e.g. a tag object would want to go under
refs/tags/).

* ab/push-dwim-dst:
  push doc: document the DWYM behavior pushing to unqualified <dst>
  push: test that <src> doesn't DWYM if <dst> is unqualified
  push: add an advice on unqualified <dst> push
  push: move unqualified refname error into a function
  push: improve the error shown on unqualified <dst> push
  i18n: remote.c: mark error(...) messages for translation
  remote.c: add braces in anticipation of a follow-up change