Commit Graph

49114 Commits

Author SHA1 Message Date
Johannes Schindelin
02e2dfebf8 Merge pull request #28 from dscho/tty-handles
Teach msys2-runtime to hand the tty through to Git
2015-03-20 15:04:27 +01:00
Johannes Schindelin
59967c3f79 Merge pull request #33 from dscho/manifest
Embed a manifest into git.exe
2015-03-20 15:04:26 +01:00
Johannes Schindelin
5d039ed525 Merge pull request #26 from dscho/msys2
Fixes required to build Git for Windows with MSys2
2015-03-20 15:04:23 +01:00
Johannes Schindelin
199ea6df41 Merge 'pull-rebase-interactive' into HEAD 2015-03-20 15:04:21 +01:00
Johannes Schindelin
ffaa9326b9 Merge 'jberezanski/wincred-sso-r2' into HEAD 2015-03-20 15:04:17 +01:00
Johannes Schindelin
9f82c7a30b Merge 'gitweb-syntax' into HEAD 2015-03-20 15:04:14 +01:00
Johannes Schindelin
158d02449a Merge 'gitk' into HEAD 2015-03-20 15:04:07 +01:00
Johannes Schindelin
bd81a43e3f Merge 'git-gui' into HEAD 2015-03-20 15:04:05 +01:00
Johannes Schindelin
0d23ef0eb6 Merge 'criss-cross-merge' into HEAD 2015-03-20 15:04:04 +01:00
Johannes Schindelin
c282cb6495 Merge 'am-submodules' into HEAD 2015-03-20 15:04:03 +01:00
Johannes Schindelin
dd9c6db316 Merge 'hide-dotgit' into HEAD 2015-03-20 15:04:01 +01:00
Johannes Schindelin
43a1473c13 Merge 'unicode' into HEAD 2015-03-20 15:03:59 +01:00
Karsten Blees
dc595c0bd4 git-gui:handle the encoding of Git's output correctly
If we use 'eval exec $opt $cmdp $args' to execute git command,
tcl engine will convert the output of the git comand with the rule
system default code page to unicode.

But cp936 -> unicode conversion implicitly done by exec is not reversible.
So we have to use git_read instead.

Bug report and an original reproducer by Cloud Chou:
https://github.com/msysgit/git/issues/302

Karsten Blees writes this code patch.
Cloud Chou find the reason of the bug.

Thanks-to: dscho
Thanks-to: patthoyts
Signed-off-by: Karsten Blees <blees@dcon.de>
Original-test-by: Cloud Chou <515312382@qq.com>
Signed-off-by: Cloud Chou <515312382@qq.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 15:00:54 +01:00
Johannes Schindelin
d4183729b2 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-20 14:33:24 +01:00
Cesar Eduardo Barros
08184097bf 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-20 14:33:23 +01:00
Johannes Schindelin
7cb4d70a62 Merge 'refs/rewritten/junio/notyet' into HEAD 2015-03-20 14:13:32 +01:00
마누엘
1f6151d1f2 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-20 14:11:54 +01:00
Johannes Schindelin
c31754f61f 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-20 14:11:54 +01:00
Johannes Schindelin
b7ec3dab0b 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-20 14:11:54 +01:00
Johannes Schindelin
d0c6ab37a4 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-20 14:11:54 +01:00
Johannes Schindelin
909ffa6d54 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-20 14:11:54 +01:00
Johannes Schindelin
ce54945f22 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-20 14:11:53 +01:00
Johannes Schindelin
b23fb0a8a3 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-20 14:11:53 +01:00
Johannes Schindelin
b33a9244ad 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-20 14:11:52 +01:00
Johannes Schindelin
c88b2edfe0 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-20 14:11:52 +01:00
Johannes Schindelin
72b4065bef 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-20 14:11:52 +01:00
Johannes Schindelin
3173fdc617 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-20 14:11:52 +01:00
Johannes Schindelin
1519a125d8 Squash compile warning with MSys2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:52 +01:00
Johannes Schindelin
86b9d96d5c 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-20 14:11:51 +01:00
Johannes Schindelin
558e336b1f Let's use gettext with MSys2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:51 +01:00
Johannes Schindelin
afcfb75f3d Build Python stuff with MSys2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:51 +01:00
Johannes Schindelin
ac915551e0 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-20 14:11:51 +01:00
Johannes Schindelin
cde5a30804 Start supporting MSys2 in config.mak.uname
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:51 +01:00
Johannes Schindelin
86f728c601 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-20 14:11:50 +01:00
Johannes Schindelin
4598ea7f63 Avoid redefining S_* constants
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:50 +01:00
Johannes Schindelin
d3f90ab5bb 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-20 14:11:41 +01:00
Johannes Schindelin
7d187b0dbe 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-20 14:11:39 +01:00
Thomas Braun
1351194365 Enable support for perl regular expressions (LIBPCRE)
Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
2015-03-20 14:11:39 +01:00
Sebastian Schuberth
3e9e746265 Makefile: Set htmldir to match the default HTML docs location under MSYS
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2015-03-20 14:11:39 +01:00
Sebastian Schuberth
40795c7aab 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-20 14:11:39 +01:00
Johannes Schindelin
3dfe17d259 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-20 14:11:39 +01:00
Johannes Schindelin
fbbce33d99 Teach 'git remote' that the config var branch.*.rebase can be 'interactive'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:38 +01:00
Johannes Schindelin
0b7d80dbcf Handle the branch.<name>.rebase value 'interactive'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:38 +01:00
Johannes Schindelin
355800ed2b Teach 'git pull' to handle --rebase=interactive
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:38 +01:00
Jakub Bereżański
354a58d3e9 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-20 14:11:37 +01:00
Jakub Bereżański
9856d4d444 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-20 14:11:37 +01:00
Johannes Schindelin
a4940fef33 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-20 14:11:36 +01:00
Johannes Schindelin
ad3ed290cc Only switch on the line number toggle when highlighting is activated
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:36 +01:00
Johannes Schindelin
63d3fe9b83 Gitweb: add support for Alex Gorbatchev's SyntaxHighlighter in Javascript
Gitweb is not exactly what you would call server-friendly, so let's
offload one more task onto the client.

To enable this, put something like this into your gitweb_config.perl:

	$feature{'syntaxhighlighter_js'}{'default'} = [{
		url => '/SyntaxHighlighter/',
		style => 'Django',
		theme => 'FadeToGrey'
	}];

and clone git://github.com/alexgorbatchev/SyntaxHighlighter into the
directory you specified via the 'url' parameter.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:36 +01:00
Sebastian Schuberth
3ecb14bbd4 gitk: Use an external icon file on Windows
Git for Windows now ships with the new Git icon from git-scm.com. Use that
icon file if it exists instead of the old procedurally drawn one.

This patch was sent upstream but so far no decision on its inclusion was
made, so commit it to our fork.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2015-03-20 14:11:35 +01:00