From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60897: 29.0.60; vc-revert fails to revert buffer Date: Sun, 22 Jan 2023 21:50:26 +0200 Message-ID: <83cz76jqm5.fsf@gnu.org> References: <29401.1674004194@hassadar.pretzelnet.org> <86edrr4zcz.fsf@mail.linkov.net> <868rhu5w0u.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1514"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60897@debbugs.gnu.org, epg@pretzelnet.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 22 20:51:22 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pJgN8-000AeN-5L for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Jan 2023 20:51:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJgMp-00015j-TH; Sun, 22 Jan 2023 14:51:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJgMo-00015V-KR for bug-gnu-emacs@gnu.org; Sun, 22 Jan 2023 14:51:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJgMo-0001Gj-CY for bug-gnu-emacs@gnu.org; Sun, 22 Jan 2023 14:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pJgMo-0004xT-1J for bug-gnu-emacs@gnu.org; Sun, 22 Jan 2023 14:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Jan 2023 19:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60897 X-GNU-PR-Package: emacs Original-Received: via spool by 60897-submit@debbugs.gnu.org id=B60897.167441703918998 (code B ref 60897); Sun, 22 Jan 2023 19:51:02 +0000 Original-Received: (at 60897) by debbugs.gnu.org; 22 Jan 2023 19:50:39 +0000 Original-Received: from localhost ([127.0.0.1]:52666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJgMQ-0004wL-P7 for submit@debbugs.gnu.org; Sun, 22 Jan 2023 14:50:39 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJgML-0004vr-T9 for 60897@debbugs.gnu.org; Sun, 22 Jan 2023 14:50:37 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJgMB-0001D0-Po; Sun, 22 Jan 2023 14:50:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=JKjIIU2K+8q4P0YmeV6g1ieuMkTpADnFUidgjukmQFI=; b=H44XmkktDKjZ p15AIeEm5SVULhkodBZmIselHFTnuqV0dqLjn2Gb7bsJChTBKJrXyMzxOghPPNgU9ABz8hviclRfp 4ePDLTDOd2QBz8ZTqzf9CCbOnQdNXHGmz6UxPuoSyu+vwLZsFko5qfWvJxP1Sc8ampsLVY2x4VcVO 4wdgBSmUeWMtCt+BnSCZi2HyXYwR438frRykuI8dCacVoyOCVDYmazn4IUfS8eP7j+weQ8Zk8JCRC 5Tq1RCeBDRokfK/GRyQHShpTj+iZoQ+FiBdV5Xxymn//I1CAh1rvaOJYNp75dlxQsPWw74c6umcjT HZewixc24RNF8HDvnYNVvQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJgM9-0004Ps-F8; Sun, 22 Jan 2023 14:50:22 -0500 In-Reply-To: <868rhu5w0u.fsf@mail.linkov.net> (message from Juri Linkov on Sun, 22 Jan 2023 19:17:21 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:253959 Archived-At: > Cc: 60897@debbugs.gnu.org > From: Juri Linkov > Date: Sun, 22 Jan 2023 19:17:21 +0200 > > > But as you noticed it doesn't refresh the buffer. This is because > > vc-deduce-fileset in the diff buffer now returns relative file names, > > not absolute as vc-resynch-buffer expects. > > > > Expanding relative file names to absolute is not possible in > > diff-vc-deduce-fileset, because then C-x v v will fail in > > vc-default-checkin-patch that expects relative file names. > > > > So I think the right place to do this is before trying to compare > > relative names with (string= buffer-file-name file): > > > > diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el > > @@ -643,6 +643,8 @@ vc-resynch-buffers-in-directory > > > > (defun vc-resynch-buffer (file &optional keep noquery reset-vc-info) > > "If FILE is currently visited, resynch its buffer." > > + (unless (file-name-absolute-p file) > > + (setq file (expand-file-name file (vc-root-dir)))) > > (if (string= buffer-file-name file) > > (vc-resynch-window file keep noquery reset-vc-info) > > (if (file-directory-p file) > > Eli, is this ok for the emacs-29 branch? I'm unsure because > vc-resynch-buffer is used in too many places, so this change > is not localized to vc-revert. You could use the expanded file name only for the purposes of the string= call, no? Then the effect of this change would be very local and thus safer.