1
0
mirror of https://github.com/git/git.git synced 2024-11-19 07:44:03 +01:00

Merge branch 'bg/apply-doc'

* bg/apply-doc:
  Fix over-simplified documentation for 'git log -z'
  apply: Use the term "working tree" consistently
  apply: Format all options using back-quotes
  apply: apply works outside a repository
  Clarify and correct -z
This commit is contained in:
Junio C Hamano 2009-11-23 22:32:39 -08:00
commit d2cd66556d
2 changed files with 39 additions and 21 deletions

@ -85,10 +85,23 @@ ifndef::git-format-patch[]
endif::git-format-patch[]
ifndef::git-format-patch[]
-z::
NUL-line termination on output. This affects the `--raw`
output field terminator. Also output from commands such
as `git-log` will be delimited with NUL between commits.
ifdef::git-log[]
Separate the commits with NULs instead of with new newlines.
+
Also, when `--raw` or `--numstat` has been given, do not munge
pathnames and use NULs as output field terminators.
endif::git-log[]
ifndef::git-log[]
When `--raw` or `--numstat` has been given, do not munge
pathnames and use NULs as output field terminators.
endif::git-log[]
+
Without this option, each pathname output will have TAB, LF, double quotes,
and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`,
respectively, and the pathname will be enclosed in double quotes if
any of those replacements occurred.
--name-only::
Show only names of changed files.

@ -3,7 +3,7 @@ git-apply(1)
NAME
----
git-apply - Apply a patch on a git index file and/or a working tree
git-apply - Apply a patch to files and/or to the index
SYNOPSIS
@ -20,8 +20,11 @@ SYNOPSIS
DESCRIPTION
-----------
Reads supplied 'diff' output and applies it on a git index file
and a work tree.
Reads the supplied diff output (i.e. "a patch") and applies it to files.
With the `--index` option the patch is also applied to the index, and
with the `--cache` option the patch is only applied to the index.
Without these options, the command applies the patch only to files,
and does not require them to be in a git repository.
OPTIONS
-------
@ -34,7 +37,7 @@ OPTIONS
input. Turns off "apply".
--numstat::
Similar to \--stat, but shows the number of added and
Similar to `--stat`, but shows the number of added and
deleted lines in decimal notation and the pathname without
abbreviation, to make it more machine friendly. For
binary files, outputs two `-` instead of saying
@ -48,22 +51,22 @@ OPTIONS
--check::
Instead of applying the patch, see if the patch is
applicable to the current work tree and/or the index
applicable to the current working tree and/or the index
file and detects errors. Turns off "apply".
--index::
When --check is in effect, or when applying the patch
When `--check` is in effect, or when applying the patch
(which is the default when none of the options that
disables it is in effect), make sure the patch is
applicable to what the current index file records. If
the file to be patched in the work tree is not
the file to be patched in the working tree is not
up-to-date, it is flagged as an error. This flag also
causes the index file to be updated.
--cached::
Apply a patch without touching the working tree. Instead take the
cached data, apply the patch, and store the result in the index
without using the working tree. This implies '--index'.
without using the working tree. This implies `--index`.
--build-fake-ancestor=<file>::
Newer 'git-diff' output has embedded 'index information'
@ -87,11 +90,13 @@ the information is read from the current index instead.
rejected hunks in corresponding *.rej files.
-z::
When showing the index information, do not munge paths,
but use NUL terminated machine readable format. Without
this flag, the pathnames output will have TAB, LF, and
backslash characters replaced with `\t`, `\n`, and `\\`,
respectively.
When `--numstat` has been given, do not munge pathnames,
but use a NUL-terminated machine-readable format.
+
Without this option, each pathname output will have TAB, LF, double quotes,
and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`,
respectively, and the pathname will be enclosed in double quotes if
any of those replacements occurred.
-p<n>::
Remove <n> leading slashes from traditional diff paths. The
@ -107,8 +112,8 @@ the information is read from the current index instead.
By default, 'git-apply' expects that the patch being
applied is a unified diff with at least one line of context.
This provides good safety measures, but breaks down when
applying a diff generated with --unified=0. To bypass these
checks use '--unidiff-zero'.
applying a diff generated with `--unified=0`. To bypass these
checks use `--unidiff-zero`.
+
Note, for the reasons stated above usage of context-free patches is
discouraged.
@ -144,7 +149,7 @@ discouraged.
be useful when importing patchsets, where you want to include certain
files or directories.
+
When --exclude and --include patterns are used, they are examined in the
When `--exclude` and `--include` patterns are used, they are examined in the
order they appear on the command line, and the first match determines if a
patch to each path is used. A patch to a path that does not match any
include/exclude pattern is used by default if there is no include pattern
@ -227,13 +232,13 @@ Submodules
If the patch contains any changes to submodules then 'git-apply'
treats these changes as follows.
If --index is specified (explicitly or implicitly), then the submodule
If `--index` is specified (explicitly or implicitly), then the submodule
commits must match the index exactly for the patch to apply. If any
of the submodules are checked-out, then these check-outs are completely
ignored, i.e., they are not required to be up-to-date or clean and they
are not updated.
If --index is not specified, then the submodule commits in the patch
If `--index` is not specified, then the submodule commits in the patch
are ignored and only the absence or presence of the corresponding
subdirectory is checked and (if possible) updated.