Commit Graph

44523 Commits

Author SHA1 Message Date
Johannes Schindelin
a604f2cd93 Merge 'normalize-win-paths' into HEAD 2014-02-17 12:42:39 -06:00
Johannes Schindelin
e094dbbec9 Merge 'msvc-link-crt' into HEAD 2014-02-17 12:42:39 -06:00
Johannes Schindelin
a704b30605 Merge 'install-wincred' into HEAD 2014-02-17 12:42:39 -06:00
Johannes Schindelin
bc6f2b6f94 Merge 'fix-is-exe' into HEAD 2014-02-17 12:42:39 -06:00
Johannes Schindelin
6f49259561 Merge 'fix-externals' into HEAD 2014-02-17 12:42:39 -06:00
Johannes Schindelin
c9159b77e8 Merge 'stash-reflog' into HEAD 2014-02-17 12:42:38 -06:00
Johannes Schindelin
bcfa092816 Merge 'http-msys-paths' into HEAD 2014-02-17 12:42:38 -06:00
Johannes Schindelin
e1485677c2 Merge 'remote-hg-prerequisites' into HEAD
These fixes were necessary for Sverre Rabbelier's remote-hg to work,
but for some magic reason they are not necessary for the current
remote-hg. Makes you wonder how that one gets away with it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-02-17 12:42:38 -06:00
Johannes Schindelin
4d799ec5d8 Merge 'win-tests-fixes' into HEAD 2014-02-17 12:42:38 -06:00
Johannes Schindelin
1483c59c0b Merge 'grep-fixes' into HEAD 2014-02-17 12:42:37 -06:00
Johannes Schindelin
9181f8d2f8 Merge 'pull-rebase-interactive' into HEAD 2014-02-17 12:42:37 -06:00
Johannes Schindelin
6286e2f2e5 Merge 'send-email' into HEAD 2014-02-17 12:42:37 -06:00
Johannes Schindelin
ae9bc8b987 Merge 'jberezanski/wincred-sso-r2' into HEAD 2014-02-17 12:42:37 -06:00
Johannes Schindelin
9021aa4cd6 Merge 'gitweb-syntax' into HEAD 2014-02-17 12:42:37 -06:00
Johannes Schindelin
950eea2370 Merge 'gitk' into HEAD 2014-02-17 12:42:36 -06:00
Johannes Schindelin
81e62a40ec Merge 'git-gui' into HEAD 2014-02-17 12:42:36 -06:00
Johannes Schindelin
8df6c3899c Merge 'deny-current-branch' into HEAD 2014-02-17 12:42:36 -06:00
Johannes Schindelin
7a5369a26c Merge 'criss-cross-merge' into HEAD 2014-02-17 12:42:36 -06:00
Johannes Schindelin
1af3f1f6a5 Merge 'am-submodules' into HEAD 2014-02-17 12:42:36 -06:00
Johannes Schindelin
5f7383305b Merge 'unc' into HEAD 2014-02-17 12:42:35 -06:00
Johannes Schindelin
356cdb109f Merge 'home' into HEAD 2014-02-17 12:42:35 -06:00
Johannes Schindelin
3a85ef5d3b Merge 'hide-dotgit' into HEAD 2014-02-17 12:42:35 -06:00
Johannes Schindelin
4636cf566d Merge 'unicode' into HEAD 2014-02-17 12:42:35 -06:00
Heiko Voigt
72e28e0ada Windows: Always normalize paths to Windows-style
It appears that `pwd` returns the POSIX-style or the DOS-style path
depending which style the previous `cd` used. To normalize, enforce `pwd
-W` in scripts.

From the original e-mail exchange:

On Thu, Mar 22, 2012 at 11:13:37AM +0100, Sebastian Schuberth wrote:
> On Wed, Mar 21, 2012 at 22:21, Johannes Sixt <j6t@kdbg.org> wrote:
>
> > I build git and run its tests outside the msysgit environment. Does that
> > explain the difference? (And I use CMD.)
>
> It does not make a difference for me. I started cmd.exe at
> c:\msysgit\git\t, added c:\msysgit\bin temporarily to PATH, and ran
> "sh t5526-fetch-submodules.sh -i -v", and the test still fails.

Yes it probably does. Johannes said that he runs the tests outside of
the msysgit folder. That way there is only one path the submodule script
gets reported and not two like '/c/msysgit/git' and '/git'.

That would explain to me why it is passing.

I am afraid that the only solution is to patch msys itself to report the
long absolute path when passing window style paths to cd. Currently when
I do

	cd c:/msysgit/git

I will end up in '/git' instead of the long path.

I found that there is a -W option to pwd in msys bash which makes it
always return the real windows path. A normalization in that direction
is unique and thus might be more robust. Have a look at the attached
patch. With this at least t5526 passes. I was not able to run the whole
testsuite properly at the moment. I can have a look at that tomorrow.

What do you think?

Cheers Heiko

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-02-17 12:08:15 -06:00
Karsten Blees
fc4383c55f MSVC: link dynamically to the CRT
Dynamic linking is generally preferred over static linking, and MSVCRT.dll
has been integral part of Windows for a long time.

This also fixes linker warnings for _malloc and _free in zlib.lib, which
seems to be compiled for MSVCRT.dll already.

The DLL version also exports some of the CRT initialization functions,
which are hidden in the static libcmt.lib (e.g. __wgetmainargs, required by
subsequent Unicode patches).

Signed-off-by: Karsten Blees <blees@dcon.de>
2014-02-17 12:08:15 -06:00
Pat Thoyts
2f2d3040b3 wincred: add install target and avoid overwriting configured variables.
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:15 -06:00
Heiko Voigt
235d7d2a6f help: correct behavior for is_executable on Windows
The previous implementation said that the filesystem information on
Windows is not reliable to determine whether a file is executable.
To find gather this information it was peeking into the first two bytes
of a file to see whether it looks executable.
Apart from the fact that on Windows executables are usually defined as
such by their extension it lead to slow opening of help file in some
situations.

When you have virus scanner running calling open on an executable file
is a potentially expensive operation. See the following measurements (in
seconds) for example.

With virus scanner running (coldcache):

$ ./a.exe /libexec/git-core/
before open (git-add.exe): 0.000000
after open (git-add.exe): 0.412873
before open (git-annotate.exe): 0.000175
after open (git-annotate.exe): 0.397925
before open (git-apply.exe): 0.000243
after open (git-apply.exe): 0.399996
before open (git-archive.exe): 0.000147
after open (git-archive.exe): 0.397783
before open (git-bisect--helper.exe): 0.000160
after open (git-bisect--helper.exe): 0.397700
before open (git-blame.exe): 0.000160
after open (git-blame.exe): 0.399136
...

With virus scanner running (hotcache):

$ ./a.exe /libexec/git-core/
before open (git-add.exe): 0.000000
after open (git-add.exe): 0.000325
before open (git-annotate.exe): 0.000229
after open (git-annotate.exe): 0.000177
before open (git-apply.exe): 0.000167
after open (git-apply.exe): 0.000150
before open (git-archive.exe): 0.000154
after open (git-archive.exe): 0.000156
before open (git-bisect--helper.exe): 0.000132
after open (git-bisect--helper.exe): 0.000180
before open (git-blame.exe): 0.000718
after open (git-blame.exe): 0.000724
...

This test did just list the given directory and open() each file in it.

With this patch I get:

$ time git help git
Launching default browser to display HTML ...

real    0m8.723s
user    0m0.000s
sys     0m0.000s

and without

$ time git help git
Launching default browser to display HTML ...

real    1m37.734s
user    0m0.000s
sys     0m0.031s

both tests with cold cache and giving the machine some time to settle
down after restart.

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
2014-02-17 12:08:14 -06:00
Adam Roben
4b5b45019e Make non-.exe externals work again
7ebac8cb94 made launching of .exe
externals work when installed in Unicode paths. But it broke launching
of non-.exe externals, no matter where they were installed. We now
correctly maintain the UTF-8 and UTF-16 paths in tandem in lookup_prog.

This fixes t5526, among others.

Signed-off-by: Adam Roben <adam@roben.org>
2014-02-17 12:08:14 -06:00
Adam Roben
5d88db7b01 Fix launching of externals from Unicode paths
If Git were installed in a path containing non-ASCII characters,
commands such as git-am and git-submodule, which are implemented as
externals, would fail to launch with the following error:

> fatal: 'am' appears to be a git command, but we were not
> able to execute it. Maybe git-am is broken?

This was due to lookup_prog not being Unicode-aware. It was somehow
missed in 2ee5a1a14a.

Note that the only problem in this function was calling
GetFileAttributes instead of GetFileAttributesW. The calls to access()
were fine because access() is a macro which resolves to mingw_access,
which already handles Unicode correctly. But I changed lookup_prog to
use _waccess directly so that we only convert the path to UTF-16 once.

Signed-off-by: Adam Roben <adam@roben.org>
2014-02-17 12:08:13 -06:00
Evgeny Pashkin
5cc7c27b4f Fixed wrong path delimiter in exe finding
On Windows XP3 in git bash
git clone git@github.com:octocat/Spoon-Knife.git
cd Spoon-Knife
git gui
menu Remote\Fetch from\origin
error: cannot spawn git: No such file or directory
error: could not run rev-list

if u run
git fetch --all
it worked normal in git bash or gitgui tools

In second version CreateProcess get 'C:\Git\libexec\git-core/git.exe' in
first version - C:/Git/libexec/git-core/git.exe and not executes (unix
slashes)

after fixing C:\Git\libexec\git-core\git.exe or
C:/Git/libexec/git-core\git.exe it works normal

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-02-17 12:08:13 -06:00
Johannes Schindelin
ff4588fb06 git stash: make sure that .git/logs/refs/ exists
If the user has not activated reflogs, or if nothing has been recorded
yet (as is the case directly after cloning), said directory may not
exist yet.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-02-17 12:08:12 -06:00
Johannes Schindelin
052a677726 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>
2014-02-17 12:08:12 -06:00
Johannes Schindelin
051c75e107 Always auto-gc after calling a fast-import transport
After importing anything with fast-import, we should always let the
garbage collector do its job, since the objects are written to disk
inefficiently.

This brings down an initial import of http://selenic.com/hg from about
230 megabytes to about 14.

In the future, we may want to make this configurable on a per-remote
basis, or maybe teach fast-import about it in the first place.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-02-17 12:08:11 -06:00
Sverre Rabbelier
caa9c16c4c remote-helper: check helper status after import/export
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
2014-02-17 12:08:11 -06:00
Sverre Rabbelier
18e250f1bd transport-helper: add trailing --
[PT: ensure we add an additional element to the argv array]
2014-02-17 12:08:11 -06:00
Johannes Schindelin
529f4d46e5 fast-export: do not refer to non-existing marks
When calling `git fast-export a..a b` when a and b refer to the same
commit, nothing would be exported, and an incorrect reset line would
be printed for b ('from :0').

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
2014-02-17 12:08:11 -06:00
Johannes Schindelin
0c50531547 Disable t0110's high-bit test on Windows
The bash Git for Windows uses (i.e. the MSys bash) cannot pass
command-line arguments with high bits set verbatim to non-MSys programs,
but instead converts those characters with high bits set to their hex
representation.

For example, when running

	strings "$(echo -e '\x80')"

(where strings.exe is a MinGW program, not an MSys one) it will complain
about not finding the file called "80".

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-02-17 12:08:10 -06:00
Brice Lambson
9cab03e969 MinGW: Update tests to handle a native eol of crlf
Some of the tests were written with the assumption that the native eol would always be lf. After defining NATIVE_CRLF on MinGW, these tests began failing. This change will update the tests to also handle a native eol of crlf.

Signed-off-by: Brice Lambson <bricelam@live.com>
2014-02-17 12:08:10 -06:00
Pat Thoyts
dec6cba393 Push the NATIVE_CRLF Makefile variable to C and added a test for native.
Commit 95f31e9a correctly points out that the NATIVE_CRLF setting is
incorrectly set on Mingw git. However, the Makefile variable is not
propagated to the C preprocessor and results in no change. This patch
pushes the definition to the C code and adds a test to validate that
when core.eol as native is crlf, we actually normalize text files to this
line ending convention when core.autocrlf is false.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:10 -06:00
Pat Thoyts
9d2ae8b5e3 t9902: mingw-specific fix for gitfile link files
The path in a .git platform independent link file needs to be absolute
and under mingw we need it to be a windows type path, not a unix style
path so it should start with a drive letter and not a /.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:10 -06:00
Karsten Blees
6167d240ce t800[12]: work around MSys limitation
MSys works very hard to convert Unix-style paths into DOS-style ones.
*Very* hard.

So hard, indeed, that

	git blame -L/hello/,/green/

is translated into something like

	git blame -LC:/msysgit/hello/,C:/msysgit/green/

As seen in msys_p2w in src\msys\msys\rt\src\winsup\cygwin\path.cc, line
3204ff:

	case '-':
	  //
	  // here we check for POSIX paths as attributes to a POSIX switch.
	  //
	...

seemingly absolute POSIX paths in single-letter options get expanded by
msys.dll unless they contain '=' or ';'.

So a quick and very dirty fix is to use '-L/;*evil/'. (Using an equal sign
works only when it is before a comma, so in the above example, /=*green/
would still be converted to a DOS-style path.)

Commit-message-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-02-17 12:08:10 -06:00
Pat Thoyts
2482bc95bf t4041: ensure the utf-8 encoded string really gets stored as utf-8.
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:09 -06:00
Pat Thoyts
f31ded3453 t4205: use a file to ensure the encoding is as desired with msysgit
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:09 -06:00
Pat Thoyts
5ff3d724f3 t6006: be explicit about the encoding of test strings for msysgit
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:09 -06:00
Pat Thoyts
a0530b4ffc t7102: do not assume the system encoding is utf-8
The commit_msg function has an assumption that the string is being output
as utf-8. On Windows this is not true so always convert from the system
encoding to the desired encoding.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:09 -06:00
Pat Thoyts
a119eaa89a t4210: skip command-line encoding tests on mingw
On Windows the application command line is provided as unicode and in
mingw-git we convert that to utf-8. So these tests that require a iso-8859-1
input are being subverted by the encoding transformations we perform and
should be skipped.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:08 -06:00
Pat Thoyts
56d1f600d5 t7800: a few tests should ignore crlf in checking the result.
Those tests that generate files using echo can expect crlf issues when run
under windows. For such cases we use 'test_cmp_text'.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:08 -06:00
Pat Thoyts
7f2d9843a9 t0008: avoid absolute path on Windows as colon is used in the tests
The test separator char is a colon which means any absolute paths on windows
confuse the tests that use global_excludes.

Suggested-by: Karsten Blees <karsten.blees@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:08 -06:00
Johannes Schindelin
4f11e3d22e Fix t3404 for Windows
The usual problem: CR/LF...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-02-17 12:08:08 -06:00
Pat Thoyts
4ab6a8d345 t1306: perform file comparisons using text mode for Windows support
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-02-17 12:08:08 -06:00