About two weeks ago, Andrea Crotti wrote:
> On 01/19/2012 07:51 PM, Eli Barzilay wrote:
> > I've lost a bunch of little bits of work here and there in the
> > past, and now that I lost a more substantial bit I finally sat
> > down to find the guilty party -- which turned out to be magit.
> >
> > It's probably best to explain what I do:
> >
> >    * Open some file, work on it.
> >
> >    * Do a pull to get my repo updated, find that the git doesn't
> >      like the file with the edits there.
> >
> >    * Run a git checkout on the file, re-run the pull.
> >
> >    * rm the file, save the buffer that still holds my edited
> >      version.
> 
> Yes I agree with you, this should not be the default behaviour.  But
> how is it possible that it just reverted the buffers (which were
> modified) without even asking you for confirmation?  Are you sure
> you have default settings about that?  In particular
> revert-without-query is by default nil on my machine..

I should have clarifiedL when I say "work on it" I mean that it's also
saved.  After I see the problem in updating, I just re-checkout the
file on disk, and Emacs thinks that the file is unmodified.  If at
this point I'll touch the file again, it will obviously notice that it
was changed on disk and offer to revert it.  It asks about it, since
there could be important stuff that will get lost -- which is exactly
the right thing for me.

What magit does, is that revert operation, but it doesn't ask about
it, and thefore I do lose that work, and until that incident, without
even knowing about it.  (I later realized that this was the reason for
a few times I pushed code out and later wondered how come I forgot
some change.)

I think that magit should leave the buffers as is, because any layer
of convenience in keeping files up-to-date should be left for some
lower-level code.  In this case, the code is already there, and it's
already doing the right thing (ask when the buffer is touched).
Another example where not doing the clever thing that it tries to do
now pays of: I override that ask-about-revert thing, and make it auto
revert after a ding to alert me, and making sure that I can undo the
revert operation so nothing gets lost.  Because magit updates the
files behind my back, all that code is made irrelevant.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Reply via email to