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

Combined diff format: Show all filenames by default?

From
KSKang-Che Sung <explorer09@gmail.com>
Date
May 3, 2024, 02:06 UTC
Message-ID
<CADDzAfNz3R5yj1SdJYbBe0f8m3Sp-R+X6dRpYoJ8Foj6zijcDA@mail.gmail.com>
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: Junio C Hamano
Message 1 of 5 in “Combined diff format: Show all filenames by default?”
  1. Kang-Che SungMay 3, 2024
  2. Junio C HamanoMay 3, 2024
  3. Kang-Che SungMay 3, 2024
  4. Junio C HamanoMay 3, 2024
  5. Kang-Che SungMay 3, 2024

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.