unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4206: 23.1; vc-dir bug with git
@ 2009-08-19 21:20 Tom Tromey
  2009-08-21  4:14 ` Dan Nicolaescu
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2009-08-19 21:20 UTC (permalink / raw)
  To: bug-gnu-emacs


Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:


I ran vc-dir on a git checkout that I have.
I have some unregistered subdirectories in this checkout,
for example autom4te.cache (created by autoconf).

In the *vc-dir* buffer I see:

                         gdb/testsuite/autom4te.cache/
     unregistered        gdb/testsuite/autom4te.cache/

That is, the directory is listed twice.

This seems weird to me.  Is this intentional?
I think it should only be listed once.



If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1/etc/DEBUG for instructions.


In GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.5)
 of 2009-08-03 on x86-5.fedora.phx.redhat.com
Windowing system distributor `The X.Org Foundation', version 11.0.10601901
configured using `configure  '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i586-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu' 'target_alias=i586-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-bu
 ffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  gnus-undo-mode: t
  highlight-changes-visible-mode: t
  erc-status-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<return> C-x o C-x 1 M-> <f10> <f10> <f10> <f10> <f10> 
<f10> <help-echo> <f10> <f10> <f10> <f10> <switch-frame> 
<help-echo> <switch-frame> " s e t SPC v a r i a b 
l e " <return> I SPC u s u a l l y SPC j u s t SPC 
u s e SPC " p r i n t " SPC s h o <M-backspace> t h 
o u g h <return> l i k e SPC <backspace> : S-SPC SPC 
p SPC x SPC = SPC 5 <return> <f10> <f10> <f10> <f10> 
<f10> <f10> <f10> <help-echo> <f10> <f10> <help-echo> 
<f10> <f10> <f10> C-c b <f10> C-c b <f10> <f10> <f10> 
<f10> <f10> <f10> <f10> <f10> C-z o C-x b * g u <tab> 
<return> q <return> y <return> C-c b C-e C-a C-p C-p 
C-k C-k C-k C-o C-n C-e M-b M-b M-b M-b <M-backspace> 
<M-backspace> TAB C-n TAB C-a C-n C-p C-p C-e C-k M-SPC 
C-n C-a C-M-SPC C-M-\ C-M-f <return> } C-a C-u C-u 
C-p C-l C-p C-p C-p C-s = C-b <return> C-a C-u C-u 
C-p C-l C-x C-s <switch-frame> <switch-frame> <switch-frame> 
<f10> <f10> <f10> <f10> <f10> <f10> <f10> <f10> <f10> 
C-c b <f10> <f10> <f10> <f10> <f10> <f10> <f10> C-z 
o C-x b * G <tab> <return> 1 g C-z o <f10> <f10> <f10> 
C-x v d <M-backspace> <M-backspace> <M-backspace> a 
r <tab> <return> C-x 1 C-u C-n C-n C-n C-n C-h c i 
C-h c I C-h w v c - i g <tab> <tab> C-g C-g C-g C-h 
c d C-u C-n C-n C-n C-n f C-v C-v C-v C-v C-v C-v C-v 
C-v C-v C-v C-x k <return> <f10> <f10> <switch-frame> 
C-z o <f10> <f10> <f10> <f10> C-z o M-x r e p o r t 
- e m <tab> <return>

Recent messages:
Wrote /home/tromey/Mail/mail/other/275197
Wrote /home/tromey/Mail/mail/other/275198
nnml: Reading incoming mail (15 new)...done
Opening nnml server on private...done
Opening nnml server...done
Checking new news...done
i runs the command vc-register
I is undefined
Quit [3 times]
d is undefined
call-interactively: End of buffer
Tom






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

* bug#4206: 23.1; vc-dir bug with git
  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
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Nicolaescu @ 2009-08-21  4:14 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 4206

Tom Tromey <tromey@redhat.com> writes:

  > Please write in English if possible, because the Emacs maintainers
  > usually do not have translators to read other languages for them.
  > 
  > Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
  > and to the gnu.emacs.bug news group.
  > 
  > Please describe exactly what actions triggered the bug
  > and the precise symptoms of the bug:
  > 
  > 
  > I ran vc-dir on a git checkout that I have.
  > I have some unregistered subdirectories in this checkout,
  > for example autom4te.cache (created by autoconf).
  > 
  > In the *vc-dir* buffer I see:
  > 
  >                          gdb/testsuite/autom4te.cache/
  >      unregistered        gdb/testsuite/autom4te.cache/
  > 
  > That is, the directory is listed twice.
  > 
  > This seems weird to me.  Is this intentional?
  > I think it should only be listed once.

Not really intentional.
vc-dir assumes that vc-git-dir-status returns only files, that's why it
gets confused when it gets a directory with the "unregistered" state.

What's the right thing to do here?  
vc-git-register does not support (yet?) passing directories as an
argument. 





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

* bug#4206: 23.1; vc-dir bug with git
  2009-08-21  4:14 ` Dan Nicolaescu
@ 2009-08-21 17:46   ` Tom Tromey
  2009-08-23 11:57     ` Dan Nicolaescu
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2009-08-21 17:46 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 4206

>>>>> "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.  "git add
DIR" usually does the right thing and in any case if it "overshoots" it
can be corrected.

Tom





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

* bug#4206: 23.1; vc-dir bug with git
  2009-08-21 17:46   ` Tom Tromey
@ 2009-08-23 11:57     ` Dan Nicolaescu
  2009-08-25 17:54       ` Stefan Monnier
  2009-12-10 19:44       ` Dan Nicolaescu
  0 siblings, 2 replies; 9+ messages in thread
From: Dan Nicolaescu @ 2009-08-23 11:57 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 4206

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)
 





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

* bug#4206: 23.1; vc-dir bug with git
  2009-08-23 11:57     ` Dan Nicolaescu
@ 2009-08-25 17:54       ` Stefan Monnier
  2009-08-25 18:14         ` Dan Nicolaescu
  2009-12-10 19:44       ` Dan Nicolaescu
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2009-08-25 17:54 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: Tom Tromey, 4206

> 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 :-(

The first thing to do is to decide which behavior is preferable, and
to document it in the leading comments of vc.el.


        Stefan





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

* bug#4206: 23.1; vc-dir bug with git
  2009-08-25 17:54       ` Stefan Monnier
@ 2009-08-25 18:14         ` Dan Nicolaescu
  2009-08-25 21:16           ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Nicolaescu @ 2009-08-25 18:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Tom Tromey, 4206

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

  > > 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 :-(
  > 
  > The first thing to do is to decide which behavior is preferable, and
  > to document it in the leading comments of vc.el.

IMO it would be better if vc-revert of a file in 'added state should
put it to 'unregistered.  We don't have another way to do this in VC,
and this is a very intuitive UI.

WDYT?





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

* bug#4206: 23.1; vc-dir bug with git
  2009-08-25 18:14         ` Dan Nicolaescu
@ 2009-08-25 21:16           ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2009-08-25 21:16 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: Tom Tromey, 4206

>> > 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 :-(
>> 
>> The first thing to do is to decide which behavior is preferable, and
>> to document it in the leading comments of vc.el.

> IMO it would be better if vc-revert of a file in 'added state should
> put it to 'unregistered.  We don't have another way to do this in VC,
> and this is a very intuitive UI.

Agreed.


        Stefan





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

* bug#4206: 23.1; vc-dir bug with git
  2009-08-23 11:57     ` Dan Nicolaescu
  2009-08-25 17:54       ` Stefan Monnier
@ 2009-12-10 19:44       ` Dan Nicolaescu
  2012-03-27 18:28         ` Glenn Morris
  1 sibling, 1 reply; 9+ messages in thread
From: Dan Nicolaescu @ 2009-12-10 19:44 UTC (permalink / raw)
  To: 4206; +Cc: Tom Tromey

Is this still a problem with the current CVS?





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

* bug#4206: 23.1; vc-dir bug with git
  2009-12-10 19:44       ` Dan Nicolaescu
@ 2012-03-27 18:28         ` Glenn Morris
  0 siblings, 0 replies; 9+ messages in thread
From: Glenn Morris @ 2012-03-27 18:28 UTC (permalink / raw)
  To: 4206-done

Version: 23.2

Dan Nicolaescu wrote:

> Is this still a problem with the current CVS?

AFAICS, this is fixed in 23.2 and later.





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

end of thread, other threads:[~2012-03-27 18:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).