git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Combined diff format: Show all filenames by default?
@ 2024-05-03  2:06 Kang-Che Sung
  2024-05-03 14:57 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Kang-Che Sung @ 2024-05-03  2:06 UTC (permalink / raw)
  To: Git List

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-03 22:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-03  2:06 Combined diff format: Show all filenames by default? Kang-Che Sung
2024-05-03 14:57 ` 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

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).