Граф коммитов

94369 Коммитов

Автор SHA1 Сообщение Дата
Johannes Schindelin 97b25226d1
Merge pull request #145 from microsoft/kg/external-diff-save-env
Fix problems with `git difftool` and a large number of files
2019-05-29 15:07:37 +02:00
Junio C Hamano e4784d6a31 Merge branch 'kg/external-diff-save-env'
The code to drive GIT_EXTERNAL_DIFF command relied on the string
returned from getenv() to be non-volatile, which is not true, that
has been corrected.

* kg/external-diff-save-env:
  diff: ensure correct lifetime of external_diff_cmd
2019-05-29 10:50:08 +02:00
Kevin Willford adf2904912
Merge pull request #137 Fix the Azure Pipeline (e.g. macOS builds after the upgrade to Mojave)
Fix the Azure Pipeline (e.g. macOS builds after the upgrade to Mojave)
2019-05-10 23:09:57 -04:00
Johannes Schindelin 523982978a Merge branch 'dscho/gcc-8-gfw'
This backports several patch series from Git for Windows' `master` to
make things compile with GCC v8.x, as that will soon be the default for
Git for Windows (and is already the current setup on this developer's
machine).
2019-05-10 22:17:37 +02:00
Johannes Schindelin 32c18f9c5a fixup! mingw: kill child processes in a gentler way
This is needed to make things compile with GCC 8.x and later.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-05-10 22:17:37 +02:00
Johannes Schindelin 2f0b391a4c kwset: allow building with GCC 8
The kwset functionality makes use of the obstack code, which expects to
be handed a function that can allocate large chunks of data. It expects
that function to accept a `size` parameter of type `long`.

This upsets GCC 8 on Windows, because `long` does not have the same
bit size as `size_t` there.

Now, the proper thing to do would be to switch to `size_t`. But this
would make us deviate from the "upstream" code even further, making it
hard to synchronize with newer versions, and also it would be quite
involved because that `long` type is so invasive in that code.

Let's punt, and instead provide a super small wrapper around
`xmalloc()`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-05-10 22:17:37 +02:00
Johannes Schindelin 7df0cdfdbd mingw: allow compiling with GCC 8 and DEVELOPER=1
The return type of the `GetProcAddress()` function is `FARPROC` which
evaluates to `long long int (*)()`, i.e. it cannot be cast to the
correct function signature by GCC 8.

To work around that, we first cast to `void *` and go on with our merry
lives.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-05-10 22:17:37 +02:00
SZEDER Gábor 91802d2329 compat/obstack: fix -Wcast-function-type warnings
GCC 8 introduced the new -Wcast-function-type warning, which is
implied by -Wextra (which, in turn is enabled in our DEVELOPER flags).
When building Git with GCC 8 and this warning enabled on a non-glibc
platform [1], one is greeted with a screenful of compiler
warnings/errors:

  compat/obstack.c: In function '_obstack_begin':
  compat/obstack.c:162:17: error: cast between incompatible function types from 'void * (*)(long int)' to 'struct _obstack_chunk * (*)(void *, long int)' [-Werror=cast-function-type]
     h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
                   ^
  compat/obstack.c:163:16: error: cast between incompatible function types from 'void (*)(void *)' to 'void (*)(void *, struct _obstack_chunk *)' [-Werror=cast-function-type]
     h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
                  ^
  compat/obstack.c:116:8: error: cast between incompatible function types from 'struct _obstack_chunk * (*)(void *, long int)' to 'struct _obstack_chunk * (*)(long int)' [-Werror=cast-function-type]
      : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
          ^
  compat/obstack.c:168:22: note: in expansion of macro 'CALL_CHUNKFUN'
     chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
                        ^~~~~~~~~~~~~
  <snip>

'struct obstack' stores pointers to two functions to allocate and free
"chunks", and depending on how obstack is used, these functions take
either one parameter (like standard malloc() and free() do; this is
how we use it in 'kwset.c') or two parameters.  Presumably to reduce
memory footprint, a single field is used to store the function pointer
for both signatures, and then it's casted to the appropriate signature
when the function pointer is accessed.  These casts between function
pointers with different number of parameters are what trigger those
compiler errors.

Modify 'struct obstack' to use unions to store function pointers with
different signatures, and then use the union member with the
appropriate signature when accessing these function pointers.  This
eliminates the need for those casts, and thus avoids this compiler
error.

[1] Compiling 'compat/obstack.c' on a platform with glibc is sort of
    a noop, see the comment before '#  define ELIDE_CODE', so this is
    not an issue on common Linux distros.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
2019-05-10 22:17:37 +02:00
Johannes Schindelin d68d6c8019 ci: move the Windows jobs to the top
The tests on Windows arguably take the longest, so let's get the build
done with, first thing.
2019-05-10 22:17:08 +02:00
Johannes Schindelin 32f719bccf fixup! mingw: special-case arguments to `sh`
While working on parallelizing the tests in Azure Pipelines, an issue
was discovered with the `is_msys2_sh()` function: it expects the path
components to be separated by exactly one dir separator. That does not
need to be the case, though, e.g. when the components in the `PATH`
variable have trailing slashes.

Let's make the code much more robust in this respect.

This fixes t5580.5.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-05-10 22:16:29 +02:00
Johannes Schindelin 9d2b561441 ci: backport parallel tests on Windows
It just takes forever, or at least over an hour, to run them in a
non-parallel way. That's why we switched to parallel testing in v2.21.0,
and hereby we bring that goodness back to vfs-2.20.1.
2019-05-10 22:16:27 +02:00
Johannes Schindelin b1493165d3 ci: use newer Azure Pipelines YAML schema
We will need this in the next commit, where we backport the parallelized
tests on Windows.
2019-05-10 21:23:11 +02:00
Johannes Schindelin de859a79e7 ci: use git-sdk-64-minimal
This is a (partial) backport of the improvements of the Azure Pipeline
made in Git for Windows v2.21.0.

The major benefit is that it makes the task to initialize the Git for
Windows SDK *a lot* faster.

It would also have worked around a problem where an MSYS2 update breaks
t6500.13, and it will work around similar problems in the future, as the
Azure Pipeline that updates git-sdk-64-minimal will not publish a new
artifact unless Git's test suite (as of upstream's current `master`)
passes.
2019-05-05 01:22:57 +02:00
Johannes Schindelin 469f915db8 t6500(mingw): use the Windows PID of the shell
In Git for Windows, we use the MSYS2 Bash which inherits a non-standard
PID model from Cygwin's POSIX emulation layer: every MSYS2 process has a
regular Windows PID, and in addition it has an MSYS2 PID (which
corresponds to a shadow process that emulates Unix-style signal
handling).

With the upgrade to the MSYS2 runtime v3.x, this shadow process cannot
be accessed via `OpenProcess()` any longer, and therefore t6500 thought
incorrectly that the process referenced in `gc.pid` (which is not
actually a real `gc` process in this context, but the current shell) no
longer exists.

Let's fix this by making sure that the Windows PID is written into
`gc.pid` in this test script soo that `git.exe` is able to understand
that that process does indeed still exist.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-05-05 01:22:57 +02:00
Johannes Schindelin 0d14af1ef6 Merge branch 'ld/git-p4-remove-flakey-test'
This removes a test that failed frequently on Azure Pipelines' macOS
agents, indicating some serious flakiness.
2019-05-05 01:22:57 +02:00
Johannes Schindelin 357204fd8a Merge branch 'jk/no-sigpipe-during-network-transport'
This branch fixes the flakiness of the git-daemon tests on macOS.
2019-05-03 19:04:13 +02:00
Johannes Schindelin 7671a3827b mingw: allow building with an MSYS2 runtime v3.x
Recently the Git for Windows project started the upgrade process to
a MSYS2 runtime version based on Cygwin v3.x.

This has the very notable consequence that `$(uname -r)` no longer
reports a version starting with "2", but a version with "3".

That breaks our build, as df5218b4c3 (config.mak.uname: support MSys2,
2016-01-13) simply did not expect the version reported by `uname -r` to
depend on the underlying Cygwin version: it expected the reported
version to match the "2" in "MSYS2".

So let's invert that test case to test for *anything else* than a
version starting with "1" (for MSys). That should safeguard us for the
future, even if Cygwin ends up releasing versionsl like 314.272.65536.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-03 19:01:27 +02:00
Johannes Schindelin 1fa66cd1e4 Merge branch 'js/iso8895-test-on-apfs'
This is patch 2/2 that is needed to cope with Azure Pipelines' macOS
agents' upgrade to Mojave (which uncovered two bugs in Git).
2019-05-03 17:50:05 +02:00
Johannes Schindelin 00f1927dbe Merge branch 'js/macos-gettext-build'
This is patch 1/2 that is needed to cope with Azure Pipelines' macOS
agents' upgrade to Mojave (which uncovered two bugs in Git).
2019-05-03 17:49:59 +02:00
Johannes Schindelin 6a2dc809b6 t9822: skip tests if file names cannot be ISO-8859-1 encoded
Most notably, it seems that macOS' APFS does not allow that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-03 17:49:59 +02:00
Johannes Schindelin 4be16dbc19 macOS: make sure that gettext is found
Due to reasons (some XCode versions seem to include gettext, some
don't?), Homebrew does not expose the libraries and headers in
/usr/local/ by default anymore.

Let's help find them again.

Note: for some reason, this is a change of behavior caused by the
upgrade to Mojave, identified in our Azure Pipeline; it seems that
Homebrew used to add the /usr/local/ directories to the include and link
search path before, but now it no longer does.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-03 17:49:58 +02:00
Jeff Hostetler 8d75d0a301
Merge pull request #131 from jeffhostetler/gvfs-fix-ci-static-analysis
Fix CI static analysis
2019-03-27 13:26:10 -04:00
Jeff Hostetler 11966f8283
Merge pull request #130 from jeffhostetler/gvfs-fix-gitlink-in-coretxt
core.txt: fixup typo in gitlink for check-docs
2019-03-27 13:16:18 -04:00
Jeff Hostetler 0d1452f318 status: fixup deserialize for cocci
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-03-27 11:26:04 -04:00
Jeff Hostetler 5330f5d626 commit: change old hashcmp to hasheq for cocci
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-03-27 11:25:35 -04:00
Jeff Hostetler 50988f364b core.txt: fixup typo in gitlink for check-docs
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-03-27 10:25:58 -04:00
Jeff King 143588949c fetch: ignore SIGPIPE during network operation
The default SIGPIPE behavior can be useful for a command that generates
a lot of output: if the receiver of our output goes away, we'll be
notified asynchronously to stop generating it (typically by killing the
program).

But for a command like fetch, which is primarily concerned with
receiving data and writing it to disk, an unexpected SIGPIPE can be
awkward. We're already checking the return value of all of our write()
calls, and dying due to the signal takes away our chance to gracefully
handle the error.

On Linux, we wouldn't generally see SIGPIPE at all during fetch. If the
other side of the network connection hangs up, we'll see ECONNRESET. But
on OS X, we get a SIGPIPE, and the process is killed. This causes t5570
to racily fail, as we sometimes die by signal (instead of the expected
die() call) when the server side hangs up.

Let's ignore SIGPIPE during the network portion of the fetch, which will
cause our write() to return EPIPE, giving us consistent behavior across
platforms.

This fixes the test flakiness, but note that it stops short of fixing
the larger problem. The server side hit a fatal error, sent us an "ERR"
packet, and then hung up. We notice the failure because we're trying to
write to a closed socket. But by dying immediately, we never actually
read the ERR packet and report its content to the user. This is a (racy)
problem on all platforms. So this patch lays the groundwork from which
that problem might be fixed consistently, but it doesn't actually fix
it.

Note the placement of the SIGPIPE handling. The absolute minimal change
would be to ignore SIGPIPE only when we're writing. But twiddling the
signal handler for each write call is inefficient and maintenance
burden. On the opposite end of the spectrum, we could simply declare
that fetch does not need SIGPIPE handling, since it doesn't generate a
lot of output, and we could just ignore it at the start of cmd_fetch().

This patch takes a middle ground. It ignores SIGPIPE during the network
operation (which is admittedly most of the program, since the actual
network operations are all done under the hood by the transport code).
So it's still pretty coarse.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-05 15:02:18 +09:00
Jeff King 37c80012f1 fetch: avoid calling write_or_die()
The write_or_die() function has one quirk that a caller might not
expect: when it sees EPIPE from the write() call, it translates that
into a death by SIGPIPE. This doesn't change the overall behavior (the
program exits either way), but it does potentially confuse test scripts
looking for a non-signal exit code.

Let's switch away from using write_or_die() in a few code paths, which
will give us more consistent exit codes. It also gives us the
opportunity to write more descriptive error messages, since we have
context that write_or_die() does not.

Note that this won't do much by itself, since we'd typically be killed
by SIGPIPE before write_or_die() even gets a chance to do its thing.
That will be addressed in the next patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-05 15:02:01 +09:00
Ben Peart 2ab73608a0
Merge pull request #125 from benpeart/blockeol
fixup! gvfs: ensure all filters and EOL conversions are blocked
2019-02-28 17:04:43 -05:00
Jeff Hostetler db3f8ae2d1
Merge pull request #124 from jeffhostetler/perf-midx-verify
midx: verify: group objects by packfile to speed up object verification
2019-02-28 15:02:41 -05:00
Ben Peart a39e631466 fixup! gvfs: ensure all filters and EOL conversions are blocked
Ensure writing out files properly blocks expanding $Id: when the ident
attribute is set for a path under GVFS.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2019-02-28 12:35:36 -05:00
Jeff Hostetler 4a4f2f41e7 trace2:data: add trace2 data to midx
Log multi-pack-index sub-command (cmd_mode).
Log number of objects and number of packfiles.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-02-28 11:39:43 -05:00
Jeff Hostetler 2560f7e3bf midx: verify: group objects by packfile to speed up object verification
Sort the set of objects by packfile so that only one packfile needs
to be open at a time.

This is a performance improvement.  Previously, objects were
verified in OID order.  This essentially requires all packfiles
to be open at the same time.  If the number of packfiles exceeds
the open file limit, packfiles would be closed and re-opened
many times.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-02-28 09:29:29 -05:00
Jeff Hostetler be59e6fef9
Merge pull request #121 from jeffhostetler/hotfix-midx-verify
midx: verify: add midx packfiles to the packed_git list
2019-02-27 15:33:23 -05:00
Jeff Hostetler fa4b43c831 midx: verify: add midx packfiles to the packed_git list
Fix "git multi-pack-index verify" to handle repos with thousands
of packfiles.

Midx verify adds the individual "packed_git" structures to the
multi_pack_index.packs array, but it does not add them to the
"repository.objects.packed_git" list.  During the verification
code, each packfile is opened and scanned.  And "pack_open_fds"
is incremented.  If "pack_open_fds" equals the "pack_max_fds"
open_packed_git_1() calls close_one_pack() to LRU-style close
an already open packfile.  But because the packfiles were never
added to the "packed_git" list, close_one_pack() does nothing.
If there are very many packfiles, Git runs out of file descriptors
and fails.

Note that this was observed on Windows when build with GCC and
in a repository with more than (2048-25) packfiles.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-02-26 13:53:05 -05:00
Ben Peart 8af1f397ff
Merge pull request #119 from benpeart/revert-pager-atexit
fixup! pager: fix order of atexit() calls
2019-02-14 09:27:30 -05:00
Ben Peart 79dca30445 fixup! pager: fix order of atexit() calls
This reverts commit 3f588065b0 as it no longer fixes the underlying issue.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2019-02-13 16:45:47 -05:00
Jeff Hostetler 178619c5d0
Merge pull request #117 from jeffhostetler/gvfs-trace2-next-fixup
fixup! trace2: collect Windows-specific process information
2019-02-11 17:32:22 -05:00
Jeff Hostetler dcbd5a1763 fixup! trace2: collect Windows-specific process information
Guard against infinite loop while computing the parent process hierarchy.

CreateToolhelp32Snapshot() is used to get a list of all processes on the
system.  Each process entry contains the process PID and PPID (alive at the
time of the snapshot).  We compute the set of ancestors of the current process
by repeated searches on this list.

Testing revealed that the snapshot can contain PPID cycles.  This causes an
infinite loop during the set construction and causes the git.exe command to
hang.

Testing found an instance where 3 processes were in a PPID cycle.  The
snapshot implied that each of these processes was its own great-grandparent.
This should not be possible unless a PID was recycled and just happened to
match up.

For full disclosure, the Windows "System Idle Process" has PID and PPID 0.
If it were to launch a Git command, it could cause a similar infinite loop.
Or more properly, if any ancestor of the current Git command has PPID 0, it
will appear to be a descendant of the idle process and trigger the problem.

This commit fixes both cases by maintaining a list of the PIDs seen during
the ancestor walk and stopping if a cycle is detected.

Additionally, code was added to truncate the search after a reasonable fixed
depth limit.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-02-11 14:30:30 -05:00
Luke Diamand 3f360ded54 git-p4: remove ticket expiry test
The git-p4 login ticket expiry test causes unreliable test
runs. Since the handling of ticket expiry in git-p4 is far
from polished anyway, let's remove it for now.

A better way to actually run the test is to create a python
"fake" version of "p4" which returns whatever expiry results
the test requires.

Ideally git-p4 would look at the expiry time before starting
any long operations, and cleanup gracefully if there is not
enough time left. But that's quite hard to do.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-02-06 12:58:57 -08:00
Jeff Hostetler 5c7bc007df
Merge pull request #115 from jeffhostetler/gvfs-trace2-v7
Trace2 re-roll from upstream "pu" plus VFS additions
2019-02-06 11:50:18 -05:00
Jeff Hostetler 9835bc6a95 gvfs:trace2:data: add vfs stats
Report the number of files tracked.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-02-05 16:20:59 -05:00
Jeff Hostetler a0751d6ea4 gvfs:trace2:data: status serialization
Add trace information around status serialization.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-02-05 16:20:59 -05:00
Jeff Hostetler 40171a59f4 gvfs:trace2:data: status deserialization information
Add trace2 region and data events describing attempts to deserialize
status data using a status cache.

A category:status, label:deserialize region is pushed around the
deserialize code.

Deserialization results when reading from a file are:
    category:status, path   = <path>
    category:status, polled = <number_of_attempts>
    category:status, result = "ok" | "reject"

When reading from STDIN are:
    category:status, path   = "STDIN"
    category:status, result = "ok" | "reject"

Status will fallback and run a normal status scan when a "reject"
is reported (unless "--deserialize-wait=fail").

If "ok" is reported, status was able to use the status cache and
avoid scanning the workdir.

Additionally, a cmd_mode is emitted for each step: collection,
deserialization, and serialization.  For example, if deserialization
is attempted and fails and status falls back to actually computing
the status, a cmd_mode message containing "deserialize" is issued
and then a cmd_mode for "collect" is issued.

Also, if deserialization fails, a data message containing the
rejection reason is emitted.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-02-05 16:20:15 -05:00
Jeff Hostetler 49484a5ca0 gvfs:trace2:data: add trace2 tracing around read_object_process
Add trace2 region around read_object_process to collect
time spent waiting for missing objects to be dynamically
fetched.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-02-05 16:15:46 -05:00
Jeff Hostetler 1d7d271d4b DROPME: trace2:status: use the_repository rather than s->repo
Temporarily fix wt-status.c in GVFS 2.20.* to use "the_repository"
rather than "s->repo" which does not yet appear in the this fork.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2019-02-05 16:13:37 -05:00
Jeff Hostetler f2ba675acb trace2: add for_each macros to clang-format
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-02-05 16:00:46 -05:00
Jeff Hostetler ad23341a7d trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.sh
Create unit tests for Trace2.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-02-05 16:00:46 -05:00
Jeff Hostetler 83de4d3d46 trace2:data: add subverb for rebase
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-02-05 16:00:46 -05:00
Jeff Hostetler 8ace6f8960 trace2:data: add subverb to reset command
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-02-05 16:00:46 -05:00