Đoàn Trần Công Danh <congdanhqx@xxxxxxxxx> writes: > A handful of Git's commands respect `--abbrev' for customizing length > of abbreviation of object names. > > For diff-family, Git supports 2 different options for 2 different > purposes, `--full-index' for showing diff-patch object's name in full, > and `--abbrev' to customize the length of object names in diff-raw and > diff-tree header lines, without any options to customise the length of > object names in diff-patch format. When working with diff-patch format, > we only have two options, either full index, or default abbrev length. Correct. > Although, that consistent is documented, it doesn't stop users from I am not sure what you meant by the word "consistent" here. Dropping the word altogether makes the sentence work just fine, but it may not be what you wanted to say, so I dunno. > trying to use `--abbrev' with the hope of customising diff-patch's > objects' name's abbreviation. OK. > Let's resolve that inconsistency. I am not sure if this should even be called "inconsistency". We have two things to control, (1) length of abbreviated object names in the "raw" output and (2) length of abbreviated object names on the "index" line, and they can be independently controlled with different options. What this patch does is, as the first paragraph explained, the latter does not take an arbitrary length as end users may expect. Let's allow the blob object names shown on the "index" line to be abbreviated to arbitrary length given via the "--abbrev" option. perhaps? > To preserve backward compatibility with old script that specify both > `--full-index' and `--abbrev', always shows full object id > if `--full-index' is specified. s/shows/show/ but otherwise good. > diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt > index b7af973d9c..1bb897d665 100644 > --- a/Documentation/diff-options.txt > +++ b/Documentation/diff-options.txt > @@ -446,10 +446,11 @@ endif::git-format-patch[] > --abbrev[=<n>]:: > Instead of showing the full 40-byte hexadecimal object > name in diff-raw format output and diff-tree header > - lines, show only a partial prefix. This is > - independent of the `--full-index` option above, which controls > - the diff-patch output format. Non default number of > - digits can be specified with `--abbrev=<n>`. > + lines, show only a partial prefix. > + In diff-patch output format, `--full-index` takes higher > + precedent, i.e. if `--full-index` is specified, full blob "precedence", I think. > + names will be shown regardless of `--abbrev`. > + Non default number of digits can be specified with `--abbrev=<n>`.