From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Davis Herring Newsgroups: gmane.emacs.devel Subject: Re: Don't complain about changed file when it hasn't changed Date: Mon, 29 Aug 2016 13:22:15 -0600 Organization: XCP-1 Message-ID: References: <83oa4bbq5b.fsf@gnu.org> <28f1147e-3aa7-b574-b420-ef18ebe699b5@lanl.gov> <83zinva1lt.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1472498560 6607 195.159.176.226 (29 Aug 2016 19:22:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 29 Aug 2016 19:22:40 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 29 21:22:36 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1beS8h-0001LY-N2 for ged-emacs-devel@m.gmane.org; Mon, 29 Aug 2016 21:22:35 +0200 Original-Received: from localhost ([::1]:45394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beS8e-0003KC-PX for ged-emacs-devel@m.gmane.org; Mon, 29 Aug 2016 15:22:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beS8V-0003FP-Q3 for emacs-devel@gnu.org; Mon, 29 Aug 2016 15:22:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1beS8R-0000IU-Ks for emacs-devel@gnu.org; Mon, 29 Aug 2016 15:22:22 -0400 Original-Received: from proofpoint4.lanl.gov ([204.121.3.52]:53823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beS8R-0000IP-EP; Mon, 29 Aug 2016 15:22:19 -0400 Original-Received: from mailrelay1.lanl.gov (mailrelay1.lanl.gov [128.165.4.101]) by mailgate4.lanl.gov (8.15.0.59/8.15.0.59) with ESMTP id u7TJMFxL002325; Mon, 29 Aug 2016 13:22:15 -0600 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 7F321141B68B; Mon, 29 Aug 2016 13:22:15 -0600 (MDT) X-NIE-2-Virus-Scanner: amavisd-new at mailrelay1.lanl.gov Original-Received: from chinstrap.lanl.gov (chinstrap.lanl.gov [128.165.123.246]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 6144F141B689; Mon, 29 Aug 2016 13:22:15 -0600 (MDT) In-Reply-To: <83zinva1lt.fsf@gnu.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.15.154, 1.0.3, 0.0.0000 definitions=2016-08-29_09:2016-08-29, 2016-08-29, 1970-01-01 signatures=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 204.121.3.52 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206903 Archived-At: > I don't understand why Git touches files it doesn't need to change. > It can (and does, AFAIK) compute the checksum of a file to know > whether it changed. True that for a basic "git checkout new-branch" Git compares the (tree and blob) hashes to decide what files to touch. However: $ git init Initialized empty Git repository in /tmp/grd/.git/ $ touch a b $ git add a b $ git commit -m "initial" [master (root-commit) ad16e59] initial 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 a create mode 100644 b $ echo >>a $ git commit -am "newline: a" [master 9023233] newline: a 1 files changed, 1 insertions(+), 0 deletions(-) $ echo >>a $ git commit -am "newline 2: a" [master eeb78ed] newline 2: a 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout -q HEAD^ $ echo >>b $ git commit -am "newline: b" [detached HEAD 2332479] newline: b 1 files changed, 1 insertions(+), 0 deletions(-) $ stat -c %y b 2016-08-29 13:15:46.820780908 -0600 $ git rebase master First, rewinding head to replay your work on top of it... Applying: newline: b $ stat -c %y b 2016-08-29 13:16:04.538756145 -0600 As the output says, it "rewinds" your changes and reapplies them on top of the chosen commit. This could be considered an artifact of "git rebase"'s implementation as a shell script on top of the other git commands, but given the possibility of merge conflicts to resolve it's not clear that it "ought" to be done entirely in-memory before updating only those files that need it on disk. > AFAIU, the undo records are kept because you don't revert the buffer, > not because of the check. You could refuse to revert with the current > code, and keep the undo information, right? You could, but Emacs would be trusting you that the file really wasn't altered. You could check yourself with `diff-buffer-with-file', but that's tedious; I find I usually just toss the undo information (by typing 'r' in response to the query). Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.