Subject: bug#42145: vc-git file order mismatch between vc-dir and vc-diff

From: Dmitry Gutov <[email-masked]>
Date: Wed, 1 Jul 2020 01:08:04 +0300

On 30.06.2020 23:57, Juri Linkov wrote:
> There is an old usability problem in vc-dir.
> 
> Typing ‘=’ in a vc-dir buffer displays a vc-diff buffer where files are
> sorted by different order than files are sorted in the vc-dir buffer.

vc-dir has its own presentation logic, it's pretty complex.

'git diff' has a '-O' argument, which accepts <orderfile>. Maybe it'll 
help, but I kind of doubt that. Ideas welcome.

> For example, there is a need to commit only part of changes.
> To decide what files should be marked in the vc-dir buffer,
> a convenient way is to browse diffs in the vc-diff buffer
> one by one and mark corresponding files in the vc-dir buffer.
> But since these file lists are in different order, the task
> becomes a major hassle because vc-diff doesn't distinguish
> between files and directories while sorting them by name,
> but vc-dir puts directories at the end after files.

Here's a bigger feature I've wanted to see in VC for a while: commit 
from a diff.

There is a third-party package: https://github.com/caldwell/commit-patch

But it implements some of its logic in Perl, and the message buffer it 
creates is non-standard. I'd really like to see it ported to VC.

The idea is, you open a diff, maybe split some of the hunks, kill the 
ones you don't need (diff-mode supports all these operations), and then 
commit the remaining ones, from multiple files, if needed. Seems like a 
good replacement for 'git add -p' for Emacs power users.