all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* VC / Git: amend function / mark for add / timing
@ 2009-10-12  0:30 David Reitter
  2009-10-12  6:55 ` David Kastrup
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: David Reitter @ 2009-10-12  0:30 UTC (permalink / raw)
  To: Emacs development discussions; +Cc: julliard, spiegel

It would be nice if VC provided a function to add the "--amend"  
argument to "git commit" so that the last commit is amended.  This is  
useful when one forgets to check in file, especially after using C-x v  
v to commit a single file.   The logical binding I thought of at first  
was C-u C-x v v, but that seems to do something else.

Also, it's not obvious at all from the menu how to mark the file in  
the current buffer for addition, i.e. do a "git add".  Is this  
possible at all?

Finally, it takes several seconds when I open a file that's under git  
version control.  What can we do about this?  I think I complained  
about it at some point, and we didn't find a solution.   I'd rather  
have VC functions blocked until the file status is obtained  
(asynchronically) rather than having to wait before I can do any  
viewing/editing on the file.  (But this particular solution would  
require a number of changes.)

Many thanks for improving vc-git!






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: VC / Git: amend function / mark for add / timing
  2009-10-12  0:30 VC / Git: amend function / mark for add / timing David Reitter
@ 2009-10-12  6:55 ` David Kastrup
  2009-10-13 17:28 ` Dan Nicolaescu
  2009-10-13 19:33 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: David Kastrup @ 2009-10-12  6:55 UTC (permalink / raw)
  To: emacs-devel

David Reitter <david.reitter@gmail.com> writes:

> It would be nice if VC provided a function to add the "--amend"
> argument to "git commit" so that the last commit is amended.  This is
> useful when one forgets to check in file, especially after using C-x v
> v to commit a single file.  The logical binding I thought of at first
> was C-u C-x v v, but that seems to do something else.
>
> Also, it's not obvious at all from the menu how to mark the file in
> the current buffer for addition, i.e. do a "git add".  Is this
> possible at all?

I don't think so unless you are using git.el.  My preferred candidate
for this would be C-x v i (since it basically does a git add for an
unregistered file, it could do the same for a registered file).

-- 
David Kastrup





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: VC / Git: amend function / mark for add / timing
  2009-10-12  0:30 VC / Git: amend function / mark for add / timing David Reitter
  2009-10-12  6:55 ` David Kastrup
@ 2009-10-13 17:28 ` Dan Nicolaescu
  2009-10-13 22:34   ` Juri Linkov
  2009-10-13 19:33 ` Stefan Monnier
  2 siblings, 1 reply; 6+ messages in thread
From: Dan Nicolaescu @ 2009-10-13 17:28 UTC (permalink / raw)
  To: David Reitter; +Cc: Emacs development discussions

David Reitter <david.reitter@gmail.com> writes:

  > It would be nice if VC provided a function to add the "--amend"
  > argument to "git commit" so that the last commit is amended.  This is
  > useful when one forgets to check in file, especially after using C-x v
  > v to commit a single file.   The logical binding I thought of at first
  > was C-u C-x v v, but that seems to do something else.

It shouldn't be too hard to implement this, just that someone needs to
figure out what is the best UI for it.

  > Also, it's not obvious at all from the menu how to mark the file in
  > the current buffer for addition, i.e. do a "git add".  Is this
  > possible at all?

You can do:
C-x v d
mark the files and directories you want
C-x v v




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: VC / Git: amend function / mark for add / timing
  2009-10-12  0:30 VC / Git: amend function / mark for add / timing David Reitter
  2009-10-12  6:55 ` David Kastrup
  2009-10-13 17:28 ` Dan Nicolaescu
@ 2009-10-13 19:33 ` Stefan Monnier
  2009-10-13 20:37   ` Alexandre Julliard
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2009-10-13 19:33 UTC (permalink / raw)
  To: David Reitter; +Cc: julliard, spiegel, Emacs development discussions

> It would be nice if VC provided a function to add the "--amend" argument to
> "git commit" so that the last commit is amended.  This is useful when one
> forgets to check in file, especially after using C-x v  v to commit a single
> file.   The logical binding I thought of at first was C-u C-x v v, but that
> seems to do something else.

Maybe VC should provide a generic way to provide addition args to pass
to the backend.

> Finally, it takes several seconds when I open a file that's under git
> version control.  What can we do about this?  I think I complained
> about it at some point, and we didn't find a solution.

Currently VC's design is that it assesses the file's VC-status (mostly,
whether or not it's under VC control and if so, under which backend and
what is its current revision number and/or modification status) when the
file gets opened, synchronously.

This presumes that vc-registered is very quick.  If it is not, we have
a problem.  In the case of Git, I believe there's no easy way for Emacs
to figure out whether a file is under Git's control short of running
Git, so the speed of vc-registered will depend on the speed of Git.

If you find this to be too slow, here's what we can do:
1- try to change vc-git-registered so it uses different Git commands
   that are quicker.
2- change vc-git-registered to always return non-nil in Git
   repositories, even for files which actually aren't controlled by Git,
   so we don't even need to run Git to get this answer.  This may
   require further changes to make sure that no other info is needed
   (e.g. file modification status) before a VC command is actually
   run.  It may also require moving Git to the end of
   vc-handled-backends.
3- as you suggest make it work asynchronously.  This would probably look
   like `2' above, except that the relevant info would appear later on,
   asynchronously, rather than doing it synchronously at the first
   VC command invocation.

So the first step would be to figure out *why* is the code so slow.
Is Git the culprit?  If so, why is it so slow?


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: VC / Git: amend function / mark for add / timing
  2009-10-13 19:33 ` Stefan Monnier
@ 2009-10-13 20:37   ` Alexandre Julliard
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Julliard @ 2009-10-13 20:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: David Reitter, spiegel, Emacs development discussions

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> Currently VC's design is that it assesses the file's VC-status (mostly,
> whether or not it's under VC control and if so, under which backend and
> what is its current revision number and/or modification status) when the
> file gets opened, synchronously.
>
> This presumes that vc-registered is very quick.  If it is not, we have
> a problem.  In the case of Git, I believe there's no easy way for Emacs
> to figure out whether a file is under Git's control short of running
> Git, so the speed of vc-registered will depend on the speed of Git.

I believe that vc-git-registered is fast, but vc-git-state can be slow,
because git-diff-index unpacks the tree objects for all the files in the
head commit to check them against the index. On an unpacked repo with a
cold disk cache that can take a while.

I don't see a way to get a proper status without doing a diff-index, but
it would probably be possible to fix Git to apply the pathname filter at
a higher level to avoid accessing unnecessary objects.

-- 
Alexandre Julliard
julliard@winehq.org




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: VC / Git: amend function / mark for add / timing
  2009-10-13 17:28 ` Dan Nicolaescu
@ 2009-10-13 22:34   ` Juri Linkov
  0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2009-10-13 22:34 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: David Reitter, emacs-devel

>   > It would be nice if VC provided a function to add the "--amend"
>   > argument to "git commit" so that the last commit is amended.  This is
>   > useful when one forgets to check in file, especially after using C-x v
>   > v to commit a single file.   The logical binding I thought of at first
>   > was C-u C-x v v, but that seems to do something else.
>
> It shouldn't be too hard to implement this, just that someone needs to
> figure out what is the best UI for it.

I think we already have the best UI in PCL-CVS where the prefix key C-u
asks for additional arguments.

-- 
Juri Linkov
http://www.jurta.org/emacs/




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-10-13 22:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-12  0:30 VC / Git: amend function / mark for add / timing David Reitter
2009-10-12  6:55 ` David Kastrup
2009-10-13 17:28 ` Dan Nicolaescu
2009-10-13 22:34   ` Juri Linkov
2009-10-13 19:33 ` Stefan Monnier
2009-10-13 20:37   ` Alexandre Julliard

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.