Merge branch 'sn/diff-doc'
* sn/diff-doc:
docs: clarify git diff modes of operation
diff,difftool: Don't use the {0,2} notation in usage strings
CodingGuidelines: Add a section on writing documentation
This commit is contained in:
@ -143,3 +143,55 @@ For C programs:
|
|||||||
|
|
||||||
- When we pass <string, length> pair to functions, we should try to
|
- When we pass <string, length> pair to functions, we should try to
|
||||||
pass them in that order.
|
pass them in that order.
|
||||||
|
|
||||||
|
Writing Documentation:
|
||||||
|
|
||||||
|
Every user-visible change should be reflected in the documentation.
|
||||||
|
The same general rule as for code applies -- imitate the existing
|
||||||
|
conventions. A few commented examples follow to provide reference
|
||||||
|
when writing or modifying command usage strings and synopsis sections
|
||||||
|
in the manual pages:
|
||||||
|
|
||||||
|
Placeholders are enclosed in angle brackets:
|
||||||
|
<file>
|
||||||
|
--sort=<key>
|
||||||
|
--abbrev[=<n>]
|
||||||
|
|
||||||
|
Possibility of multiple occurences is indicated by three dots:
|
||||||
|
<file>...
|
||||||
|
(One or more of <file>.)
|
||||||
|
|
||||||
|
Optional parts are enclosed in square brackets:
|
||||||
|
[<extra>]
|
||||||
|
(Zero or one <extra>.)
|
||||||
|
|
||||||
|
--exec-path[=<path>]
|
||||||
|
(Option with an optional argument. Note that the "=" is inside the
|
||||||
|
brackets.)
|
||||||
|
|
||||||
|
[<patch>...]
|
||||||
|
(Zero or more of <patch>. Note that the dots are inside, not
|
||||||
|
outside the brackets.)
|
||||||
|
|
||||||
|
Multiple alternatives are indicated with vertical bar:
|
||||||
|
[-q | --quiet]
|
||||||
|
[--utf8 | --no-utf8]
|
||||||
|
|
||||||
|
Parentheses are used for grouping:
|
||||||
|
[(<rev>|<range>)...]
|
||||||
|
(Any number of either <rev> or <range>. Parens are needed to make
|
||||||
|
it clear that "..." pertains to both <rev> and <range>.)
|
||||||
|
|
||||||
|
[(-p <parent>)...]
|
||||||
|
(Any number of option -p, each with one <parent> argument.)
|
||||||
|
|
||||||
|
git remote set-head <name> (-a | -d | <branch>)
|
||||||
|
(One and only one of "-a", "-d" or "<branch>" _must_ (no square
|
||||||
|
brackets) be provided.)
|
||||||
|
|
||||||
|
And a somewhat more contrived example:
|
||||||
|
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
|
||||||
|
Here "=" is outside the brackets, because "--diff-filter=" is a
|
||||||
|
valid usage. "*" has its own pair of brackets, because it can
|
||||||
|
(optionally) be specified only when one or more of the letters is
|
||||||
|
also provided.
|
||||||
|
|||||||
@ -8,12 +8,17 @@ git-diff - Show changes between commits, commit and working tree, etc
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
'git diff' [<common diff options>] <commit>{0,2} [--] [<path>...]
|
[verse]
|
||||||
|
'git diff' [options] [<commit>] [--] [<path>...]
|
||||||
|
'git diff' [options] --cached [<commit>] [--] [<path>...]
|
||||||
|
'git diff' [options] <commit> <commit> [--] [<path>...]
|
||||||
|
'git diff' [options] [--no-index] [--] <path> <path>
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
Show changes between two trees, a tree and the working tree, a
|
Show changes between the working tree and the index or a tree, changes
|
||||||
tree and the index file, or the index file and the working tree.
|
between the index and a tree, changes between two trees, or changes
|
||||||
|
between two files on disk.
|
||||||
|
|
||||||
'git diff' [--options] [--] [<path>...]::
|
'git diff' [--options] [--] [<path>...]::
|
||||||
|
|
||||||
|
|||||||
@ -7,13 +7,14 @@ git-difftool - Show changes using common diff tools
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
'git difftool' [<options>] <commit>{0,2} [--] [<path>...]
|
'git difftool' [<options>] [<commit> [<commit>]] [--] [<path>...]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
'git difftool' is a git command that allows you to compare and edit files
|
'git difftool' is a git command that allows you to compare and edit files
|
||||||
between revisions using common diff tools. 'git difftool' is a frontend
|
between revisions using common diff tools. 'git difftool' is a frontend
|
||||||
to 'git diff' and accepts the same options and arguments.
|
to 'git diff' and accepts the same options and arguments. See
|
||||||
|
linkgit:git-diff[1].
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
|
|||||||
@ -22,7 +22,7 @@ struct blobinfo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const char builtin_diff_usage[] =
|
static const char builtin_diff_usage[] =
|
||||||
"git diff <options> <rev>{0,2} -- <path>*";
|
"git diff [<options>] [<commit> [<commit>]] [--] [<path>...]";
|
||||||
|
|
||||||
static void stuff_change(struct diff_options *opt,
|
static void stuff_change(struct diff_options *opt,
|
||||||
unsigned old_mode, unsigned new_mode,
|
unsigned old_mode, unsigned new_mode,
|
||||||
|
|||||||
Reference in New Issue
Block a user