unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@gnu.org>
To: Miles Bader <miles@gnu.org>
Cc: Eric James Michael Ritz <Eric@cybersprocket.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel@gnu.org
Subject: Re: [vc-git] Showing ‘.git/*’ files in vc-dir
Date: Thu, 01 Jul 2010 02:44:12 -0400	[thread overview]
Message-ID: <yxqiq4zhfb7.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <buohbkj69ex.fsf@dhlpc061.dev.necel.com> (Miles Bader's message of "Thu\, 01 Jul 2010 14\:47\:02 +0900")

Miles Bader <miles@gnu.org> writes:

> Dan Nicolaescu <dann@gnu.org> writes:
>>>> Not sure what the best solution is: make vc-git-state return
>>>> nil, or make vc-dir ignore files in .git, or something else ...
>>>
>>> Maybe find-file shouldn't add unregistered files to vc-dir buffers.
>>
>> Sure it should, one wants to be able to register those files.
>
> One can visit the file and "register" it that way, right (C-x v v)?

This is going on the wrong track.

The problem is not unrelated to adding 'unregistered files.

The issue is that vc-git-state says 'unregistered for files that it
should not say 'unregistered.

(vc-git-state "SOME_FILE_THAT_DOES_NOT_EXIST") says 'unregistered

(vc-git-state ".git/HEAD") says 'unregistered


This patch seems to fix it:

=== modified file 'lisp/vc/vc-git.el'
--- lisp/vc/vc-git.el   2010-06-11 19:09:57 +0000
+++ lisp/vc/vc-git.el   2010-07-01 06:37:30 +0000
@@ -180,7 +180,9 @@ If nil, use the value of `vc-diff-switch
   ;; was modified upstream.  But we can't check that without a network
   ;; operation.
   (if (not (vc-git-registered file))
-      'unregistered
+      (let ((st (vc-git--run-command-string
+            file "ls-files" "-t" "-o" "--")))
+            (if (and (stringp st) (not (string= st ""))) 'unregistered nil))
     (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
     (let ((diff (vc-git--run-command-string
                  file "diff-index" "-z" "HEAD" "--")))


It would be nice if someone more familiar with the git low level
commands would take a look at this function and try to make it a bit better.
As the comment there says, it should be able to return 'ignored.
It would be nice if it could be able to return 'conflict too.



  reply	other threads:[~2010-07-01  6:44 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29 18:29 [vc-git] Showing ‘.git/*’ files in vc-dir Eric James Michael Ritz
2010-06-29 19:54 ` Dan Nicolaescu
2010-06-29 20:07   ` Eric James Michael Ritz
2010-06-29 20:54     ` Dan Nicolaescu
2010-06-29 21:16       ` Eric James Michael Ritz
2010-07-01  1:27       ` Stefan Monnier
2010-07-01  3:06         ` Dan Nicolaescu
2010-07-01  5:47           ` Miles Bader
2010-07-01  6:44             ` Dan Nicolaescu [this message]
2010-07-01 13:40               ` Eric James Michael Ritz
2010-07-04 17:26               ` Eric James Michael Ritz
2010-07-04 19:30                 ` Dan Nicolaescu
2010-07-04 19:45                   ` Eric James Michael Ritz
2010-07-04 17:27               ` Stefan Monnier
2010-07-04 19:26                 ` Dan Nicolaescu
2010-07-01  7:36           ` Jan Djärv
2010-07-01  8:32             ` Dan Nicolaescu
2010-07-01  8:39               ` Glenn Morris
2010-07-01  9:29                 ` Jan Djärv
2010-07-01 15:34                 ` Dan Nicolaescu
2010-07-01  9:23               ` Jan Djärv
2010-07-01 15:26                 ` Dan Nicolaescu
2010-07-01 16:25                   ` Jan Djärv
2010-07-23 15:30                     ` Stefan Monnier
2010-07-01  8:35             ` Glenn Morris
2010-07-01  9:16               ` Miles Bader
2010-07-01  9:22                 ` Deniz Dogan
2010-07-01 15:23                 ` Dan Nicolaescu
2010-07-01 21:14                 ` Glenn Morris
2010-07-01 22:24                   ` René Kyllingstad
2010-07-02  3:14                     ` Miles Bader

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yxqiq4zhfb7.fsf@fencepost.gnu.org \
    --to=dann@gnu.org \
    --cc=Eric@cybersprocket.com \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 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).