From: "Đoàn Trần Công Danh" <congdanhqx@gmail.com> To: git@vger.kernel.org Cc: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>, "SZEDER Gábor" <szeder.dev@gmail.com>, "brian m . carlson" <sandals@crustytoothpaste.net>, "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net> Subject: [PATCH v5 0/2] diff: index-line: respect --abbrev in object's name Date: Fri, 21 Aug 2020 18:51:45 +0700 [thread overview] Message-ID: <cover.1598010556.git.congdanhqx@gmail.com> (raw) 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. 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. Based-on-patch-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 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. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> @@ 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>`. -- 2.28.0.143.g760df7782d.dirty
next prev parent reply other threads:[~2020-08-21 11:54 UTC|newest] Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-09 2:19 [RFC PATCH 0/2] extend --abbrev support to diff-patch format Đoàn Trần Công Danh 2020-08-09 2:19 ` [RFC PATCH 1/2] revision: differentiate if --no-abbrev asked explicitly Đoàn Trần Công Danh 2020-08-09 2:19 ` [RFC PATCH 2/2] diff: extend --abbrev support to diff-patch format Đoàn Trần Công Danh 2020-08-09 19:01 ` [RFC PATCH 0/2] " Junio C Hamano 2020-08-10 10:00 ` Jeff King 2020-08-10 12:31 ` Đoàn Trần Công Danh 2020-08-10 15:15 ` Junio C Hamano 2020-08-10 15:27 ` Jeff King 2020-08-11 0:33 ` Đoàn Trần Công Danh 2020-08-11 5:22 ` Jeff King 2020-08-11 12:07 ` Đoàn Trần Công Danh 2020-08-10 15:06 ` Junio C Hamano 2020-08-11 11:49 ` [PATCH v2 0/2] diff: index-line: respect --abbrev in object's name Đoàn Trần Công Danh 2020-08-11 11:49 ` [PATCH v2 1/2] revision: differentiate if --no-abbrev asked explicitly Đoàn Trần Công Danh 2020-08-11 18:54 ` Junio C Hamano 2020-08-11 11:49 ` [PATCH v2 2/2] diff: index-line: respect --abbrev in object's name Đoàn Trần Công Danh 2020-08-14 0:23 ` [PATCH v3 0/2] " Đoàn Trần Công Danh 2020-08-14 0:23 ` [PATCH v3 1/2] revision: differentiate if --no-abbrev asked explicitly Đoàn Trần Công Danh 2020-08-14 0:50 ` Junio C Hamano 2020-08-14 0:59 ` Đoàn Trần Công Danh 2020-08-14 1:06 ` Junio C Hamano 2020-08-14 14:50 ` Đoàn Trần Công Danh 2020-08-19 22:50 ` Junio C Hamano 2020-08-14 0:23 ` [PATCH v3 2/2] diff: index-line: respect --abbrev in object's name Đoàn Trần Công Danh 2020-08-14 15:18 ` SZEDER Gábor 2020-08-14 17:00 ` Junio C Hamano 2020-08-14 18:59 ` Junio C Hamano 2020-08-15 0:21 ` brian m. carlson 2020-08-15 2:27 ` Đoàn Trần Công Danh 2020-08-17 16:17 ` Junio C Hamano 2020-08-20 4:56 ` Junio C Hamano 2020-08-20 12:35 ` [PATCH v4 0/2] " Đoàn Trần Công Danh 2020-08-20 12:35 ` [PATCH v4 1/2] t4013: improve diff-post-processor logic Đoàn Trần Công Danh 2020-08-20 19:49 ` Junio C Hamano 2020-08-21 12:05 ` Đoàn Trần Công Danh 2020-08-21 15:44 ` Junio C Hamano 2020-08-20 12:35 ` [PATCH v4 2/2] diff: index-line: respect --abbrev in object's name Đoàn Trần Công Danh 2020-08-20 19:58 ` Junio C Hamano 2020-08-21 11:51 ` Đoàn Trần Công Danh [this message] 2020-08-21 11:51 ` [PATCH v5 1/2] t4013: improve diff-post-processor logic Đoàn Trần Công Danh 2020-08-21 11:51 ` [PATCH v5 2/2] diff: index-line: respect --abbrev in object's name Đoàn Trần Công Danh
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=cover.1598010556.git.congdanhqx@gmail.com \ --to=congdanhqx@gmail.com \ --cc=git@vger.kernel.org \ --cc=gitster@pobox.com \ --cc=peff@peff.net \ --cc=sandals@crustytoothpaste.net \ --cc=szeder.dev@gmail.com \ --subject='Re: [PATCH v5 0/2] diff: index-line: respect --abbrev in object'\''s name' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).