emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vc-git] Showing ‘.git/*’ files in vc -dir


From: Eric James Michael Ritz
Subject: Re: [vc-git] Showing ‘.git/*’ files in vc -dir
Date: Thu, 01 Jul 2010 09:40:01 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 07/01/2010 02:44 AM, Dan Nicolaescu wrote:
> Miles Bader <address@hidden> writes:
>
>> Dan Nicolaescu <address@hidden> 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.

In the `-t` needed in the call to git-ls-files?  It we are just
interested in whether or not the file is there, the `-o` by itself
will work fine.

We should also be able to use `git ls-files --ignored
- --exclude-standard -- $file` to see if we need to return 'ignored for
a file.

- --
Eric James Michael Ritz
Cyber Sprocket Labs
(843) 225-3830
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMLJquAAoJEEHUZXw5hMWsBzcH/R5m5qNqcWTJQubmt/x4OC3N
2EBtIkaDSPEPehDD4tLfA/Ppbd0gNyGDQqyk4TSUOGIQR67HIrQf7MVl4x9Sf5md
4YFjt9xM9xPSW48NWNn2A9xlcejCFwAL7fcq5T3sA2oLmofeYMu36mriAniGHTbq
DQ0xxsdr0FHjKltgah2bwvMUqIXUQfBnYBg9WlzYOsWnzUzTWFi4LaYgtWKzyaRz
YifXT8RS4SiRuEWXM16KF/qDuQQ/l3+uL1safnRjKr378Pp3k+t8k0CeX5+EGfvX
cmbNIuJ5Vyo0+r8UJM0SFg+qmBZf7YSzwiQuNi/D3n1G05dIvM/RvrJFm7MRFr4=
=/09u
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]