GNU bug report logs - #42145
vc-git file order mismatch between vc-dir and vc-diff

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Juri Linkov <juri@HIDDEN>; dated Tue, 30 Jun 2020 21:34:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 42145 <at> debbugs.gnu.org:


Received: (at 42145) by debbugs.gnu.org; 8 Mar 2025 18:49:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 08 13:49:26 2025
Received: from localhost ([127.0.0.1]:56820 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tqzEk-00013M-AU
	for submit <at> debbugs.gnu.org; Sat, 08 Mar 2025 13:49:26 -0500
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:36629)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tqzEh-00012x-JR
 for 42145 <at> debbugs.gnu.org; Sat, 08 Mar 2025 13:49:24 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 606CC44285;
 Sat,  8 Mar 2025 18:49:16 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Sean Whitton <spwhitton@HIDDEN>
Subject: Re: bug#42145: vc-git file order mismatch between vc-dir and vc-diff
In-Reply-To: <871pv8nrsa.fsf@HIDDEN>
Organization: LINKOV.NET
References: <87bll048br.fsf@HIDDEN>
 <fbcbcdb9-391d-50ed-8fb4-6c1b832639bb@HIDDEN>
 <871rluewrf.fsf@HIDDEN>
 <82542bee-ec10-86b6-39bb-8d4fa0c68770@HIDDEN>
 <871pv8nrsa.fsf@HIDDEN>
Date: Sat, 08 Mar 2025 20:48:41 +0200
Message-ID: <875xkjs7fq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduudegfedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepfedprhgtphhtthhopeegvddugeehseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepughguhhtohhvseihrghnuggvgidrrhhupdhrtghpthhtohepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 42145
Cc: 42145 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>>>> 'git diff' has a '-O' argument, which accepts <orderfile>. Maybe
>>>> it'll help, but I kind of doubt that. Ideas welcome.
>>
>>> Maybe it's possible to write a diff-mode function to sort file hunks
>>> in
>>> vc-diff output buffer?  Maybe by just giving the right file-beginning
>>> regexp to sort-subr?
>>
>> Which sort-subr?
>
> Juri, could you specify the name of the sorting function?

It seems the best candidates for NEXTRECFUN and ENDRECFUN of 'sort-subr'
are 'diff-file-next' and 'diff-file-prev', but functions for
STARTKEYFUN and ENDKEYFUN needs to be written with some use of
'diff-find-file-name'.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42145; Package emacs. Full text available.

Message received at 42145 <at> debbugs.gnu.org:


Received: (at 42145) by debbugs.gnu.org; 8 Mar 2025 03:08:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 07 22:08:17 2025
Received: from localhost ([127.0.0.1]:51338 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tqkXx-0005ke-CM
	for submit <at> debbugs.gnu.org; Fri, 07 Mar 2025 22:08:17 -0500
Received: from sendmail.purelymail.com ([34.202.193.197]:46866)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>)
 id 1tqkXu-0005kQ-L2
 for 42145 <at> debbugs.gnu.org; Fri, 07 Mar 2025 22:08:15 -0500
DKIM-Signature: a=rsa-sha256;
 b=jUB6XCbjth0enrNAj7s9I/+XFnRA32lB6h6mbPcGLCWtY2yWftBkY/QBs+OLgnCHo9G/KidtP8BGj/aGoJ2usw0tqXZF8JpwIg5pa6TqSVBXWZ2w1ARqaUbA2rRNMLmSOmxJ4/ORmjfD1c3ppPz9+AShX+93PV0PO9dG3horXnr3APCFw2//zpqKJVdKJWdHN2JrESYZ+vmm1/YvSjId6nHodbIvEb1tT4ogmrHOJ32Wzlh0aiA9hDcQEO3J8YMjTJhUq5nT3ea+sAgT5H3NUwQ7WGGyqrl6hLV7wQlXz9MH0sip2g3/TPqcFFeqEV1JmAX4/K5miic4ZcYBHxzxWw==;
 s=purelymail3; d=spwhitton.name; v=1;
 bh=WcbhZ6YNaco5XSCzt0q/m98LBiymr1A+AyoOOIt1Sa8=;
 h=Received:Received:From:To:Subject:Date; 
DKIM-Signature: a=rsa-sha256;
 b=dx4txCUYcBkjmfr4uFWbP5u5IeiwP12qt1QMVr7J9iU8hpofRFbfufIVh6yFxZzSU1BX2h0FN9bxyrmL+kkjXdsn6C4sp9eFvHXOp8IC20BbeZ+SPuB5i+NNKbHJ/62w7XzG8CdfZLx+A948obtX5aTZ9Y+CZhUmLfhPMJmiMS1Kh71UdnFjLbdjGFzPouHuTnyJuD+o1dbEd3Qur202BDmRqiLJidGRoZzyPGpGFQgo8PGwsvNi+8pbRDHw+SKF+x+lIH6zlKreT6F1dY+0P11KuEvy2t/z9ey2C8+q9li/AvJgRLBKS9XztjHq9o+YodXT42Xcv8JqEJKxKc/fQA==;
 s=purelymail3; d=purelymail.com; v=1;
 bh=WcbhZ6YNaco5XSCzt0q/m98LBiymr1A+AyoOOIt1Sa8=;
 h=Feedback-ID:Received:Received:From:To:Subject:Date; 
Feedback-ID: 20115:3760:null:purelymail
X-Pm-Original-To: 42145 <at> debbugs.gnu.org
Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 2014008717; 
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Sat, 08 Mar 2025 03:08:07 +0000 (UTC)
Received: by melete.silentflame.com (Postfix, from userid 1000)
 id 0A28B7E965C; Sat,  8 Mar 2025 11:08:05 +0800 (CST)
From: Sean Whitton <spwhitton@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>, Juri Linkov <juri@HIDDEN>
Subject: Re: bug#42145: vc-git file order mismatch between vc-dir and vc-diff
In-Reply-To: <82542bee-ec10-86b6-39bb-8d4fa0c68770@HIDDEN>
References: <87bll048br.fsf@HIDDEN>
 <fbcbcdb9-391d-50ed-8fb4-6c1b832639bb@HIDDEN>
 <871rluewrf.fsf@HIDDEN>
 <82542bee-ec10-86b6-39bb-8d4fa0c68770@HIDDEN>
Date: Sat, 08 Mar 2025 11:08:05 +0800
Message-ID: <871pv8nrsa.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42145
Cc: 42145 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

On Thu 02 Jul 2020 at 01:44am +03, Dmitry Gutov wrote:

> On 02.07.2020 00:44, Juri Linkov wrote:
>>> 'git diff' has a '-O' argument, which accepts <orderfile>. Maybe
>>> it'll help, but I kind of doubt that. Ideas welcome.
>
>> Maybe it's possible to write a diff-mode function to sort file hunks
>> in
>> vc-diff output buffer?  Maybe by just giving the right file-beginning
>> regexp to sort-subr?
>
> Which sort-subr?

Juri, could you specify the name of the sorting function?

> Overall, it sounds possible. But I would be careful about making the
> display of long diffs slower.

We could have it disable itself if the size of the diff-mode buffer to
sort was already very large.

I think this would be a nice UI improvement.  It would have the
advantage over Juri's advice of not being Git-specific, and also
depending on the implementation, revert-buffer wouldn't mess up the
order again.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42145; Package emacs. Full text available.

Message received at 42145 <at> debbugs.gnu.org:


Received: (at 42145) by debbugs.gnu.org; 30 Mar 2021 19:24:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 30 15:24:59 2021
Received: from localhost ([127.0.0.1]:52862 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lRJz1-0002Jk-9a
	for submit <at> debbugs.gnu.org; Tue, 30 Mar 2021 15:24:59 -0400
Received: from relay8-d.mail.gandi.net ([217.70.183.201]:37429)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1lRJyt-0002JD-N4
 for 42145 <at> debbugs.gnu.org; Tue, 30 Mar 2021 15:24:53 -0400
X-Originating-IP: 91.129.107.223
Received: from mail.gandi.net (m91-129-107-223.cust.tele2.ee [91.129.107.223])
 (Authenticated sender: juri@HIDDEN)
 by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 755C01BF206;
 Tue, 30 Mar 2021 19:24:43 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#42145: vc-git file order mismatch between vc-dir and vc-diff
References: <87bll048br.fsf@HIDDEN>
 <fbcbcdb9-391d-50ed-8fb4-6c1b832639bb@HIDDEN>
Date: Tue, 30 Mar 2021 22:23:59 +0300
In-Reply-To: <fbcbcdb9-391d-50ed-8fb4-6c1b832639bb@HIDDEN> (Dmitry Gutov's
 message of "Wed, 1 Jul 2020 01:08:04 +0300")
Message-ID: <871rbwtq5w.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 42145
Cc: 42145 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

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

I solved this problem by adding two advises:

1. vc-dir-deduce-fileset - create orderfile
2. vc-git-diff - use orderfile

#+begin_src emacs-lisp
(defvar vc-git-orderfile nil)

(advice-add 'vc-dir-deduce-fileset :after
            (lambda (&rest _)
              (when (and vc-ewoc (eq this-command 'vc-diff))
                (let* ((tmpfile (make-temp-file "vc-git-orderfile-"))
                       files)
                  (ewoc-map (lambda (filearg)
                              (push (vc-dir-fileinfo->name filearg) files))
                            vc-ewoc)
                  (with-temp-file tmpfile
                    (mapcar (lambda (file) (insert file "\n")) (nreverse files)))
                  (setq vc-git-orderfile tmpfile))))
            '((name . vc-dir-create-orderfile)))

(advice-add 'vc-git-diff :around
            (lambda (orig-fun &rest args)
              (if (and vc-git-orderfile (file-exists-p vc-git-orderfile))
                  (let ((vc-git-diff-switches
                         (append (list (format "-O%s" vc-git-orderfile))
                                 vc-git-diff-switches)))
                    (unwind-protect
	                (apply orig-fun args)
	              (delete-file vc-git-orderfile)
                      (setq vc-git-orderfile nil)))
                (apply orig-fun args)))
            '((name . vc-git-diff-use-orderfile)))
#+end_src

Ideas welcome how to integrate this nicely to the vc package.

Also it has one limitation: revert-buffer in the *vc-diff* buffer
doesn't keep the original order, but this is a very minor problem.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42145; Package emacs. Full text available.

Message received at 42145 <at> debbugs.gnu.org:


Received: (at 42145) by debbugs.gnu.org; 1 Jul 2020 22:44:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 01 18:44:30 2020
Received: from localhost ([127.0.0.1]:53922 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jqlSw-0000Hl-3Z
	for submit <at> debbugs.gnu.org; Wed, 01 Jul 2020 18:44:30 -0400
Received: from mail-wr1-f46.google.com ([209.85.221.46]:39046)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1jqlSq-0000HV-P6
 for 42145 <at> debbugs.gnu.org; Wed, 01 Jul 2020 18:44:28 -0400
Received: by mail-wr1-f46.google.com with SMTP id q5so25746201wru.6
 for <42145 <at> debbugs.gnu.org>; Wed, 01 Jul 2020 15:44:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=78JwTGOecYEXVO6aIL40YVeEXb+Ct39n5ScEJIYUYHU=;
 b=O1JiOz0xi57XsyDHKvP5wsG/v12KBQfk9qlLnWiFOpON6DRrw6TUd6EgLbEwVAUR+T
 1PpQOh/5irCCYaH3TgKChTDCW2wJmJa3BOc06T1J7eIxtbIi3OANkOPKr2STmmpUYbjl
 twAXH8xg3zHsixLx6EjPktwmL75EKUY/FlrPzepIvKvmLe7WoqzwjLV3vJibO8g/JTYI
 zkaUilRajOmdFLsNP8Rpo/KgKRnBA6eGJnuHrW5u2qISvycz4dbgH93YjyTzAgAFsWlJ
 pkOBRHwyyA7yaOJDhZ2IpYgLBX82MlkgVTFY7ScCp4WHhMgpdHQ8I8mqjY5sYl36/Yjx
 3oZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=78JwTGOecYEXVO6aIL40YVeEXb+Ct39n5ScEJIYUYHU=;
 b=N+KBFrXTSOhE23jySj9qYGh22NTX4DG9B+NWOWOaXX7twjEQ7J+754DCId5RPoIGcK
 JgFjoP+oXjNfl9Yu8SrOcZjr4yy7TC5rOywzFMPhkyLswDqcXcb3vZCH9a67Ax/Piu+Y
 DC9pxwOBZZaM7Bgg6MBqEF0Hst9lJS7iNF0MLRt3Rqbpnt81Xr/CqVGLgDYNqHEpfcEv
 2sMXRcZnbDpVNUX+7zLeZDqkHiaMGle6f5sSXA1Izhg4d3m1xjZuFMfjqCbeD+zmf2zt
 6xgUO66JMytNrkHbs9dCP+Ku69icHnepsFFHK+161AKs27CsuwtS0xZixMx9fS+r1DsA
 VaWQ==
X-Gm-Message-State: AOAM530vPQT5BS3vadIHQuTyyNZ0+O2TIFGMAv206h7hZXKcjif4cVNc
 o9LUgzpOaxJYm/e8ftv9XUN8rxCb
X-Google-Smtp-Source: ABdhPJyd/hNcAXqikjrebM7eTdekNmplyqax8oif/lplCvp4RaIs3oJRYCQSzOTcWJTt2THD01GlmQ==
X-Received: by 2002:a05:6000:1c8:: with SMTP id
 t8mr30696122wrx.73.1593643458421; 
 Wed, 01 Jul 2020 15:44:18 -0700 (PDT)
Received: from [192.168.0.3] ([66.205.73.129])
 by smtp.googlemail.com with ESMTPSA id 138sm2985641wmb.1.2020.07.01.15.44.17
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 01 Jul 2020 15:44:17 -0700 (PDT)
Subject: Re: bug#42145: vc-git file order mismatch between vc-dir and vc-diff
To: Juri Linkov <juri@HIDDEN>
References: <87bll048br.fsf@HIDDEN>
 <fbcbcdb9-391d-50ed-8fb4-6c1b832639bb@HIDDEN>
 <871rluewrf.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <82542bee-ec10-86b6-39bb-8d4fa0c68770@HIDDEN>
Date: Thu, 2 Jul 2020 01:44:15 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.8.0
MIME-Version: 1.0
In-Reply-To: <871rluewrf.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 42145
Cc: 42145 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

On 02.07.2020 00:44, Juri Linkov wrote:
 >> 'git diff' has a '-O' argument, which accepts <orderfile>. Maybe
 >> it'll help, but I kind of doubt that. Ideas welcome.

 > Maybe it's possible to write a diff-mode function to sort file hunks
 > in
 > vc-diff output buffer?  Maybe by just giving the right file-beginning
 > regexp to sort-subr?

Which sort-subr?

Overall, it sounds possible. But I would be careful about making the 
display of long diffs slower.

>> 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.
> But I wonder how it could handle binary files where git-diff output says just
> "Binary files differ".

Perhaps it wouldn't.

Or perhaps it would check them in wholesale, without choosing individual 
pieces inside.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42145; Package emacs. Full text available.

Message received at 42145 <at> debbugs.gnu.org:


Received: (at 42145) by debbugs.gnu.org; 1 Jul 2020 22:10:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 01 18:10:33 2020
Received: from localhost ([127.0.0.1]:53861 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jqkw5-0005kp-3C
	for submit <at> debbugs.gnu.org; Wed, 01 Jul 2020 18:10:33 -0400
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:60401)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1jqkw1-0005kX-06
 for 42145 <at> debbugs.gnu.org; Wed, 01 Jul 2020 18:10:32 -0400
X-Originating-IP: 91.129.96.187
Received: from mail.gandi.net (m91-129-96-187.cust.tele2.ee [91.129.96.187])
 (Authenticated sender: juri@HIDDEN)
 by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id D34E62000A;
 Wed,  1 Jul 2020 22:10:21 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#42145: vc-git file order mismatch between vc-dir and vc-diff
Organization: LINKOV.NET
References: <87bll048br.fsf@HIDDEN>
 <fbcbcdb9-391d-50ed-8fb4-6c1b832639bb@HIDDEN>
Date: Thu, 02 Jul 2020 00:44:04 +0300
In-Reply-To: <fbcbcdb9-391d-50ed-8fb4-6c1b832639bb@HIDDEN> (Dmitry Gutov's
 message of "Wed, 1 Jul 2020 01:08:04 +0300")
Message-ID: <871rluewrf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 42145
Cc: 42145 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

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

The current sorting order in vc-dir is quite good,
so better not to change it.

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

Maybe it's possible to write a diff-mode function to sort file hunks in
vc-diff output buffer?  Maybe by just giving the right file-beginning regexp
to sort-subr?

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

Nice idea.

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

But I wonder how it could handle binary files where git-diff output says just
"Binary files differ".




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42145; Package emacs. Full text available.

Message received at 42145 <at> debbugs.gnu.org:


Received: (at 42145) by debbugs.gnu.org; 30 Jun 2020 22:08:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 30 18:08:15 2020
Received: from localhost ([127.0.0.1]:51885 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jqOQJ-00086R-9r
	for submit <at> debbugs.gnu.org; Tue, 30 Jun 2020 18:08:15 -0400
Received: from mail-wr1-f65.google.com ([209.85.221.65]:42344)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1jqOQH-00086E-En
 for 42145 <at> debbugs.gnu.org; Tue, 30 Jun 2020 18:08:13 -0400
Received: by mail-wr1-f65.google.com with SMTP id o11so21678972wrv.9
 for <42145 <at> debbugs.gnu.org>; Tue, 30 Jun 2020 15:08:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=uEgKeqrkQxj9+NFOdI8REVVKqBdi3GscF0dvz4fRdbo=;
 b=MFVY5ZgkaTqH5Gx8cgfH9ikk6OAKCaOJBbebpN1WHiNLQJI9QGkT4PUiDSAl7jwtzG
 mdSsu3HA8S08Enlggdljd9v9KTnLQho3fpXwi7kgwUmJKKxYyeconZ19nA343JeAxjU5
 oqqeV1aVq0srKgHZz6Jmy1Z8y4iGWVbpy2kPn9B15dj6z3NMf4fUjkCZyxzUI83APCxt
 2BjI/lGb/VH/TgshIqPapp7aRtwxWysJ9HJkNS0b9Dk7/3jz7+zBek6YWNyCpo9VgiXp
 XcAnRjHEMYvOQ8foEPODrrY14e6UXTAl4T2es7yvRxAhpfBDcMMhiDXEqCVeWnPLnp/V
 LwnA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=uEgKeqrkQxj9+NFOdI8REVVKqBdi3GscF0dvz4fRdbo=;
 b=mFAdi0pbBDe+F2/3Vf/PD5xJVXQq0qFiHWJP8UZtdv1SdwLl14N3TRDoB1q2R9bOhG
 +fKrdXcFlC9E7AF6DcX+fPQok6Pw+0w7tNe9m/bRMb3+gTEK7bhOroswjKQDdX3kn8ps
 p6BkvDNap8UBNzBUH5nYFKvJpx9t1GKu13G5hychdk2zfAgjKyQqDvdbyRRUZkPgOPUm
 eK+E7ixo7Dkgsrlh6ojZakDHvUcAL0gaeiGChr0pbmk+vgqHqMepHOhFUzW/IC2pysli
 3rAeUFRI5fSZUjfcBpXioKS9Uk5aMSr3h/IU80PLW9UjpUySO12cjItoCVe93kwELDUe
 NsOA==
X-Gm-Message-State: AOAM530qeXKOJ+Ec0l2f1xfR6smUwifPEcrannErBTQIQFDp23s1oCr2
 MH6CetHhOvcEOr4IimSCBs9GyuR+
X-Google-Smtp-Source: ABdhPJx75aF/ZJlxOcNJ8KaYSW+zd5zHa80JnrJjmZ2Abb3clppp7/YsCfB0l+LOWwsEaXBmeB8xuQ==
X-Received: by 2002:adf:a491:: with SMTP id g17mr24959049wrb.132.1593554887217; 
 Tue, 30 Jun 2020 15:08:07 -0700 (PDT)
Received: from [192.168.0.3] ([66.205.73.129])
 by smtp.googlemail.com with ESMTPSA id k14sm4847150wrn.76.2020.06.30.15.08.06
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Tue, 30 Jun 2020 15:08:06 -0700 (PDT)
Subject: Re: bug#42145: vc-git file order mismatch between vc-dir and vc-diff
To: Juri Linkov <juri@HIDDEN>, 42145 <at> debbugs.gnu.org
References: <87bll048br.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <fbcbcdb9-391d-50ed-8fb4-6c1b832639bb@HIDDEN>
Date: Wed, 1 Jul 2020 01:08:04 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.8.0
MIME-Version: 1.0
In-Reply-To: <87bll048br.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42145
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42145; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 30 Jun 2020 21:33:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 30 17:33:47 2020
Received: from localhost ([127.0.0.1]:51824 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jqNsx-0007Ds-IJ
	for submit <at> debbugs.gnu.org; Tue, 30 Jun 2020 17:33:47 -0400
Received: from lists.gnu.org ([209.51.188.17]:36056)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1jqNsv-0007Df-Q9
 for submit <at> debbugs.gnu.org; Tue, 30 Jun 2020 17:33:46 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49966)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1jqNsv-00076H-I0
 for bug-gnu-emacs@HIDDEN; Tue, 30 Jun 2020 17:33:45 -0400
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:44531)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1jqNss-0003Di-0f
 for bug-gnu-emacs@HIDDEN; Tue, 30 Jun 2020 17:33:45 -0400
X-Originating-IP: 91.129.96.187
Received: from mail.gandi.net (m91-129-96-187.cust.tele2.ee [91.129.96.187])
 (Authenticated sender: juri@HIDDEN)
 by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 060206000A
 for <bug-gnu-emacs@HIDDEN>; Tue, 30 Jun 2020 21:33:38 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: vc-git file order mismatch between vc-dir and vc-diff
Organization: LINKOV.NET
Date: Tue, 30 Jun 2020 23:57:28 +0300
Message-ID: <87bll048br.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=217.70.183.195; envelope-from=juri@HIDDEN;
 helo=relay3-d.mail.gandi.net
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/30 17:33:39
X-ACL-Warn: Detected OS   = Linux 3.11 and newer
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

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.

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.

Is it possible to fix the file sorting order either in vc-dir
or in vc-diff buffers?




Acknowledgement sent to Juri Linkov <juri@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#42145; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 8 Mar 2025 19:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.