Commit Graph

91639 Commits

Author SHA1 Message Date
Johannes Schindelin
8c589eb5dd git-p4: use test_atexit to kill the daemon
This should be more reliable than the current method, and prepares the
test suite for a consistent way to clean up before re-running the tests
with different options.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 18:25:13 +01:00
Johannes Schindelin
35f510f4ea git-daemon: use test_atexit in the tests
This makes use of the just-introduced consistent way to specify that a
long-running process needs to be terminated at the end of a test script
run.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 18:25:13 +01:00
Johannes Schindelin
1abc832afa tests: introduce test_atexit
When running the p4 daemon or `git daemon`, we want to kill it at the
end of the test script.

So far, we do this "manually".

However, in the next few commits we want to teach the test suite to
optionally re-run scripts with different options, therefore we will have
to have a consistent way to stop daemons.

Let's introduce `test_atexit`, which is loosely modeled after
`test_when_finished` (but has a broader scope: rather than running the
commands after the current test case, run them when the test script
finishes, and also run them when the `--immediate` option is in effect).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 18:25:13 +01:00
Johannes Schindelin
18e0d3a222 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.

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.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 18:25:13 +01:00
Johannes Schindelin
42eb1fc0c8 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).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 18:25:13 +01:00
Johannes Schindelin
53289cf285 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.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 18:25:12 +01:00
Johannes Schindelin
ee0383cf1e 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.

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>
2018-11-19 18:25:12 +01:00
Johannes Schindelin
56065dbf84 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.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 18:25:12 +01:00
Johannes Schindelin
9ef2ea46ac 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>
2018-11-19 18:25:12 +01:00
Johannes Schindelin
8c1b7d6abd 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>
2018-11-19 18:25:08 +01:00
Johannes Schindelin
a0e524d987 t0061: fix with --with-dashes and RUNTIME_PREFIX
When building Git with RUNTIME_PREFIX and starting a test helper from
t/helper/, it fails to detect the system prefix correctly.

This is the reason that the warning

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

to be printed.

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

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

So let's just ignore the RUNTIME_PREFIX warning.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 18:24:30 +01:00
Johannes Schindelin
afa65bfa01 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>
2018-11-19 18:24:26 +01:00
Johannes Schindelin
d27ba1fe67 Merge 'unmask-credentials-username'
This came in via pull request #677 from yaras/fix-git-675

Fixed masking username with asterisks when reading credentials

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:28 +01:00
Johannes Schindelin
ce3915acfb Merge 'aslr' into HEAD
Address Space Layout Randomization (ASLR) allows executables' memory
layout to change at random between runs, and therefore offers a quite
decent protection against many attacks.

We enable ASLR because MSYS2's C compiler offers support for ASLR, and
whatever performance impact it has is neglible, according to
https://insights.sei.cmu.edu/cert/2014/02/differences-between-aslr-on-windows-and-linux.html

This merges the part of https://github.com/git-for-windows/git/pull/612
that does not break Git ;-)

This fixes https://github.com/git-for-windows/git/issues/608

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:28 +01:00
Johannes Schindelin
5232b1542b Merge 'sideband-bug' into HEAD
This works around the push-over-git-protocol issues pointed out in
https://github.com/msysgit/git/issues/101.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:28 +01:00
Johannes Schindelin
7395cb7bdb Merge 'fix-externals' into HEAD 2018-11-19 17:58:27 +01:00
Johannes Schindelin
c0b8b0cd3e Merge 'remote-hg-prerequisites' into HEAD
These fixes were necessary for Sverre Rabbelier's remote-hg to work,
but for some magic reason they are not necessary for the current
remote-hg. Makes you wonder how that one gets away with it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:27 +01:00
Johannes Schindelin
ca4c5025f8 Merge branch 'add-e-truncate'
This patch teaches `git add -e` to truncate the patch file first (in
case that there is a left-over one from a previous, failed attempt).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:27 +01:00
Johannes Schindelin
0d019e5972 Merge branch 'cvsexportcommit-crlf'
This used to be "Merge pull request #938 from virtuald/patch-1"

git-cvsexportcommit.perl: Force crlf translation

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:26 +01:00
Johannes Schindelin
54e1c74dc0 Merge branch 'reset-stdin'
This topic branch adds the (experimental) --stdin/-z options to `git
reset`. Those patches are still under review in the upstream Git project,
but are already merged in their experimental form into Git for Windows'
`master` branch, in preparation for a MinGit-only release.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:26 +01:00
Johannes Schindelin
fcdef9d32d Merge branch 'unhidden-git'
It has been reported that core.hideDotFiles=false stopped working...
This topic branch fixes it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:26 +01:00
Johannes Schindelin
e06a79a7e3 Merge branch 'perl5lib'
With this topic branch, the PERL5LIB variable is unset to avoid external
settings from interfering with Git's own Perl interpreter.

This branch also cleans up some of our Windows-only config setting code
(and this will need to be rearranged in the next merging rebase so that
the cleanup comes first, and fscache and longPaths support build on
top).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:20 +01:00
Johannes Schindelin
c1778c91bf Merge 'mingw-getcwd' into HEAD 2018-11-19 17:58:12 +01:00
Johannes Schindelin
ba3f584744 Merge branch 'require-windows-vista-or-later'
This will be needed by the next commit, as it will make use of the
`GetFinalPathNameByHandleW()` function (which requires Vista or later).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:11 +01:00
Johannes Schindelin
a2cbc84332 mingw: respect core.hidedotfiles = false in git-init again
This is a brown paper bag. When adding the tests, we actually failed
to verify that the config variable is heeded in git-init at all. And
when changing the original patch that marked the .git/ directory as
hidden after reading the config, it was lost on this developer that
the new code would use the hide_dotfiles variable before the config
was read.

The fix is obvious: read the (limited, pre-init) config *before*
creating the .git/ directory.

This fixes https://github.com/git-for-windows/git/issues/789

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:58:03 +01:00
Johannes Schindelin
c57c026d2a Merge branch 'make-builtin-stash-and-rebase-opt-ins'
This branch adds back the scripted versions, then adds the option to
use the builtin versions of `stash` and `rebase` by setting
`stash.useBuiltin=true` and `rebase.useBuiltin=true`, respectively,
(the latter already worked for the top-level `git rebase` command and
the `--am` backend, and now it also works for the interactive backend).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:46:26 +01:00
Johannes Schindelin
92609f8902 non-builtin rebase: use non-builtin interactive backend
We recently converted both the `git rebase` and the `git rebase -i`
command from Unix shell scripts to builtins.

The former has a safety valve allowing to fall back to the scripted
`rebase`, just in case that there is a bug in the builtin `rebase`:
setting the config variable `rebase.useBuiltin` to `false` will
fall back to using the scripted version.

The latter did not have such a safety hatch.

Let's reinstate the scripted interactive rebase backend so that `rebase.useBuiltin=false` will not use the builtin interactive rebase,
just in case that an end user runs into a bug with the builtin version
and needs to get out of the fix really quickly.

This is necessary because Git for Windows wants to ship the builtin
rebase/interactive rebase earlier than core Git: Git for Windows
v2.19.0 will come with the option of a drastically faster (if a lot
less battle-tested) `git rebase`/`git rebase -i`.

As the file name `git-rebase--interactive` is already in use, let's
rename the scripted backend to `git-legacy-rebase--interactive`.

A couple of additional touch-ups are needed (such as teaching the
builtin `rebase--interactive`, which assumed the role of the
`rebase--helper`, to perform the two tricks to skip the unnecessary
picks and to generate a new todo list) to make things work again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:45:15 +01:00
Johannes Schindelin
b8bea45b73 Merge 'builtin-rebase--am'
This patch teaches the builtin rebase to avoid the scripted --am backend
and call `git format-patch` and `git am` directly.

Meaning: apart from the --merge and the --preserve-merges backends, `git
rebase` is now implemented in pure C, with no need to ask the Unix shell
interpreter for help.

This brings us really close to a fully builtin `git rebase`: the
--preserve-merges mode is about to be deprecated (as soon as the
--rebase-merges mode has proven stable and robust enough), and there are
plans to scrap the `git-rebase--merge` backend in favor of teaching the
interactive rebase enough tricks to run the --merge mode, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:44:53 +01:00
Johannes Schindelin
04ca03a9c2 Add back the original, scripted interactive rebase backend
This simply copies the version as of v2.19.0-rc0 verbatim. As of now,
it is not hooked up (because it needs a couple more changes to work);
The next commit will use the scripted interactive rebase backend from
`git rebase` again when `rebase.useBuiltin=false`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:44:53 +01:00
Johannes Schindelin
20324fb72c Merge branch 'js/builtin-rebase-perf-fix' 2018-11-19 17:44:53 +01:00
Johannes Schindelin
18e49058fe Merge branch 'js/rebase-autostash-detach-fix' 2018-11-19 17:44:52 +01:00
Johannes Schindelin
ead7116e38 Merge branch 'js/rebase-autostash-fix' 2018-11-19 17:44:52 +01:00
Johannes Schindelin
1d14e97f1f Merge branch 'jc/rebase-in-c-5-test-typofix' 2018-11-19 17:44:52 +01:00
Johannes Schindelin
42373df654 Merge branch 'rebase-r-and-merge-head-v1' 2018-11-19 17:44:51 +01:00
Johannes Schindelin
424f0e0bac Merge 'pk/rebase-in-c-6-final'
This final patch flips the switch and makes the builtin rebase the
default. The old, Unix shell scripted version can still be called via

	git -c rebase.useBuiltin=false rebase [...]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:44:51 +01:00
Johannes Schindelin
772596ed94 Merge 'js/rebase-in-c-5.5-work-with-rebase-i-in-c'
This branch first merges the builtin interactive rebase, and then
teaches the builtin rebase to hand off interactive rebases to the
builtin backend correctly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:44:51 +01:00
Johannes Schindelin
e54faa8fca Merge 'pk/rebase-in-c-5-test'
This fifth batch of builtin rebase patches concludes the conversion: the
builtin rebase is now feature-complete.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:44:50 +01:00
Johannes Schindelin
c8c939ce6b Merge 'pk/rebase-in-c-4-opts'
This wave of built rebase patches implements the remaining rebase
options in the builtin rebase.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:44:50 +01:00
Johannes Schindelin
c2001b5930 Merge 'pk/rebase-in-c-3-acts'
This set of patches implements the actions (such as --continue, --skip,
etc) in the builtin rebase.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:44:50 +01:00
Johannes Schindelin
a531e96321 Merge 'pk/rebase-in-c-2-basic'
This is the second wave of patches to bring us closer to a builtin `git
rebase`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:44:49 +01:00
Johannes Schindelin
32ecb04847 Merge 'pk/rebase-in-c'
This is the first batch of the patches that turn `git rebase` into
a builtin.

This not only helps performance on Windows, but *especially* makes
things more robust, as no MSYS2 Bash will be required to run this
command any longer.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:44:41 +01:00
Johannes Schindelin
0ede56d9d3 Merge 'ps/stash-in-c'
This merges the builtin stash.

Upstream Git did not integrate it into any stable integration branch
yet, but the performance improvements are substantial enough,
especially on Windows, that we really, really, really want to have it
early.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:44:06 +01:00
Johannes Schindelin
b7d63ca980 builtin rebase: call git am directly
While the scripted `git rebase` still has to rely on the
`git-rebase--am.sh` script to implement the glue between the `rebase`
and the `am` commands, we can go a more direct route in the builtin
rebase and avoid using a shell script altogether.

This reduces the chances of Git for Windows running into trouble due to
problems with the POSIX emulation layer (known as "MSYS2 runtime",
itself a derivative of the Cygwin runtime): when no shell script is
called, the POSIX emulation layer is avoided altogether.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:43:43 +01:00
Johannes Schindelin
f2abea2e1d status: rebase and merge can be in progress at the same time
Since `git rebase -r` was introduced, that is possible. But our
machinery did not think that possible, and failed to say anything about
the rebase in progress when in the middle of a merge.

Let's work around that in the minimal fashion.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:41:31 +01:00
Johannes Schindelin
ac06fe354b built-in rebase --skip/--abort: clean up stale .git/<name> files
The scripted version of the rebase used to execute `git reset --hard`
when skipping or aborting. When we ported this to C, we did update the
worktree and some reflogs, but we failed to imitate `git reset --hard`'s
behavior regarding files in .git/ such as MERGE_HEAD.

Let's address this oversight.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:41:31 +01:00
Johannes Schindelin
a64b5ad5e6 rebase -i: include MERGE_HEAD into files to clean up
Every once in a while, the interactive rebase makes sure that no stale
files are lying around. These days, we need to include MERGE_HEAD into
that set of files, as the `merge` command will generate them.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:41:31 +01:00
Johannes Schindelin
694d96d3a4 rebase -r: do not write MERGE_HEAD unless needed
When we detect that a `merge` can be skipped because the merged commit
is already an ancestor of HEAD, we do not need to commit, therefore
writing the MERGE_HEAD file is useless.

It is actually worse than useless: a subsequent `git commit` will pick
it up and think that we want to merge that commit, still.

To avoid that, move the code that writes the MERGE_HEAD file to a
location where we already know that the `merge` cannot be skipped.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:41:31 +01:00
Johannes Schindelin
155f6f89a7 rebase -r: demonstrate bug with conflicting merges
When calling `merge` on a branch that has already been merged, that
`merge` is skipped quietly, but currently a MERGE_HEAD file is being
left behind and will then be grabbed by the next `pick` (that did
not want to create a *merge* commit).

Demonstrate this.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:41:31 +01:00
Johannes Schindelin
79c14d1127 Merge 'mingw-modernize-pthread_cond_t'
This was pull request #1214 from rongjiecomputer/master

Implement pthread_cond_t with Win32 CONDITION_VARIABLE

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 17:38:54 +01:00
Johannes Schindelin
8e0e1fafeb Merge 'default-ident' into HEAD 2018-11-19 17:38:54 +01:00