From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#55578: 29.0.50; auto-revert-use-notify vs 'git checkout -- ' Date: Tue, 24 May 2022 17:58:36 +0200 Message-ID: <87leuqgbwz.fsf@miha-pc> References: <87r14lfpui.fsf@miha-pc> <87mtf7nnok.fsf@gmx.de> Reply-To: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12520"; mail-complaints-to="usenet@ciao.gmane.io" To: Michael Albinus , 55578@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 24 18:17:40 2022 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 1ntXE3-0002z1-EV for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 May 2022 18:17:40 +0200 Original-Received: from localhost ([::1]:48600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntXE2-0007bs-B5 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 May 2022 12:17:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWmM-0007R4-8d for bug-gnu-emacs@gnu.org; Tue, 24 May 2022 11:49:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59252) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWmL-0006WE-WC for bug-gnu-emacs@gnu.org; Tue, 24 May 2022 11:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ntWmL-00063n-Ro for bug-gnu-emacs@gnu.org; Tue, 24 May 2022 11:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 May 2022 15:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55578 X-GNU-PR-Package: emacs Original-Received: via spool by 55578-submit@debbugs.gnu.org id=B55578.165340731423260 (code B ref 55578); Tue, 24 May 2022 15:49:01 +0000 Original-Received: (at 55578) by debbugs.gnu.org; 24 May 2022 15:48:34 +0000 Original-Received: from localhost ([127.0.0.1]:53149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntWlt-000636-I6 for submit@debbugs.gnu.org; Tue, 24 May 2022 11:48:33 -0400 Original-Received: from kamnitnik.top ([209.250.245.214]:42544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntWlq-00062w-Bf for 55578@debbugs.gnu.org; Tue, 24 May 2022 11:48:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1653407308; bh=l5dQqfuLRe7Sg0iVtxgEdOo6QtD6opih2p6Io1h2sBM=; h=From:To:Subject:In-Reply-To:References:Date:From; b=uaWMkzQa7ZUh7Ejlzax/xzlpRrxwvwCU9g8fWh8nq33Gjml1rues3Bx7r3jPmD2Lw 4qtliRjuaQHjwvuBFmw2yHt3x4kfn/ve/3RCL5OCRzIaZwMMSRaKAxjCLAuOzipgtz CsGLg9384LNl6VOUBZn6bs/bZjp/iVXWVE/w1VFt5J4Y1K20ue3YEKuPbN6TfGaEYN WJZp5OZaNzPSGcK6vHx5dAvGIRzK68FBDTBskdqU2L0X0hiFqU0H4ztNdOavgh5bZ8 kGFsuvhupsfIB3CkwwzpYfho7jxGcKkUBtlEZrwyoWz+623dothNgfpqgqUBWruQO5 dxb2UBidisrxQ== In-Reply-To: <87mtf7nnok.fsf@gmx.de> 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" Xref: news.gmane.io gmane.emacs.bugs:233017 Archived-At: --=-=-= Content-Type: text/plain Michael Albinus writes: > Indeed, git deletes and (re-)creates the file. See the following file > notify events, when monitoring the git repository (/tmp/xxx is the repo, > /tmp/xxx/foo the file). This happens, after calling "git checkout -- foo": > > --8<---------------cut here---------------start------------->8--- > file-notify-handle-event (file-notify ((1 . 0) (delete) "foo" 0) file-notify--callback-inotify) > file-notify-handle-event (file-notify ((1 . 0) (create) "foo" 0) file-notify--callback-inotify) > file-notify-handle-event (file-notify ((1 . 0) (modify) "foo" 0) file-notify--callback-inotify) > --8<---------------cut here---------------end--------------->8--- > > The corresponding events for the file /tmp/xxx/foo are > > --8<---------------cut here---------------start------------->8--- > file-notify-handle-event (file-notify ((1 . 1) (delete) "foo" 0) file-notify--callback-inotify) > file-notify-callback (1 . 1) deleted "/tmp/xxx/foo" nil #s(file-notify--watch "/tmp/xxx" "foo" auto-revert-notify-handler) "/tmp/xxx/foo" "/tmp/xxx" > auto-revert-notify-handler ((1 . 1) deleted "/tmp/xxx/foo") > file-notify-handle-event (file-notify ((1 . 1) stopped "/tmp/xxx/foo") auto-revert-notify-handler) > auto-revert-notify-handler ((1 . 1) stopped "/tmp/xxx/foo") > --8<---------------cut here---------------end--------------->8--- > > As you can see, file notifications are stopped after receiving the > 'delete' event. This is a feature of our file notifications implementation. > > Running "echo test >> foo" instead shows the events > > --8<---------------cut here---------------start------------->8--- > file-notify-handle-event (file-notify ((1 . 0) (modify) "foo" 0) file-notify--callback-inotify) > file-notify-callback (1 . 0) changed "/tmp/xxx/foo" nil #s(file-notify--watch "/tmp/xxx" nil auto-revert-notify-handler) "/tmp/xxx" "/tmp/xxx" > auto-revert-notify-handler ((1 . 0) changed "/tmp/xxx/foo") > --8<---------------cut here---------------end--------------->8--- > > This works as expected. So I fear there's nothing we can do. I imagine that after receiving a 'delete' event, auto-revert-mode could set up a file-notify watch handler on the directory containing the (now deleted) file. This handler would respond to a 'create' event corresponding to the filename by reverting the buffer, removing the directory file-notify watch and (re-)adding an ordinary file-notify handler on the file. Are there any obvious flaws with this approach that I'm missing? > Best regards, Michael. Best regards. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmKNAKwTHG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZP2e6D/4vg4chM7OkaZo9b0MlvQo4d+q08DUB v8AhCtUQgw47gPHiHS1b5WhiRXiyK4hEg1YRTRmTjaasm25YZRb0wsTscki6fVgu gR5r/D7KJkVYd7oM240AVInmX44IcgADE1yipDev2JEqXmvtFPlKDiWeqtfnRvhH VR/22AlqJBOCn///QYi/oXAhopMWn+6/hrpSb0u1W7vy7XyzSSPaGmKu0r3nK1uW GPfFeo+h5+sb/9MdkAPLyZR+Xdrf7CRFMUFldof2VLc+o7+BBub8bFhk8/Nk688d buUGDF1ZsQtsKumFYAotPgoKRI7vKOlw+i9LiQ8LMWFhXx+11I7ToCf9lEpp6YNl zaAoyB+0oLSpZX2S5jE++/f937FUVSlsGslPxICsqki2BphkA2GoC20u9UrIm2ha I9jAS4F3WGYTg9M3vvacqvXuXRHAgtC4bkc1k7L9xZE6gySiJZSwdfTio9g0RAjY EahlmubGHdtzORG+pZvCI2u328lBW4bvkSuKWMB8zSEN8tHwKLmz8sY7PA3CLnSP N2tHC1jETjHxIi9mstQbXM7NfOgvX7V8MR8Lury3C0ufZ+VHFLmoA5nue++X7fOl /7IxapsqpWVnY1myG4XxIlpAUwqNBYcbqTO4KygxOVw547B17uvxx7aQSBhipFZo u6ow4kgj7SJ08g== =6GeB -----END PGP SIGNATURE----- --=-=-=--