mirror of
https://github.com/git/git.git
synced 2024-11-24 18:33:43 +08:00
Merge branch 'maint'
* maint: Use =20 when rfc2047 encoding spaces. Create a new manpage for the gitignore format, and reference it elsewhere Documentation: robustify asciidoc GIT_VERSION replacement
This commit is contained in:
commit
86eff8c512
@ -2,7 +2,7 @@ MAN1_TXT= \
|
||||
$(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
|
||||
$(wildcard git-*.txt)) \
|
||||
gitk.txt
|
||||
MAN5_TXT=gitattributes.txt
|
||||
MAN5_TXT=gitattributes.txt gitignore.txt
|
||||
MAN7_TXT=git.txt
|
||||
|
||||
DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT))
|
||||
@ -112,8 +112,7 @@ clean:
|
||||
%.html : %.txt
|
||||
rm -f $@+ $@
|
||||
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
|
||||
$(ASCIIDOC_EXTRA) -o - $< | \
|
||||
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
|
||||
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
|
||||
mv $@+ $@
|
||||
|
||||
%.1 %.5 %.7 : %.xml
|
||||
@ -122,8 +121,7 @@ clean:
|
||||
%.xml : %.txt
|
||||
rm -f $@+ $@
|
||||
$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
|
||||
$(ASCIIDOC_EXTRA) -o - $< | \
|
||||
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
|
||||
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
|
||||
mv $@+ $@
|
||||
|
||||
user-manual.xml: user-manual.txt user-manual.conf
|
||||
|
@ -40,7 +40,7 @@ template::[header-declarations]
|
||||
<refentrytitle>{mantitle}</refentrytitle>
|
||||
<manvolnum>{manvolnum}</manvolnum>
|
||||
<refmiscinfo class="source">Git</refmiscinfo>
|
||||
<refmiscinfo class="version">@@GIT_VERSION@@</refmiscinfo>
|
||||
<refmiscinfo class="version">{git_version}</refmiscinfo>
|
||||
<refmiscinfo class="manual">Git Manual</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
|
@ -259,7 +259,8 @@ Common unit suffixes of 'k', 'm', or 'g' are supported.
|
||||
core.excludeFile::
|
||||
In addition to '.gitignore' (per-directory) and
|
||||
'.git/info/exclude', git looks into this file for patterns
|
||||
of files which are not meant to be tracked.
|
||||
of files which are not meant to be tracked. See
|
||||
gitlink:gitignore[5].
|
||||
|
||||
alias.*::
|
||||
Command aliases for the gitlink:git[1] command wrapper - e.g.
|
||||
|
@ -139,46 +139,24 @@ Exclude Patterns
|
||||
|
||||
'git-ls-files' can use a list of "exclude patterns" when
|
||||
traversing the directory tree and finding files to show when the
|
||||
flags --others or --ignored are specified.
|
||||
flags --others or --ignored are specified. gitlink:gitignore[5]
|
||||
specifies the format of exclude patterns.
|
||||
|
||||
These exclude patterns come from these places:
|
||||
These exclude patterns come from these places, in order:
|
||||
|
||||
1. command line flag --exclude=<pattern> specifies a single
|
||||
pattern.
|
||||
1. The command line flag --exclude=<pattern> specifies a
|
||||
single pattern. Patterns are ordered in the same order
|
||||
they appear in the command line.
|
||||
|
||||
2. command line flag --exclude-from=<file> specifies a list of
|
||||
patterns stored in a file.
|
||||
2. The command line flag --exclude-from=<file> specifies a
|
||||
file containing a list of patterns. Patterns are ordered
|
||||
in the same order they appear in the file.
|
||||
|
||||
3. command line flag --exclude-per-directory=<name> specifies
|
||||
a name of the file in each directory 'git-ls-files'
|
||||
examines, and if exists, its contents are used as an
|
||||
additional list of patterns.
|
||||
|
||||
An exclude pattern file used by (2) and (3) contains one pattern
|
||||
per line. A line that starts with a '#' can be used as comment
|
||||
for readability.
|
||||
|
||||
There are three lists of patterns that are in effect at a given
|
||||
time. They are built and ordered in the following way:
|
||||
|
||||
* --exclude=<pattern> from the command line; patterns are
|
||||
ordered in the same order as they appear on the command line.
|
||||
|
||||
* lines read from --exclude-from=<file>; patterns are ordered
|
||||
in the same order as they appear in the file.
|
||||
|
||||
* When --exclude-per-directory=<name> is specified, upon
|
||||
entering a directory that has such a file, its contents are
|
||||
appended at the end of the current "list of patterns". They
|
||||
are popped off when leaving the directory.
|
||||
|
||||
Each pattern in the pattern list specifies "a match pattern" and
|
||||
optionally the fate; either a file that matches the pattern is
|
||||
considered excluded or included. A filename is matched against
|
||||
the patterns in the three lists; the --exclude-from list is
|
||||
checked first, then the --exclude-per-directory list, and then
|
||||
finally the --exclude list. The last match determines its fate.
|
||||
If there is no match in the three lists, the fate is "included".
|
||||
examines, normally `.gitignore`. Files in deeper
|
||||
directories take precedence. Patterns are ordered in the
|
||||
same order they appear in the files.
|
||||
|
||||
A pattern specified on the command line with --exclude or read
|
||||
from the file specified with --exclude-from is relative to the
|
||||
@ -186,58 +164,9 @@ top of the directory tree. A pattern read from a file specified
|
||||
by --exclude-per-directory is relative to the directory that the
|
||||
pattern file appears in.
|
||||
|
||||
An exclude pattern is of the following format:
|
||||
|
||||
- an optional prefix '!' which means that the fate this pattern
|
||||
specifies is "include", not the usual "exclude"; the
|
||||
remainder of the pattern string is interpreted according to
|
||||
the following rules.
|
||||
|
||||
- if it does not contain a slash '/', it is a shell glob
|
||||
pattern and used to match against the filename without
|
||||
leading directories.
|
||||
|
||||
- otherwise, it is a shell glob pattern, suitable for
|
||||
consumption by fnmatch(3) with FNM_PATHNAME flag. I.e. a
|
||||
slash in the pattern must match a slash in the pathname.
|
||||
"Documentation/\*.html" matches "Documentation/git.html" but
|
||||
not "ppc/ppc.html". As a natural exception, "/*.c" matches
|
||||
"cat-file.c" but not "mozilla-sha1/sha1.c".
|
||||
|
||||
An example:
|
||||
|
||||
--------------------------------------------------------------
|
||||
$ cat .git/info/exclude
|
||||
# ignore objects and archives, anywhere in the tree.
|
||||
*.[oa]
|
||||
$ cat Documentation/.gitignore
|
||||
# ignore generated html files,
|
||||
*.html
|
||||
# except foo.html which is maintained by hand
|
||||
!foo.html
|
||||
$ git-ls-files --ignored \
|
||||
--exclude='Documentation/*.[0-9]' \
|
||||
--exclude-from=.git/info/exclude \
|
||||
--exclude-per-directory=.gitignore
|
||||
--------------------------------------------------------------
|
||||
|
||||
Another example:
|
||||
|
||||
--------------------------------------------------------------
|
||||
$ cat .gitignore
|
||||
vmlinux*
|
||||
$ ls arch/foo/kernel/vm*
|
||||
arch/foo/kernel/vmlinux.lds.S
|
||||
$ echo '!/vmlinux*' >arch/foo/kernel/.gitignore
|
||||
--------------------------------------------------------------
|
||||
|
||||
The second .gitignore keeps `arch/foo/kernel/vmlinux.lds.S` file
|
||||
from getting ignored.
|
||||
|
||||
|
||||
See Also
|
||||
--------
|
||||
gitlink:git-read-tree[1]
|
||||
gitlink:git-read-tree[1], gitlink:gitignore[5]
|
||||
|
||||
|
||||
Author
|
||||
@ -246,7 +175,7 @@ Written by Linus Torvalds <torvalds@osdl.org>
|
||||
|
||||
Documentation
|
||||
--------------
|
||||
Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
|
||||
Documentation by David Greaves, Junio C Hamano, Josh Triplett, and the git-list <git@vger.kernel.org>.
|
||||
|
||||
GIT
|
||||
---
|
||||
|
@ -341,7 +341,8 @@ have finished your work-in-progress), attempt the merge again.
|
||||
|
||||
See Also
|
||||
--------
|
||||
gitlink:git-write-tree[1]; gitlink:git-ls-files[1]
|
||||
gitlink:git-write-tree[1]; gitlink:git-ls-files[1];
|
||||
gitlink:gitignore[5]
|
||||
|
||||
|
||||
Author
|
||||
|
@ -42,11 +42,9 @@ mean the same thing and the latter is kept for backward
|
||||
compatibility) and `color.status.<slot>` configuration variables
|
||||
to colorize its output.
|
||||
|
||||
As for gitlink:git-add[1], the configuration variable
|
||||
'core.excludesfile' can indicate a path to a file containing patterns
|
||||
of file names to exclude, in addition to patterns given in
|
||||
'info/exclude' and '.gitignore'.
|
||||
|
||||
See Also
|
||||
--------
|
||||
gitlink:gitignore[5]
|
||||
|
||||
Author
|
||||
------
|
||||
|
116
Documentation/gitignore.txt
Normal file
116
Documentation/gitignore.txt
Normal file
@ -0,0 +1,116 @@
|
||||
gitignore(5)
|
||||
============
|
||||
|
||||
NAME
|
||||
----
|
||||
gitignore - Specifies intentionally untracked files to ignore
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
$GIT_DIR/info/exclude, .gitignore
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
A `gitignore` file specifies intentionally untracked files that
|
||||
git should ignore. Each line in a `gitignore` file specifies a
|
||||
pattern.
|
||||
|
||||
When deciding whether to ignore a path, git normally checks
|
||||
`gitignore` patterns from multiple sources, with the following
|
||||
order of precedence:
|
||||
|
||||
* Patterns read from the file specified by the configuration
|
||||
variable 'core.excludesfile'.
|
||||
|
||||
* Patterns read from `$GIT_DIR/info/exclude`.
|
||||
|
||||
* Patterns read from a `.gitignore` file in the same directory
|
||||
as the path, or in any parent directory, ordered from the
|
||||
deepest such file to a file in the root of the repository.
|
||||
These patterns match relative to the location of the
|
||||
`.gitignore` file. A project normally includes such
|
||||
`.gitignore` files in its repository, containing patterns for
|
||||
files generated as part of the project build.
|
||||
|
||||
The underlying git plumbing tools, such as
|
||||
gitlink:git-ls-files[1] and gitlink:git-read-tree[1], read
|
||||
`gitignore` patterns specified by command-line options, or from
|
||||
files specified by command-line options. Higher-level git
|
||||
tools, such as gitlink:git-status[1] and gitlink:git-add[1],
|
||||
use patterns from the sources specified above.
|
||||
|
||||
Patterns have the following format:
|
||||
|
||||
- A blank line matches no files, so it can serve as a separator
|
||||
for readability.
|
||||
|
||||
- A line starting with # serves as a comment.
|
||||
|
||||
- An optional prefix '!' which negates the pattern; any
|
||||
matching file excluded by a previous pattern will become
|
||||
included again.
|
||||
|
||||
- If the pattern does not contain a slash '/', git treats it as
|
||||
a shell glob pattern and checks for a match against the
|
||||
pathname without leading directories.
|
||||
|
||||
- Otherwise, git treats the pattern as a shell glob suitable
|
||||
for consumption by fnmatch(3) with the FNM_PATHNAME flag:
|
||||
wildcards in the pattern will not match a / in the pathname.
|
||||
For example, "Documentation/\*.html" matches
|
||||
"Documentation/git.html" but not
|
||||
"Documentation/ppc/ppc.html". A leading slash matches the
|
||||
beginning of the pathname; for example, "/*.c" matches
|
||||
"cat-file.c" but not "mozilla-sha1/sha1.c".
|
||||
|
||||
An example:
|
||||
|
||||
--------------------------------------------------------------
|
||||
$ git-status
|
||||
[...]
|
||||
# Untracked files:
|
||||
[...]
|
||||
# Documentation/foo.html
|
||||
# Documentation/gitignore.html
|
||||
# file.o
|
||||
# lib.a
|
||||
# src/internal.o
|
||||
[...]
|
||||
$ cat .git/info/exclude
|
||||
# ignore objects and archives, anywhere in the tree.
|
||||
*.[oa]
|
||||
$ cat Documentation/.gitignore
|
||||
# ignore generated html files,
|
||||
*.html
|
||||
# except foo.html which is maintained by hand
|
||||
!foo.html
|
||||
$ git-status
|
||||
[...]
|
||||
# Untracked files:
|
||||
[...]
|
||||
# Documentation/foo.html
|
||||
[...]
|
||||
--------------------------------------------------------------
|
||||
|
||||
Another example:
|
||||
|
||||
--------------------------------------------------------------
|
||||
$ cat .gitignore
|
||||
vmlinux*
|
||||
$ ls arch/foo/kernel/vm*
|
||||
arch/foo/kernel/vmlinux.lds.S
|
||||
$ echo '!/vmlinux*' >arch/foo/kernel/.gitignore
|
||||
--------------------------------------------------------------
|
||||
|
||||
The second .gitignore prevents git from ignoring
|
||||
`arch/foo/kernel/vmlinux.lds.S`.
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
Documentation by David Greaves, Junio C Hamano, Josh Triplett,
|
||||
Frank Lichtenheld, and the git-list <git@vger.kernel.org>.
|
||||
|
||||
GIT
|
||||
---
|
||||
Part of the gitlink:git[7] suite
|
@ -155,8 +155,7 @@ info/exclude::
|
||||
exclude pattern list. `.gitignore` is the per-directory
|
||||
ignore file. `git status`, `git add`, `git rm` and `git
|
||||
clean` look at it but the core git commands do not look
|
||||
at it. See also: gitlink:git-ls-files[1] `--exclude-from`
|
||||
and `--exclude-per-directory`.
|
||||
at it. See also: gitlink:gitignore[5].
|
||||
|
||||
remotes::
|
||||
Stores shorthands to be used to give URL and default
|
||||
|
@ -1103,12 +1103,12 @@ showing up in the output of "`git status`", etc.
|
||||
|
||||
Git therefore provides "exclude patterns" for telling git which files to
|
||||
actively ignore. Exclude patterns are thoroughly explained in the
|
||||
"Exclude Patterns" section of the gitlink:git-ls-files[1] manual page,
|
||||
but the heart of the concept is simply a list of files which git should
|
||||
ignore. Entries in the list may contain globs to specify multiple files,
|
||||
or may be prefixed by "`!`" to explicitly include (un-ignore) a previously
|
||||
excluded (ignored) file (i.e. later exclude patterns override earlier ones).
|
||||
The following example should illustrate such patterns:
|
||||
gitlink:gitignore[5] manual page, but the heart of the concept is simply
|
||||
a list of files which git should ignore. Entries in the list may contain
|
||||
globs to specify multiple files, or may be prefixed by "`!`" to
|
||||
explicitly include (un-ignore) a previously excluded (ignored) file
|
||||
(i.e. later exclude patterns override earlier ones). The following
|
||||
example should illustrate such patterns:
|
||||
|
||||
-------------------------------------------------
|
||||
# Lines starting with '#' are considered comments.
|
||||
|
10
commit.c
10
commit.c
@ -511,12 +511,16 @@ static int add_rfc2047(char *buf, const char *line, int len,
|
||||
bp += i;
|
||||
for (i = 0; i < len; i++) {
|
||||
unsigned ch = line[i] & 0xFF;
|
||||
if (is_rfc2047_special(ch)) {
|
||||
/*
|
||||
* We encode ' ' using '=20' even though rfc2047
|
||||
* allows using '_' for readability. Unfortunately,
|
||||
* many programs do not understand this and just
|
||||
* leave the underscore in place.
|
||||
*/
|
||||
if (is_rfc2047_special(ch) || ch == ' ') {
|
||||
sprintf(bp, "=%02X", ch);
|
||||
bp += 3;
|
||||
}
|
||||
else if (ch == ' ')
|
||||
*bp++ = '_';
|
||||
else
|
||||
*bp++ = ch;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ check_encoding () {
|
||||
while test "$i" -le $cnt
|
||||
do
|
||||
git format-patch --encoding=UTF-8 --stdout HEAD~$i..HEAD~$j |
|
||||
grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD_=C3=B3=C3=BA?=" &&
|
||||
grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" &&
|
||||
git-cat-file commit HEAD~$j |
|
||||
case "$header" in
|
||||
8859)
|
||||
@ -73,9 +73,9 @@ test_expect_success 'format-patch output (ISO-8859-1)' '
|
||||
git format-patch --stdout master..HEAD^ >out-l1 &&
|
||||
git format-patch --stdout HEAD^ >out-l2 &&
|
||||
grep "^Content-Type: text/plain; charset=ISO-8859-1" out-l1 &&
|
||||
grep "^From: =?ISO-8859-1?q?=C1=E9=ED_=F3=FA?=" out-l1 &&
|
||||
grep "^From: =?ISO-8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l1 &&
|
||||
grep "^Content-Type: text/plain; charset=ISO-8859-1" out-l2 &&
|
||||
grep "^From: =?ISO-8859-1?q?=C1=E9=ED_=F3=FA?=" out-l2
|
||||
grep "^From: =?ISO-8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l2
|
||||
'
|
||||
|
||||
test_expect_success 'format-patch output (UTF-8)' '
|
||||
@ -84,9 +84,9 @@ test_expect_success 'format-patch output (UTF-8)' '
|
||||
git format-patch --stdout master..HEAD^ >out-u1 &&
|
||||
git format-patch --stdout HEAD^ >out-u2 &&
|
||||
grep "^Content-Type: text/plain; charset=UTF-8" out-u1 &&
|
||||
grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD_=C3=B3=C3=BA?=" out-u1 &&
|
||||
grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u1 &&
|
||||
grep "^Content-Type: text/plain; charset=UTF-8" out-u2 &&
|
||||
grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD_=C3=B3=C3=BA?=" out-u2
|
||||
grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u2
|
||||
'
|
||||
|
||||
test_expect_success 'rebase (U/U)' '
|
||||
|
Loading…
Reference in New Issue
Block a user