Re: How to enable file status icons for Git? - BEST version

<[email protected]>
Newsgroups gmane.emacs.code-browser
Message-ID <[email protected]>
Well, then choose the other - this is why i had made this customizable via the ecb-vc-supported-backends - option ;-)

Klaus

_________________________________________________________Klaus Berndl / Capgemini sd&m / München Business Development Manager / Bereich BankenTel: +49 89 63812 392 / Fax: +49 89 63812 220 / www.de.capgemini-sdm.comMobil: +49 162 2842 051 / [email protected] sd&m AG, Carl-Wery-Str. 42, 81739 München Zusammen. Für nachhaltigen Erfolg._________________________________________________________Vorstand: Edmund Küpper (Vorsitzender), Burkhard Kehrbusch, Rüdiger Azone,Dr. Uwe Dumslaff, Kai Grambow, Dr. Michael Rading, Josef RannerAufsichtsrat: Pierre Hessler (Vorsitzender)Sitz und Amtsgericht: München HRB 126057



-----Ursprüngliche Nachricht-----
Von: Houman Dunnil [mailto:[email protected]]
Gesendet: Do 09.04.2009 08:10
An: Berndl, Klaus
Cc: [email protected]
Betreff: Re: [ECB-list] How to enable file status icons for Git? - BEST version
 
Awesome! But for some reason the other function works very faster for me.

On Mon, Apr 6, 2009 at 9:09 PM,  <[email protected]> wrote:
> Hi,
>
> Here comes the best version:
>
> (defun ecb-vc-dir-managed-by-GIT (directory)
>  "Return 'CC if DIRECTORY is managed by Git. nil if not.
> Because with Git only the top-most directory of a source-tree has a subdir
> .git this function tries recursively upwards if there is a .git-subdir."
>  (and (locate-library "vc-git")
>       (fboundp 'vc-git-root)
>       (vc-git-root directory)))
>
> Why to reinvent the wheel, when vc-git.el has all what we need... ;-)
>
> Ciao,
> Klaus
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected] [mailto:[email protected]]
> Gesendet: Montag, 6. April 2009 18:10
> An: [email protected]
> Cc: [email protected]
> Betreff: Re: [ECB-list] How to enable file status icons for Git?
>
> Hi,
>
> Just for full correctness:
>
> The previous version we talked about today has one fault: if would not work if the root-directory ("/" or C:) is managed by git - i know, not very probable but who knows... ;-)
>
> To fix this the check of existence of the gitdir must be done *before* checking if we have the rootdir...
>
> So i will checkin and add to ECB this version:
>
> (defun ecb-vc-dir-managed-by-GIT (directory)
>  "Return 'CC if DIRECTORY is managed by Git. nil if not.
> Because with Git only the top-most directory of a source-tree has a subdir .git this function tries recursively upwards if there is a .git-subdir."
>  (let* ((sourcedir (ecb-fix-filename (file-truename directory)))
>         (gitdir (concat sourcedir "/.git/")))
>    (if (and (ecb-file-exists-p gitdir)
>             (locate-library "vc-git"))
>        'GIT
>      (if (equal sourcedir (ecb-fix-filename "/"))
>          nil
>        (ecb-vc-dir-managed-by-GIT (concat sourcedir "/../"))))))
>
> Just for your information....
>
> Ciao,
> Klaus
>
> -----Ursprüngliche Nachricht-----
> Von: Houman Dunnil [mailto:[email protected]]
> Gesendet: Montag, 6. April 2009 14:47
> An: Berndl, Klaus
> Cc: [email protected]
> Betreff: Re: [ECB-list] How to enable file status icons for Git?
>
> Found the bug... It was because of eq function, changed it equal and it works great now!
>
> (defun ecb-vc-dir-managed-by-GIT (directory)
>  (let* ((cannon (file-truename directory))
>         (gitdir (concat cannon "/.git/")))
>    (cond ((equal cannon "/") 'nil)
>          ((and (ecb-file-exists-p gitdir)
>                (locate-library "vc-git"))
>           'git)
>          (t
>           (ecb-vc-dir-managed-by-GIT (concat cannon "/../"))))))
>
> On Mon, Apr 6, 2009 at 4:53 PM, Houman Dunnil <[email protected]> wrote:
>> On Mon, Apr 6, 2009 at 3:46 PM,  <[email protected]> wrote:
>>> Well, let me recapitulate:
>>>
>>> If you have a directory-tree <top-most-directory> version-managed by Git then only <top-most-directory> has a subdir .git but all other subdirs containing git-managed sourc-files not, right?
>>
>> Correct.
>>
>> One step further...
>>
>> With the following method it works great for all files a Git
>> directory, but I cannot browse directories in ECB that are not under
>> Git control. It says "Lisp nesting exceeds `max-lisp-eval-depth'". Any
>> clue?
>>
>> (defun ecb-vc-dir-managed-by-GIT (directory)
>>    (if (eq directory "/")
>>        nil
>>      (cond ((and (ecb-file-exists-p (concat directory "/.git/"))
>>                  (locate-library "vc-git"))
>>             'GIT)
>>            (t
>>             (ecb-vc-dir-managed-by-GIT (concat directory "/../"))))))
>>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Ecb-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ecb-list
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com

_______________________________________________
Ecb-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecb-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.