Commit Graph

68594 Commits

Author SHA1 Message Date
Johannes Schindelin
034f327957 Merge pull request #1006 from segevfiner/git-ssh-command-putty
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
2017-02-21 15:28:16 +01:00
Segev Finer
2ade3e6be7 connect: Add the envvar GIT_SSH_VARIANT and ssh.variant config
This environment variable and configuration value allow to
override the autodetection of plink/tortoiseplink in case that
Git gets it wrong.

[jes: wrapped overly-long lines, factored out and changed
get_ssh_variant() to handle_ssh_variant() to accomodate the
change from the putty/tortoiseplink variables to
port_option/needs_batch, adjusted the documentation, free()d
value obtained from the config.]

Signed-off-by: Segev Finer <segev208@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:45 +01:00
Johannes Schindelin
5ae9c69f2c git_connect(): factor out SSH variant handling
We handle plink and tortoiseplink as OpenSSH replacements, by passing
the correct command-line options when detecting that they are used.

To let users override that auto-detection (in case Git gets it wrong),
we need to introduce new code to that end.

In preparation for this code, let's factor out the SSH variant handling
into its own function, handle_ssh_variant().

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:45 +01:00
Junio C Hamano
60100924c4 connect: rename tortoiseplink and putty variables
One of these two may have originally been named after "what exact
SSH implementation do we have" so that we can tweak the command line
options, but these days "putty=1" no longer means "We are using the
plink SSH implementation that comes with PuTTY".  It is set when we
guess that either PuTTY plink or Tortoiseplink is in use.

Rename them after what effect is desired.  The current "putty"
option is about using "-P <port>" when OpenSSH would use "-p <port>",
so rename it to port_option whose value is either 'p' or 'P".  The
other one is about passing an extra command line option "-batch",
so rename it needs_batch.

[jes: wrapped overly-long line]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:45 +01:00
Segev Finer
bf67dd3817 connect: handle putty/plink also in GIT_SSH_COMMAND
Git for Windows has special support for the popular SSH client PuTTY:
when using PuTTY's non-interactive version ("plink.exe"), we use the -P
option to specify the port rather than OpenSSH's -p option. TortoiseGit
ships with its own, forked version of plink.exe, that adds support for
the -batch option, and for good measure we special-case that, too.

However, this special-casing of PuTTY only covers the case where the
user overrides the SSH command via the environment variable GIT_SSH
(which allows specifying the name of the executable), not
GIT_SSH_COMMAND (which allows specifying a full command, including
additional command-line options).

When users want to pass any additional arguments to (Tortoise-)Plink,
such as setting a private key, they are required to either use a shell
script named plink or tortoiseplink or duplicate the logic that is
already in Git for passing the correct style of command line arguments,
which can be difficult, error prone and annoying to get right.

This patch simply reuses the existing logic and expands it to cover
GIT_SSH_COMMAND, too.

Note: it may look a little heavy-handed to duplicate the entire
command-line and then split it, only to extract the name of the
executable. However, this is not a performance-critical code path, and
the code is much more readable this way.

Signed-off-by: Segev Finer <segev208@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:45 +01:00
Johannes Schindelin
62d9d1a8bb Merge branch 'unc-paths'
A bug fix for pushing to shared folders (fixing a regression introduced
into v2.11.0).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:44 +01:00
Johannes Schindelin
c0f364c19b Merge pull request #996 from jeffhostetler/jeffhostetler/register_rename_src
diffcore-rename: speed up register_rename_src
2017-02-21 14:55:42 +01:00
Johannes Sixt
829b14f363 fix pushing to //server/share/dir on Windows
normalize_path_copy() is not prepared to keep the double-slash of a
//server/share/dir kind of path, but treats it like a regular POSIX
style path and transforms it to /server/share/dir.

The bug manifests when 'git push //server/share/dir master' is run,
because tmp_objdir_add_as_alternate() uses the path in normalized
form when it registers the quarantine object database via
link_alt_odb_entries(). Needless to say that the directory cannot be
accessed using the wrongly normalized path.

Fix it by skipping all of the root part, not just a potential drive
prefix. offset_1st_component takes care of this, see the
implementation in compat/mingw.c::mingw_offset_1st_component().

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

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:42 +01:00
Johannes Schindelin
48b5245f94 mingw: demonstrate a regression pushing to UNC paths
On Windows, there are "UNC paths" to access network (AKA shared) folders,
of the form \\server\sharename\directory. This provides a convenient way
for Windows developers to share their Git repositories without having to
have a dedicated server.

Git for Windows v2.11.0 introduced a regression where pushing to said UNC
paths no longer works, although fetching and cloning still does.

Demonstrate what is the problem, using so-called "administrative shares":
disk volumes are automatically shared under certain circumstances, e.g.
the C: drive is shared as \\localhost\c$. The test needs to be skipped if
the current directory is inaccessible via said administrative share, of
course.

Original-report: https://github.com/git-for-windows/git/issues/979
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:42 +01:00
Johannes Schindelin
3f53d2353e Merge pull request #1004 from whoisj/nolock-env
Carry non-locking status value in the environment.
2017-02-21 14:55:41 +01:00
Johannes Schindelin
7df2350e43 Merge 'gettickcount64' into HEAD
These two patches are really a fixup to PR #1004.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:40 +01:00
Jeff Hostetler
68aa8230d3 diffcore-rename: speed up register_rename_src
Teach register_rename_src() to see if new file pair
can simply be appended to the rename_src[] array before
performing the binary search to find the proper insertion
point.

This is a performance optimization.  This routine is called
during run_diff_files in status and the caller is iterating
over the sorted index, so we should expect to be able to
append in the normal case.  The existing insert logic is
preserved so we don't have to assume that, but simply take
advantage of it if possible.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-02-21 14:55:39 +01:00
J Wyman
cdcf47cf3e Carry non-locking status value in the environment.
If the user has specified '--no-lock-index' when calling git-status, it only seems reasonable that the user intends that option to be carried through to any child forks/procs as well. Currently, the '--no-lock-status' call is lost when submodules are checked. This change places the desired option into the environment, which is in turn passed down to all subsequent children.

With cmd_status checking for '--no-lock--status' first from args then from environment, we're able to keep the option set in all children.

Signed-off-by: J Wyman <jeremy.wyman@microsoft.com>
2017-02-21 14:55:37 +01:00
Johannes Schindelin
df80cbcb8d Merge pull request #1003 from shoelzer/master
poll: Use GetTickCount64 to avoid wraparound issues
2017-02-21 14:55:36 +01:00
Johannes Schindelin
2e249beffb poll: lazy-load GetTickCount64()
This fixes the compilation, actually, as we still did not make the jump to
post-Windows XP completely: we still compile with _WIN32_WINNT set to
0x0502 (which corresponds to Windows Server 2003 and is technically
greater than Windows XP's 0x0501).

However, GetTickCount64() is only available starting with Windows
Vista/Windows Server 2008.

Let's just lazy-load the function, which should also help Git for Windows
contributors who want to reinstate Windows XP support.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:36 +01:00
Johannes Schindelin
4efb0a6f92 Merge pull request #159 from dscho/vagrant
Add Vagrant support (easy Linux VM setup)
2017-02-21 14:55:34 +01:00
Steve Hoelzer
0e658a7104 poll: Use GetTickCount64 to avoid wraparound issues
From Visual Studio 2015 Code Analysis: Warning C28159 Consider using
'GetTickCount64' instead of 'GetTickCount'.

Reason: GetTickCount overflows roughly every 49 days. Code that does not
take that into account can loop indefinitely. GetTickCount64 operates on
64 bit values and does not have that problem.

Signed-off-by: Steve Hoelzer <shoelzer@gmail.com>
2017-02-21 14:55:34 +01:00
Johannes Schindelin
6059b1e88c Merge branch 'http-empty-auth'
This topic branch fixes a rather serious regression with NTLM
authentication: when using "empty credentials", i.e. when inserting ":@"
into a URL (e.g. https://:@me.visualstudio.com/), we used to ask cURL to
use the login credentials. But a recent change broke that. Which this
branch fixes again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:33 +01:00
Johannes Schindelin
beb7c81f37 Merge pull request #991 from jeffhostetler/jeffhostetler/string_list_realloc
string-list: use ALLOC_GROW macro when reallocing string_list
2017-02-21 14:55:32 +01:00
Johannes Schindelin
f7477384b5 Merge pull request #988 from jeffhostetler/jeffhostetler/quick_add_index_entry
read-cache: speed up add_index_entry during checkout
2017-02-21 14:55:31 +01:00
Johannes Schindelin
bebfa9b00d Support Vagrant: quick & easy Linux virtual machine setup
When developing Git for Windows, we always have to ensure that we do not
break any non-Windows platforms, e.g. by introducing Windows-specific code
into the platform-independent source code.

At other times, it is necessary to test whether a bug is Windows-specific
or not, in order to send the bug report to the correct place. Having
access to a Linux-based Git comes in really handy in such a situation.

Vagrant offers a painless way to install and use a defined Linux
development environment on Windows (and other Operating Systems). We offer
a Vagrantfile to that end for two reasons:

1) To allow Windows users to gain the full power of Linux' Git

2) To offer users an easy path to verify that the issue they are about
   to report is really a Windows-specific issue; otherwise they would
   need to report it to git@vger.kernel.org instead.

Using it is easy: Download and install https://www.virtualbox.org/, then
download and install https://www.vagrantup.com/, then direct your
command-line window to the Git source directory containing the Vagrantfile
and run the commands:

	vagrant up
	vagrant ssh

See https://github.com/git-for-windows/git/wiki/Vagrant for details.

As part of switching Git for Windows' development environment from msysGit
to the MSys2-based Git SDK, this Vagrantfile was copy-edited from msysGit:

	https://github.com/msysgit/msysgit/blob/0be8f2208/Vagrantfile

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:29 +01:00
Johannes Schindelin
d20e863f78 http(s): automatically try NTLM authentication first
It is common in corporate setups to have permissions managed via a
domain account. That means that the user does not really have to log in
when accessing a central repository via https://, but that the login
credentials are used to authenticate with that repository.

The common way to do that used to require empty credentials, i.e. hitting
Enter twice when being asked for user name and password, or by using the
very funny notation https://:@server/repository

A recent commit (5275c3081c (http: http.emptyauth should allow empty (not
just NULL) usernames, 2016-10-04)) broke that usage, though, all of a
sudden requiring users to set http.emptyAuth = true.

Which brings us to the bigger question why http.emptyAuth defaults to
false, to begin with.

It would be one thing if cURL would not let the user specify credentials
interactively after attempting NTLM authentication (i.e. login
credentials), but that is not the case.

It would be another thing if attempting NTLM authentication was not
usually what users need to do when trying to authenticate via https://.
But that is also not the case.

So let's just go ahead and change the default, and unbreak the NTLM
authentication. As a bonus, this also makes the "you need to hit Enter
twice" (which is hard to explain: why enter empty credentials when you
want to authenticate with your login credentials?) and the ":@" hack
(which is also pretty, pretty hard to explain to users) obsolete.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:28 +01:00
Jeff Hostetler
3d1eeb439d string-list: use ALLOC_GROW macro when reallocing string_list
Use ALLOC_GROW() macro when reallocing a string_list array
rather than simply increasing it by 32.  This is a performance
optimization.

During status on a very large repo and there are many changes,
a significant percentage of the total run time was spent
reallocing the wt_status.changes array.

This change decreased the time in wt_status_collect_changes_worktree()
from 125 seconds to 45 seconds on my very large repository.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-02-21 14:55:27 +01:00
Johannes Schindelin
bda2df0daa Merge pull request #978 from jeffhostetler/jeffhostetler/thread_verify_hdr
read-cache: run verify_hdr() in background thread
2017-02-21 14:55:26 +01:00
Johannes Schindelin
f02c6691cb Merge 'misc-vs-fixes-extra' into HEAD
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:25 +01:00
Johannes Schindelin
451571466f Merge branch 'visual-studio'
This topic branch teaches the project generator to generate a Visual
Studio solution, ready to be opened in Visual Studio 2010 or later.

The idea, of course, is to let some automatic build job generate and
commit the project files with

	make MSVC=1 vcxproj

and then (force-)push to a special-purpose branch.

The major part of this branch thicket concerns itself not only with
generating the Visual Studio project files, but making sure that the
user can then run the test suite from a regular Git Bash (i.e. *not*
requiring a Git for Windows SDK), e.g. by running

	cd t
	prove --timer --jobs 15 ./t[0-9]*.sh

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:24 +01:00
Johannes Schindelin
e5948bef91 Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_fscache
add: use preload-index and fscache for performance
2017-02-21 14:55:23 +01:00
Johannes Schindelin
94019f8a4e Merge pull request #964 from jeffhostetler/jeffhostetler/memihash_perf
Jeffhostetler/memihash perf
2017-02-21 14:55:22 +01:00
Johannes Schindelin
61990d5169 mingw: make readlink() independent of core.symlinks
Regardless whether we think we are able to create symbolic links, we
should always read them.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:22 +01:00
Johannes Schindelin
f0aea18b0d Merge pull request #955 from jeffhostetler/jeffhostetler/preload_index_perf
preload-index: avoid lstat for skip-worktree items
2017-02-21 14:55:21 +01:00
Johannes Schindelin
e00d7b0b47 Merge pull request #938 from virtuald/patch-1
git-cvsexportcommit.perl: Force crlf translation
2017-02-21 14:55:20 +01:00
Johannes Schindelin
e10eaad4f6 Merge branch 'reset-stdin'
This topic branch adds the (experimental) --stdin/-z options to `git
reset`. Those patches are still under review in the upstream Git project,
but are already merged in their experimental form into Git for Windows'
`master` branch, in preparation for a MinGit-only release.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:20 +01:00
Johannes Schindelin
3a0f88a821 Merge branch 'mingw-strftime'
This topic branch works around an out-of-memory bug when the user
specified a format via --date=format:<format> that strftime() does
not like.

Reported by Stefan Naewe.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:19 +01:00
Johannes Schindelin
89dba07421 Unbreak interactive GPG prompt upon signing
With the recent update in efee955 (gpg-interface: check gpg signature
creation status, 2016-06-17), we ask GPG to send all status updates to
stderr, and then catch the stderr in an strbuf.

But GPG might fail, and send error messages to stderr. And we simply
do not show them to the user.

Even worse: this swallows any interactive prompt for a passphrase. And
detaches stderr from the tty so that the passphrase cannot be read.

So while the first problem could be fixed (by printing the captured
stderr upon error), the second problem cannot be easily fixed, and
presents a major regression.

So let's just revert commit efee9553a4.

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

Cc: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:18 +01:00
Johannes Schindelin
0a311a9599 Merge pull request #866 from landstander668/add_platform
Add reporting of build platform
2017-02-21 14:55:18 +01:00
Johannes Schindelin
05f35aae5b Merge branch 'unhidden-git'
It has been reported that core.hideDotFiles=false stopped working...
This topic branch fixes it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:17 +01:00
Johannes Schindelin
f8cb1b82cd 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>
2017-02-21 14:55:16 +01:00
Johannes Schindelin
ca4866eadd Merge pull request #797 from glhez/master
`git bundle create <bundle>` leaks handle the revlist is empty.
2017-02-21 14:55:15 +01:00
Johannes Schindelin
271ba7bd4c Merge 'release-gc-repack' into HEAD 2017-02-21 14:55:15 +01:00
Johannes Schindelin
2fb06dc224 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>
2017-02-21 14:55:14 +01:00
Jeff Hostetler
c3949cd6c6 test-strcmp-offset: created test for strcmp_offset
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-02-21 14:55:12 +01:00
Jeff Hostetler
a52b273c6c read-cache: speed up add_index_entry during checkout
Teach add_index_entry_with_check() and has_dir_name()
to see if the path of the new item is greater than the
last path in the index array before attempting to search
for it.

This is a performance optimization.

During checkout, merge_working_tree() populates the new
index in sorted order, so this change saves at least 2
lookups per file.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-02-21 14:55:12 +01:00
Jeff Hostetler
41e583391e read-cache: run verify_hdr() in background thread
This is a performance optimization.

Teach do_read_index() to call verify_hdr() using a thread
and allow SHA1 verification to run concurrently with the
parsing of index-entries and extensions.

For large index files, this cuts the startup time in half.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-02-21 14:55:11 +01:00
Johannes Schindelin
9f0a3fc16c msvc: avoid debug assertion windows in Debug Mode
For regular debugging, it is pretty helpful when a debug assertion in a
running application triggers a window that offers to start the debugger.

However, when running the test suite, it is not so helpful, in
particular when the debug assertions are then suppressed anyway because
we disable the invalid parameter checking (via invalidcontinue.obj, see
the comment in config.mak.uname about that object for more information).

So let's simply disable that window in Debug Mode (it is already
disabled in Release Mode).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:09 +01:00
Johannes Schindelin
b5fb4fc117 Merge 'no-dashed-invocation' into HEAD 2017-02-21 14:55:08 +01:00
Johannes Schindelin
bf0de2c80b Merge 'misc-vs-fixes' into HEAD 2017-02-21 14:55:07 +01:00
Johannes Schindelin
b863fa4513 msvc: add a Makefile target to pre-generate the VS solution
The entire idea of generating the VS solution makes only sense if we
generate it via Continuous Integration; otherwise potential users would
still have to download the entire Git for Windows SDK.

So let's just add a target in the Makefile that can be used to generate
said solution; The generated files will then be committed so that they
can be pushed to a branch ready to check out by Visual Studio users.

To make things even more useful, we also generate and commit other files
that are required to run the test suite, such as templates and
bin-wrappers: with this, developers can run the test suite in a regular
Git Bash (that is part of a regular Git for Windows installation) after
building the solution in Visual Studio.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:07 +01:00
Johannes Schindelin
e4b4290853 msvc: fix make test without having to play PATH games
When building with Microsoft Visual C, we use NuGet to acquire the
dependencies (such as OpenSSL, cURL, etc). We even unpack those
dependencies.

This patch teaches the test suite to add the directory with the unpacked
.dll files to the PATH before running the tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:07 +01:00
Johannes Schindelin
a89ef5709b msvc: ignore incremental compile output
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:06 +01:00
Johannes Schindelin
2aff353622 msvc: ignore .dll files copied into the top-level directory
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-02-21 14:55:06 +01:00