Commit Graph

88805 Commits

Author SHA1 Message Date
Heiko Voigt
416ef42de8 git-gui: provide question helper for retry fallback on Windows
Make use of the new environment variable GIT_ASK_YESNO to support the
recently implemented fallback in case unlink, rename or rmdir fail for
files in use on Windows. The added dialog will present a yes/no question
to the the user which will currently be used by the windows compat layer
to let the user retry a failed file operation.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
2018-10-04 20:54:52 +02:00
Heiko Voigt
62f926117a Revert "git-gui: set GIT_DIR and GIT_WORK_TREE after setup"
This reverts commit a9fa11fe5b.
2018-10-04 20:54:52 +02:00
Johannes Schindelin
f0badda8d7 Start the merging-rebase to v2.19.1
This commit starts the rebase of 0d848d696a to 0d3c37ddac
2018-10-04 20:54:51 +02:00
Johannes Schindelin
79ff0c6229 Merge pull request #1864 from dscho/reinstate-cousins
Two things I totally forgot
2018-10-04 18:20:37 +00:00
Johannes Schindelin
180b383d46 Merge 'built-in-stash-rebase-fixes-extra'
Ramsay pointed this out, but not in the email thread of the patches
themselves, so I had missed this earlier.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 14:48:26 +02:00
Johannes Schindelin
6bc7024aec fixup! builtin rebase: support -C and --whitespace=<type>
The constant `0` is not the correct one for pointers.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 14:47:46 +02:00
Johannes Schindelin
f86e9afb41 Merge branch 'git-gui-hooks-path' of https://github.com/dscho/git-gui
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 14:46:21 +02:00
Johannes Schindelin
574c78137f respect core.hooksPath, falling back to .git/hooks
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

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

Initial-patch-by: Philipp Gortan <philipp@gortan.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 14:46:00 +02:00
Johannes Schindelin
6c65e18eb1 Merge pull request #1862 from dscho/fixup-poll.c
Fix up compat/poll/poll.c
2018-10-03 19:40:18 +00:00
Johannes Schindelin
46ffe1da4c squash! compat/poll: prepare for targeting Windows Vista
We also need to make sure that we override those constants *after*
`winsock2.h` has been `#include`d (otherwise we would not really
override those constants).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-03 17:46:01 +02:00
Johannes Schindelin
502e856705 Merge pull request #1853 from dscho/fix-gc-segfault
Fix occasional segmentation fault in `git gc`
2018-09-28 10:59:09 +02:00
Johannes Schindelin
ba593a7c31 Merge pull request #1827 from benpeart/fscache_refresh_index
Enable the filesystem cache (fscache) in refresh_index().
2018-09-28 00:39:59 +02:00
Johannes Schindelin
843931bbb9 pack-objects (mingw): initialize packing_data mutex in the correct spot
In 9ac3f0e5b3 (pack-objects: fix performance issues on packing large
deltas, 2018-07-22), a mutex was introduced that is used to guard the
call to set the delta size. This commit even added code to initialize
it, but at an incorrect spot: in `init_threaded_search()`, while the
call to `oe_set_delta_size()` (and hence to `packing_data_lock()`) can
happen in the call chain `check_object()` <- `get_object_details()` <-
`prepare_pack()` <- `cmd_pack_objects()`, which is long before the
`prepare_pack()` function calls `ll_find_deltas()` (which initializes
the threaded search).

Another tell-tale that the mutex was initialized in an incorrect spot is
that the function to initialize it lives in builtin/, while the code
that uses the mutex is defined in a libgit.a header file.

Let's use a more appropriate function: `prepare_packing_data()`, which
not only lives in libgit.a, but *has* to be called before the
`packing_data` struct is used that contains that mutex.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-27 22:34:04 +02:00
Johannes Schindelin
a20f413991 pack-objects (mingw): demonstrate a segmentation fault with large deltas
There is a problem in the way 9ac3f0e5b3 (pack-objects: fix
performance issues on packing large deltas, 2018-07-22) initializes that
mutex in the `packing_data` struct. The problem manifests in a
segmentation fault on Windows, when a mutex (AKA critical section) is
accessed without being initialized. (With pthreads, you apparently do
not really have to initialize them?)

This was reported in https://github.com/git-for-windows/git/issues/1839.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-27 22:26:03 +02:00
Johannes Schindelin
c4996b710c Fix typo 'detla' -> 'delta'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-27 21:40:25 +02:00
Junio C Hamano
cae598d998 Git 2.19.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.19.1
2018-09-27 11:52:33 -07:00
Junio C Hamano
1958ad504b Sync with 2.18.1
* maint-2.18:
  Git 2.18.1
  Git 2.17.2
  fsck: detect submodule paths starting with dash
  fsck: detect submodule urls starting with dash
  Git 2.16.5
  Git 2.15.3
  Git 2.14.5
  submodule-config: ban submodule paths that start with a dash
  submodule-config: ban submodule urls that start with dash
  submodule--helper: use "--" to signal end of clone options
2018-09-27 11:50:45 -07:00
Junio C Hamano
268fbcd172 Git 2.18.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.18.1
2018-09-27 11:48:19 -07:00
Junio C Hamano
44f87dac99 Sync with 2.17.2
* maint-2.17:
  Git 2.17.2
  fsck: detect submodule paths starting with dash
  fsck: detect submodule urls starting with dash
  Git 2.16.5
  Git 2.15.3
  Git 2.14.5
  submodule-config: ban submodule paths that start with a dash
  submodule-config: ban submodule urls that start with dash
  submodule--helper: use "--" to signal end of clone options
2018-09-27 11:45:01 -07:00
Junio C Hamano
6e9e91e9ca Git 2.17.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.17.2
2018-09-27 11:44:07 -07:00
Jeff King
1a7fd1fb29 fsck: detect submodule paths starting with dash
As with urls, submodule paths with dashes are ignored by
git, but may end up confusing older versions. Detecting them
via fsck lets us prevent modern versions of git from being a
vector to spread broken .gitmodules to older versions.

Compared to blocking leading-dash urls, though, this
detection may be less of a good idea:

  1. While such paths provide confusing and broken results,
     they don't seem to actually work as option injections
     against anything except "cd". In particular, the
     submodule code seems to canonicalize to an absolute
     path before running "git clone" (so it passes
     /your/clone/-sub).

  2. It's more likely that we may one day make such names
     actually work correctly. Even after we revert this fsck
     check, it will continue to be a hassle until hosting
     servers are all updated.

On the other hand, it's not entirely clear that the behavior
in older versions is safe. And if we do want to eventually
allow this, we may end up doing so with a special syntax
anyway (e.g., writing "./-sub" in the .gitmodules file, and
teaching the submodule code to canonicalize it when
comparing).

So on balance, this is probably a good protection.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-27 11:41:31 -07:00
Jeff King
a124133e1e fsck: detect submodule urls starting with dash
Urls with leading dashes can cause mischief on older
versions of Git. We should detect them so that they can be
rejected by receive.fsckObjects, preventing modern versions
of git from being a vector by which attacks can spread.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-27 11:41:26 -07:00
Junio C Hamano
e43aab778c Sync with 2.16.5
* maint-2.16:
  Git 2.16.5
  Git 2.15.3
  Git 2.14.5
  submodule-config: ban submodule paths that start with a dash
  submodule-config: ban submodule urls that start with dash
  submodule--helper: use "--" to signal end of clone options
2018-09-27 11:41:02 -07:00
Junio C Hamano
27d05d1a1a Git 2.16.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.16.5
2018-09-27 11:38:32 -07:00
Junio C Hamano
424aac653a Sync with 2.15.3
* maint-2.15:
  Git 2.15.3
  Git 2.14.5
  submodule-config: ban submodule paths that start with a dash
  submodule-config: ban submodule urls that start with dash
  submodule--helper: use "--" to signal end of clone options
2018-09-27 11:35:43 -07:00
Junio C Hamano
924c623e1c Git 2.15.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.15.3
2018-09-27 11:33:47 -07:00
Jameson Miller
a5565b477c Merge pull request #1852 from dscho/built-in-stash-rebase-fixes
Built-in stash/rebase fixes
2018-09-27 14:29:12 -04:00
Junio C Hamano
902df9f5c4 Sync with Git 2.14.4
* maint-2.14:
  Git 2.14.5
  submodule-config: ban submodule paths that start with a dash
  submodule-config: ban submodule urls that start with dash
  submodule--helper: use "--" to signal end of clone options
2018-09-27 11:20:22 -07:00
Junio C Hamano
d0832b2847 Git 2.14.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.14.5
2018-09-27 11:19:11 -07:00
Jeff King
273c61496f submodule-config: ban submodule paths that start with a dash
We recently banned submodule urls that look like
command-line options. This is the matching change to ban
leading-dash paths.

As with the urls, this should not break any use cases that
currently work. Even with our "--" separator passed to
git-clone, git-submodule.sh gets confused. Without the code
portion of this patch, the clone of "-sub" added in t7417
would yield results like:

    /path/to/git-submodule: 410: cd: Illegal option -s
    /path/to/git-submodule: 417: cd: Illegal option -s
    /path/to/git-submodule: 410: cd: Illegal option -s
    /path/to/git-submodule: 417: cd: Illegal option -s
    Fetched in submodule path '-sub', but it did not contain b56243f8f4eb91b2f1f8109452e659f14dd3fbe4. Direct fetching of that commit failed.

Moreover, naively adding such a submodule doesn't work:

  $ git submodule add $url -sub
  The following path is ignored by one of your .gitignore files:
  -sub

even though there is no such ignore pattern (the test script
hacks around this with a well-placed "git mv").

Unlike leading-dash urls, though, it's possible that such a
path _could_ be useful if we eventually made it work. So
this commit should be seen not as recommending a particular
policy, but rather temporarily closing off a broken and
possibly dangerous code-path. We may revisit this decision
later.

There are two minor differences to the tests in t7416 (that
covered urls):

  1. We don't have a "./-sub" escape hatch to make this
     work, since the submodule code expects to be able to
     match canonical index names to the path field (so you
     are free to add submodule config with that path, but we
     would never actually use it, since an index entry would
     never start with "./").

  2. After this patch, cloning actually succeeds. Since we
     ignore the submodule.*.path value, we fail to find a
     config stanza for our submodule at all, and simply
     treat it as inactive. We still check for the "ignoring"
     message.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-27 09:34:59 -07:00
Jeff King
f6adec4e32 submodule-config: ban submodule urls that start with dash
The previous commit taught the submodule code to invoke our
"git clone $url $path" with a "--" separator so that we
aren't confused by urls or paths that start with dashes.

However, that's just one code path. It's not clear if there
are others, and it would be an easy mistake to add one in
the future. Moreover, even with the fix in the previous
commit, it's quite hard to actually do anything useful with
such an entry. Any url starting with a dash must fall into
one of three categories:

 - it's meant as a file url, like "-path". But then any
   clone is not going to have the matching path, since it's
   by definition relative inside the newly created clone. If
   you spell it as "./-path", the submodule code sees the
   "/" and translates this to an absolute path, so it at
   least works (assuming the receiver has the same
   filesystem layout as you). But that trick does not apply
   for a bare "-path".

 - it's meant as an ssh url, like "-host:path". But this
   already doesn't work, as we explicitly disallow ssh
   hostnames that begin with a dash (to avoid option
   injection against ssh).

 - it's a remote-helper scheme, like "-scheme::data". This
   _could_ work if the receiver bends over backwards and
   creates a funny-named helper like "git-remote--scheme".
   But normally there would not be any helper that matches.

Since such a url does not work today and is not likely to do
anything useful in the future, let's simply disallow them
entirely. That protects the existing "git clone" path (in a
belt-and-suspenders way), along with any others that might
exist.

Our tests cover two cases:

  1. A file url with "./" continues to work, showing that
     there's an escape hatch for people with truly silly
     repo names.

  2. A url starting with "-" is rejected.

Note that we expect case (2) to fail, but it would have done
so even without this commit, for the reasons given above.
So instead of just expecting failure, let's also check for
the magic word "ignoring" on stderr. That lets us know that
we failed for the right reason.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-27 09:34:58 -07:00
Jeff King
98afac7a7c submodule--helper: use "--" to signal end of clone options
When we clone a submodule, we call "git clone $url $path".
But there's nothing to say that those components can't begin
with a dash themselves, confusing git-clone into thinking
they're options. Let's pass "--" to make it clear what we
expect.

There's no test here, because it's actually quite hard to
make these names work, even with "git clone" parsing them
correctly. And we're going to restrict these cases even
further in future commits. So we'll leave off testing until
then; this is just the minimal fix to prevent us from doing
something stupid with a badly formed entry.

Reported-by: joernchen <joernchen@phenoelit.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-27 09:34:55 -07:00
Johannes Schindelin
fb77ec5460 fixup! Add a build definition for Azure DevOps
In Azure Pipelines, a sane setting is to prevent secret variables from
being shared with Pull Requests originating from forks.

In Git, we use such a secret variable: we want to mount a file share on
which previous we store outcomes of previous runs, and avoid re-running
known-good phases (both for speed as well as to avoid spending resources
unnecessarily). This file share should not be mounted in PRs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-27 16:12:26 +02:00
Johannes Schindelin
1e6a1c510f fixup! builtin rebase: support --gpg-sign option
The `--gpg-sign` option takes an *optional* argument, not a mandatory
one.

This was discovered as part of the investigation of
https://github.com/git-for-windows/git/issues/1836.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-27 15:01:47 +02:00
Johannes Schindelin
ddb6e5ca19 fixup! rebase -i: implement the main part of interactive rebase as a builtin
The `--gpg-sign` option takes an *optional* argument, not a mandatory
one.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-27 15:01:47 +02:00
Johannes Schindelin
2af24038a9 fixup! stash: convert apply to builtin
When converting the `stash apply` command, we were missing at least two
error messages: when the diff could not be applied with `--index`, we
want to suggest to re-run the command without `--index`.

While at it, and because we now can, let's also add an error message in
the case that the diff could not be generated in the first place (the
shell script could not do that, as it piped the output of `git diff` to
`git apply`, and there is no portable way to handle errors in the
command whose output is redirected).

Noticed by Matthew Cheetham.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-27 14:14:58 +02:00
Johannes Schindelin
d6a9496dda Merge pull request #1850 from dscho/fix-badge
fixup! Merge remote-tracking branch 'origin/master' into azure-pipelines
2018-09-26 22:10:36 +02:00
Johannes Schindelin
e615d6d988 fixup! Merge remote-tracking branch 'origin/master' into azure-pipelines
D'oh. There really need to be two slashes, not one, after the protocol.
Copy/edit fail.

Now, where do I have my brown paper bag. Ah. There it is.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-26 21:49:59 +02:00
Jameson Miller
fae60552db Merge pull request #1837 from git-for-windows/azure-pipelines
Set up CI with Azure Pipelines
2018-09-24 16:57:30 -04:00
Johannes Schindelin
dbd1489657 Merge remote-tracking branch 'origin/master' into azure-pipelines
This merges Git for Windows' `master` branch into the branch, resolving
the conflicts in README.md by replacing the Azure Pipelines links with
Git for Windows' own ones.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-20 05:21:27 +02:00
Johannes Schindelin
3d83d68965 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").

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-20 05:21:20 +02:00
Johannes Schindelin
2631b4a641 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>
2018-09-20 05:21:20 +02:00
Johannes Schindelin
bb8decfff7 tests: record more stderr with --write-junit-xml in case of failure
Sometimes, failures in a test case are actually caused by issues in
earlier test cases.

To make it easier to see those issues, let's attach the output from
before the failing test case (i.e. stdout/stderr since the previous
failing test case, or the start of the test script). This will be
visible in the "Attachments" of the details of the failed test.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-09-20 05:21:20 +02:00
Johannes Schindelin
7bc1e3b480 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>
2018-09-20 05:21:20 +02:00
Johannes Schindelin
baf81a7f84 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-09-20 05:21:20 +02:00
Johannes Schindelin
b461868985 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-09-20 05:21:20 +02:00
Johannes Schindelin
4b81cb1e59 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-09-20 05:21:20 +02:00
Johannes Schindelin
7f446cc241 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-09-20 05:21:20 +02:00
Jameson Miller
42a3604fdc Merge pull request #1840 from jamill/fixup_test
fixup! mingw: respect core.hidedotfiles = false in git-init again
2018-09-18 13:35:29 -04:00
Jameson Miller
faec6efd90 fixup! mingw: respect core.hidedotfiles = false in git-init again
Fix broken command chain in t0001-init.sh.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
2018-09-17 17:39:55 -04:00