GNU bug report logs - #2678
vc-git-register not working when passed a directory argument

Previous Next

Package: emacs;

Reported by: Miles Bader <miles <at> gnu.org>

Date: Sun, 15 Mar 2009 06:15:04 UTC

Severity: normal

Done: Dan Nicolaescu <dann <at> ics.uci.edu>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 2678 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Miles Bader <miles <at> gnu.org>
Cc: 2678 <at> debbugs.gnu.org
Subject: Re: bug#2678: 23.0.91; vc-next-action in vc-dir acts strangely when  only adds are necessary
Date: Fri, 20 Mar 2009 19:54:05 -0700 (PDT)
Miles Bader <miles <at> gnu.org> writes:

  > On Sat, Mar 21, 2009 at 1:15 AM, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:
  > > Given that you are familiar with git, the function to fix to get this
  > > working is the one liner `vc-git-register':
  > >
  > > (defun vc-git-register (files &optional rev comment)
  > >  "Register FILE into the git version-control system."
  > >  (vc-git-command nil 0 files "update-index" "--add" "--"))
  > ...
  > > (vc-git-register "/tmp/zonk2/")
  > 
  > The obvious solution is to use "add" instead of "update-index --add".
  > 
  > [I tested it, it works.]
  > 
  > However, it'd be nice to ask whoever wrote this function originally
  > whether there was a reason for using "update-index" instead of "add",

I'd assume it would be the vc-git.el author.

  > given that vc.el apparently expects higher-level level functionality
  > (recursion) from the register hook.  I suppose update-index is the
  > more conservative choice, since it's officially "plumbing", but I'm
  > not aware of any problems with using the higher-level git-add in this
  > case.  [The git backend already uses "add" in other places too.]
  > 
  > Also, I wonder:
  > 
  >   (1) Given that vc-dir already has a list of files presented in the
  > directory listing, how come it doesn't give the backend that list,
  > instead of just the directory (having the backend do the recursion
  > seems more likely to yield unexpected results)?

When the point is on the "./" entry (or before), and nothing is selected
it means that you are asking for an action to be performed on the
directory, that is gets sent to the VC command.
If you want a list of files to be sent, mark a list of files and that is
what will be sent.

  >    (2) Perhaps vc-dir it should do a "revert-buffer" (or something)
  > afterwards when it operations on a subdirectory or the whole
  > directory, as any operation with the backend doing the recursion may
  > change something other than what is displayed.  This is easy to see if
  > their were unregistered subdirectories with files -- doing "v" to
  > register a subdirectory adds all files in that directory, which vc-dir
  > hadn't displayed before, so currently "v" doesn't properly show them
  > afterwards (doing "g" shows them).

It does, but there might be other things not working correctly with git,
try with hg and you will see it working correctly.




This bug report was last modified 15 years and 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.