Commit Graph

96884 Commits

Author SHA1 Message Date
Johannes Schindelin
eb5d06f545 Merge pull request #2115 from dscho/gfw/msys2-3.x
mingw: allow building with an MSYS2 runtime v3.x
2019-03-10 17:37:25 +01:00
Johannes Schindelin
0f22e2e3c8 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>
2019-03-08 11:17:04 +01:00
Johannes Schindelin
1a02835a1e Merge pull request #2111 from gitgitgadget/jk/no-sigpipe-during-network-transport
Fix t5570 flakiness on macOS
2019-03-07 16:34:37 +01:00
Johannes Schindelin
89cb7de2a1 Merge pull request #2110 from dscho/avoid-find-in-makefile
Accelerate startup time of `make`
2019-03-07 13:39:19 +01:00
Johannes Schindelin
6b27cae126 Merge pull request #2112 from dscho/gfw/rebase-am-and-orig-head
built-in rebase: pick up the ORIG_HEAD fix early
2019-03-07 12:56:36 +01:00
Johannes Schindelin
1c5bf602cb built-in rebase: set ORIG_HEAD just once, before the rebase
Technically, the scripted version set ORIG_HEAD only in two spots (which
really could have been one, because it called `git checkout $onto^0` to
start the rebase and also if it could take a shortcut, and in both cases
it called `git update-ref $orig_head`).

Practically, it *implicitly* reset ORIG_HEAD whenever `git reset --hard`
was called.

However, what we really want is that it is set exactly once, at the
beginning of the rebase.

So let's do that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-07 10:23:57 +01:00
Johannes Schindelin
3dfe7f7bb9 built-in rebase: demonstrate that ORIG_HEAD is not set correctly
The ORIG_HEAD pseudo ref is supposed to refer to the original,
pre-rebase state after a successful rebase. Let's add a regression test
to prove that this regressed: With GIT_TEST_REBASE_USE_BUILTIN=false,
this test case passes, with GIT_TEST_REBASE_USE_BUILTIN=true (or unset),
it fails.

Reported by Nazri Ramliy.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-07 10:23:00 +01:00
Johannes Schindelin
f13cff1f64 built-in rebase: use the correct reflog when switching branches
By mistake, we used the reflog intended for ORIG_HEAD.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-07 10:22:59 +01:00
Johannes Schindelin
6264310893 built-in rebase: no need to check out onto twice
In the case that the rebase boils down to a fast-forward, the built-in
rebase reset the working tree twice: once to start the rebase at `onto`,
then realizing that the original (pre-rebase) HEAD was an ancestor and
we basically already fast-forwarded to the post-rebase HEAD,
`reset_head()` was called to update the original ref and to point HEAD
back to it.

That second `reset_head()` call does not need to touch the working tree,
though, as it does not change the actual tip commit (and therefore the
working tree should stay unchanged anyway): only the ref needs to be
updated (because the rebase detached the HEAD, and we want to go back to
the branch on which the rebase was started).

But that second `reset_head()` was called without the flag to leave the
working tree alone (the reason: when that call was introduced, that flag
was not yet even thought of). Let's avoid that unnecessary work by
passing that flag.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-07 10:22:59 +01: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
Johannes Schindelin
cb253bd0cf Makefile: use git ls-files to list header files, if possible
In d85b0dff72 (Makefile: use `find` to determine static header
dependencies, 2014-08-25), we switched from a static list of header
files to a dynamically-generated one, asking `find` to enumerate them.

Back in those days, we did not use `$(LIB_H)` by default, and many a
`make` implementation seems smart enough not to run that `find` command
in that case, so it was deemed okay to run `find` for special targets
requiring this macro.

However, as of ebb7baf02f (Makefile: add a hdr-check target,
2018-09-19), $(LIB_H) is part of a global rule and therefore must be
expanded. Meaning: this `find` command has to be run upon every
`make` invocation. In the presence of many a worktree, this can tax the
developers' patience quite a bit.

Even in the absence of worktrees or other untracked files and
directories, the cost of I/O to generate that list of header files is
simply a lot larger than a simple `git ls-files` call.

Therefore, just like in 335339758c (Makefile: ask "ls-files" to list
source files if available, 2011-10-18), we now prefer to use `git
ls-files` to enumerate the header files to enumerating them via `find`,
falling back to the latter if the former failed (which would be the case
e.g. in a worktree that was extracted from a source .tar file rather
than from a clone of Git's sources).

This has one notable consequence: we no longer include `command-list.h`
in `LIB_H`, as it is a generated file, not a tracked one, but that is
easily worked around. Of the three sites that use `LIB_H`, two
(`LOCALIZED_C` and `CHK_HDRS`) already handle generated headers
separately. In the third, the computed-dependency fallback, we can just
add in a reference to $(GENERATED_H).

Likewise, we no longer include not-yet-tracked header files in `LIB_H`.

Given the speed improvements, these consequences seem a comparably small
price to pay.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-04 12:01:04 +01:00
Johannes Schindelin
da5a923050 Merge pull request #2102 from dscho/fix-msvc
msvc: add forgotten source file
2019-02-28 13:37:18 +01:00
Johannes Schindelin
d4d3efbe10 msvc: add forgotten source file
In 1cadad6f65 (git clone <url> C:\cygwin\home\USER\repo' is working
(again), 2018-12-15), we introduced a new source file, containing
utility functions on Windows. But we forgot to adjust the MSVC section.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-28 13:31:50 +01:00
Johannes Schindelin
fcbaede58b Merge pull request #2101 from yashb5/typo-gitattributes
gitattributes.txt: fix typo
2019-02-28 13:15:03 +01:00
Yash Bhatambare
c0f7219ba1 gitattributes.txt: fix typo
`UTF-16-LE-BOM` to `UTF-16LE-BOM`.

this closes https://github.com/git-for-windows/git/issues/2095

Signed-off-by: Yash Bhatambare <ybhatambare@gmail.com>
2019-02-28 17:01:47 +05:30
Johannes Schindelin
2481c4cbe9 Merge pull request #2091 from dscho/symlink-attr-extra
Touch up symlink .gitattributes support
v2.21.0.windows.1
2019-02-26 17:13:28 +01:00
Johannes Schindelin
f6431ebcae Merge pull request #2092 from dscho/mingw-safer-compat-poll
fixup! poll: lazy-load GetTickCount64()
2019-02-25 23:17:39 +01:00
Bert Belder
74e71f1c3c mingw: allow to specify the symlink type in .gitattributes
On Windows, symbolic links have a type: a "file symlink" must point at
a file, and a "directory symlink" must point at a directory. If the
type of symlink does not match its target, it doesn't work.

Git does not record the type of symlink in the index or in a tree. On
checkout it'll guess the type, which only works if the target exists
at the time the symlink is created. This may often not be the case,
for example when the link points at a directory inside a submodule.

By specifying `symlink=file` or `symlink=dir` the user can specify what
type of symlink Git should create, so Git doesn't have to rely on
unreliable heuristics.

Signed-off-by: Bert Belder <bertbelder@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-25 21:26:11 +01:00
Johannes Schindelin
ec3a6e598e Merge pull request #2093 from dscho/release-gc-repack
Drop duplicate patch
2019-02-25 21:09:32 +01:00
Johannes Schindelin
7da09845f1 fixup! gc/repack: release packs when needed
This drops the patch that made it already upstream (and Git for Windows
added the line *another* time)...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-25 08:14:54 +01:00
Johannes Schindelin
bf6414811d fixup! poll: lazy-load GetTickCount64()
This is another left-over from the pre-Vista times.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 22:51:35 +01:00
Johannes Schindelin
65225ba2dd Introduce helper to create symlinks that knows about index_state
On Windows, symbolic links actually have a type depending on the target:
it can be a file or a directory.

In certain circumstances, this poses problems, e.g. when a symbolic link
is supposed to point into a submodule that is not checked out, so there
is no way for Git to auto-detect the type.

To help with that, we will add support over the course of the next
commits to specify that symlink type via the Git attributes. This
requires an index_state, though, something that Git for Windows'
`symlink()` replacement cannot know about because the function signature
is defined by the POSIX standard and not ours to change.

So let's introduce a helper function to create symbolic links that
*does* know about the index_state.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 22:03:28 +01:00
Johannes Schindelin
0ea8e6532d fixup! Win32: symlink: specify symlink type in .gitattributes
Since `git_check_attr()` implicitly depends on the index, we really
should redo this in a manner that has a chance of going into upstream:
by introducing an index-aware helper function to create symbolic links,
and to override that in a Windows-specific manner instead.

In preparation for this, let's drop the original commit for now.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 22:01:27 +01:00
Johannes Schindelin
0fd7b8c613 Merge pull request #1354 from dscho/phase-out-show-ignored-directory-gracefully
Phase out `--show-ignored-directory` gracefully
2019-02-24 21:43:13 +01:00
Johannes Schindelin
3a852e7fbb Merge branch 'status-no-lock-index'
This branch allows third-party tools to call `git status
--no-lock-index` to avoid lock contention with the interactive Git usage
of the actual human user.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:43:12 +01:00
Jameson Miller
11f4841e33 Merge 'builtin-stash-rebase-v3'
To avoid having to play tricks as in earlier rounds, we bit the sour
apple and rebased the `builtin-stash-rebase-v3` branch thicket onto the
commit starting Git for Windows' merging-rebase.

(The merging-rebase pulls in the previous branch thicket via a "fake
merge", i.e. a merge commit that does not actually apply any changes
from the merged commit history. This has the unfortunate side effect of
confusing `merge` into thinking that any branch that was merged into an
earlier round does not need to be merged again.)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:43:12 +01:00
Johannes Schindelin
e3b193c3b4 Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:43:11 +01:00
Johannes Schindelin
4ae836b9e0 Merge branch 'fix-terminal-prompt'
This fixes the issue identified in

	https://github.com/git-for-windows/git/issues/1498

where Git would not fall back to reading credentials from a Win32
Console when the credentials could not be read from the terminal via the
Bash hack (that is necessary to support running in a MinTTY).

Tested in a Powershell window.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:43:10 +01:00
Johannes Schindelin
d4f952ba50 Merge pull request #1170 from dscho/mingw-kill-process
Handle Ctrl+C in Git Bash nicely

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:43:10 +01:00
Johannes Schindelin
f2737ea948 Merge branch 'fsync-object-files-always'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:43:09 +01:00
Johannes Schindelin
2bf950fdd4 Merge pull request #1937 from benpeart/fscache-NtQueryDirectoryFile-gfw
fscache: teach fscache to use NtQueryDirectoryFile
2019-02-24 21:43:09 +01:00
Johannes Schindelin
3b8fa2ad57 Merge pull request #1934 from benpeart/fscache-thread-safe-enable-gfw
fscache: make fscache_enable() thread safe
2019-02-24 21:43:08 +01:00
Johannes Schindelin
a884dd28ac Merge remote-tracking branch 'benpeart/fscache-per-thread-gfw'
This brings substantial wins in performance because the FSCache is now
per-thread, being merged to the primary thread only at the end, so we do
not have to lock (except while merging).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:43:07 +01:00
Johannes Schindelin
3f3ca1b684 Merge pull request #1910 from benpeart/fscache_statistics-gfw
fscache: add fscache hit statistics
2019-02-24 21:43:04 +01:00
Johannes Schindelin
11a8206f6a Merge pull request #1914 from benpeart/free-fscache-after-add-gfw
At the end of the add command, disable and free the fscache
2019-02-24 21:43:03 +01:00
Johannes Schindelin
f78bd8c6c4 Merge pull request #1911 from benpeart/git_test_fscache-gfw
fscache: add GIT_TEST_FSCACHE support
2019-02-24 21:43:03 +01:00
Johannes Schindelin
2dc8736655 Merge pull request #1909 from benpeart/free-fscache-after-status-gfw
status: disable and free fscache at the end of the status command
2019-02-24 21:43:02 +01:00
Johannes Schindelin
e542f2d866 Merge pull request #1908 from benpeart/FindFirstFileEx-gfw
fscache: use FindFirstFileExW to avoid retrieving the short name
2019-02-24 21:43:02 +01:00
Johannes Schindelin
7d1d09dc97 Merge pull request #1827 from benpeart/fscache_refresh_index
Enable the filesystem cache (fscache) in refresh_index().
2019-02-24 21:43:01 +01:00
Johannes Schindelin
3a645b01ce Merge 'docker-volumes-are-no-symlinks'
This was pull request #1645 from ZCube/master

Support windows container.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:43:01 +01:00
Johannes Schindelin
d12a55cd5c Merge pull request #1468 from atetubou/fscache_checkout_flush
checkout.c: enable fscache for checkout again

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:43:00 +01:00
Johannes Schindelin
cffcaadb52 Merge pull request #1426 from atetubou/fetch_pack
fetch-pack.c: enable fscache for stats under .git/objects
2019-02-24 21:43:00 +01:00
Johannes Schindelin
d4b788f3b6 Merge pull request #1344 from jeffhostetler/perf_add_excludes_with_fscache
dir.c: make add_excludes aware of fscache during status
2019-02-24 21:42:59 +01:00
Johannes Schindelin
e0f856b986 Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_fscache
add: use preload-index and fscache for performance
2019-02-24 21:42:59 +01:00
Johannes Schindelin
6777db5e8a Merge branch 'core-longpaths-everywhere'
Git for Windows supports the core.longPaths config setting to allow
writing/reading long paths via the \\?\ trick for a long time now.

However, for that support to work, it is absolutely necessary that
git_default_config() is given a chance to parse the config. Otherwise
Git will be non the wiser.

So let's make sure that as many commands that previously failed to
parse the core.* settings now do that, implicitly enabling long path
support in a lot more places.

Note: this is not a perfect solution, and it cannot be, as there is
a chicken-and-egg problem in reading the config itself...

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:42:58 +01:00
Johannes Schindelin
5a8f282711 Merge pull request #994 from jeffhostetler/jeffhostetler/fscache_nfd
fscache: add not-found directory cache to fscache
2019-02-24 21:42:58 +01:00
Johannes Schindelin
1a2fb817d3 Merge branch 'spawn-with-spaces'
This change lets us spawn .bat scripts whose paths contain spaces.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:42:57 +01:00
Johannes Schindelin
ac6fe9ec81 Merge branch 'clean-long-paths'
This addresses https://github.com/git-for-windows/git/issues/521

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-02-24 21:42:57 +01:00
Johannes Schindelin
7c0f65ca5f Merge pull request #305 from dscho/msysgit_issues_182
Allow `add -p` and `add -i` with a large number of files
2019-02-24 21:42:56 +01:00