[PATCH v2 0/2] diff: index-line: respect --abbrev in object's name
- From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
- Date
- Aug 11, 2020, 11:49 UTC
- Message-ID
- <cover.1597146478.git.congdanhqx@gmail.com>
- In-Reply-To
- <cover.1596887883.git.congdanhqx@gmail.com>
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.
Although, that consistent is documented, it doesn't stop users from trying to use `--abbrev' with the hope of customising diff-patch's objects' name's abbreviation.
Let's resolve that inconsistency.
Đoàn Trần Công Danh (2): revision: differentiate if --no-abbrev asked explicitly diff: index-line: respect --abbrev in object's name
Documentation/diff-options.txt | 9 +++--- diff.c | 5 +++- revision.c | 2 +- t/t4013-diff-various.sh | 3 ++ ...ff.diff-tree_--root_-p_--abbrev=10_initial | 29 +++++++++++++++++++ ...--root_-p_--full-index_--abbrev=10_initial | 29 +++++++++++++++++++ ...f.diff-tree_--root_-p_--full-index_initial | 29 +++++++++++++++++++ 7 files changed, 100 insertions(+), 6 deletions(-) create mode 100644 t/t4013/diff.diff-tree_--root_-p_--abbrev=10_initial create mode 100644 t/t4013/diff.diff-tree_--root_-p_--full-index_--abbrev=10_initial create mode 100644 t/t4013/diff.diff-tree_--root_-p_--full-index_initial
Range-diff against v1:
1: 9daef7445c = 1: 9daef7445c revision: differentiate if --no-abbrev asked explicitly
2: 9146313893 ! 2: 12acf1fe5d diff: extend --abbrev support to diff-patch format
@@ Metadata
Author: Đoàn Trần Công Danh <congdanhqx@gmail.com>
## Commit message ##
- diff: extend --abbrev support to diff-patch format
+ diff: index-line: respect --abbrev in object's name
+
+ 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.
+
+ Although, that consistent is documented, it doesn't stop users from
+ trying to use `--abbrev' with the hope of customising diff-patch's
+ objects' name's abbreviation.
+
+ Let's resolve that inconsistency.
+
+ To preserve backward compatibility with old script that specify both
+ `--full-index' and `--abbrev', always shows full object id
+ if `--full-index' is specified.
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
-- 2.28.0.215.g32ffa52ee0