Commit Graph

49285 Commits

Author SHA1 Message Date
nalla
e469731d24 Merge branch 'some-CR-fixes'
This branch contains some hacks so that Git produces less CR, and then
some tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:25:05 +01:00
nalla
1dd7778fbb Merge pull request #28 from dscho/tty-handles
Teach msys2-runtime to hand the tty through to Git
2015-03-24 11:25:04 +01:00
nalla
e60734d01e Merge pull request #33 from dscho/manifest
Embed a manifest into git.exe
2015-03-24 11:25:03 +01:00
nalla
42b1fc6095 Merge pull request #26 from dscho/msys2
Fixes required to build Git for Windows with MSys2
2015-03-24 11:25:02 +01:00
nalla
f96acd3889 Merge 'pull-rebase-interactive' into HEAD 2015-03-24 11:25:01 +01:00
nalla
f9fc855959 Merge 'jberezanski/wincred-sso-r2' into HEAD 2015-03-24 11:25:00 +01:00
nalla
88f75d5db2 Merge 'gitweb-syntax' into HEAD 2015-03-24 11:25:00 +01:00
nalla
31961d60dd Merge 'gitk' into HEAD 2015-03-24 11:24:59 +01:00
nalla
781f39f395 Merge 'git-gui' into HEAD 2015-03-24 11:24:58 +01:00
nalla
434790165f Merge 'criss-cross-merge' into HEAD 2015-03-24 11:24:58 +01:00
nalla
bcffd8382a Merge 'am-submodules' into HEAD 2015-03-24 11:24:57 +01:00
nalla
c2535cebe7 Merge 'hide-dotgit' into HEAD 2015-03-24 11:24:56 +01:00
nalla
f271353394 Merge 'unicode' into HEAD 2015-03-24 11:24:56 +01:00
nalla
213873eafd Merge 'refs/rewritten/junio/notyet' into HEAD 2015-03-24 11:24:55 +01:00
Johannes Schindelin
a0f9858b8f Windows: make sure that merge-octopus only outputs LF line endings
This happens to shut up t7602 on Windows which would otherwise take
the different line endings for a sign that the merge failed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:13 +01:00
Sebastian Schuberth
cae5461aba am: Use cat instead of echo to avoid DOS line-endings (fixes t4150)
Along the lines of 05d0e3b and f33946d, use cat instead of echo to avoid
line ending mismatches in the test result of "am empty-file does not
infloop" which make the test fail.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2015-03-24 11:24:12 +01:00
Sebastian Schuberth
052d6c8ec4 submodule: Fix t7400, t7405, t7406 for msysGit
Again, avoid using echo (which issues DOS line endings on msysGit) to not mix
with Unix line-endings issued by git built-ins, even if this is at the cost of
calling an external executable (cat) instead of a shell built-in (echo).
2015-03-24 11:24:12 +01:00
Johannes Schindelin
8263f72cb8 mingw: Work around MSVCRT's isatty() not knowing about MSys2
MSys2 has a slightly different notion of what constitutes a tty than
the Microsoft C runtime. The former knows whether stdin/stdout/stderr
was redirected or not, while the latter looks for a Win32 Console.

In particular when we want to know whether to spawn a pager or not, we
would rather want to know what MSys2 thinks.

We are about to introduce a change to the msys2-runtime that sets an
environment variable MSYS_TTY_HANDLES to a list of Win32 handles that
correspond to stdin/stdout/stderr, respectively, *but skips* handles that
MSys2 does not think are terminals.

This commit handles that input to augment the isatty() function to return
1 also when MSYS_TTY_HANDLES contains the corresponding handle.

The only time when Git needs to know whether a Console is attached or not
is when winansi.c is asked to Do Its Thing, therefore we refrain from
overriding isatty there.

Note: this was an issue with MSys1-based Git for Windows, too, hidden by
the fact that Git for Windows used `cmd.exe` as a terminal -- which is
backed by a real Win32 Console. Had MSys1 used, say, rxvt as its default
terminal, the symptom would have been that "git log" does not spawn a
pager by default but instead outputs the entire history (without color
coding, too). In MSys2, the default terminal is mintty, therefore we
finally could not avoid to address the issue.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:10 +01:00
Cesar Eduardo Barros
8b4a049688 mingw: Embed a manifest to trick UAC into Doing The Right Thing
On Windows >= Vista, not having an application manifest with a
requestedExecutionLevel can cause several kinds of confusing behavior.

The first and more obvious behavior is "Installer Detection", where
Windows sometimes decides (by looking at things like the file name and
even sequences of bytes within the executable) that an executable is an
installer and should run elevated (causing the well-known popup dialog
to appear). In Git's context, subcommands such as "git patch-id" or "git
update-index" fall prey to this behavior.

The second and more confusing behavior is "File Virtualization". It
means that when files are written without having write permission, it
does not fail (as expected), but they are instead redirected to
somewhere else. When the files are read, the original contents are
returned, though, not the ones that were just written somewhere else.
Even more confusing, not all write accesses are redirected; Trying to
write to write-protected .exe files, for example, will fail instead of
redirecting.

In addition to being unwanted behavior, File Virtualization causes
dramatic slowdowns in Git (see for instance
http://code.google.com/p/msysgit/issues/detail?id=320).

There are two ways to prevent those two behaviors: Either you embed an
application manifest within all your executables, or you add an external
manifest (a file with the same name followed by .manifest) to all your
executables. Since Git's builtins are hardlinked (or copied), it is
simpler and more robust to embed a manifest.

A recent enough MSVC compiler should already embed a working internal
manifest, but for MinGW you have to do so by hand.

Very lightly tested on Wine, where like on Windows XP it should not make
any difference.

References:
  - New UAC Technologies for Windows Vista
    http://msdn.microsoft.com/en-us/library/bb756960.aspx
  - Create and Embed an Application Manifest (UAC)
    http://msdn.microsoft.com/en-us/library/bb756929.aspx

[js: simplified the embedding dramatically by reusing Git for Windows'
existing Windows resource file, removed the optional (and dubious)
processorArchitecture attribute of the manifest's assemblyIdentity
section.]

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:09 +01:00
마누엘
66ee249f3b mingw: Try to delete target directory first.
When the rename function tries to move a directory it fails if the target
directory exists. It should check if it can delete the (possibly empty)
target directory and then try again to move the directory.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: 마누엘 <nalla@users.noreply.github.com>
2015-03-24 11:24:08 +01:00
Johannes Schindelin
9bab9e8c22 mingw: Make sure sigset_t is defined
With MSys2, the sigset_t type is defined in sys/types.h, therefore we
need to #include said file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:07 +01:00
Johannes Schindelin
6d1d74cd44 MSys2: Fix t9700 assumption about directory separators
This test assumed that there are no two equivalent directory separators.
However, on Windows, the back slash and the forward slash *are*
equivalent. Let's paper over this issue by converting the backward
slashes to forward ones in the test that fails with MSys2 otherwise.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:07 +01:00
Johannes Schindelin
38f9a93b20 Git.pm: stop assuming that absolute paths start with a slash
This fixes t7800 with MSys2.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:06 +01:00
Johannes Schindelin
e012fbbdbe mingw: Prepare the TMP environment variable for shell scripts
When shell scripts access a $TMP variable containing backslashes, they
will be mistaken for escape characters. Let's not let that happen by
converting them to forward slashes.

This fixes t7800 with MSys2.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:06 +01:00
Johannes Schindelin
75a993e725 Tests: optionally skip redirecting stdin/stdout/stderr
There is a really useful debugging technique developed by Sverre
Rabbelier that inserts "bash &&" somewhere in the test scripts, letting
the developer interact at given points with the current state.

Another debugging technique, used a lot by this here coder, is to run
certain executables via gdb by guarding a "gdb -args" call in
bin-wrappers/git.

Both techniques were disabled by 781f76b1(test-lib: redirect stdin of
tests).

Let's reinstate the ability to run an interactive shell by making the
redirection optional: setting the TEST_NO_REDIRECT environment variable
will skip the redirection.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:05 +01:00
Johannes Schindelin
072a4f50b7 t5516: override MinGW-specific pwd override
This test is susceptible to MSys2's posix-to-windows path mangling; Let's
just use POSIX paths throughout and let the tests pass.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:05 +01:00
Johannes Schindelin
37ab763b00 Tests (MinGW): Disable mkfifo-based tests
With MSys2, there is actually an implementation of mkfifo available. The
only problem is that it is only emulating named pipes through the MSys2
runtime; The Win32 API has no idea about named pipes, hence the Git
executable cannot access those pipes either.

The symptom is that Git fails with a '<name>: No such file or directory'
because MSys2 emulates named pipes through special-crafted '.lnk' files.

The solution is to tell the test suite explicitly that we cannot use
named pipes when we want to test a MinGW Git.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:04 +01:00
Johannes Schindelin
1a8c0b9bf9 Tests (MinGW): Do not bother to test funny file names
MSys2 actually allows to create files or directories whose names contain
tabs, newlines or colors, even if plain Win32 API cannot access them.
As we are using an MSys2 bash to run the tests, such files or
directories are created successfully, but Git has no chance to work with
them because it is a regular Windows program, hence limited by the Win32
API.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:04 +01:00
Johannes Schindelin
a629f48bfe Special-case the MSYS2_TZ environment variable
With MSys2, the "TZ" environment variable gets filtered out when calling
non-MSys2 executables. The reason is that Windows' time zone handling is
substantially different from the POSIX one.

However, we just taught Git for Windows' fork of the MSys2 runtime to
pass on the timezone in a different environment variable, MSYS2_TZ for
the sole purpose of Git being able to reinterpret it correctly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:04 +01:00
Johannes Schindelin
53c9de986f Error out when mingw_startup() *and* NO_UNSETENV are active
The unsetenv code has no idea to update our environ_size, therefore
causing segmentation faults when environment variables are removed
without compat/mingw.c's knowing (MinGW's optimized lookup would try
to strcmp() against NULL in such a case).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:03 +01:00
Johannes Schindelin
4826853b5e Squash compile warning with MSys2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:03 +01:00
Johannes Schindelin
d697d998bd Do not trust MSys2's MinGW gettext.sh
It does not quite work because it produces DOS line endings which the
shell does not like at all.

This lets t3406, t3903, t4254, t7400, t7401, t7406 and t7407 pass.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:02 +01:00
Johannes Schindelin
63d6524d8c Let's use gettext with MSys2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:02 +01:00
Johannes Schindelin
ff5c75bcbf Build Python stuff with MSys2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:01 +01:00
Johannes Schindelin
35bd8f96ff Start supporting 64-bit MSys2
This just makes things compile, the test suite most likely needs extra
tender loving care in addition to this change.

While at it, also allow building MSys2 Git (i.e. a Git that uses MSys2's
POSIX emulation layer).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:01 +01:00
Johannes Schindelin
55f0555dbd Start supporting MSys2 in config.mak.uname
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:00 +01:00
Johannes Schindelin
8505e79fab Do not re-define _CONSOLE_FONT_INFOEX when compiling with MSys2
MSys2 already has that structure.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:24:00 +01:00
Johannes Schindelin
f94d58d552 Avoid redefining S_* constants
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:23:59 +01:00
Johannes Schindelin
8a8d66c4d6 Assorted header fixes to support MSys2-based MinGW build
The excellent MSys2 project brings a substantially updated MinGW
environment including newer GCC versions and new headers. To support
compiling Git, let's special-case the new MinGW (tell-tale: the
_MINGW64_VERSION_MAJOR constant is defined).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:23:59 +01:00
Johannes Schindelin
8bb5b6e167 Help debugging with MSys2 by optionally executing bash with strace
MSys2's strace facility is very useful for debugging... With this patch,
the bash will be executed through strace if the environment variable
GIT_STRACE_COMMANDS is set, which comes in real handy when investigating
issues in the test suite.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:23:58 +01:00
Thomas Braun
bba44dc2cb Enable support for perl regular expressions (LIBPCRE)
Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
2015-03-24 11:23:58 +01:00
Sebastian Schuberth
174818b131 Makefile: Set htmldir to match the default HTML docs location under MSYS
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2015-03-24 11:23:57 +01:00
Sebastian Schuberth
f050e3452c MinGW: Use MakeMaker to build the Perl libraries
This way the libraries get properly installed into the "site_perl"
directory and we just have to move them out of the "mingw" directory.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2015-03-24 11:23:57 +01:00
Johannes Schindelin
cdc1844c3d Handle http.* config variables pointing to files gracefully on Windows
On Windows, we would like to be able to have a default http.sslCAinfo
that points to an MSys path (i.e. relative to the installation root of
Git).  As Git is a MinGW program, it has to handle the conversion
of the MSys path into a MinGW32 path itself.

Since system_path() considers paths starting with '/' as absolute, we
have to convince it to make a Windows path by stripping the leading
slash.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:23:56 +01:00
Johannes Schindelin
2ca0f2607e Teach 'git remote' that the config var branch.*.rebase can be 'interactive'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:23:55 +01:00
Johannes Schindelin
be5edbf03b Handle the branch.<name>.rebase value 'interactive'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:23:54 +01:00
Johannes Schindelin
035f34e6f7 Teach 'git pull' to handle --rebase=interactive
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:23:54 +01:00
Jakub Bereżański
accd2089f2 wincred: handle empty username/password correctly
Empty (length 0) usernames and/or passwords, when saved in the Windows
Credential Manager, come back as null when reading the credential.

One use case for such empty credentials is with NTLM authentication, where
empty username and password instruct libcurl to authenticate using the
credentials of the currently logged-on user (single sign-on).

When locating the relevant credentials, make empty username match null.
When outputting the credentials, handle nulls correctly.

Signed-off-by: Jakub Bereżański <kuba@berezanscy.pl>
2015-03-24 11:23:52 +01:00
Jakub Bereżański
37b2fb5521 t0302: check helper can handle empty credentials
Make sure the helper does not crash when blank username and password is
provided. If the helper can save such credentials, it should be able to
read them back.

Signed-off-by: Jakub Bereżański <kuba@berezanscy.pl>
2015-03-24 11:23:52 +01:00
Johannes Schindelin
0bf1787f93 gitweb (SyntaxHighlighter): interpret #l<line-number>
It is pretty convenient to refer to a line number by appending, say,
highlighter, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-24 11:23:50 +01:00