Commit Graph

49084 Commits

Author SHA1 Message Date
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
7cb4d70a62 Merge 'refs/rewritten/junio/notyet' into HEAD 2015-03-20 14:13:32 +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
Johannes Schindelin
65bbfe75d6 Gitweb: make line number toggling work for Firefox and Safari
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:35 +01:00
Johannes Schindelin
21bd6e859f gitweb: Allow line number toggling with Javascript
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:35 +01:00
Johannes Schindelin
cb88df7c1f git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:34 +01:00
Chris West (Faux)
ba0c77fd42 Fix another invocation of git from gitk with an overly long command-line
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2015-03-20 14:11:34 +01:00
Johannes Schindelin
85b02096ec Work around the command line limit on Windows
On Windows, there are dramatic problems when a command line grows
beyond PATH_MAX, which is restricted to 8191 characters on XP and
later (according to http://support.microsoft.com/kb/830473).

Work around this by just cutting off the command line at that length
(actually, at a space boundary) in the hope that only negative
refs are chucked: gitk will then do unnecessary work, but that is
still better than flashing the gitk window and exiting with exit
status 5 (which no Windows user is able to make sense of).

The first fix caused Tcl to fail to compile the regexp, see msysGit issue
427. Here is another fix without using regexp, and using a more relaxed
command line length limit to fix the original issue 387.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:34 +01:00
Johannes Sixt
5f9a8fd0dc criss cross rename failure workaround
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:33 +01:00
Heiko Voigt
ec5ae71278 git-gui: provide question helper for retry fallback on Windows
Make use of the new environment variable GIT_ASK_YESNO to support the
recently implemented fallback in case unlink, rename or rmdir fail for
files in use on Windows. The added dialog will present a yes/no question
to the the user which will currently be used by the windows compat layer
to let the user retry a failed file operation.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
2015-03-20 14:11:33 +01:00
Heiko Voigt
96ca2bdd58 Revert "git-gui: set GIT_DIR and GIT_WORK_TREE after setup"
This reverts commit a9fa11fe5b.
2015-03-20 14:11:33 +01:00
Johannes Schindelin
e48eeac6db git am: ignore dirty submodules
This fixes a rebase in the presence of dirty submodules. This is
orthogonal to the application of patches changing submodules.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:32 +01:00
Pat Thoyts
1ef2300c99 mingw: add tests for the hidden attribute on the git directory
With msysGit the .git directory is supposed to be hidden, unless it is
a bare git repository. Test this.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2015-03-20 14:11:32 +01:00
Johannes Schindelin
27988c7556 When initializing .git/, record the current setting of core.hideDotFiles
This is on Windows only, of course.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:31 +01:00
Erik Faye-Lund
8da2124b9e core.hidedotfiles: hide '.git' dir by default
At least for cross-platform projects, it makes sense to hide the
files starting with a dot, as this is the behavior on Unix/MacOSX.

However, at least Eclipse has problems interpreting the hidden flag
correctly, so the default is to hide only the .git/ directory.

The config setting core.hideDotFiles therefore supports not only
'true' and 'false', but also 'dotGitOnly'.

[jes: clarified the commit message, made git init respect the setting
by marking the .git/ directory only after reading the config, and added
documentation, and rebased on top of current junio/next]

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-20 14:11:29 +01:00
Karsten Blees
11250140ee Unicode file name support (gitk and git-gui)
Assumes file names in git tree objects are UTF-8 encoded.

On most unix systems, the system encoding (and thus the TCL system
encoding) will be UTF-8, so file names will be displayed correctly.

On Windows, it is impossible to set the system encoding to UTF-8. Changing
the TCL system encoding (via 'encoding system ...', e.g. in the startup
code) is explicitly discouraged by the TCL docs.

Change gitk and git-gui functions dealing with file names to always convert
from and to UTF-8.

Signed-off-by: Karsten Blees <blees@dcon.de>
2015-03-20 14:11:04 +01:00
Erik Faye-Lund
812d9ee5bb Makefile: do not depend on curl-config
MinGW builds of cURL does not ship with curl-config unless built
with the autoconf based build system, which is not the practice
recommended by the documentation. MsysGit has had issues with
binaries of that sort, so it has switched away from autoconf-based
cURL-builds.

Unfortunately, broke pushing over WebDAV on Windows, because
http-push.c depends on cURL's multi-threaded API, which we could
not determine the presence of any more.

Since troublesome curl-versions are ancient, and not even present
in RedHat 5, let's just assume cURL is capable instead of doing a
non-robust check.

Instead, add a check for curl_multi_init to our configure-script,
for those on ancient system. They probably already need to do the
configure-dance anyway.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
2015-03-20 14:11:04 +01:00
Johannes Schindelin
5adb572fa4 Start the merging-rebase to v2.3.3
This commit starts the rebase of 1ead675 to 330b4af
2015-03-20 14:11:03 +01:00
dscho
8e0da87e31 Merge pull request #38 from dscho/mingw-environment
Fix access violations when cloning/fetching via HTTPS
2015-03-20 07:55:08 +01:00
dscho
1bd4e1e642 Merge pull request #40 from nalla/git-terminal-prompt
mingw: Proper `git_terminal_prompt` with `xterm`
2015-03-19 17:15:33 +01:00
nalla
50158a5a1a mingw: Support git_terminal_prompt with more terminals
The `git_terminal_prompt()` function expects the terminal window to be
attached to a Win32 Console. However, this is not the case with terminal
windows other than `cmd.exe`'s, e.g. with MSys2's own `mintty`.

Non-cmd terminals such as `mintty` still have to have a Win32 Console
to be proper console programs, but have to hide the Win32 Console to
be able to provide more flexibility (such as being resizeable not only
vertically but also horizontally). By writing to that Win32 Console,
`git_terminal_prompt()` manages only to send the prompt to nowhere and
to wait for input from a Console to which the user has no access.

This commit introduces a function specifically to support `mintty` -- or
other terminals that are compatible with MSys2's `/dev/tty` emulation. We
use the `TERM` environment variable as an indicator for that: if the value
starts with "xterm" (such as `mintty`'s "xterm_256color"), we prefer to
let `xterm_prompt()` handle the user interaction.

To handle the case when standard input/output are redirected – as is the
case when pushing via HTTPS: `git-remote-https`' standard input and
output are pipes from/to the main Git executable – we make use of the
`MSYS_TTY_HANDLES` environment variable that was introduced to
fix another bug in MSys2-based Git: this environment variable contains
the Win32 `HANDLE`s of the standard input, output and error as originally
passed from MSys2 to the Git executable, enclosed within space
characters, skipping handles that do not refer to the terminal window
(e.g. when they were redirected). We will only use those handles when
that environment variable lists all three handles because then we can be
100% certain that we are running inside a terminal window, and that we
know exactly which Win32 handles to use to communicate with it.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: nalla <nalla@hamal.uberspace.de>
2015-03-19 17:12:31 +01:00
Johannes Schindelin
22cc9c928b mingw: be *very* wary about outside environment changes
The environment is modified in most surprising circumstances, and not
all of them are under Git's control. For example, calling
curl_global_init() on Windows will ensure that the CHARSET variable is
set, adding one if necessary.

While the previous commit worked around crashes triggered by such
outside changes of the environment by relaxing the requirement that the
environment be terminated by a NULL pointer, the other assumption made
by `mingw_getenv()` and `mingw_putenv()` is that the environment is
sorted, for efficient lookup via binary search.

Let's make real sure that our environment is intact before querying or
modifying it, and reinitialize our idea of the environment if necessary.

With this commit, before working on the environment we look briefly for
indicators that the environment was modified outside of our control, and
to ensure that it is terminated with a NULL pointer and sorted again in
that case.

Note: the indicators are maybe not sufficient. For example, when a
variable is removed, it will not be noticed. It might also be a problem
if outside changes to the environment result in a modified `environ`
pointer: it is unclear whether such a modification could result in a
problem when `mingw_putenv()` needs to `realloc()` the environment
buffer.

For the moment, however, the current fix works well enough, so let's
only face the potential problems when (and if!) they occur.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-19 13:09:09 +01:00
Johannes Schindelin
ab16d5e4b1 mingw: be more defensive when making the environment block
Outside of our Windows-specific code, the end of the environment can be
marked also by a pointer to a NUL character, not only by a NULL pointer
as our code assumed so far.

That led to a buffer overrun in `make_environment_block()` when running
`git-remote-https` in `mintty` (because `curl_global_init()` added the
`CHARSET` environment variable *outside* of `mingw_putenv()`, ending the
environment in a pointer to an empty string).

Side note for future debugging on Windows: when running programs in
`mintty`, the standard input/output/error is not connected to a Win32
Console, but instead is pipe()d. That means that even stderr may not be
written completely before a crash, but has to be fflush()ed explicitly.
For example, when debugging crashes, the developer should insert an
`fflush(stderr);` at the end of the `error()` function defined in
usage.c.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-19 10:37:36 +01:00
dscho
22208dd485 Merge 'poll_inftim' into HEAD
This was originally 'pull request #330 from ethomson/poll_inftim' in
msysgit/git.

poll: honor the timeout on Win32

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-18 20:41:12 +01:00
Edward Thomson
09b6a7755b poll: honor the timeout on Win32
Ensure that when passing a pipe, the gnulib poll replacement will not
return 0 before the timeout has passed.

Not obeying the timeout (and merely returning 0) causes pathological
behavior when preparing a packfile for a repository and taking a
long time to do so.  If poll were to return 0 immediately, this would
cause keep-alives to get sent as quickly as possible until the packfile
was created.  Such deviance from the standard would cause megabytes (or
more) of keep-alive packets to be sent.

GetTickCount is used as it is efficient, stable and monotonically
increasing.  (Neither GetSystemTime nor QueryPerformanceCounter have
all three of these properties.)
2015-03-18 20:39:11 +01:00
dscho
b578abdabc Merge pull request #39 from git-for-windows/fix-msys1-build
mingw: Define git-wrapper variables in the scope of the build targets
2015-03-18 20:11:04 +01:00
Sebastian Schuberth
5942abf369 mingw: Define git-wrapper variables in the scope of the build targets
This fixes the MSYS1-based build which otherwise would have the variables
but not the build targets.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2015-03-18 16:02:30 +01:00
dscho
5fb2a138bd Merge pull request #34 from dscho/git-wrapper
Use msysGit's `git-wrapper` instead of the builtins
2015-03-18 10:17:43 +01:00
Johannes Schindelin
498ae57062 squash! mingw: Compile the Git wrapper
Embed the manifest in the Git wrapper, too

This is needed for builtins such as 'patch-id' to avoid triggering
Windows' User Access Control.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-18 08:50:44 +01:00
Johannes Schindelin
df303210b3 mingw: Use the Git wrapper for builtins
This reduces the disk footprint of a full Git for Windows setup
dramatically because on Windows, one cannot assume that hard links are
supported.

The net savings are calculated easily: the 32-bit `git.exe` file weighs
in with 7662 kB while the `git-wrapper.exe` file (modified to serve as a
drop-in replacement for builtins) weighs a scant 21 kB. At this point,
there are 109 builtins which results in a total of 813 MB disk space
being freed up by this commit.

Yes, that is really more than half a gigabyte.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-18 08:50:42 +01:00
Johannes Schindelin
fba4cbbec3 Let the Git wrapper serve as a drop-in replacement for builtins
Git started out as a bunch of separate commands, in the true Unix spirit.
Over time, more and more functionality was shared between the different
Git commands, though, so it made sense to introduce the notion of
"builtins": programs that are actually integrated into the main Git
executable.

These builtins can be called in two ways: either by specifying a
subcommand as the first command-line argument, or -- for backwards
compatibility -- by calling the Git executable hardlinked to a filename
of the form "git-<subcommand>". Example: the "log" command can be called
via "git log <parameters>" or via "git-log <parameters>". The latter
form is actually deprecated and only supported for scripts; calling
"git-log" interactively will not even work by default because the
libexec/git-core/ directory is not in the PATH.

All of this is well and groovy as long as hard links are supported.

Sadly, this is not the case in general on Windows. So it actually hurts
quite a bit when you have to fall back to copying all of git.exe's
currently 7.5MB 109 times, just for backwards compatibility.

The simple solution would be to install really trivial shell script
wrappers in place of the builtins:

	for builtin in $BUILTINS
	do
		rm git-$builtin.exe
		printf '#!/bin/sh\nexec git %s "$@"\n' $builtin > git-builtin
		chmod a+x git-builtin
	done

This method would work -- even on Windows because Git for Windows ships a
full-fledged Bash. However, the Windows Bash comes at a price: it needs to
spin up a full-fledged POSIX emulation layer everytime it starts.
Therefore, the shell script solution would incur a significant performance
penalty.

The best solution the Git for Windows team could come up with is to extend
the Git wrapper -- that is needed to call Git from cmd.exe anyway, and
that weighs in with a scant 19KB -- to also serve as a drop-in replacement
for the builtins so that the following workaround is satisfactory:

	for builtin in $BUILTINS
	do
		cp git-wrapper.exe git-$builtin.exe
	done

This commit allows for this, by extending the module file parsing to
turn builtin command names like `git-log.exe ...` into calls to the main
Git executable: `git.exe log ...`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-18 08:50:41 +01:00
Johannes Schindelin
857a6716ab Refactor git-wrapper into more functions
This prepares the wrapper for modifications to serve as a drop-in
replacement for the builtins.

This commit's diff is best viewed with the `-w` flag.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-18 08:50:33 +01:00
Johannes Schindelin
ba105aade7 fixup! mingw: Prepare the TMP environment variable for shell scripts 2015-03-18 08:48:01 +01:00