Commit Graph

96959 Commits

Author SHA1 Message Date
Johannes Schindelin
1acc1e9960 fixup! t3903: modernize style
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:19 +01:00
Johannes Schindelin
0e1bf9f413 fixup! stash: rename test cases to be more descriptive
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:19 +01:00
Johannes Schindelin
e4e2dfd6cd fixup! stash: add tests for git stash show config
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:18 +01:00
Johannes Schindelin
82de2cee8f fixup! stash: mention options in show synopsis
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:18 +01:00
Johannes Schindelin
f0adfd761f fixup! stash: convert apply to builtin
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:18 +01:00
Johannes Schindelin
2b8b36b1e0 fixup! stash: convert drop and clear to builtin
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:17 +01:00
Johannes Schindelin
35eac1e64d fixup! stash: convert branch to builtin
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:17 +01:00
Johannes Schindelin
566be3a203 fixup! stash: convert pop to builtin
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:17 +01:00
Johannes Schindelin
fd928add8d fixup! stash: convert list to builtin
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:16 +01:00
Johannes Schindelin
6f1ce35dc4 fixup! stash: convert show to builtin
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:16 +01:00
Johannes Schindelin
2b45b40686 fixup! stash: convert store to builtin
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:16 +01:00
Johannes Schindelin
c341b4ea07 fixup! stash: convert create to builtin
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:15 +01:00
Johannes Schindelin
ca9031fea0 fixup! stash: convert push to builtin
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:15 +01:00
Johannes Schindelin
666ae6eea8 fixup! stash: make push -q quiet
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:15 +01:00
Johannes Schindelin
de276357c9 fixup! stash: convert save to builtin
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:14 +01:00
Johannes Schindelin
2b4813df50 fixup! stash: optimize get_untracked_files() and check_changes()
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:14 +01:00
Johannes Schindelin
7f224087fe fixup! stash: replace all write-tree child processes with API calls
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:14 +01:00
Johannes Schindelin
19ba7d4a3b fixup! stash: convert stash--helper.c into stash.c
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:13 +01:00
Johannes Schindelin
ab8c1b3341 fixup! stash: add back the original, scripted git stash
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:13 +01:00
Johannes Schindelin
1a179124f1 fixup! stash: optionally use the scripted version again
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:13 +01:00
Johannes Schindelin
1acb791d83 fixup! tests: add a special setup where stash.useBuiltin is off
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:12 +01:00
Johannes Schindelin
b95677fed3 fixup! stash: fix segmentation fault when files were added with intent
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:12 +01:00
Johannes Schindelin
017b95da39 fixup! strbuf_vinsertf: provide the correct buffer size to vsnprintf
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:12 +01:00
Johannes Schindelin
c6f8916538 fixup! stash: discard in-process cache after spawning index-changing processes
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:11 +01:00
Johannes Schindelin
41fef97f02 fixup! stash: avoid unnecessary reset_tree() call
In preparation for a newer patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-03-11 16:36:11 +01:00
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