From: Davis Herring <herring@lanl.gov>
To: Eli Zaretskii <eliz@gnu.org>
Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org
Subject: Re: Don't complain about changed file when it hasn't changed
Date: Mon, 29 Aug 2016 13:22:15 -0600 [thread overview]
Message-ID: <a87a9f0b-a909-3145-f09d-eea3675a14cf@lanl.gov> (raw)
In-Reply-To: <83zinva1lt.fsf@gnu.org>
> 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.
next prev parent reply other threads:[~2016-08-29 19:22 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-29 0:29 Don't complain about changed file when it hasn't changed Stefan Monnier
2016-08-29 3:36 ` Clément Pit--Claudel
2016-08-29 3:39 ` Daniel Colascione
2016-08-29 3:43 ` Clément Pit--Claudel
2016-08-29 6:44 ` Michael Albinus
2016-08-29 14:42 ` Eli Zaretskii
2016-08-29 16:18 ` Michael Albinus
2016-08-29 17:42 ` Davis Herring
2016-08-29 17:57 ` Clément Pit--Claudel
2016-08-29 19:10 ` Davis Herring
2016-08-29 13:17 ` Stefan Monnier
2016-08-30 9:20 ` Michael Albinus
2016-08-30 15:00 ` Stefan Monnier
2016-08-30 13:40 ` Clément Pit--Claudel
2016-08-30 15:01 ` Stefan Monnier
2016-08-30 15:23 ` Clément Pit--Claudel
2016-08-30 15:48 ` Stefan Monnier
2016-08-30 16:55 ` Eli Zaretskii
2016-08-30 16:11 ` Eli Zaretskii
2016-08-30 16:38 ` Clément Pit--Claudel
2016-08-29 14:34 ` Eli Zaretskii
2016-08-29 14:50 ` Stefan Monnier
2016-08-30 15:26 ` Eli Zaretskii
2016-08-30 15:44 ` Stefan Monnier
2016-08-30 16:15 ` Eli Zaretskii
2016-08-30 17:13 ` Stefan Monnier
2016-08-30 17:26 ` Eli Zaretskii
2016-08-30 18:02 ` Stefan Monnier
2016-08-30 15:46 ` Stefan Monnier
2016-08-30 16:19 ` Eli Zaretskii
2016-08-30 17:16 ` Stefan Monnier
2016-08-30 17:32 ` Eli Zaretskii
2016-08-30 18:06 ` Stefan Monnier
2016-09-01 13:49 ` Eli Zaretskii
2016-09-02 15:22 ` Stefan Monnier
2016-09-02 15:26 ` Eli Zaretskii
2016-09-02 15:44 ` Stefan Monnier
2016-09-02 15:39 ` Joost Kremers
2016-08-29 16:01 ` Stefan Monnier
2016-08-29 16:26 ` Eli Zaretskii
2016-08-30 0:35 ` Stefan Monnier
2016-08-29 17:50 ` Davis Herring
2016-08-29 18:09 ` Eli Zaretskii
2016-08-29 19:22 ` Davis Herring [this message]
2016-08-30 0:39 ` Stefan Monnier
2016-08-30 7:55 ` Andreas Schwab
2016-08-30 0:37 ` Stefan Monnier
2016-08-30 1:23 ` Rolf Ade
2016-08-30 15:12 ` Eli Zaretskii
2016-08-30 15:34 ` Clément Pit--Claudel
2016-08-30 16:14 ` Eli Zaretskii
2016-09-06 16:29 ` John Wiegley
2016-09-06 17:50 ` Stefan Monnier
2016-09-06 17:52 ` John Wiegley
2016-09-06 19:00 ` Andreas Röhler
2016-09-06 21:00 ` Stefan Monnier
2016-09-06 21:29 ` Drew Adams
2016-09-06 21:41 ` Karl Fogel
2016-09-06 21:59 ` Paul Eggert
2016-09-06 22:01 ` Karl Fogel
2016-09-06 22:07 ` Davis Herring
2016-09-06 22:21 ` Karl Fogel
2016-09-06 22:46 ` Clément Pit--Claudel
2016-09-07 0:24 ` Stefan Monnier
2016-09-07 16:49 ` Karl Fogel
2016-09-07 18:41 ` Andreas Röhler
2016-09-07 20:02 ` Karl Fogel
2016-09-06 22:03 ` Karl Fogel
2016-12-24 1:03 ` Rolf Ade
2016-12-25 15:44 ` Stefan Monnier
2016-12-26 0:29 ` Rolf Ade
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a87a9f0b-a909-3145-f09d-eea3675a14cf@lanl.gov \
--to=herring@lanl.gov \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.