зеркало из https://github.com/microsoft/git.git
Merge branch 'maint'
* maint: Better advice on using topic branches for kernel development Documentation: update implicit "--no-index" behavior in "git diff" Documentation: expand 'git diff' SEE ALSO section Documentation: diff can compare blobs Documentation: gitrevisions is in section 7 shell portability: no "export VAR=VAL" CodingGuidelines: reword parameter expansion section Documentation: update-index: -z applies also to --index-info Documentation: No argument of ALLOC_GROW should have side-effects
This commit is contained in:
Коммит
38a18873b2
|
@ -35,11 +35,22 @@ For shell scripts specifically (not exhaustive):
|
|||
properly nests. It should have been the way Bourne spelled
|
||||
it from day one, but unfortunately isn't.
|
||||
|
||||
- We use ${parameter-word} and its [-=?+] siblings, and their
|
||||
colon'ed "unset or null" form.
|
||||
- We use POSIX compliant parameter substitutions and avoid bashisms;
|
||||
namely:
|
||||
|
||||
- We use ${parameter#word} and its [#%] siblings, and their
|
||||
doubled "longest matching" form.
|
||||
- We use ${parameter-word} and its [-=?+] siblings, and their
|
||||
colon'ed "unset or null" form.
|
||||
|
||||
- We use ${parameter#word} and its [#%] siblings, and their
|
||||
doubled "longest matching" form.
|
||||
|
||||
- No "Substring Expansion" ${parameter:offset:length}.
|
||||
|
||||
- No shell arrays.
|
||||
|
||||
- No strlen ${#parameter}.
|
||||
|
||||
- No pattern replacement ${parameter/pattern/string}.
|
||||
|
||||
- We use Arithmetic Expansion $(( ... )).
|
||||
|
||||
|
@ -47,14 +58,6 @@ For shell scripts specifically (not exhaustive):
|
|||
of them, as some shells do not grok $((x)) while accepting $(($x))
|
||||
just fine (e.g. dash older than 0.5.4).
|
||||
|
||||
- No "Substring Expansion" ${parameter:offset:length}.
|
||||
|
||||
- No shell arrays.
|
||||
|
||||
- No strlen ${#parameter}.
|
||||
|
||||
- No regexp ${parameter/pattern/string}.
|
||||
|
||||
- We do not use Process Substitution <(list) or >(list).
|
||||
|
||||
- We prefer "test" over "[ ... ]".
|
||||
|
|
|
@ -27,7 +27,7 @@ OPTIONS
|
|||
<object>::
|
||||
The name of the object to show.
|
||||
For a more complete list of ways to spell object names, see
|
||||
the "SPECIFYING REVISIONS" section in linkgit:gitrevisions[1].
|
||||
the "SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
|
||||
|
||||
-t::
|
||||
Instead of the content, show the object type identified by
|
||||
|
|
|
@ -49,7 +49,7 @@ git imposes the following rules on how references are named:
|
|||
These rules make it easy for shell script based tools to parse
|
||||
reference names, pathname expansion by the shell when a reference name is used
|
||||
unquoted (by mistake), and also avoids ambiguities in certain
|
||||
reference name expressions (see linkgit:gitrevisions[1]):
|
||||
reference name expressions (see linkgit:gitrevisions[7]):
|
||||
|
||||
. A double-dot `..` is often used as in `ref1..ref2`, and in some
|
||||
contexts this notation means `{caret}ref1 ref2` (i.e. not in
|
||||
|
|
|
@ -21,7 +21,7 @@ OPTIONS
|
|||
<commit>...::
|
||||
Commits to cherry-pick.
|
||||
For a more complete list of ways to spell commits, see
|
||||
linkgit:gitrevisions[1].
|
||||
linkgit:gitrevisions[7].
|
||||
Sets of commits can be passed but no traversal is done by
|
||||
default, as if the '--no-walk' option was specified, see
|
||||
linkgit:git-rev-list[1].
|
||||
|
|
|
@ -23,9 +23,9 @@ tree and the index file, or the index file and the working tree.
|
|||
further add to the index but you still haven't. You can
|
||||
stage these changes by using linkgit:git-add[1].
|
||||
+
|
||||
If exactly two paths are given, and at least one is untracked,
|
||||
compare the two files / directories. This behavior can be
|
||||
forced by --no-index.
|
||||
If exactly two paths are given and at least one points outside
|
||||
the current repository, 'git diff' will compare the two files /
|
||||
directories. This behavior can be forced by --no-index.
|
||||
|
||||
'git diff' [--options] --cached [<commit>] [--] [<path>...]::
|
||||
|
||||
|
@ -64,15 +64,16 @@ forced by --no-index.
|
|||
|
||||
Just in case if you are doing something exotic, it should be
|
||||
noted that all of the <commit> in the above description, except
|
||||
for the last two forms that use ".." notations, can be any
|
||||
<tree-ish>.
|
||||
in the last two forms that use ".." notations, can be any
|
||||
<tree>. The third form ('git diff <commit> <commit>') can also
|
||||
be used to compare two <blob> objects.
|
||||
|
||||
For a more complete list of ways to spell <commit>, see
|
||||
"SPECIFYING REVISIONS" section in linkgit:gitrevisions[1].
|
||||
"SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
|
||||
However, "diff" is about comparing two _endpoints_, not ranges,
|
||||
and the range notations ("<commit>..<commit>" and
|
||||
"<commit>\...<commit>") do not mean a range as defined in the
|
||||
"SPECIFYING RANGES" section in linkgit:gitrevisions[1].
|
||||
"SPECIFYING RANGES" section in linkgit:gitrevisions[7].
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
@ -159,8 +160,12 @@ rewrites (very expensive).
|
|||
|
||||
SEE ALSO
|
||||
--------
|
||||
linkgit:git-difftool[1]::
|
||||
Show changes using common diff tools
|
||||
diff(1),
|
||||
linkgit:git-difftool[1],
|
||||
linkgit:git-log[1],
|
||||
linkgit:gitdiffcore[7],
|
||||
linkgit:git-format-patch[1],
|
||||
linkgit:git-apply[1]
|
||||
|
||||
Author
|
||||
------
|
||||
|
|
|
@ -439,7 +439,7 @@ Marks must be declared (via `mark`) before they can be used.
|
|||
* A complete 40 byte or abbreviated commit SHA-1 in hex.
|
||||
|
||||
* Any valid Git SHA-1 expression that resolves to a commit. See
|
||||
``SPECIFYING REVISIONS'' in linkgit:gitrevisions[1] for details.
|
||||
``SPECIFYING REVISIONS'' in linkgit:gitrevisions[7] for details.
|
||||
|
||||
The special case of restarting an incremental import from the
|
||||
current branch value should be written as:
|
||||
|
|
|
@ -39,7 +39,7 @@ There are two ways to specify which commits to operate on.
|
|||
that leads to the <since> to be output.
|
||||
|
||||
2. Generic <revision range> expression (see "SPECIFYING
|
||||
REVISIONS" section in linkgit:gitrevisions[1]) means the
|
||||
REVISIONS" section in linkgit:gitrevisions[7]) means the
|
||||
commits in the specified range.
|
||||
|
||||
The first rule takes precedence in the case of a single <commit>. To
|
||||
|
|
|
@ -31,7 +31,7 @@ OPTIONS
|
|||
either <since> or <until> is omitted, it defaults to
|
||||
`HEAD`, i.e. the tip of the current branch.
|
||||
For a more complete list of ways to spell <since>
|
||||
and <until>, see linkgit:gitrevisions[1].
|
||||
and <until>, see linkgit:gitrevisions[7].
|
||||
|
||||
--follow::
|
||||
Continue listing the history of a file beyond renames
|
||||
|
|
|
@ -41,7 +41,7 @@ OPTIONS[[OPTIONS]]
|
|||
+
|
||||
The <src> is often the name of the branch you would want to push, but
|
||||
it can be any arbitrary "SHA-1 expression", such as `master~4` or
|
||||
`HEAD` (see linkgit:gitrevisions[1]).
|
||||
`HEAD` (see linkgit:gitrevisions[7]).
|
||||
+
|
||||
The <dst> tells which ref on the remote side is updated with this
|
||||
push. Arbitrary expressions cannot be used here, an actual ref must
|
||||
|
|
|
@ -40,7 +40,7 @@ see linkgit:git-log[1].
|
|||
The reflog is useful in various git commands, to specify the old value
|
||||
of a reference. For example, `HEAD@\{2\}` means "where HEAD used to be
|
||||
two moves ago", `master@\{one.week.ago\}` means "where master used to
|
||||
point to one week ago", and so on. See linkgit:gitrevisions[1] for
|
||||
point to one week ago", and so on. See linkgit:gitrevisions[7] for
|
||||
more details.
|
||||
|
||||
To delete single entries from the reflog, use the subcommand "delete"
|
||||
|
|
|
@ -31,7 +31,7 @@ OPTIONS
|
|||
<commit>...::
|
||||
Commits to revert.
|
||||
For a more complete list of ways to spell commit names, see
|
||||
linkgit:gitrevisions[1].
|
||||
linkgit:gitrevisions[7].
|
||||
Sets of commits can also be given but no traversal is done by
|
||||
default, see linkgit:git-rev-list[1] and its '--no-walk'
|
||||
option.
|
||||
|
|
|
@ -32,7 +32,7 @@ no <rev> nor <glob> is given on the command line.
|
|||
OPTIONS
|
||||
-------
|
||||
<rev>::
|
||||
Arbitrary extended SHA1 expression (see linkgit:gitrevisions[1])
|
||||
Arbitrary extended SHA1 expression (see linkgit:gitrevisions[7])
|
||||
that typically names a branch head or a tag.
|
||||
|
||||
<glob>::
|
||||
|
|
|
@ -36,7 +36,7 @@ OPTIONS
|
|||
<object>...::
|
||||
The names of objects to show.
|
||||
For a more complete list of ways to spell object names, see
|
||||
"SPECIFYING REVISIONS" section in linkgit:gitrevisions[1].
|
||||
"SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
|
||||
|
||||
include::pretty-options.txt[]
|
||||
|
||||
|
|
|
@ -144,8 +144,8 @@ you will need to handle the situation manually.
|
|||
Report what is being added and removed from index.
|
||||
|
||||
-z::
|
||||
Only meaningful with `--stdin`; paths are separated with
|
||||
NUL character instead of LF.
|
||||
Only meaningful with `--stdin` or `--index-info`; paths are
|
||||
separated with NUL character instead of LF.
|
||||
|
||||
\--::
|
||||
Do not interpret any more arguments as options.
|
||||
|
|
|
@ -495,7 +495,7 @@ HEAD::
|
|||
(i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
|
||||
|
||||
For a more complete list of ways to spell object names, see
|
||||
"SPECIFYING REVISIONS" section in linkgit:gitrevisions[1].
|
||||
"SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
|
||||
|
||||
|
||||
File/Directory Structure
|
||||
|
|
|
@ -971,7 +971,7 @@ commits from the master branch. The string inside brackets
|
|||
before the commit log message is a short name you can use to
|
||||
name the commit. In the above example, 'master' and 'mybranch'
|
||||
are branch heads. 'master^' is the first parent of 'master'
|
||||
branch head. Please see linkgit:gitrevisions[1] if you want to
|
||||
branch head. Please see linkgit:gitrevisions[7] if you want to
|
||||
see more complex cases.
|
||||
|
||||
[NOTE]
|
||||
|
|
|
@ -69,7 +69,7 @@ frequently used options.
|
|||
the form "'<from>'..'<to>'" to show all revisions between '<from>' and
|
||||
back to '<to>'. Note, more advanced revision selection can be applied.
|
||||
For a more complete list of ways to spell object names, see
|
||||
linkgit:gitrevisions[1].
|
||||
linkgit:gitrevisions[7].
|
||||
|
||||
<path>...::
|
||||
|
||||
|
|
|
@ -397,7 +397,7 @@ is usually a shortcut for the HEAD branch in the repository "origin".
|
|||
For the complete list of paths which git checks for references, and
|
||||
the order it uses to decide which to choose when there are multiple
|
||||
references with the same shorthand name, see the "SPECIFYING
|
||||
REVISIONS" section of linkgit:gitrevisions[1].
|
||||
REVISIONS" section of linkgit:gitrevisions[7].
|
||||
|
||||
[[Updating-a-repository-With-git-fetch]]
|
||||
Updating a repository with git fetch
|
||||
|
@ -568,7 +568,7 @@ We have seen several ways of naming commits already:
|
|||
- HEAD: refers to the head of the current branch
|
||||
|
||||
There are many more; see the "SPECIFYING REVISIONS" section of the
|
||||
linkgit:gitrevisions[1] man page for the complete list of ways to
|
||||
linkgit:gitrevisions[7] man page for the complete list of ways to
|
||||
name revisions. Some examples:
|
||||
|
||||
-------------------------------------------------
|
||||
|
@ -909,7 +909,7 @@ commits reachable from some head but not from any tag in the repository:
|
|||
$ gitk $( git show-ref --heads ) --not $( git show-ref --tags )
|
||||
-------------------------------------------------
|
||||
|
||||
(See linkgit:gitrevisions[1] for explanations of commit-selecting
|
||||
(See linkgit:gitrevisions[7] for explanations of commit-selecting
|
||||
syntax such as `--not`.)
|
||||
|
||||
[[making-a-release]]
|
||||
|
@ -1635,7 +1635,7 @@ you've checked out.
|
|||
The reflogs are kept by default for 30 days, after which they may be
|
||||
pruned. See linkgit:git-reflog[1] and linkgit:git-gc[1] to learn
|
||||
how to control this pruning, and see the "SPECIFYING REVISIONS"
|
||||
section of linkgit:gitrevisions[1] for details.
|
||||
section of linkgit:gitrevisions[7] for details.
|
||||
|
||||
Note that the reflog history is very different from normal git history.
|
||||
While normal history is shared by every repository that works on the
|
||||
|
@ -2171,11 +2171,14 @@ $ git push mytree release
|
|||
|
||||
Now to apply some patches from the community. Think of a short
|
||||
snappy name for a branch to hold this patch (or related group of
|
||||
patches), and create a new branch from the current tip of Linus's
|
||||
branch:
|
||||
patches), and create a new branch from a recent stable tag of
|
||||
Linus's branch. Picking a stable base for your branch will:
|
||||
1) help you: by avoiding inclusion of unrelated and perhaps lightly
|
||||
tested changes
|
||||
2) help future bug hunters that use "git bisect" to find problems
|
||||
|
||||
-------------------------------------------------
|
||||
$ git checkout -b speed-up-spinlocks origin
|
||||
$ git checkout -b speed-up-spinlocks v2.6.35
|
||||
-------------------------------------------------
|
||||
|
||||
Now you apply the patch(es), run some tests, and commit the change(s). If
|
||||
|
|
2
cache.h
2
cache.h
|
@ -445,7 +445,7 @@ extern int init_db(const char *template_dir, unsigned int flags);
|
|||
* at least 'nr' entries; the number of entries currently allocated
|
||||
* is 'alloc', using the standard growing factor alloc_nr() macro.
|
||||
*
|
||||
* DO NOT USE any expression with side-effect for 'x' or 'alloc'.
|
||||
* DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'.
|
||||
*/
|
||||
#define ALLOC_GROW(x, nr, alloc) \
|
||||
do { \
|
||||
|
|
|
@ -137,7 +137,7 @@ It does not apply to blobs recorded in its index."
|
|||
export GITHEAD_$his_tree
|
||||
if test -n "$GIT_QUIET"
|
||||
then
|
||||
export GIT_MERGE_VERBOSITY=0
|
||||
GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY
|
||||
fi
|
||||
git-merge-recursive $orig_tree -- HEAD $his_tree || {
|
||||
git rerere $allow_rerere_autoupdate
|
||||
|
|
|
@ -111,7 +111,7 @@ call_merge () {
|
|||
export GITHEAD_$cmt GITHEAD_$hd
|
||||
if test -n "$GIT_QUIET"
|
||||
then
|
||||
export GIT_MERGE_VERBOSITY=1
|
||||
GIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY
|
||||
fi
|
||||
eval 'git-merge-$strategy' $strategy_opts '"$cmt^" -- "$hd" "$cmt"'
|
||||
rv=$?
|
||||
|
|
|
@ -373,7 +373,7 @@ apply_stash () {
|
|||
|
||||
if test -n "$GIT_QUIET"
|
||||
then
|
||||
export GIT_MERGE_VERBOSITY=0
|
||||
GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY
|
||||
fi
|
||||
if git merge-recursive $b_tree -- $c_tree $w_tree
|
||||
then
|
||||
|
|
|
@ -134,8 +134,8 @@ cat >ls.expected <<EOF
|
|||
100644 $ONE_SHA1 0 me
|
||||
EOF
|
||||
|
||||
export GIT_DIR="$TRASH_DIRECTORY/.git"
|
||||
export GIT_WORK_TREE=/
|
||||
GIT_DIR="$TRASH_DIRECTORY/.git" && export GIT_DIR
|
||||
GIT_WORK_TREE=/ && export GIT_WORK_TREE
|
||||
|
||||
test_vars 'abs gitdir, root' "$GIT_DIR" "/" ""
|
||||
test_foobar_root
|
||||
|
@ -154,24 +154,24 @@ say "GIT_DIR relative, GIT_WORK_TREE set"
|
|||
|
||||
test_expect_success 'go to /' 'cd /'
|
||||
|
||||
export GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git"
|
||||
export GIT_WORK_TREE=/
|
||||
GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" && export GIT_DIR
|
||||
GIT_WORK_TREE=/ && export GIT_WORK_TREE
|
||||
|
||||
test_vars 'rel gitdir, root' "$GIT_DIR" "/" ""
|
||||
test_foobar_root
|
||||
|
||||
test_expect_success 'go to /foo' 'cd /foo'
|
||||
|
||||
export GIT_DIR="../$TRASH_DIRECTORY/.git"
|
||||
export GIT_WORK_TREE=/
|
||||
GIT_DIR="../$TRASH_DIRECTORY/.git" && export GIT_DIR
|
||||
GIT_WORK_TREE=/ && export GIT_WORK_TREE
|
||||
|
||||
test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/"
|
||||
test_foobar_foo
|
||||
|
||||
test_expect_success 'go to /foo/bar' 'cd /foo/bar'
|
||||
|
||||
export GIT_DIR="../../$TRASH_DIRECTORY/.git"
|
||||
export GIT_WORK_TREE=/
|
||||
GIT_DIR="../../$TRASH_DIRECTORY/.git" && export GIT_DIR
|
||||
GIT_WORK_TREE=/ && export GIT_WORK_TREE
|
||||
|
||||
test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/"
|
||||
test_foobar_foobar
|
||||
|
@ -180,24 +180,24 @@ say "GIT_DIR relative, GIT_WORK_TREE relative"
|
|||
|
||||
test_expect_success 'go to /' 'cd /'
|
||||
|
||||
export GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git"
|
||||
export GIT_WORK_TREE=.
|
||||
GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" && export GIT_DIR
|
||||
GIT_WORK_TREE=. && export GIT_WORK_TREE
|
||||
|
||||
test_vars 'rel gitdir, root' "$GIT_DIR" "/" ""
|
||||
test_foobar_root
|
||||
|
||||
test_expect_success 'go to /' 'cd /foo'
|
||||
|
||||
export GIT_DIR="../$TRASH_DIRECTORY/.git"
|
||||
export GIT_WORK_TREE=..
|
||||
GIT_DIR="../$TRASH_DIRECTORY/.git" && export GIT_DIR
|
||||
GIT_WORK_TREE=.. && export GIT_WORK_TREE
|
||||
|
||||
test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/"
|
||||
test_foobar_foo
|
||||
|
||||
test_expect_success 'go to /foo/bar' 'cd /foo/bar'
|
||||
|
||||
export GIT_DIR="../../$TRASH_DIRECTORY/.git"
|
||||
export GIT_WORK_TREE=../..
|
||||
GIT_DIR="../../$TRASH_DIRECTORY/.git" && export GIT_DIR
|
||||
GIT_WORK_TREE=../.. && export GIT_WORK_TREE
|
||||
|
||||
test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/"
|
||||
test_foobar_foobar
|
||||
|
|
|
@ -15,7 +15,7 @@ run_backend() {
|
|||
}
|
||||
|
||||
GET() {
|
||||
export REQUEST_METHOD="GET" &&
|
||||
REQUEST_METHOD="GET" && export REQUEST_METHOD &&
|
||||
run_backend "/repo.git/$1" &&
|
||||
unset REQUEST_METHOD &&
|
||||
if ! grep "Status" act.out >act
|
||||
|
@ -27,8 +27,8 @@ GET() {
|
|||
}
|
||||
|
||||
POST() {
|
||||
export REQUEST_METHOD="POST" &&
|
||||
export CONTENT_TYPE="application/x-$1-request" &&
|
||||
REQUEST_METHOD="POST" && export REQUEST_METHOD &&
|
||||
CONTENT_TYPE="application/x-$1-request" && export CONTENT_TYPE &&
|
||||
run_backend "/repo.git/$1" "$2" &&
|
||||
unset REQUEST_METHOD &&
|
||||
unset CONTENT_TYPE &&
|
||||
|
@ -47,7 +47,7 @@ log_div() {
|
|||
. "$TEST_DIRECTORY"/t556x_common
|
||||
|
||||
expect_aliased() {
|
||||
export REQUEST_METHOD="GET" &&
|
||||
REQUEST_METHOD="GET" && export REQUEST_METHOD &&
|
||||
if test $1 = 0; then
|
||||
run_backend "$2"
|
||||
else
|
||||
|
|
|
@ -50,7 +50,7 @@ get_static_files() {
|
|||
}
|
||||
|
||||
SMART=smart
|
||||
export GIT_HTTP_EXPORT_ALL=1
|
||||
GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL
|
||||
test_expect_success 'direct refs/heads/master not found' '
|
||||
log_div "refs/heads/master"
|
||||
GET refs/heads/master "404 Not Found"
|
||||
|
@ -73,7 +73,7 @@ test_expect_success 'export if git-daemon-export-ok' '
|
|||
get_static_files "200 OK"
|
||||
'
|
||||
SMART=smart
|
||||
export GIT_HTTP_EXPORT_ALL=1
|
||||
GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL
|
||||
test_expect_success 'static file if http.getanyfile true is ok' '
|
||||
log_div "getanyfile true"
|
||||
config http.getanyfile true &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче