1
0
mirror of https://github.com/git/git.git synced 2024-10-21 09:18:12 +02:00
Commit Graph

8398 Commits

Author SHA1 Message Date
Jeff King
6bc0cb5176 http-backend: spool ref negotiation requests to buffer
When http-backend spawns "upload-pack" to do ref
negotiation, it streams the http request body to
upload-pack, who then streams the http response back to the
client as it reads. In theory, git can go full-duplex; the
client can consume our response while it is still sending
the request.  In practice, however, HTTP is a half-duplex
protocol. Even if our client is ready to read and write
simultaneously, we may have other HTTP infrastructure in the
way, including the webserver that spawns our CGI, or any
intermediate proxies.

In at least one documented case[1], this leads to deadlock
when trying a fetch over http. What happens is basically:

  1. Apache proxies the request to the CGI, http-backend.

  2. http-backend gzip-inflates the data and sends
     the result to upload-pack.

  3. upload-pack acts on the data and generates output over
     the pipe back to Apache. Apache isn't reading because
     it's busy writing (step 1).

This works fine most of the time, because the upload-pack
output ends up in a system pipe buffer, and Apache reads
it as soon as it finishes writing. But if both the request
and the response exceed the system pipe buffer size, then we
deadlock (Apache blocks writing to http-backend,
http-backend blocks writing to upload-pack, and upload-pack
blocks writing to Apache).

We need to break the deadlock by spooling either the input
or the output. In this case, it's ideal to spool the input,
because Apache does not start reading either stdout _or_
stderr until we have consumed all of the input. So until we
do so, we cannot even get an error message out to the
client.

The solution is fairly straight-forward: we read the request
body into an in-memory buffer in http-backend, freeing up
Apache, and then feed the data ourselves to upload-pack. But
there are a few important things to note:

  1. We limit the in-memory buffer to prevent an obvious
     denial-of-service attack. This is a new hard limit on
     requests, but it's unlikely to come into play. The
     default value is 10MB, which covers even the ridiculous
     100,000-ref negotation in the included test (that
     actually caps out just over 5MB). But it's configurable
     on the off chance that you don't mind spending some
     extra memory to make even ridiculous requests work.

  2. We must take care only to buffer when we have to. For
     pushes, the incoming packfile may be of arbitrary
     size, and we should connect the input directly to
     receive-pack. There's no deadlock problem here, though,
     because we do not produce any output until the whole
     packfile has been read.

     For upload-pack's initial ref advertisement, we
     similarly do not need to buffer. Even though we may
     generate a lot of output, there is no request body at
     all (i.e., it is a GET, not a POST).

[1] http://article.gmane.org/gmane.comp.version-control.git/269020

Test-adapted-from: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-05-25 20:43:18 -07:00
Junio C Hamano
fdf96a20ac Git 2.2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-12 14:06:12 -08:00
Junio C Hamano
ba1edc9264 Merge branch 'rw/apply-does-not-take-ignore-date' into maint
* rw/apply-does-not-take-ignore-date:
  git-am.txt: --ignore-date flag is not passed to git-apply
2015-01-12 14:00:16 -08:00
Junio C Hamano
c2e8e4b9da Prepare for 2.2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-22 12:20:38 -08:00
Junio C Hamano
ebae81e96d Merge branch 'po/everyday-doc' into maint
"Everyday" document had a broken link.

* po/everyday-doc:
  Documentation: change "gitlink" typo in git-push
2014-12-22 12:18:17 -08:00
Junio C Hamano
5d509d5e1c Merge branch 'jk/colors-fix' into maint
"git config --get-color" did not parse its command line arguments
carefully.

* jk/colors-fix:
  t4026: test "normal" color
  config: fix parsing of "git config --get-color some.key -1"
  docs: describe ANSI 256-color mode
2014-12-22 12:16:58 -08:00
Junio C Hamano
9b7cbb3159 Git 2.2.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-17 11:49:34 -08:00
Junio C Hamano
77933f4449 Sync with v2.1.4
* maint-2.1:
  Git 2.1.4
  Git 2.0.5
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index
2014-12-17 11:46:57 -08:00
Junio C Hamano
8e36a6d575 Git 2.1.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-17 11:44:59 -08:00
Junio C Hamano
58f1d950e3 Sync with v2.0.5
* maint-2.0:
  Git 2.0.5
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index
2014-12-17 11:42:28 -08:00
Junio C Hamano
9a8c2b67cd Git 2.0.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-17 11:30:46 -08:00
Junio C Hamano
5e519fb8b0 Sync with v1.9.5
* maint-1.9:
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index
2014-12-17 11:28:54 -08:00
Junio C Hamano
83332636f5 Git 1.9.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-17 11:22:32 -08:00
Junio C Hamano
6898b79721 Sync with v1.8.5.6
* maint-1.8.5:
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index
2014-12-17 11:20:31 -08:00
Junio C Hamano
5c8213a769 Git 1.8.5.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-17 11:18:45 -08:00
Junio C Hamano
2aa9100846 Merge branch 'dotgit-case-maint-1.8.5' into maint-1.8.5
* dotgit-case-maint-1.8.5:
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index
2014-12-17 11:11:15 -08:00
Johannes Schindelin
2b4c6efc82 read-cache: optionally disallow NTFS .git variants
The point of disallowing ".git" in the index is that we
would never want to accidentally overwrite files in the
repository directory. But this means we need to respect the
filesystem's idea of when two paths are equal. The prior
commit added a helper to make such a comparison for NTFS
and FAT32; let's use it in verify_path().

We make this check optional for two reasons:

  1. It restricts the set of allowable filenames, which is
     unnecessary for people who are not on NTFS nor FAT32.
     In practice this probably doesn't matter, though, as
     the restricted names are rather obscure and almost
     certainly would never come up in practice.

  2. It has a minor performance penalty for every path we
     insert into the index.

This patch ties the check to the core.protectNTFS config
option. Though this is expected to be most useful on Windows,
we allow it to be set everywhere, as NTFS may be mounted on
other platforms. The variable does default to on for Windows,
though.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-17 11:04:45 -08:00
Jeff King
a42643aa8d read-cache: optionally disallow HFS+ .git variants
The point of disallowing ".git" in the index is that we
would never want to accidentally overwrite files in the
repository directory. But this means we need to respect the
filesystem's idea of when two paths are equal. The prior
commit added a helper to make such a comparison for HFS+;
let's use it in verify_path.

We make this check optional for two reasons:

  1. It restricts the set of allowable filenames, which is
     unnecessary for people who are not on HFS+. In practice
     this probably doesn't matter, though, as the restricted
     names are rather obscure and almost certainly would
     never come up in practice.

  2. It has a minor performance penalty for every path we
     insert into the index.

This patch ties the check to the core.protectHFS config
option. Though this is expected to be most useful on OS X,
we allow it to be set everywhere, as HFS+ may be mounted on
other platforms. The variable does default to on for OS X,
though.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-17 11:04:44 -08:00
Ronald Wampler
0cef4e765c git-am.txt: --ignore-date flag is not passed to git-apply
Signed-off-by: Ronald Wampler <rdwampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-09 14:25:53 -08:00
Junio C Hamano
b260d265e1 Git 2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-26 13:18:34 -08:00
Marc Branchaud
a2b450d6fd RelNotes: spelling & grammar tweaks
Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-26 13:18:04 -08:00
Junio C Hamano
652e759330 Git 2.2.0-rc3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-21 12:10:56 -08:00
Jeff King
0edad17d67 docs: describe ANSI 256-color mode
Our color specifications have supported the 256-color ANSI
extension for years, but we never documented it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-20 10:13:25 -08:00
Junio C Hamano
ca0107e279 Merge branch 'sv/submitting-final-patch'
* sv/submitting-final-patch:
  SubmittingPatches: final submission is To: maintainer and CC: list
2014-11-19 13:48:01 -08:00
Junio C Hamano
eeb92d7e60 Merge branch 'sn/tutorial-status-output-example'
* sn/tutorial-status-output-example:
  gittutorial: fix output of 'git status'
2014-11-19 13:47:59 -08:00
Junio C Hamano
bfd6b53aab Merge branch 'mh/doc-remote-helper-xref'
* mh/doc-remote-helper-xref:
  doc: add some crossrefs between manual pages
2014-11-19 13:47:56 -08:00
Junio C Hamano
0cfd333d0b Merge branch 'jc/doc-commit-only'
* jc/doc-commit-only:
  Documentation/git-commit: clarify that --only/--include records the working tree contents
2014-11-18 10:19:42 -08:00
Junio C Hamano
4d86216f5b Merge branch 'ta/tutorial-modernize'
* ta/tutorial-modernize:
  gittutorial.txt: remove reference to ancient Git version
2014-11-18 10:18:28 -08:00
brian m. carlson
366c8d4ca3 Documentation: change "gitlink" typo in git-push
The git-push manual page used "gitlink" in one place instead of
"linkgit".  Fix this so the link renders correctly.

Noticed-by: Dan Allen <dan.j.allen@gmail.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-17 09:27:47 -08:00
Stefan Naewe
8942821ec0 gittutorial: fix output of 'git status'
'git status' doesn't output leading '#'s these days.

Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-13 10:53:50 -08:00
Slavomir Vlcek
faa8fac1ec SubmittingPatches: final submission is To: maintainer and CC: list
In an earlier part there is:

  "re-send it with "To:" set to the maintainer [*1*] and "cc:" the list [*2*]"

for the final submission, but later we see

  "Send it to the list and cc the maintainer."

Fix the later one to match the previous.

Signed-off-by: Slavomir Vlcek <svlc@inventati.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-13 10:39:24 -08:00
Junio C Hamano
f5709437d9 Update draft release notes to 2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-12 12:13:39 -08:00
Junio C Hamano
7fa1365c54 Merge branch 'nd/gitignore-trailing-whitespace' into maint
* nd/gitignore-trailing-whitespace:
  gitignore.txt: fix spelling of "backslash"
2014-11-12 12:13:12 -08:00
Max Horn
2672671872 doc: add some crossrefs between manual pages
In particular, git-fast-import and -export link to each
other, and gitremote-helpers links to existing remote
helpers, and vice versa. Also link to fast-import from the
remote helper spec, as this is relevant for remote helpers
using the fast-import format.

Signed-off-by: Max Horn <max@quendi.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-11 14:47:04 -08:00
Thomas Ackermann
022cf2bf88 gittutorial.txt: remove reference to ancient Git version
Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-11 14:46:08 -08:00
Junio C Hamano
a4c4708fe6 Sync with maint
* maint:
  Documentation/config.txt: fix minor typo
  config.txt: fix typo
2014-11-10 11:26:18 -08:00
Thomas Quinot
a79c3a1b81 Documentation/config.txt: fix minor typo
Add a missing article at the beginning of a sentence, and rephrase
slightly.

Signed-off-by: Thomas Quinot <thomas@quinot.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-10 11:25:26 -08:00
Nicolas Dermine
71069cdfc7 config.txt: fix typo
Signed-off-by: Nicolas Dermine <nicolas.dermine@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-10 10:06:25 -08:00
Junio C Hamano
d956a20a69 Documentation/git-commit: clarify that --only/--include records the working tree contents
With the original phrasing, it is possible to misunderstand as if
the contents in the index for only the specified paths are made into
the new commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-07 11:57:57 -08:00
Junio C Hamano
a1ad2475a7 Merge branch 'maint'
* maint:
  docs/credential-store: s/--store/--file/
2014-11-06 10:52:51 -08:00
Junio C Hamano
32da67bf22 Merge branch 'nd/gitignore-trailing-whitespace'
Documentation update.

* nd/gitignore-trailing-whitespace:
  gitignore.txt: fix spelling of "backslash"
2014-11-06 10:52:40 -08:00
Jeff King
e50cd67ba4 docs/credential-store: s/--store/--file/
The option name "--store" was used early in development, but
never even made it into an applied patch, let alone a
released version of git. I forgot to update the matching
documentation at the time, though.

Noticed-by: Jesse Hopkins <jesse.hopkins@lmco.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-06 09:51:08 -08:00
Ben North
03af7cd158 gitignore.txt: fix spelling of "backslash"
Signed-off-by: Ben North <ben@redfrontdoor.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-04 14:44:47 -08:00
Thomas Ackermann
f745acb028 Documentation: typofixes
In addition to fixing trivial and obvious typos, be careful about
the following points:

 - Spell ASCII, URL and CRC in ALL CAPS;
 - Spell Linux as Capitalized;
 - Do not omit periods in "i.e." and "e.g.".

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-04 13:14:44 -08:00
Matthieu Moy
dd83521629 RelNotes/2.2.0.txt: fix minor typos
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-03 11:29:10 -08:00
Junio C Hamano
4ace7ff455 Git 2.2.0-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-31 11:57:23 -07:00
Junio C Hamano
ef59f324b0 Merge branch 'for-junio' of git://bogomips.org/git-svn
* 'for-junio' of git://bogomips.org/git-svn:
  git-svn: use SVN::Ra::get_dir2 when possible
  git-svn: add space after "W:" prefix in warning
  git-svn: (cleanup) remove editor param passing
  git-svn: prepare SVN::Ra config pieces once
  Git.pm: add specified name to tempfile template
  git-svn: disable _rev_list memoization
  git-svn: save a little memory as fetch progresses
  git-svn: remove unnecessary DESTROY override
  git-svn: reload RA every log-window-size
  git-svn.txt: advertise pushurl with dcommit
  git-svn: remove mergeinfo rev caching
  git-svn: cache only mergeinfo revisions
  git-svn: reduce check_cherry_pick cache overhead
  git-svn: only look at the root path for svn:mergeinfo
  git-svn: only look at the new parts of svn:mergeinfo
2014-10-31 11:50:20 -07:00
Junio C Hamano
598d7eb160 Merge branch 'rs/child-process-init'
* rs/child-process-init:
  api-run-command: add missing list item marker
2014-10-31 11:49:49 -07:00
Junio C Hamano
bf1f639ea2 Merge branch 'rs/grep-color-words'
Allow painting or not painting (partial) matches in context lines
when showing "grep -C<num>" output in color.

* rs/grep-color-words:
  grep: add color.grep.matchcontext and color.grep.matchselected
2014-10-31 11:49:47 -07:00
Junio C Hamano
36666ce4da Sync with Git 2.1.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-29 10:50:17 -07:00