{"thread":{"id":"21707","subject":"[PATCH 2/4] apply: apply works outside a repository","startedAt":"2009-11-22T16:19:45Z","lastAt":"2009-11-22T17:28:59Z","messageCount":2,"participants":["Björn Gustavsson","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"128110","messageId":"4B0964A1.2040302@gmail.com","threadId":"21707","inReplyTo":null,"subject":"[PATCH 2/4] apply: apply works outside a repository","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2009-11-22T16:19:45Z","receivedAt":"2009-11-22T16:19:45Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"The documentation for 'git apply' talks about applying a\npatch/diff to the index and to the working tree, which seems\nto imply that it will not work outside a git repository.\n\nActually 'git patch' works outside a repository (which can\nbe useful especially for applying binary or rename patches that\nthe standard \"patch\" utility cannot handle), so the documentation\nshould mention it.\n\nSigned-off-by: Björn Gustavsson <bgustavsson@gmail.com>\n---\n Documentation/git-apply.txt |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\nindex 4f791ee..6857a68 100644\n--- a/Documentation/git-apply.txt\n+++ b/Documentation/git-apply.txt\n@@ -23,6 +23,10 @@ DESCRIPTION\n Reads supplied 'diff' output and applies it on a git index file\n and a work tree.\n \n+'git-apply' can also be used outside a git repository as long\n+as no options that require a git repository are given\n+(e.g. `--index` or `--cached`).\n+\n OPTIONS\n -------\n <patch>...::\n-- \n1.6.5.3.298.g39add\n"},{"id":"128117","messageId":"7v3a46ii3o.fsf@alter.siamese.dyndns.org","threadId":"21707","inReplyTo":"4B0964A1.2040302@gmail.com","subject":"Re: [PATCH 2/4] apply: apply works outside a repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-22T17:28:59Z","receivedAt":"2009-11-22T17:28:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Björn Gustavsson <bgustavsson@gmail.com> writes:\n\n> The documentation for 'git apply' talks about applying a\n> patch/diff to the index and to the working tree, which seems\n> to imply that it will not work outside a git repository.\n\nThanks.  I think the headline should also be reworded.  It currently\nreads:\n\n    Apply a patch on a git index file and/or a working tree\n\nbut historically and still in real life practices, when you use apply (as\nopposed to am), you apply primarily to the files and optionally to the\nindex, so this should read something like:\n\n    Apply a patch to files and/or to the index\n\nWe could say \"to files in the work tree\", but that would give a wrong\nimpression that the files we talk about must be in a directory that is\npart of the work tree of some repository, so it probably is better without\nit.\n\nThe same comment applies to the beginning of the DESCRIPTION section.  I\nactually think your added text should reword the current two-liner there,\ninstead of being added at the bottom.  Here is my attempt.\n\n    Reads supplied diff output (iow \"a patch\"), and applies it to files.\n    With --index (--cache) options, the patch is also (only) applied to\n    the index respectively.  Without these options, the command applies\n    the patch only to files, and does not require them to be in a git\n    repository.\n"}]}