Commit Graph

35433 Commits

Author SHA1 Message Date
Gregor Uhlenheuer
002c82fddb Git.pm: Use stream-like writing in cat_blob()
This commit fixes the issue with the handling of large files causing an
'Out of memory' perl exception. Instead of reading and writing the whole
blob at once now the blob is written in small pieces.

The problem was raised and discussed in this mail to the msysGit mailing
list: http://thread.gmane.org/gmane.comp.version-control.msysgit/12080

Signed-off-by: Gregor Uhlenheuer <kongo2002@googlemail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:48 -05:00
Johannes Schindelin
cf1e82f073 grep -I: do not bother to read known-binary files
Incidentally, this makes grep -I respect the "binary" attribute (actually,
the "-text" attribute, but "binary" implies that).

Since the attributes are not thread-safe, we now need to switch off
threading if -I was passed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:48 -05:00
Johannes Schindelin
13e7afc0f4 git grep -O -i: if the pager is 'less', pass the '-i' option
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:48 -05:00
Johannes Schindelin
90b1d1787d 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>
2012-05-11 23:25:48 -05:00
Johannes Schindelin
02bb5480bd Only switch on the line number toggle when highlighting is activated
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:47 -05:00
Johannes Schindelin
85312b173d 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>
2012-05-11 23:25:47 -05:00
Johannes Schindelin
806ccd78ae Gitweb: make line number toggling work for Firefox and Safari
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:47 -05:00
Johannes Schindelin
cff5040e00 gitweb: Allow line number toggling with Javascript
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:47 -05:00
Heiko Voigt
61c11b3714 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>
2012-05-11 23:25:47 -05:00
Evgeny Pashkin
2f57b4438b 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>
2012-05-11 23:25:47 -05:00
Johannes Schindelin
608e7d0cf1 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>
2012-05-11 23:25:47 -05:00
Eric Sunshine
a6dfde5a1d Make mingw_offset_1st_component() behave consistently for all paths.
mingw_offset_1st_component() returns "foo" for inputs "/foo" and
"c:/foo", but inconsistently returns "/foo" for UNC input
"/machine/share/foo".  Fix it to return "foo" for all cases.

Reference: http://groups.google.com/group/msysgit/browse_thread/thread/c0af578549b5dda0

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:47 -05:00
Cezary Zawadka
1413296b6b Allow using UNC path for git repository
[efl: moved MinGW-specific part to compat/]

[jes: fixed compilation on non-Windows]

Signed-off-by: Cezary Zawadka <czawadka@gmail.com>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:47 -05:00
Johannes Schindelin
97cbb6c61b Add a Windows-specific fallback to getenv("HOME");
This fixes msysGit issue 482 properly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:47 -05:00
bert Dvornik
0cffc3c171 send-email: handle Windows paths for display just like we do for processing
In git-send-email.perl, here are two checks to determine if
$smtp_server is an absolute path (so it'll be treated as a mailer) or
not (so it'll be treated as a hostname).  The one that handles actual
mail processing has been taught to recognize Windows pathnames by
commit 33b2e81f.

The other check is just to tell the user what happened, so it's far
less important, but the current state is that we will still claim to
the user that c:/foo/bar is a server. =)  This makes the second check
consistent with the first.

Signed-off-by: bert Dvornik <dvornik+git@gmail.com>
2012-05-11 23:25:47 -05:00
Erik Faye-Lund
a150c4e7d0 send-email: accept absolute path even on Windows
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:47 -05:00
Johannes Schindelin
5d9737b9e4 Let deny.currentBranch=updateInstead ignore submodules
They are not affected by the update anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:47 -05:00
Johannes Schindelin
346890a067 Add a few more values for receive.denyCurrentBranch
For a long time, this developer thought that Git's insistence that
pushing into the current branch is evil was completely merited.

Just for fun, the original patch tried to show people that Git is right
there, and that it causes more trouble than it does good when Git allows
you to try to update the working tree for fast-forwards, or to detach the
HEAD, depending on some config settings.

Surprisingly, the opposite was shown.

So here is the support for two new options you can give the config
variable receive.denyCurrentBranch:

'updateInstead':
	Try to merge the working tree with the new tip of the branch
	(which can lead to really horrible merge conflicts).

'detachInstead':
	Detach the HEAD, thereby avoiding a disagreement between the
	HEAD and the index (as well as the working tree), possibly
	leaving the local user wondering how on earth her HEAD became
	so detached.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:47 -05:00
Chris West (Faux)
3d849e3ee1 Fix another invocation of git from gitk with an overly long command-line
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2012-05-11 23:25:47 -05:00
Johannes Schindelin
a8a7c536bf 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>
2012-05-11 23:25:47 -05:00
Karsten Blees
6581b04e81 gitk: fix file name encoding in diff hunk headers
Decode file names from system encoding in all diff hunk header lines, not
just the first (i.e. print nice file names in 'rename from' / 'rename to' /
'Binary files' lines, too).

Signed-off-by: Karsten Blees <blees@dcon.de>
2012-05-11 23:25:47 -05:00
Karsten Blees
d59180491f git-gui: fix encoding in git-gui file browser
Assume git tree objects (i.e. output of git-ls-tree) are encoded in system
encoding, for display in the git-gui file browser.

Signed-off-by: Karsten Blees <blees@dcon.de>
2012-05-11 23:25:47 -05:00
Johannes Schindelin
0fcec1c90d git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:47 -05:00
Heiko Voigt
b150e8cb1f 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>
2012-05-11 23:25:46 -05:00
Johannes Schindelin
6eae55b9ba 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>
2012-05-11 23:25:46 -05:00
Heiko Voigt
f474d924b3 Revert "git-gui: set GIT_DIR and GIT_WORK_TREE after setup"
This reverts commit a9fa11fe5b.
2012-05-11 23:25:46 -05:00
Johannes Sixt
50b7ec9795 criss cross rename failure workaround
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:46 -05:00
Matthieu Moy
cc36606c88 bash-completion: don't add quoted space for ZSH (fix regression)
Commit a31e626 (completion: optimize refs completion) introduced a
regression for ZSH users: ref names were completed with a quoted trailing
space (i.e. "git checkout ma" completes to "git checkout master\ "). The
space is convenient for bash users since we use "-o nospace", but a
quoted space is worse than nothing. The absence of trailing space for ZSH
is a long-standing issue, that this patch is not fixing. We just fix the
regression by not appending a space when the shell is ZSH.

Original-patch-by: SZEDER Gábor <szeder@ira.uka.de>
Reported-by: Stefan Haller <lists@haller-berlin.de>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-11 23:25:46 -05:00
Pat Thoyts
f13fa8757a 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>
2012-05-11 23:25:46 -05:00
Erik Faye-Lund
c96eaac51c mingw: do not hide bare repositories
As reported in msysGit issue 450 the recent change to set the windows
hidden attribute on the .git directory is being applied to bare git
directories. This patch excludes bare repositories.

Tested-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
2012-05-11 23:25:46 -05:00
Johannes Schindelin
724566976c 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>
2012-05-11 23:25:46 -05:00
Erik Faye-Lund
e384376961 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>
2012-05-11 23:25:46 -05:00
Johannes Schindelin
319c67e67f Define NO_GETTEXT for Git for Windows
The dreaded "your vnsprintf is broken (returned -1)" error is back. At
least with the libintl version we have. So for the moment, just work
around the issue by _not_ using gettext.

Ah, I wish that my attempt at implementing a custom strbuf_vaddf() would
not have been brushed aside so rashly. Oh well. Time saved on maintaining
that thing, I guess (although more time went into working around coping
with existing implementations).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:46 -05:00
Sebastian Schuberth
883ba42d61 Makefile: Do not use OLD_ICONV on MINGW anymore
We are building libiconv now the same way as upstream MinGW does, so we do
not need OLD_ICONV anymore when compiling Git either in msysGit or
mingwGitDevEnv.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2012-05-11 23:25:46 -05:00
Johannes Schindelin
13280df1dd Do not compile compat/**/*.c with -Wold-style-definition
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:46 -05:00
Johannes Schindelin
348cad8551 Make CFLAGS more strict
This is a gcc-ism, but as we use gcc exclusively, we can use them.

Taken from one of Junio's mails. (Reminded to cherry-pick this patch
by one of Karsten Blees' mails.)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 23:25:46 -05:00
Johannes Schindelin
692b345be3 Start the merging-rebase to junio/next
This commit starts the rebase of ec1752b to 830d0c2
using the rebasing merge dca8a93615.
2012-05-11 23:25:46 -05:00
Johannes Schindelin
ec1752b417 Fix invalid call to dd(1)
t4012 assumed that it is okay to seek beyond the end of stdin. It is not,
and leads to an access violation (Windows speak for: segmentation fault)
with MinGW's dd.exe iff run in non-verbose mode.

Further, for some reason 'echo X | dd bs=1k seek=1' resulted in 2050 bytes
in this developer's setup instead of 1026.

So let's use a valid technique to generate 1024 NULs followed by X and a
line feed: a good ole' Perl script.

This patch is dedicated to Randal "Merlyn" Schwartz.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 21:11:47 -05:00
Johannes Schindelin
dca8a93615 Rebasing merge to junio/next (830d0c2)
Previous rebasing merge: 33362bc4c7
2012-05-11 17:53:33 -05:00
Olivier Refalo
cb9077b049 POSIX style 2/2 2012-05-11 17:51:11 -05:00
Olivier Refalo
967b1b84bb POSIX style 1/2 2012-05-11 17:51:11 -05:00
Olivier Refalo
6cd0c5d1b3 fix build: compat/mingw.c:1236: error: conflicting types for 'mingw_execv'
compat/../compat/mingw.h:294: note: previous declaration of 'mingw_execv' was here
make: *** [compat/mingw.o] Error 1
2012-05-11 17:51:11 -05:00
Michael J Gruber
2f463713c6 t5801: skip without hg
The tests for remote-hg require hg, so skip them all when there is no
hg available.
2012-05-11 17:51:11 -05:00
Johannes Schindelin
5caafa8f5b fast-export: report SHA-1 instead of gibberish when marks exist already
Cc: Pieter de Bie <pdebie@ai.rug.nl>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 17:51:11 -05:00
Johannes Schindelin
1542f51e1e 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>
2012-05-11 17:51:11 -05:00
Johannes Schindelin
e3705f658e remote-hg: do not interfer with hg's revs() method
Matt Mackall introduced a revs() method to the localrepo class on Wed
Nov 2 13:37:34 2011 in the commit 'localrepo: add revs helper method'.
It is used when constructing a commit in memory.

If we store the set of revs we want to handle under the same name, it
overrides that method, resulting in an unpleasant 'TypeError: 'set'
object is not callable' whenever we want to push (as we are constructing
commits in memory, then).

So let's work around that by renaming our field to 'revs_' and hope that
upstream Mercurial does not introduce a field of that name, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 17:50:55 -05:00
Johannes Schindelin
0dc6202322 remote-hg: handle another funny author line from http://scelenic.com/hg
In this case: David Soria Parra <dsp <at> php.net>.

With this last of three Postel patches, remote-hg can import the
Mercurial repository completely.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 17:50:05 -05:00
Johannes Schindelin
472200fa11 remote-hg: another case of Postel's law
This change allows invalid input from Mercurial repositories where the
author is recorded as 'Name <email@blah' (missing the closing '>').

With this change, importing http://scelenic.com/hg itself no longer fails
with:

	fatal: Missing > in ident string: Benoit Boissinot
	<benoit.boissinot@ens-lyon.org <none@none> 1129685868 -0700

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 17:50:05 -05:00
Johannes Schindelin
a67df35847 remote-hg: Postel's law dictates we should handle Author<author@mail>
We should handle a missing space before the email part of an author ident
gracefully. See for example the icedtea6 repository.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2012-05-11 17:50:05 -05:00
Sverre Rabbelier
d149b7ae6b git-remote-hg: add tests 2012-05-11 17:50:05 -05:00