Commit graph

34474 commits

Author SHA1 Message Date
Steffen Prohaska a487916dd5 Revert "compat/clipped-write.c: large write(2) fails on Mac OS X/XNU"
This reverts commit 6c642a8786.

The previous commit introduced a size limit on IO chunks on all
platforms.  The compat clipped_write() is not needed anymore.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-20 11:11:08 -07:00
Steffen Prohaska 0b6806b9e4 xread, xwrite: limit size of IO to 8MB
Checking out 2GB or more through an external filter (see test) fails
on Mac OS X 10.8.4 (12E55) for a 64-bit executable with:

    error: read from external filter cat failed
    error: cannot feed the input to external filter cat
    error: cat died of signal 13
    error: external filter cat failed 141
    error: external filter cat failed

The reason is that read() immediately returns with EINVAL when asked
to read more than 2GB.  According to POSIX [1], if the value of
nbyte passed to read() is greater than SSIZE_MAX, the result is
implementation-defined.  The write function has the same restriction
[2].  Since OS X still supports running 32-bit executables, the
32-bit limit (SSIZE_MAX = INT_MAX = 2GB - 1) seems to be also
imposed on 64-bit executables under certain conditions.  For write,
the problem has been addressed earlier [6c642a].

Address the problem for read() and write() differently, by limiting
size of IO chunks unconditionally on all platforms in xread() and
xwrite().  Large chunks only cause problems, like causing latencies
when killing the process, even if OS X was not buggy.  Doing IO in
reasonably sized smaller chunks should have no negative impact on
performance.

The compat wrapper clipped_write() introduced earlier [6c642a] is
not needed anymore.  It will be reverted in a separate commit.  The
new test catches read and write problems.

Note that 'git add' exits with 0 even if it prints filtering errors
to stderr.  The test, therefore, checks stderr.  'git add' should
probably be changed (sometime in another commit) to exit with
nonzero if filtering fails.  The test could then be changed to use
test_must_fail.

Thanks to the following people for suggestions and testing:

    Johannes Sixt <j6t@kdbg.org>
    John Keeping <john@keeping.me.uk>
    Jonathan Nieder <jrnieder@gmail.com>
    Kyle J. McKay <mackyle@gmail.com>
    Linus Torvalds <torvalds@linux-foundation.org>
    Torsten Bögershausen <tboegi@web.de>

[1] http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html
[2] http://pubs.opengroup.org/onlinepubs/009695399/functions/write.html

[6c642a] commit 6c642a8786
    compate/clipped-write.c: large write(2) fails on Mac OS X/XNU

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-20 11:10:59 -07:00
Jharrod LaFon 4b05440283 avoid segfault on submodule.*.path set to an empty "true"
Git fails due to a segmentation fault if a submodule path is empty.
Here is an example .gitmodules that will cause a segmentation fault:

    [submodule "foo-module"]
      path
      url = http://host/repo.git
    $ git status
    Segmentation fault (core dumped)

This is because the parsing of "submodule.*.path" is not prepared to
see a value-less "true" and assumes that the value is always
non-NULL (parsing of "ignore" has the same problem).

Fix it by checking the NULL-ness of value and complain with
config_error_nonbool().

Signed-off-by: Jharrod LaFon <jlafon@eyesopen.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-19 13:47:56 -07:00
Junio C Hamano 4d06473928 Git 1.8.4-rc4
As we had to revert two topics at the last minute, let's have
another (hopefully short) round of rc to make sure the final release
will be sound.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-19 10:34:14 -07:00
Eric Sunshine 7bca7afeff rebase -i: fix cases ignoring core.commentchar
180bad3d (rebase -i: respect core.commentchar, 2013-02-11) updated
"rebase -i" to honor core.commentchar but missed one instance of
hard-coded '#' comment character in skip_unnecessary_picks().

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-18 13:33:01 -07:00
Nguyễn Thái Ngọc Duy 3125fe528b move setup_alternate_shallow and write_shallow_commits to shallow.c
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-18 13:00:17 -07:00
Junio C Hamano 3c56875176 t3010: update to demonstrate "ls-files -k" optimization pitfalls
An earlier draft of the previous step used cache_name_exists() to
check the directory we were looking at, which missed the second case
described in its log message.  Demonstrate why it is not sufficient.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-15 14:16:00 -07:00
Junio C Hamano 2eac2a4cc4 ls-files -k: a directory only can be killed if the index has a non-directory
"ls-files -o" and "ls-files -k" both traverse the working tree down
to find either all untracked paths or those that will be "killed"
(removed from the working tree to make room) when the paths recorded
in the index are checked out.  It is necessary to traverse the
working tree fully when enumerating all the "other" paths, but when
we are only interested in "killed" paths, we can take advantage of
the fact that paths that do not overlap with entries in the index
can never be killed.

The treat_one_path() helper function, which is called during the
recursive traversal, is the ideal place to implement an
optimization.

When we are looking at a directory P in the working tree, there are
three cases:

 (1) P exists in the index.  Everything inside the directory P in
     the working tree needs to go when P is checked out from the
     index.

 (2) P does not exist in the index, but there is P/Q in the index.
     We know P will stay a directory when we check out the contents
     of the index, but we do not know yet if there is a directory
     P/Q in the working tree to be killed, so we need to recurse.

 (3) P does not exist in the index, and there is no P/Q in the index
     to require P to be a directory, either.  Only in this case, we
     know that everything inside P will not be killed without
     recursing.

Note that this helper is called by treat_leading_path() that decides
if we need to traverse only subdirectories of a single common
leading directory, which is essential for this optimization to be
correct.  This caller checks each level of the leading path
component from shallower directory to deeper ones, and that is what
allows us to only check if the path appears in the index.  If the
call to treat_one_path() weren't there, given a path P/Q/R, the real
traversal may start from directory P/Q/R, even when the index
records P as a regular file, and we would end up having to check if
any leading subpath in P/Q/R, e.g. P, appears in the index.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-15 13:50:34 -07:00
Junio C Hamano 7126102742 dir.c: use the cache_* macro to access the current index
These codepaths always start from the_index and use index_*
functions, but there is no reason to do so.  Use the compatibility
cache_* macro to access the current in-core index like everybody
else.

While at it, fix typo in the comment for a function to check if a
path within a directory appears in the index.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-15 12:08:45 -07:00
Junio C Hamano 2c2b6646c2 Revert "Add new @ shortcut for HEAD"
This reverts commit cdfd94837b, as it
does not just apply to "@" (and forms with modifiers like @{u}
applied to it), but also affects e.g. "refs/heads/@/foo", which it
shouldn't.

The basic idea of giving a short-hand might be good, and the topic
can be retried later, but let's revert to avoid affecting existing
use cases for now for the upcoming release.
2013-08-14 15:04:24 -07:00
Junio C Hamano c1ebd90c83 Revert "git stash: avoid data loss when "git stash save" kills a directory"
This reverts commit a73653130e, as it
has been reported that "ls-files --killed" is too time-consuming in
a deep directory with too many untracked crufts (e.g. $HOME/.git
tracking only a few files).

We'd need to revisit it later but "ls-files --killed" needs to be
optimized before it happens.
2013-08-14 09:53:43 -07:00
Junio C Hamano 425df881e0 Git 1.8.4-rc3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-13 11:10:18 -07:00
Junio C Hamano eaaec50fcd Merge git://github.com/git-l10n/git-po
* git://github.com/git-l10n/git-po:
  l10n: Add reference for french translation team
  l10n: fr.po: 821/2112 messages translated
2013-08-13 10:50:01 -07:00
Junio C Hamano 2809258c28 Merge branch 'sb/mailmap-updates'
* sb/mailmap-updates:
  .mailmap: Combine more (name, email) to individual persons
  .mailmap: update long-lost friends with multiple defunct addresses
2013-08-13 10:49:33 -07:00
Stefan Beller cdb6b5ac67 .mailmap: Combine more (name, email) to individual persons
Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-13 10:49:06 -07:00
Junio C Hamano 10813e0d3c .mailmap: update long-lost friends with multiple defunct addresses
A handful of past contributors are recorded with multiple e-mail
addresses, all of which are undeliverable.  With a lot of help from
Jonathan, we located all of them except for one person, and a pair
of addresses we suspect belong to a single person but we are not
certain.

Update the found ones with their currently preferred address, and
use the last known address to consolidate contributions by the lost
one.

Helped-by: Stefan Beller <stefanbeller@googlemail.com>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-13 10:47:44 -07:00
Matthieu Moy 8ed205a380 git-remote-mediawiki: ignore generated git-mw
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-13 09:52:22 -07:00
Jean-Noel Avila 1b5f46f159 l10n: Add reference for french translation team
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
2013-08-11 17:14:58 +02:00
Jean-Noel Avila 6b388fca90 l10n: fr.po: 821/2112 messages translated
Trying to focus on most useful phrases.

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
2013-08-11 17:14:58 +02:00
Junio C Hamano 96cb27a9d2 Merge branch 'maint'
* maint:
  parse-options: fix clang opterror() -Wunused-value warning
2013-08-09 15:49:55 -07:00
Junio C Hamano b48493e937 Merge branch 'master' of git://github.com/git-l10n/git-po
* 'master' of git://github.com/git-l10n/git-po:
  l10n: de.po: translate 5 messages
  l10n: de.po: translate 99 new messages
  l10n: de.po: switch from pure German to German+English
  l10n: de.po: Fix a typo
  l10n: Update Swedish translation (2135t0f0u)
  l10n: zh_CN.po: translate 5 messages (2135t0f0u)
  l10n: vi.po(2135t): v1.8.4 round 2
  l10n: git.pot: v1.8.4 round 2 (5 new, 3 removed)
2013-08-09 14:31:28 -07:00
Junio C Hamano e423a0f8a2 Merge branch 'jk/submodule-subdirectory-ok'
* jk/submodule-subdirectory-ok:
  t/t7407: fix two typos in submodule tests
2013-08-09 14:30:41 -07:00
Junio C Hamano 6f7d6ec303 Merge branch 'sb/mailmap-updates'
* sb/mailmap-updates:
  .mailmap: fixup entries
2013-08-09 14:30:13 -07:00
Stefan Beller 182be0d397 .mailmap: fixup entries
This patch adds no new names, but fixes the mistakes I made in the previous
commits. (94b410bba8, f4f49e225, c07a6bc57, 2013-07-12, .mailmap: Map
email addresses to names).

These mistakes are double white spaces between name and surname,
different capitalization in email address, or just the email address set
as name.

Also I forgot to include James Knight to the mailmap file.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-09 14:20:38 -07:00
Phil Hord dfe338ae13 t/t7407: fix two typos in submodule tests
In t/t7407-submodule-foreach.sh there is a typo in one of the
path names given for a test step.  The correct path is
nested1/nested2/.git, but nested1/nested1/nested2/.git is
given instead.  The typo is hidden because this line also
accidentally omits the && chain operator.  The omitted chain
also means the return values of all the previous commands in
this test are also being ignored.

Fix the path and add the chain operator so the entire test
sequence can be properly validated.

Signed-off-by: Phil Hord <hordp@cisco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-09 14:00:54 -07:00
Eric Sunshine a3bc3d070c parse-options: fix clang opterror() -Wunused-value warning
a469a10193 (silence some -Wuninitialized false positives;
2012-12-15) triggered "unused value" warnings when the return value of
opterror() and several other error-related functions was not used.
5ded807f7c (fix clang -Wunused-value warnings for error functions;
2013-01-16) applied a fix by adding #if !defined(__clang__) in cache.h
and git-compat-util.h, but misspelled it as #if !defined(clang) in
parse-options.h. Fix this.

This mistake went unnoticed because existing callers of opterror()
utilize its return value.  1158826394 (parse-options: add
OPT_CMDMODE(); 2013-07-30), however, adds a new invocation of opterror()
which ignores the return value, thus triggering the "unused value"
warning.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-09 09:27:44 -07:00
Ralf Thielow 4402f30155 l10n: de.po: translate 5 messages
Translate 5 new messages came from git.pot update in b8ecf23
(l10n: git.pot: v1.8.4 round 2 (5 new, 3 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2013-08-09 06:53:44 +02:00
Ralf Thielow 770c73ffc9 l10n: de.po: translate 99 new messages
Translate 99 new messages came from git.pot update in
28b3cff (l10n: git.pot: v1.8.4 round 1 (99 new, 46 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Thomas Rast <trast@inf.ethz.ch>
2013-08-09 06:53:35 +02:00
Junio C Hamano 64948ad775 Git 1.8.4-rc2
This is with mostly minor documentation and test updates, nothing
spectacular except for removal of funky lstat(2) emulation on Cygwin.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-08 14:03:21 -07:00
Ralf Thielow eb5accfece l10n: de.po: switch from pure German to German+English
This switches the translation from pure German to German+English.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Thomas Rast <trast@inf.ethz.ch>
2013-08-08 17:55:25 +02:00
Wieland Hoffmann b5c0a216f8 l10n: de.po: Fix a typo
Signed-off-by: Wieland Hoffmann <themineo@gmail.com>
2013-08-08 17:55:25 +02:00
Junio C Hamano b26ed4305f fetch: work around "transport-take-over" hack
A Git-aware "connect" transport allows the "transport_take_over" to
redirect generic transport requests like fetch(), push_refs() and
get_refs_list() to the native Git transport handling methods.  The
take-over process replaces transport->data with a fake data that
these method implementations understand.

While this hack works OK for a single request, it breaks when the
transport needs to make more than one requests.  transport->data
that used to hold necessary information for the specific helper to
work correctly is destroyed during the take-over process.

One codepath that this matters is "git fetch" in auto-follow mode;
when it does not get all the tags that ought to point at the history
it got (which can be determined by looking at the peeled tags in the
initial advertisement) from the primary transfer, it internally
makes a second request to complete the fetch.  Because "take-over"
hack has already destroyed the data necessary to talk to the
transport helper by the time this happens, the second request cannot
make a request to the helper to make another connection to fetch
these additional tags.

Mark such a transport as "cannot_reuse", and use a separate
transport to perform the backfill fetch in order to work around
this breakage.

Note that this problem does not manifest itself when running t5802,
because our upload-pack gives you all the necessary auto-followed
tags during the primary transfer.  You would need to step through
"git fetch" in a debugger, stop immediately after the primary
transfer finishes and writes these auto-followed tags, remove the
tag references and repack/prune the repository to convince the
"find-non-local-tags" procedure that the primary transfer failed to
give us all the necessary tags, and then let it continue, in order
to trigger the bug in the secondary transfer this patch fixes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-07 16:24:30 -07:00
Junio C Hamano 069d503202 fetch: refactor code that fetches leftover tags
Usually the upload-pack process running on the other side will give
us all the reachable tags we need during the primary object transfer
in do_fetch().  If that does not happen (e.g. the other side may be
running a third-party implementation of upload-pack), we will run
another fetch to pick up leftover tags that we know point at the
commits reachable from our updated tips.

Separate out the code to run this second fetch into a helper
function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-07 16:24:30 -07:00
Junio C Hamano db5723c628 fetch: refactor code that prepares a transport
Make a helper function prepare_transport() that returns a transport
to talk to a given remote.

The set_option() helper that used to always affect the file-scope
global "gtransport" now takes a transport as its parameter.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-07 16:24:30 -07:00
Junio C Hamano af23445925 fetch: rename file-scope global "transport" to "gtransport"
Although many functions in this file take a "struct transport" as a
parameter, "fetch_one()" assigns to the global singleton instance
which is a file-scope static, in order to allow a parameterless
signal handler unlock_pack() to access it.

Rename the variable to gtransport to make sure these uses stand out.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-07 16:24:30 -07:00
Junio C Hamano b9ccf55e06 t5802: add test for connect helper
This is an attempt to reproduce a problem reported for a third-party
custom "connect" remote helper.  The conjecture is that sometimes
"git fetch" wants to make two connections (one for the primary
transfer with 'follow-tags' option set, and then after noticing that
some tags are not packed because the primary transfer did not have
to send any commit that is pointed by them, another to explicitly
ask for the missing tags), and their "connect" helper is not called
in the second request, breaking the "fetch" as a whole.

Unfortunately this test script does not trigger the alleged failure
and happily passes when talking to upload-pack from git-core (see
patch 5/5 for details).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-07 16:24:30 -07:00
Matthieu Moy 89b0230a20 die_with_status: use "printf '%s\n'", not "echo"
Some implementations of 'echo' (e.g. dash's built-in) interpret
backslash sequences in their arguments.

This triggered at least one bug: the error message of "rebase -i" was
turning \t in commit messages into actual tabulations. There may be
others.

Using "printf '%s\n'" instead avoids this bad behavior, and is the form
used by the "say" function.

Noticed-by: David Kastrup <dak@gnu.org>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-07 08:49:49 -07:00
Peter Krefting aa4e5fe40f l10n: Update Swedish translation (2135t0f0u)
Fix some incorrect translations in existing messages while at it.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2013-08-06 12:44:17 +01:00
Jiang Xin b18943845c l10n: zh_CN.po: translate 5 messages (2135t0f0u)
Translate 5 new messages came from git.pot update in b8ecf23
(l10n: git.pot: v1.8.4 round 2 (5 new, 3 removed)).

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2013-08-06 17:22:16 +08:00
Tran Ngoc Quan 85ef881f6c l10n: vi.po(2135t): v1.8.4 round 2
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2013-08-06 14:34:48 +07:00
Jiang Xin b8ecf239d0 l10n: git.pot: v1.8.4 round 2 (5 new, 3 removed)
Generate po/git.pot from v1.8.4-rc1-21-gfb56570 for git v1.8.4
l10n round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2013-08-06 14:13:23 +08:00
Junio C Hamano fb56570821 Sync with maint to grab trivial doc fixes
* maint:
  fix typo in documentation of git-svn
  Documentation/rev-list-options: add missing word in --*-parents
  log doc: the argument to --encoding is not optional
2013-08-05 13:00:20 -07:00
Junio C Hamano f5206f1239 Merge branch 'es/blame-L-breakage'
* es/blame-L-breakage:
  t8001, t8002: fix "blame -L :literal" test on NetBSD
2013-08-05 10:44:39 -07:00
René Scharfe 3a4fc21a29 t8001, t8002: fix "blame -L :literal" test on NetBSD
Sub-test 42 of t8001 and t8002 ("blame -L :literal") fails on NetBSD
with the following verbose output:

	git annotate  -L:main hello.c
	Author F (expected 4, attributed 3) bad
	Author G (expected 1, attributed 1) good

This is not caused by different behaviour of git blame or annotate on
that platform, but by different test input, in turn caused by a sed
command that forgets to add a newline on NetBSD.  Here's the diff of the
commit that adds "goodbye" to hello.c, for Linux:

	@@ -1,4 +1,5 @@
	 int main(int argc, const char *argv[])
	 {
		puts("hello");
	+		puts("goodbye");
	 }

We see that it adds an extra TAB, but that's not a problem.  Here's the
same on NetBSD:

	@@ -1,4 +1,4 @@
	 int main(int argc, const char *argv[])
	 {
		puts("hello");
	-}
	+		puts("goodbye");}

It also adds an extra TAB, but it is missing the newline character
after the semicolon.

The following patch gets rid of the extra TAB at the beginning, but
more importantly adds the missing newline at the end in a (hopefully)
portable way, mentioned in http://sed.sourceforge.net/sedfaq4.html.
The diff becomes this, on both Linux and NetBSD:

	@@ -1,4 +1,5 @@
	 int main(int argc, const char *argv[])
	 {
		puts("hello");
	+	puts("goodbye");
	 }

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05 10:43:28 -07:00
Junio C Hamano a48ed48db5 Merge git://github.com/git-l10n/git-po
* git://github.com/git-l10n/git-po:
  l10n: zh_CN.po: translate 99 messages (2133t0f0u)
  l10n: vi.po (2133t)
  l10n: git.pot: v1.8.4 round 1 (99 new, 46 removed)
2013-08-05 10:38:23 -07:00
Junio C Hamano 4fcd30df85 Merge branch 'sb/mailmap-updates'
* sb/mailmap-updates:
  .mailmap: Multiple addresses of Michael S. Tsirkin
2013-08-05 10:11:14 -07:00
Junio C Hamano d6f3ab573e Merge branch 'dn/test-reject-utf-16'
* dn/test-reject-utf-16:
  t3900: test rejecting log message with NULs correctly
  Add missing test file for UTF-16.
2013-08-05 10:11:10 -07:00
Junio C Hamano c8abf659f7 Merge branch 'bc/commit-invalid-utf8'
* bc/commit-invalid-utf8:
  commit: typofix for xxFFF[EF] check
2013-08-05 10:11:04 -07:00
Junio C Hamano dc773a67e1 commit: typofix for xxFFF[EF] check
We wanted to catch all codepoints that ends with FFFE and FFFF,
not with 0FFFE and 0FFFF.

Noticed and corrected by Peter Krefting.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05 09:53:38 -07:00
Junio C Hamano 0ed45a1cd6 t3900: test rejecting log message with NULs correctly
It is not like that our longer term desire is to someday start
accept log messages with NULs in them, so it is wrong to mark a test
that demonstrates "git commit" that correctly fails given such an
input as "expect-failure".  "git commit" should fail today, and it
should fail the same way in the future given a message with NUL in it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05 09:47:11 -07:00