From: Dan Nicolaescu <dann@ics.uci.edu>
To: Tom Tromey <tromey@redhat.com>
Cc: 4206@emacsbugs.donarmstrong.com
Subject: bug#4206: 23.1; vc-dir bug with git
Date: Sun, 23 Aug 2009 04:57:14 -0700 (PDT) [thread overview]
Message-ID: <200908231157.n7NBvErL011081@godzilla.ics.uci.edu> (raw)
In-Reply-To: <m33a7l2h7n.fsf@fleche.redhat.com> (Tom Tromey's message of "Fri, 21 Aug 2009 11:46:04 -0600")
Tom Tromey <tromey@redhat.com> writes:
> >>>>> "Dan" == Dan Nicolaescu <dann@ics.uci.edu> writes:
>
> Dan> What's the right thing to do here?
> Dan> vc-git-register does not support (yet?) passing directories as an
> Dan> argument.
>
> I think the best situation would be for vc-dir to understand
> unregistered directories (and not display them twice), and for
> vc-git-register to be able to run "git add" on a directory.
The patch below helps.
But the *vc-dir* buffer does not get updated correctly.
Maybe vc-git-dir-status-files does not work quite right, but it's hard
to tell without being a low level git expert.
> "git add DIR" usually does the right thing and in any case if it "overshoots" it
> can be corrected.
It seems that vc-git-revert does not revert files in the 'added state to
'unregistered state. It does not seem that all VC backends behave
consistently in this situation :-(
--- vc-dir.el.~1.40.~ 2009-08-20 23:40:25.000000000 -0700
+++ vc-dir.el 2009-08-23 04:02:01.000000000 -0700
@@ -326,8 +326,9 @@ If BODY uses EVENT, it should be a varia
(or (vc-dir-fileinfo->directory data)
;; Otherwise compute it from the file name.
(file-name-directory
- (expand-file-name
- (vc-dir-fileinfo->name data))))))
+ (directory-file-name
+ (expand-file-name
+ (vc-dir-fileinfo->name data)))))))
(defun vc-dir-update (entries buffer &optional noinsert)
"Update BUFFER's ewoc from the list of ENTRIES.
@@ -343,8 +344,10 @@ If NOINSERT, ignore elements on ENTRIES
;; names too many times
(sort entries
(lambda (entry1 entry2)
- (let ((dir1 (file-name-directory (expand-file-name (car entry1))))
- (dir2 (file-name-directory (expand-file-name (car entry2)))))
+ (let ((dir1 (file-name-directory
+ (directory-file-name (expand-file-name (car entry1)))))
+ (dir2 (file-name-directory
+ (directory-file-name (expand-file-name (car entry2))))))
(cond
((string< dir1 dir2) t)
((not (string= dir1 dir2)) nil)
@@ -362,7 +365,8 @@ If NOINSERT, ignore elements on ENTRIES
(while (and entry node)
(let* ((entryfile (car entry))
- (entrydir (file-name-directory (expand-file-name entryfile)))
+ (entrydir (file-name-directory (directory-file-name
+ (expand-file-name entryfile))))
(nodedir (vc-dir-node-directory node)))
(cond
;; First try to find the directory.
@@ -406,7 +410,8 @@ If NOINSERT, ignore elements on ENTRIES
(unless (or node noinsert)
(let ((lastdir (vc-dir-node-directory (ewoc-nth vc-ewoc -1))))
(dolist (entry entries)
- (let ((entrydir (file-name-directory (expand-file-name (car entry)))))
+ (let ((entrydir (file-name-directory
+ (directory-file-name (expand-file-name (car entry))))))
;; Insert a directory node if needed.
(unless (string-equal lastdir entrydir)
(setq lastdir entrydir)
Index: vc-git.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-git.el,v
retrieving revision 1.86
diff -u -3 -p -u -p -r1.86 vc-git.el
--- vc-git.el 21 Aug 2009 03:37:37 -0000 1.86
+++ vc-git.el 23 Aug 2009 11:06:39 -0000
@@ -425,7 +425,15 @@ If nil, use the value of `vc-diff-switch
(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" "--"))
+ (let (flist dlist)
+ (dolist (crt files)
+ (if (file-directory-p crt)
+ (push crt dlist)
+ (push crt flist)))
+ (when flist
+ (vc-git-command nil 0 flist "update-index" "--add" "--"))
+ (when dlist
+ (vc-git-command nil 0 dlist "add"))))
(defalias 'vc-git-responsible-p 'vc-git-root)
next prev parent reply other threads:[~2009-08-23 11:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-19 21:20 bug#4206: 23.1; vc-dir bug with git Tom Tromey
2009-08-21 4:14 ` Dan Nicolaescu
2009-08-21 17:46 ` Tom Tromey
2009-08-23 11:57 ` Dan Nicolaescu [this message]
2009-08-25 17:54 ` Stefan Monnier
2009-08-25 18:14 ` Dan Nicolaescu
2009-08-25 21:16 ` Stefan Monnier
2009-12-10 19:44 ` Dan Nicolaescu
2012-03-27 18:28 ` Glenn Morris
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=200908231157.n7NBvErL011081@godzilla.ics.uci.edu \
--to=dann@ics.uci.edu \
--cc=4206@emacsbugs.donarmstrong.com \
--cc=tromey@redhat.com \
/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.