Skip to content

Commit cda34e0

Browse files
committed
doc: clarify that --abbrev=<n> is about the minimum length
Early text written in 2006 explains the "--abbrev=<n>" option to "show only a partial prefix", without saying that the length of the partial prefix is not necessarily the number given to the option to ensure that the output names the object uniquely. Update documentation for the diff family of commands, "blame", "branch --verbose", "ls-files" and "ls-tree" to stress that the short prefix must uniquely refer to an object, and <n> is merely the mininum number of hexdigits used in the prefix. Helped-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 898f807 commit cda34e0

File tree

6 files changed

+18
-11
lines changed

6 files changed

+18
-11
lines changed

Documentation/diff-options.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,8 @@ endif::git-format-patch[]
446446
--abbrev[=<n>]::
447447
Instead of showing the full 40-byte hexadecimal object
448448
name in diff-raw format output and diff-tree header
449-
lines, show only a partial prefix.
449+
lines, show the shortest prefix that is at least '<n>'
450+
hexdigits long that uniquely refers the object.
450451
In diff-patch output format, `--full-index` takes higher
451452
precedence, i.e. if `--full-index` is specified, full blob
452453
names will be shown regardless of `--abbrev`.

Documentation/git-blame.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ include::blame-options.txt[]
8787

8888
--abbrev=<n>::
8989
Instead of using the default 7+1 hexadecimal digits as the
90-
abbreviated object name, use <n>+1 digits. Note that 1 column
90+
abbreviated object name, use <m>+1 digits, where <m> is at
91+
least <n> but ensures the commit object names are unique.
92+
Note that 1 column
9193
is used for a caret to mark the boundary commit.
9294

9395

Documentation/git-branch.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SYNOPSIS
99
--------
1010
[verse]
1111
'git branch' [--color[=<when>] | --no-color] [--show-current]
12-
[-v [--abbrev=<length> | --no-abbrev]]
12+
[-v [--abbrev=<n> | --no-abbrev]]
1313
[--column[=<options>] | --no-column] [--sort=<key>]
1414
[--merged [<commit>]] [--no-merged [<commit>]]
1515
[--contains [<commit>]] [--no-contains [<commit>]]
@@ -194,8 +194,10 @@ This option is only applicable in non-verbose mode.
194194
Be more quiet when creating or deleting a branch, suppressing
195195
non-error messages.
196196

197-
--abbrev=<length>::
198-
Alter the sha1's minimum display length in the output listing.
197+
--abbrev=<n>::
198+
In the verbose listing that show the commit object name,
199+
show the shortest prefix that is at least '<n>' hexdigits
200+
long that uniquely refers the object.
199201
The default value is 7 and can be overridden by the `core.abbrev`
200202
config option.
201203

Documentation/git-ls-files.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ SYNOPSIS
1919
[--exclude-standard]
2020
[--error-unmatch] [--with-tree=<tree-ish>]
2121
[--full-name] [--recurse-submodules]
22-
[--abbrev] [--] [<file>...]
22+
[--abbrev[=<n>]] [--] [<file>...]
2323

2424
DESCRIPTION
2525
-----------
@@ -153,7 +153,8 @@ a space) at the start of each line:
153153

154154
--abbrev[=<n>]::
155155
Instead of showing the full 40-byte hexadecimal object
156-
lines, show only a partial prefix.
156+
lines, show the shortest prefix that is at least '<n>'
157+
hexdigits long that uniquely refers the object.
157158
Non default number of digits can be specified with --abbrev=<n>.
158159

159160
--debug::

Documentation/git-ls-tree.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ OPTIONS
6262

6363
--abbrev[=<n>]::
6464
Instead of showing the full 40-byte hexadecimal object
65-
lines, show only a partial prefix.
65+
lines, show the shortest prefix that is at least '<n>'
66+
hexdigits long that uniquely refers the object.
6667
Non default number of digits can be specified with --abbrev=<n>.
6768

6869
--full-name::

Documentation/pretty-options.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ configuration (see linkgit:git-config[1]).
1616

1717
--abbrev-commit::
1818
Instead of showing the full 40-byte hexadecimal commit object
19-
name, show only a partial prefix. Non default number of
20-
digits can be specified with "--abbrev=<n>" (which also modifies
21-
diff output, if it is displayed).
19+
name, show a prefix that names the object uniquely.
20+
"--abbrev=<n>" (which also modifies diff output, if it is displayed)
21+
option can be used to specify the minimum length of the prefix.
2222
+
2323
This should make "--pretty=oneline" a whole lot more readable for
2424
people using 80-column terminals.

0 commit comments

Comments
 (0)