From: Kang-Che Sung <explorer09@gmail.com>
To: Git List <git@vger.kernel.org>
Subject: Combined diff format: Show all filenames by default?
Date: Fri, 3 May 2024 10:06:37 +0800 [thread overview]
Message-ID: <CADDzAfNz3R5yj1SdJYbBe0f8m3Sp-R+X6dRpYoJ8Foj6zijcDA@mail.gmail.com> (raw)
Dear Git developers,
I have a humble feature request, perhaps to address a usability
problem that annoyed me a lot.
When Git shows merge commits, it often present a diff called a
"combined diff" format. The documentation has an example
(https://git-scm.com/docs/diff-format#_combined_diff_format)
```
diff --combined describe.c
index fabadb8,cc95eb0..4866510
--- a/describe.c
+++ b/describe.c
@@@ -98,10 -98,8 +98,10 @@@
return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
}
- static void describe(char *arg)
-static void describe(struct commit *cmit, int last_one)
++static void describe(char *arg, int last_one)
{
+ unsigned char sha1[20];
+ struct commit *cmit;
struct commit_list *list;
static int initialized = 0;
struct commit_name *n;
```
The from-file/to-file header is my main concern. It shows two lines by default:
```
--- a/describe.c
+++ b/describe.c
```
Although the documentation says it allows `--combined-all-paths`
option to show all N+1 lines:
```
--- a/file
--- a/file
--- a/file
+++ b/file
```
Why isn't this the default? I am requesting it to show the filenames
of all parent by default, for the line-by-line combined diff format.
My reason for making it default:
1. When the format is an N-way diff format, we can make it obvious
that the comparison is N-way, not two-way, by listing more than two
filenames.
2. Even though the duplicated `--- a/file` filename lines might look
redundant, it's the _number_ of those lines that matters - how many
files are involved in a diff comparison. (In contrast, showing only
two filenames is confusing.)
As the "combined diff" format is likely to last for a long time, it
would be good for Git to set a right default for presenting this
format.
Thank you.
next reply other threads:[~2024-05-03 2:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 2:06 Kang-Che Sung [this message]
2024-05-03 14:57 ` Combined diff format: Show all filenames by default? Junio C Hamano
2024-05-03 19:11 ` Kang-Che Sung
2024-05-03 19:42 ` Junio C Hamano
2024-05-03 22:25 ` Kang-Che Sung
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=CADDzAfNz3R5yj1SdJYbBe0f8m3Sp-R+X6dRpYoJ8Foj6zijcDA@mail.gmail.com \
--to=explorer09@gmail.com \
--cc=git@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).