Re: How to enable file status icons for Git? - BEST version
Houman Dunnil <[email protected]>
| Newsgroups | gmane.emacs.code-browser |
|---|---|
| Message-ID | <[email protected]> |
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