git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Junio C HamanoNext: Đoàn Trần Công Danh
Message 13 of 41 in “extend --abbrev support to diff-patch format”
  1. 0/2 extend --abbrev support to diff-patch formatĐoàn Trần Công Danh, Aug 9, 2020
  2. 1/2 revision: differentiate if --no-abbrev asked explicitlyĐoàn Trần Công Danh, Aug 9, 2020
  3. 2/2 diff: extend --abbrev support to diff-patch formatĐoàn Trần Công Danh, Aug 9, 2020
  4. Junio C HamanoAug 9, 2020
  5. Jeff KingAug 10, 2020
  6. Đoàn Trần Công DanhAug 10, 2020
  7. Junio C HamanoAug 10, 2020
  8. Jeff KingAug 10, 2020
  9. Đoàn Trần Công DanhAug 11, 2020
  10. Jeff KingAug 11, 2020
  11. Đoàn Trần Công DanhAug 11, 2020
  12. Junio C HamanoAug 10, 2020
  13. 0/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 11, 2020
  14. 1/2 revision: differentiate if --no-abbrev asked explicitlyĐoàn Trần Công Danh, Aug 11, 2020
  15. Junio C HamanoAug 11, 2020
  16. 2/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 11, 2020
  17. 0/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 14, 2020
  18. 1/2 revision: differentiate if --no-abbrev asked explicitlyĐoàn Trần Công Danh, Aug 14, 2020
  19. Junio C HamanoAug 14, 2020
  20. Đoàn Trần Công DanhAug 14, 2020
  21. Junio C HamanoAug 14, 2020
  22. Đoàn Trần Công DanhAug 14, 2020
  23. Junio C HamanoAug 19, 2020
  24. 2/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 14, 2020
  25. SZEDER GáborAug 14, 2020
  26. Junio C HamanoAug 14, 2020
  27. Junio C HamanoAug 14, 2020
  28. brian m. carlsonAug 15, 2020
  29. Đoàn Trần Công DanhAug 15, 2020
  30. Junio C HamanoAug 17, 2020
  31. Junio C HamanoAug 20, 2020
  32. 0/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 20, 2020
  33. 2/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 20, 2020
  34. Junio C HamanoAug 20, 2020
  35. 1/2 t4013: improve diff-post-processor logicĐoàn Trần Công Danh, Aug 20, 2020
  36. Junio C HamanoAug 20, 2020
  37. Đoàn Trần Công DanhAug 21, 2020
  38. Junio C HamanoAug 21, 2020
  39. 0/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 21, 2020
  40. 2/2 diff: index-line: respect --abbrev in object's nameĐoàn Trần Công Danh, Aug 21, 2020
  41. 1/2 t4013: improve diff-post-processor logicĐoàn Trần Công Danh, Aug 21, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.