Skip to content

diff: index-line: respect --abbrev in object's name

Đoàn Trần Công Danh git 5 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 0 repliesNew
  2. v42 patches 4 repliesSuperseded
  3. v32 patches 12 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v22 patches1 replySuperseded
v1 RFC2 patches9 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2t4013: improve diff-post-processor logict/t4013-diff-various.sh+39 -210 replies
2/2diff: index-line: respect --abbrev in object's nameDocumentation/diff-options.txt diff.c t/t4013-diff-various.sh +3 more+99 -50 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchJunio C Hamano
SeriesBased-on-patch-by
1/2Based-on-patch-by
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/2] diff: index-line: respect --abbrev in object's name

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.

brian m. carlson (1):
t4013: improve diff-post-processor logic

Đoàn Trần Công Danh (1):
diff: index-line: respect --abbrev in object's name

 Documentation/diff-options.txt                |  9 +--
 diff.c                                        |  5 +-
 t/t4013-diff-various.sh                       | 63 ++++++++++++-------
 ...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 +++++++++
 6 files changed, 138 insertions(+), 26 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 v4:
1: a52d0e59ec ! 1: d7e0f13eba t4013: improve diff-post-processor logic
@@ Commit message
algorithm.

However, we forgot to special case all-zero object names, which is
- special for not-exist objects, in consequence, we could't catch
+ special for missing objects, in consequence, we could't catch
possible future bugs where object names is all-zeros including but
- not limiting to:
+ not limited to:
* show intend-to-add entry
* deleted entry
* diff between index and working tree with new file

- In addition, in the incoming change, we would like to test for
- diff with 10 characters index, which is also not covered by current
- diff-processor logic.
+ We also mistakenly munged file-modes as if they were object names
+ abbreviated to 6 hexadecimal digits.

- Let's fix the bug for all-zero object names and extend object names'
- abbrev to 16 while we're at it.
+ In addition, in the upcoming change, we would like to test for
+ customizing the length of abbreviated blob objects on the index line,
+ which is not supported by current diff-processor logic.
+
+ Let's fix the bug for all-zero object names, and file modes.
+ While we're at it, support abbreviation of object names up to 16 bytes.

2: 3cec490500 ! 2: a9eb73ceab diff: index-line: respect --abbrev in object's name
@@ Commit message
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
+ Although, that behaviour 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.
+ Let's allow the blob object names shown on the "index" line to be
+ abbreviated to arbitrary length given via the "--abbrev" option.

To preserve backward compatibility with old script that specify both
- --full-index' and --abbrev', always shows full object id
+ --full-index' and --abbrev', always show full object id
if `--full-index' is specified.

@@ Documentation/diff-options.txt: endif::git-format-patch[]
- 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.e. if --full-index is specified, full blob
+ names will be shown regardless of --abbrev.
+ Non default number of digits can be specified with --abbrev=<n>.

Signature · 1 line
2.28.0.143.g760df7782d.dirty