Commit Graph

54487 Commits

Author SHA1 Message Date
Johannes Schindelin
68965c5eaa Merge branch 'conhost-git-bash' 2015-10-04 15:32:48 +02:00
Johannes Schindelin
95159ad50d git-wrapper: support COMSPEC better
The quoting rules of `cmd.exe` are really, really quirky. In particular,
if there are more than two quotes, the entire set of rules changes. That
is the reason why

	CMD /C "C:\Program Files\Git\usr\bin\bash.exe" -l -i

works, but

	CMD /C "C:\Program Files\Git\usr\bin\bash.exe" -l -i "test.sh"

fails with this error message:

	'C:\Program' is not recognized as an internal or external command,
	operable program or batch file.

The recommended fix is to pass the /S option to `cmd.exe` and surround
the entire command-line by an extra set of quotes. And here lies the
rub: for that to work, we have to append an extra quote. At the end of
the command-line. *After* the last argument was appended, if any.

This commit supports that use case by introducing the option
"APPEND_QUOTE". The intended usage is to use the following string
resource:

	SHOW_CONSOLE=1 APPEND_QUOTE=1
	@@COMSPEC@@ /S /C \"\"@@EXEPATH@@\\usr\\bin\\bash.exe\" --login -i

(Note that there are only three quotes on that command-line, the fourth
to be appended due to the `APPEND_QUOTE` setting.)

This is (1/3) to fix https://github.com/git-for-windows/git/issues/396

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:47 +02:00
Johannes Schindelin
53527eacb2 Merge branch 'getcwd-fix-case'
This makes sure that Git's idea of the current working directory matches
what is recorded on disk (which should be the same as Git's idea).

This helps in particular PowerShell users where the current working
directory can differ in case from what's stored on disk.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:46 +02:00
Johannes Schindelin
479bd07181 t0302: add forgotten quotes
This was probably missed because nobody had a left-over `trash/`
directory and the `-f` flag made sure that no error message was
produced when the file was not found that *actually* wanted to
be removed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:46 +02:00
Johannes Schindelin
8341f5f00c mingw: ensure getcwd() reports the correct case
When switching the current working directory, say, in PowerShell, it is
quite possible to use a different capitalization than the one that is
recorded on disk. While doing the same in `cmd.exe` adjusts the
capitalization magically, that does not happen in PowerShell so that
`getcwd()` returns the current directory in a different way than is
recorded on disk.

Typically this creates no problems except when you call

	git log .

in a subdirectory called, say, "GIT/" but you switched to "Git/" and
your `getcwd()` reports the latter, then Git won't understand that you
wanted to see the history as per the `GIT/` subdirectory but it thinks you
wanted to see the history of some directory that may have existed in the
past (but actually never did).

So let's be extra careful to adjust the capitalization of the current
directory before working with it.

Reported by a few PowerShell power users ;-)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:46 +02:00
Johannes Schindelin
a2448b9f0a Merge pull request #305 from dscho/msysgit_issues_182
Allow `add -p` and `add -i` with a large number of files
2015-10-04 15:32:45 +02:00
Johannes Schindelin
42aa7ea1e7 Merge branch 'bash-redirector' 2015-10-04 15:32:44 +02:00
Johannes Schindelin
97ab632281 t3701: verify that we can add *lots* of files interactively
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:44 +02:00
Kelly Heller
78ce7a9961 Allow add -p and add -i with a large number of files
This fixes https://github.com/msysgit/git/issues/182.

Inspired by Pull Request 218 using code from @PhilipDavis.

[jes: simplified code quite a bit]

Signed-off-by: Kelly Heller <kkheller@cedrus.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:44 +02:00
Johannes Schindelin
c06bc4c1b4 Merge pull request #286 from dscho/unc-alternates
Make alternates work on UNC paths
2015-10-04 15:32:43 +02:00
Johannes Schindelin
78e4839f56 Merge branch 'issue-231'
This branch hopefully addresses

	https://github.com/git-for-windows/git/issues/231

where `git repack` could not delete the object directory because there
was still an open handle on it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:43 +02:00
Johannes Schindelin
c52cada9a0 Merge pull request #275 from cs96and/cygwin_fixes
winansi.c: Fix colourization on Cygwin pseudo terminals.
2015-10-04 15:32:43 +02:00
Johannes Schindelin
661ee31b9e Merge branch 'pinnable'
Part 2/3 of fixing https://github.com/git-for-windows/git/issues/263

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:43 +02:00
Johannes Schindelin
bda838f94c Merge pull request #276 from dscho/issue-0xff
mingw: Suppress warning that <commit>:.gitattributes does not exist
2015-10-04 15:32:43 +02:00
Johannes Schindelin
62a0485186 mingw: let the Git wrapper determine the top-level directory
The Git wrapper is also used as a redirector for Git for Windows'
bin\bash.exe dropin: for backwards-compatibility, bin\bash.exe exists
and simply sets up the environment variables before executing the
*real* bash.

However, due to our logic to use the directory in which the `.exe`
lives as top-level directory (or one directory below for certain, known
basenames such as `git.exe` and `gitk.exe`), the `PATH` environment
variable was prefixed with the `/bin/bin` and `/bin/mingw/bin`
directories -- which makes no sense.

Instead, let's just auto-detect the top-level directory in the common
case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:42 +02:00
Johannes Schindelin
02f0b3e6de mingw: clean up the Git wrapper a bit
We should not conflate the 'exepath' with the 'top-level
directory'. The former should be the directory in which the executable
lives while the latter should be the top-level directory ("POSIX root
directory") as far as Git is concerned.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:42 +02:00
Johannes Schindelin
c7947caeab mingw: support UNC alternates
Just like we support having alternates pointing to different drives, we
want to support alternates pointing to network shares, i.e. UNC paths.

Technically, what we do in this patch is not to support UNC alternates,
but to support UNC paths when normalizing paths. But the latter implies
the former, and the former really was the motivation for this patch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:41 +02:00
Johannes Sixt
4ce55b968a prune: close directory earlier during loose-object directory traversal
27e1e22d (prune: factor out loose-object directory traversal, 2014-10-16)
introduced a new function for_each_loose_file_in_objdir() with a helper
for_each_file_in_obj_subdir(). The latter calls callbacks for each file
found during a directory traversal and finally also a callback for the
directory itself.

git-prune uses the function to clean up the object directory. In
particular, in the directory callback it calls rmdir(). On Windows XP,
this rmdir call fails, because the directory is still open while the
callback is called. Close the directory before calling the callback.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:41 +02:00
Alan Davies
0caf6c44d7 winansi.c: Fix colourization on Cygwin pseudo terminals.
Git only colours the output and uses pagination if isatty() returns 1.
MSys and Cygwin emulate pseudo terminals via named pipes, meaning that
isatty() returns 0.

Commit 3adef8de55 fixed this for MSys
terminals, but not Cygwin.

The named pipes that Cygwin and Msys use are very similar.  MSys PTY pipes
are called 'msys-*-pty*' and Cygwin uses 'cygwin-*-pty*'.  This commit
modifies the existing check to allow both MSys and Cygwin PTY pipes to be
identified as TTYs.

Note that Pagination is still broken on Cygwin.  less.exe is spawned (as
seen in Process Explorer and using GIT_TRACE=1), but the output is not
being piped into it.

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

Signed-off-by: Alan Davies <alan.n.davies@gmail.com>
2015-10-04 15:32:40 +02:00
Johannes Schindelin
9898acf849 git-wrapper: also allow setting the application ID
Windows 7 allows users to pin running applications to the task bar. By
setting the application ID, multiple processes can share a single task
bar entry, and this is exactly what we need for `git-bash.exe` which
wants to share the task bar entry with the `mintty.exe` instance it
launches.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:40 +02:00
Johannes Schindelin
434f0b2364 Merge pull request #200 from dscho/code-of-conduct
Add a brief "code of conduct" section to the Governance Model
2015-10-04 15:32:39 +02:00
Johannes Schindelin
596f184623 mingw: Suppress warning that <commit>:.gitattributes does not exist
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:39 +02:00
Johannes Schindelin
67b62f7399 Work around MinGW-w64 erroneously claiming to have flockfile()
The _POSIX_THREAD_SAFE_FUNCTIONS constant is supposed to be defined only
if flockfile() and friends are available. MinGW-w64 defines that
constant, but the functions are not available. Work around that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:39 +02:00
Johannes Schindelin
947363f3c0 Merge pull request #246 from uecasm/patch-1
Verify memoized files can be reloaded before using them
2015-10-04 15:32:38 +02:00
Johannes Schindelin
cf5205fb73 Merge branch 'program-data-config'
This branch introduces support for reading the "Windows-wide" Git
configuration from `%PROGRAMDATA%\Git\config`. As these settings are
intended to be shared between *all* Git-related software, that config
file takes an even lower precedence than `$(prefix)/etc/gitconfig`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:38 +02:00
Johannes Schindelin
692d172bd9 Merge branch 'git-wrapper--command'
This topic branch adds the --command=<command> option that allows
starting the Git Bash (or Git CMD) with different terminal emulators
than the one encoded via embedded string resources.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:38 +02:00
Johannes Schindelin
a17cf267f0 Merge pull request #159 from dscho/vagrant
Add Vagrant support (easy Linux VM setup)
2015-10-04 15:32:38 +02:00
Johannes Schindelin
9fecacf7ed Merge pull request #156 from kblees/kb/symlinks
Symlink support
2015-10-04 15:32:37 +02:00
Johannes Schindelin
f0571f8099 Merge 'git-wrapper' into HEAD
Use msysGit's `git-wrapper` instead of the builtins. This works around
two issues:

- when the file system does not allow hard links, we would waste over
  800 megabyte by having 109 copies of a multi-megabyte executable

- even when the file system allows hard links, the Windows Explorer
  counts the disk usage as if it did not. Many users complained about
  Git for Windows using too much space (when it actually did not). We
  can easily avoid those user complaints by merging this branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:37 +02:00
Johannes Schindelin
01250216e1 Merge 'non-win-fixes' into HEAD 2015-10-04 15:32:37 +02:00
Johannes Schindelin
ff4c754b3c Merge 'sideband-bug' into HEAD
This works around the push-over-git-protocol issues pointed out in
https://github.com/msysgit/git/issues/101.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:37 +02:00
Johannes Schindelin
1bd58d1bd4 Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:37 +02:00
Johannes Schindelin
4d8ae7d85d Merge 'fix-is-exe' into HEAD 2015-10-04 15:32:36 +02:00
Johannes Schindelin
82fd095c93 Merge 'fix-externals' into HEAD 2015-10-04 15:32:36 +02:00
Johannes Schindelin
18ba56c061 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>
2015-10-04 15:32:36 +02:00
Johannes Schindelin
61e7230c98 Merge 'win-tests-fixes' into HEAD 2015-10-04 15:32:36 +02:00
Johannes Schindelin
1dac01cf0e Merge 'msys2' into HEAD
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:35 +02:00
Johannes Schindelin
59fd0759a9 Merge 'pull-rebase-interactive' into HEAD 2015-10-04 15:32:35 +02:00
Johannes Schindelin
c94942f30c Merge 'jberezanski/wincred-sso-r2' into HEAD 2015-10-04 15:32:35 +02:00
Johannes Schindelin
f740a14eb6 Merge 'gitk' into HEAD 2015-10-04 15:32:35 +02:00
Johannes Schindelin
5a9e749e73 Merge 'git-gui' into HEAD 2015-10-04 15:32:34 +02:00
Johannes Schindelin
b146f93710 Merge 'criss-cross-merge' into HEAD 2015-10-04 15:32:34 +02:00
Johannes Schindelin
fd76af543f Merge 'hide-dotgit' into HEAD 2015-10-04 15:32:34 +02:00
Johannes Schindelin
d43366dc2f Merge 'unicode' into HEAD 2015-10-04 15:32:34 +02:00
Johannes Schindelin
71ae910f87 Add a Code of Conduct
It is better to state clearly expectations and intentions than to assume
quietly that everybody agrees.

This Code of Conduct is the Open Code of Conduct as per
http://todogroup.org/opencodeofconduct/ (the only modifications are the
adjustments to reflect that there is no "response team" in addition to the
Git for Windows maintainer, and the addition of the link to the Open Code
of Conduct itself).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:33 +02:00
Gavin Lambert
743e5889aa git-svn: do not reuse caches memoized for a different architecture
Reusing cached data speeds up git-svn by quite a fair bit. However, if
the YAML module is unavailable, the caches are written to disk in an
architecture-dependent manner. That leads to problems when upgrading,
say, from 32-bit to 64-bit Git for Windows.

Let's just try to read those caches back if we detect the absence of the
YAML module and the presence of the file, and delete the file if it
could not be read back correctly.

Note that the only way to catch the error when the memoized cache could
not be read back is to put the call inside an `eval { ... }` block
because it would die otherwise; the `eval` block should also return `1`
in case of success explicitly since the function reading back the cached
data does not return an appropriate value to test for success.

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

[jes: fixed the commit message, made the sign-off explicit]

Signed-off-by: Gavin Lambert <github@mirality.co.nz>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:33 +02:00
Johannes Schindelin
bc2133b0d3 Windows: add support for a Windows-wide configuration
Between the libgit2 and the Git for Windows project, there has been a
discussion how we could share Git configuration to avoid duplication (or
worse: skew).

Earlier, libgit2 was nice enough to just re-use Git for Windows'

	C:\Program Files (x86)\Git\etc\gitconfig

but with the upcoming Git for Windows 2.x, there would be more paths to
search, as we will have 64-bit and 32-bit versions, and the
corresponding config files will be in %PROGRAMFILES%\Git\mingw64\etc and
...\mingw32\etc, respectively.

Worse: there are portable Git for Windows versions out there which live
in totally unrelated directories, still.

Therefore we came to a consensus to use `%PROGRAMDATA%\Git\config` as the
location for shared Git settings that are of wider interest than just Git
for Windows.

On XP, there is no %PROGRAMDATA%, therefore we need to use
"%ALLUSERSPROFILE%\Application Data\Git\config" in those setups.

Of course, the configuration in `%PROGRAMDATA%\Git\config` has the
widest reach, therefore it must take the lowest precedence, i.e. Git for
Windows can still override settings in its `etc/gitconfig` file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:32 +02:00
Karsten Blees
6f6a0a3831 config.c: create missing parent directories when modifying config files
'git config' (--add / --unset etc.) automatically creates missing config
files. However, it fails with a misleading error message "could not lock
config file" if the parent directory doesn't exist.

Also create missing parent directories.

This is particularly important when calling

	git config -f /non/existing/directory/config ...

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:32 +02:00
Karsten Blees
665b6e222b config: factor out repeated code
Factor out near identical per-file logic.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:32 +02:00
Johannes Schindelin
9f1677f895 git-wrapper: leave the working directory alone by default
The idea of `git-bash.exe` automatically running the Git Bash in the
home directory was to support the start menu item `Git Bash` (which
should not start in C:\Program Files\Git, but in $HOME), and to make
that behavior consistent with double-clicking in `git-bash.exe`
portable Git.

However, it turns out that one of the main use cases of portable Git is
to run the Git Bash in GitHub for Windows, and it should start in the
top-level directory of a given project. Therefore, the concern to keep
double-clicking `git-bash.exe` consistent with the start menu item was
actually unfounded.

As to the start menu item: it can easily be changed to launch
`git-bash.exe` with a command-line option. So let's introduce the
--cd-to-home option for that purpose.

As a bonus, the Git wrapper can now also serve as a drop-in redirector
/bin/bash.exe to provide backwards-compatibility of Git for Windows 2.x
with 1.x: some 3rd-party software expects to find that executable there,
and it also expects it to leave the working directory unchanged.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-10-04 15:32:31 +02:00