* [PATCH] vc-git: Do not show `.git/*' files with vc-dir
@ 2010-06-30 12:38 Eric James Michael Ritz
2010-06-30 12:57 ` Deniz Dogan
0 siblings, 1 reply; 10+ messages in thread
From: Eric James Michael Ritz @ 2010-06-30 12:38 UTC (permalink / raw)
To: emacs-devel
When using vc-dir to work with a directory under source control by
Git, it is possible for vc-dir to show files under the top-level
`.git' directory as being unregistered. As correctly guessed by Dan
Nicolescu, this is caused when a user has $EDITOR configured to be
emacsclient, and he performs certain Git operations outside of
vc-mode, e.g. running `git-commit' from the command line.
It is unlikely that any user would want to perform operations on a
file inside of the `.git' directory via vc-dir. Therefore we can
prevent those files from appearing by teaching `vc-git-state' to
return nil for any file in those directories.
Signed-off-by: Eric James Michael Ritz <Eric@cybersprocket.com>
---
lisp/vc-git.el | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 24062a0..ae5b0ff 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -171,16 +171,21 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
(defun vc-git-state (file)
"Git-specific version of `vc-state'."
- ;; FIXME: This can't set 'ignored yet
- (if (not (vc-git-registered file))
- 'unregistered
- (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
- (let ((diff (vc-git--run-command-string
- file "diff-index" "-z" "HEAD" "--")))
- (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
- diff))
- (vc-git--state-code (match-string 1 diff))
- (if (vc-git--empty-db-p) 'added 'up-to-date)))))
+ ;; We never want to perform VC operations on files in the `.git'
+ ;; directory.
+ (cond ((string-match ".git" file)
+ nil)
+ ;; FIXME: This can't set 'ignored yet.
+ ((not (vc-git-registered file))
+ 'unregistered)
+ (t
+ (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
+ (let ((diff (vc-git--run-command-string
+ file "diff-index" "-z" "HEAD" "--")))
+ (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
+ diff))
+ (vc-git--state-code (match-string 1 diff))
+ (if (vc-git--empty-db-p) 'added 'up-to-date))))))
(defun vc-git-working-revision (file)
"Git-specific version of `vc-working-revision'."
--
1.7.2.rc0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
2010-06-30 12:38 Eric James Michael Ritz
@ 2010-06-30 12:57 ` Deniz Dogan
2010-06-30 12:58 ` Deniz Dogan
0 siblings, 1 reply; 10+ messages in thread
From: Deniz Dogan @ 2010-06-30 12:57 UTC (permalink / raw)
To: Eric; +Cc: emacs-devel
2010/6/30 Eric James Michael Ritz <Eric@cybersprocket.com>:
> + (cond ((string-match ".git" file)
Wouldn't "\\`\\.git\\'" be more appropriate? ".git" would match
anything which contains "git" preceded by at least one character.
--
Deniz Dogan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
2010-06-30 12:57 ` Deniz Dogan
@ 2010-06-30 12:58 ` Deniz Dogan
2010-06-30 13:08 ` Eric James Michael Ritz
0 siblings, 1 reply; 10+ messages in thread
From: Deniz Dogan @ 2010-06-30 12:58 UTC (permalink / raw)
To: Eric; +Cc: emacs-devel
2010/6/30 Deniz Dogan <deniz.a.m.dogan@gmail.com>:
> 2010/6/30 Eric James Michael Ritz <Eric@cybersprocket.com>:
>> + (cond ((string-match ".git" file)
>
> Wouldn't "\\`\\.git\\'" be more appropriate? ".git" would match
> anything which contains "git" preceded by at least one character.
>
Or actually, (string= ".git" file), I suppose. :)
--
Deniz Dogan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
2010-06-30 12:58 ` Deniz Dogan
@ 2010-06-30 13:08 ` Eric James Michael Ritz
0 siblings, 0 replies; 10+ messages in thread
From: Eric James Michael Ritz @ 2010-06-30 13:08 UTC (permalink / raw)
To: Deniz Dogan; +Cc: emacs-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/30/2010 08:58 AM, Deniz Dogan wrote:
> 2010/6/30 Deniz Dogan <deniz.a.m.dogan@gmail.com>:
>> 2010/6/30 Eric James Michael Ritz <Eric@cybersprocket.com>:
>>> + (cond ((string-match ".git" file)
>>
>> Wouldn't "\\`\\.git\\'" be more appropriate? ".git" would match
>> anything which contains "git" preceded by at least one character.
>>
>
> Or actually, (string= ".git" file), I suppose. :)
Whoops, you’re right. Thanks for the catch :) Fixed patch below:
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 24062a0..62e0c55 100644
- --- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -171,16 +171,21 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
(defun vc-git-state (file)
"Git-specific version of `vc-state'."
- - ;; FIXME: This can't set 'ignored yet
- - (if (not (vc-git-registered file))
- - 'unregistered
- - (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
- - (let ((diff (vc-git--run-command-string
- - file "diff-index" "-z" "HEAD" "--")))
- - (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
- - diff))
- - (vc-git--state-code (match-string 1 diff))
- - (if (vc-git--empty-db-p) 'added 'up-to-date)))))
+ ;; We never want to perform VC operations on files in the `.git'
+ ;; directory.
+ (cond ((string= ".git" file)
+ nil)
+ ;; FIXME: This can't set 'ignored yet.
+ ((not (vc-git-registered file))
+ 'unregistered)
+ (t
+ (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
+ (let ((diff (vc-git--run-command-string
+ file "diff-index" "-z" "HEAD" "--")))
+ (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
+ diff))
+ (vc-git--state-code (match-string 1 diff))
+ (if (vc-git--empty-db-p) 'added 'up-to-date))))))
(defun vc-git-working-revision (file)
"Git-specific version of `vc-working-revision'."
- --
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/
iQEcBAEBAgAGBQJMK0HfAAoJEEHUZXw5hMWsj+8IANlGzBOblHmjpuUXUno40QE1
PMyeE2YSIAzYWZ4amnuqVQE0AJg4zGVF7hG3b1e5Q0ve7HypGPWku44POU7E55oF
VmQOgHb0asa3irOxmXToBE5T8em0CuzYn6b7U8dXxx8YrXAz1IG2tUYyHmyLo60N
yr5pnIj69M02dbnsxlOpicyEYomR7R1R5afTFFFMCgEv1IICeLQHxSDkx54ZI5Cr
Xgyb2vLTEubJwAdvz4BTShZd1VJlKCivHLcpKfwweC+kcCq+u0oPD3Fws8tjevry
/BhARchmr9zCygmJ6sIe0QS7YvqEsXeZaFt2AjYobV/nvTN5gkXqsCzEBLUwPxQ=
=rzqG
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
@ 2010-06-30 14:17 Eric James Michael Ritz
2010-06-30 19:35 ` Dan Nicolaescu
0 siblings, 1 reply; 10+ messages in thread
From: Eric James Michael Ritz @ 2010-06-30 14:17 UTC (permalink / raw)
To: emacs-devel
On 06/30/2010 08:58 AM, Deniz Dogan wrote:
> 2010/6/30 Deniz Dogan <deniz.a.m.dogan@gmail.com>:
>> 2010/6/30 Eric James Michael Ritz <Eric@cybersprocket.com>:
>>> + (cond ((string-match ".git" file)
>>
>> Wouldn't "\\`\\.git\\'" be more appropriate? ".git" would match
>> anything which contains "git" preceded by at least one character.
>>
>
> Or actually, (string= ".git" file), I suppose. :)
Whoops, you’re right. Thanks for the catch :) Fixed patch below:
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 24062a0..62e0c55 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -171,16 +171,21 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
(defun vc-git-state (file)
"Git-specific version of `vc-state'."
- ;; FIXME: This can't set 'ignored yet
- (if (not (vc-git-registered file))
- 'unregistered
- (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
- (let ((diff (vc-git--run-command-string
- file "diff-index" "-z" "HEAD" "--")))
- (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
- diff))
- (vc-git--state-code (match-string 1 diff))
- (if (vc-git--empty-db-p) 'added 'up-to-date)))))
+ ;; We never want to perform VC operations on files in the `.git'
+ ;; directory.
+ (cond ((string= ".git" file)
+ nil)
+ ;; FIXME: This can't set 'ignored yet.
+ ((not (vc-git-registered file))
+ 'unregistered)
+ (t
+ (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
+ (let ((diff (vc-git--run-command-string
+ file "diff-index" "-z" "HEAD" "--")))
+ (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
+ diff))
+ (vc-git--state-code (match-string 1 diff))
+ (if (vc-git--empty-db-p) 'added 'up-to-date))))))
(defun vc-git-working-revision (file)
"Git-specific version of `vc-working-revision'."
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
2010-06-30 14:17 [PATCH] vc-git: Do not show `.git/*' files with vc-dir Eric James Michael Ritz
@ 2010-06-30 19:35 ` Dan Nicolaescu
2010-06-30 20:01 ` Eric James Michael Ritz
2010-07-01 0:07 ` Deniz Dogan
0 siblings, 2 replies; 10+ messages in thread
From: Dan Nicolaescu @ 2010-06-30 19:35 UTC (permalink / raw)
To: Eric; +Cc: emacs-devel
Eric James Michael Ritz <Eric@cybersprocket.com> writes:
> On 06/30/2010 08:58 AM, Deniz Dogan wrote:
>> 2010/6/30 Deniz Dogan <deniz.a.m.dogan@gmail.com>:
>>> 2010/6/30 Eric James Michael Ritz <Eric@cybersprocket.com>:
>>>> + (cond ((string-match ".git" file)
>>>
>>> Wouldn't "\\`\\.git\\'" be more appropriate? ".git" would match
>>> anything which contains "git" preceded by at least one character.
>>>
>>
>> Or actually, (string= ".git" file), I suppose. :)
>
> Whoops, you’re right. Thanks for the catch :) Fixed patch below:
>
> diff --git a/lisp/vc-git.el b/lisp/vc-git.el
> index 24062a0..62e0c55 100644
> --- a/lisp/vc-git.el
> +++ b/lisp/vc-git.el
> @@ -171,16 +171,21 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
>
> (defun vc-git-state (file)
> "Git-specific version of `vc-state'."
> - ;; FIXME: This can't set 'ignored yet
> - (if (not (vc-git-registered file))
> - 'unregistered
> - (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
> - (let ((diff (vc-git--run-command-string
> - file "diff-index" "-z" "HEAD" "--")))
> - (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
> - diff))
> - (vc-git--state-code (match-string 1 diff))
> - (if (vc-git--empty-db-p) 'added 'up-to-date)))))
> + ;; We never want to perform VC operations on files in the `.git'
> + ;; directory.
> + (cond ((string= ".git" file)
file is an absolute file name, so this condition cannot be true.
I still need to think what the best way of solving this is...
> + nil)
> + ;; FIXME: This can't set 'ignored yet.
> + ((not (vc-git-registered file))
> + 'unregistered)
> + (t
> + (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
> + (let ((diff (vc-git--run-command-string
> + file "diff-index" "-z" "HEAD" "--")))
> + (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
> + diff))
> + (vc-git--state-code (match-string 1 diff))
> + (if (vc-git--empty-db-p) 'added 'up-to-date))))))
>
> (defun vc-git-working-revision (file)
> "Git-specific version of `vc-working-revision'."
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
2010-06-30 19:35 ` Dan Nicolaescu
@ 2010-06-30 20:01 ` Eric James Michael Ritz
2010-06-30 22:21 ` Dan Nicolaescu
2010-07-01 0:07 ` Deniz Dogan
1 sibling, 1 reply; 10+ messages in thread
From: Eric James Michael Ritz @ 2010-06-30 20:01 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: emacs-devel
On 06/30/2010 03:35 PM, Dan Nicolaescu wrote:
> Eric James Michael Ritz <Eric@cybersprocket.com> writes:
>
>>[...]
>>
>> diff --git a/lisp/vc-git.el b/lisp/vc-git.el
>> index 24062a0..62e0c55 100644
>> --- a/lisp/vc-git.el
>> +++ b/lisp/vc-git.el
>> @@ -171,16 +171,21 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
>>
>> (defun vc-git-state (file)
>> "Git-specific version of `vc-state'."
>> - ;; FIXME: This can't set 'ignored yet
>> - (if (not (vc-git-registered file))
>> - 'unregistered
>> - (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
>> - (let ((diff (vc-git--run-command-string
>> - file "diff-index" "-z" "HEAD" "--")))
>> - (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
>> - diff))
>> - (vc-git--state-code (match-string 1 diff))
>> - (if (vc-git--empty-db-p) 'added 'up-to-date)))))
>> + ;; We never want to perform VC operations on files in the `.git'
>> + ;; directory.
>> + (cond ((string= ".git" file)
>
> file is an absolute file name, so this condition cannot be true.
>
> I still need to think what the best way of solving this is...
Ah, I didn’t know that about `file`. Thanks.
While I am interested in solving this for Git specifically, since that
is all I use at work, is it possible that a more general solution
would be appropriate? I am not very familiar with Bazaar or Mercurial
or such, but I assume they use directories like ‘.git’ and ‘.svn’ for
storing repository information. If it is possible to also make those
files appear in vc-dir by using terminal commands where $EDITOR is set
to emacsclient, then could it be more beneficial to teach vc-dir as a
whole to ignore files from the important, ‘system-level’ directories
for the various version control back-ends?
--
Eric James Michael Ritz
Cyber Sprocket Labs
(843) 225-3830
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
2010-06-30 20:01 ` Eric James Michael Ritz
@ 2010-06-30 22:21 ` Dan Nicolaescu
0 siblings, 0 replies; 10+ messages in thread
From: Dan Nicolaescu @ 2010-06-30 22:21 UTC (permalink / raw)
To: Eric James Michael Ritz; +Cc: emacs-devel
Eric James Michael Ritz <Eric@cybersprocket.com> writes:
> On 06/30/2010 03:35 PM, Dan Nicolaescu wrote:
>> Eric James Michael Ritz <Eric@cybersprocket.com> writes:
>>
>>>[...]
>>>
>>> diff --git a/lisp/vc-git.el b/lisp/vc-git.el
>>> index 24062a0..62e0c55 100644
>>> --- a/lisp/vc-git.el
>>> +++ b/lisp/vc-git.el
>>> @@ -171,16 +171,21 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
>>>
>>> (defun vc-git-state (file)
>>> "Git-specific version of `vc-state'."
>>> - ;; FIXME: This can't set 'ignored yet
>>> - (if (not (vc-git-registered file))
>>> - 'unregistered
>>> - (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
>>> - (let ((diff (vc-git--run-command-string
>>> - file "diff-index" "-z" "HEAD" "--")))
>>> - (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
>>> - diff))
>>> - (vc-git--state-code (match-string 1 diff))
>>> - (if (vc-git--empty-db-p) 'added 'up-to-date)))))
>>> + ;; We never want to perform VC operations on files in the `.git'
>>> + ;; directory.
>>> + (cond ((string= ".git" file)
>>
>> file is an absolute file name, so this condition cannot be true.
>>
>> I still need to think what the best way of solving this is...
>
> Ah, I didn’t know that about `file`. Thanks.
>
> While I am interested in solving this for Git specifically, since that
> is all I use at work, is it possible that a more general solution
> would be appropriate? I am not very familiar with Bazaar or Mercurial
> or such, but I assume they use directories like ‘.git’ and ‘.svn’ for
> storing repository information. If it is possible to also make those
> files appear in vc-dir by using terminal commands where $EDITOR is set
> to emacsclient, then could it be more beneficial to teach vc-dir as a
> whole to ignore files from the important, ‘system-level’ directories
> for the various version control back-ends?
There was a bug in vc-dir that I fixed in the emacs-23 branch, it
displayed files with a nil state. To reproduce: just edit .hg/BLAH
and see it appear in the corresponding vc-dir buffer.
The above fix should fix similar problems for hg, svn and CVS (maybe
more, but I haven't tried).
vc-git has some more problems: vc-git-state returns 'unregistered even
for non-existent files. It should return nil. It also returns
'unregistered for files in .git, it should return nil there too.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
2010-06-30 19:35 ` Dan Nicolaescu
2010-06-30 20:01 ` Eric James Michael Ritz
@ 2010-07-01 0:07 ` Deniz Dogan
2010-07-01 1:20 ` Dan Nicolaescu
1 sibling, 1 reply; 10+ messages in thread
From: Deniz Dogan @ 2010-07-01 0:07 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: Eric, emacs-devel
2010/6/30 Dan Nicolaescu <dann@gnu.org>:
> Eric James Michael Ritz <Eric@cybersprocket.com> writes:
>
>> On 06/30/2010 08:58 AM, Deniz Dogan wrote:
>>> 2010/6/30 Deniz Dogan <deniz.a.m.dogan@gmail.com>:
>>>> 2010/6/30 Eric James Michael Ritz <Eric@cybersprocket.com>:
>>>>> + (cond ((string-match ".git" file)
>>>>
>>>> Wouldn't "\\`\\.git\\'" be more appropriate? ".git" would match
>>>> anything which contains "git" preceded by at least one character.
>>>>
>>>
>>> Or actually, (string= ".git" file), I suppose. :)
>>
>> Whoops, you’re right. Thanks for the catch :) Fixed patch below:
>>
>> diff --git a/lisp/vc-git.el b/lisp/vc-git.el
>> index 24062a0..62e0c55 100644
>> --- a/lisp/vc-git.el
>> +++ b/lisp/vc-git.el
>> @@ -171,16 +171,21 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
>>
>> (defun vc-git-state (file)
>> "Git-specific version of `vc-state'."
>> - ;; FIXME: This can't set 'ignored yet
>> - (if (not (vc-git-registered file))
>> - 'unregistered
>> - (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
>> - (let ((diff (vc-git--run-command-string
>> - file "diff-index" "-z" "HEAD" "--")))
>> - (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
>> - diff))
>> - (vc-git--state-code (match-string 1 diff))
>> - (if (vc-git--empty-db-p) 'added 'up-to-date)))))
>> + ;; We never want to perform VC operations on files in the `.git'
>> + ;; directory.
>> + (cond ((string= ".git" file)
>
> file is an absolute file name, so this condition cannot be true.
>
> I still need to think what the best way of solving this is...
>
>
So it is not as simple as wrapping "file" in file-name-nondirectory?
--
Deniz Dogan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
2010-07-01 0:07 ` Deniz Dogan
@ 2010-07-01 1:20 ` Dan Nicolaescu
0 siblings, 0 replies; 10+ messages in thread
From: Dan Nicolaescu @ 2010-07-01 1:20 UTC (permalink / raw)
To: Deniz Dogan; +Cc: Eric, emacs-devel
Deniz Dogan <deniz.a.m.dogan@gmail.com> writes:
> 2010/6/30 Dan Nicolaescu <dann@gnu.org>:
>> Eric James Michael Ritz <Eric@cybersprocket.com> writes:
>>
>>> On 06/30/2010 08:58 AM, Deniz Dogan wrote:
>>>> 2010/6/30 Deniz Dogan <deniz.a.m.dogan@gmail.com>:
>>>>> 2010/6/30 Eric James Michael Ritz <Eric@cybersprocket.com>:
>>>>>> + (cond ((string-match ".git" file)
>>>>>
>>>>> Wouldn't "\\`\\.git\\'" be more appropriate? ".git" would match
>>>>> anything which contains "git" preceded by at least one character.
>>>>>
>>>>
>>>> Or actually, (string= ".git" file), I suppose. :)
>>>
>>> Whoops, you’re right. Thanks for the catch :) Fixed patch below:
>>>
>>> diff --git a/lisp/vc-git.el b/lisp/vc-git.el
>>> index 24062a0..62e0c55 100644
>>> --- a/lisp/vc-git.el
>>> +++ b/lisp/vc-git.el
>>> @@ -171,16 +171,21 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
>>>
>>> (defun vc-git-state (file)
>>> "Git-specific version of `vc-state'."
>>> - ;; FIXME: This can't set 'ignored yet
>>> - (if (not (vc-git-registered file))
>>> - 'unregistered
>>> - (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
>>> - (let ((diff (vc-git--run-command-string
>>> - file "diff-index" "-z" "HEAD" "--")))
>>> - (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
>>> - diff))
>>> - (vc-git--state-code (match-string 1 diff))
>>> - (if (vc-git--empty-db-p) 'added 'up-to-date)))))
>>> + ;; We never want to perform VC operations on files in the `.git'
>>> + ;; directory.
>>> + (cond ((string= ".git" file)
>>
>> file is an absolute file name, so this condition cannot be true.
>>
>> I still need to think what the best way of solving this is...
>>
>>
>
> So it is not as simple as wrapping "file" in file-name-nondirectory?
That would never match either.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-07-01 1:20 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-30 14:17 [PATCH] vc-git: Do not show `.git/*' files with vc-dir Eric James Michael Ritz
2010-06-30 19:35 ` Dan Nicolaescu
2010-06-30 20:01 ` Eric James Michael Ritz
2010-06-30 22:21 ` Dan Nicolaescu
2010-07-01 0:07 ` Deniz Dogan
2010-07-01 1:20 ` Dan Nicolaescu
-- strict thread matches above, loose matches on Subject: below --
2010-06-30 12:38 Eric James Michael Ritz
2010-06-30 12:57 ` Deniz Dogan
2010-06-30 12:58 ` Deniz Dogan
2010-06-30 13:08 ` Eric James Michael Ritz
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.