Hi,

On Thu, 6 Mar 2008, Sebastian Schuberth wrote:

> >  On Thu, 6 Mar 2008, [EMAIL PROTECTED] wrote:
> >
> >  > I'd like to propose to set the "Hidden" attribute for .git 
> >  > directories under Windows, just like CVS and Subversion do for the 
> >  > "CVS" and ".svn" directories. Doing so simplifies browsing / 
> >  > searching the Working Tree as most tools support to not display / 
> >  > search hidden files / folders.
> >  >
> >  > Any chance to implement this?

diff --git a/git-compat-util.h b/git-compat-util.h
index e0fe165..186dc3b 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -552,7 +552,9 @@ static inline int fcntl(int fd, int cmd, long arg)
 
 static inline int mingw_mkdir(const char *path, int mode)
 {
-       return mkdir(path);
+       return mkdir(path) ||
+               (*path == '.' &&
+               !SetFileAttributes(path, FILE_ATTRIBUTE_HIDDEN));
 }
 #define mkdir mingw_mkdir
 

For completeness' sake, we'd have to do this in mingw_open(), too, I 
guess, and wrap fopen() too...

Ciao,
Dscho

Reply via email to