Hi, On Wed, 14 Feb 2007, Junio C Hamano wrote: > Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: > > > On Wed, 14 Feb 2007, Junio C Hamano wrote: > > > >> By the way, I sometimes think it might be worth doing this: > >> > >> $ chmod a-r .git/ > >> > >> We always access files by explicit paths and never ask "ls .git/foo*" to > >> find what are under .git/ directory. > > > > If so, please make it unconfigurable. I use tab-completion in the git > > directory quite often. > > Do you mean "configurable"? No. I meant "unconfigurable", since the sane default _would_ be a-r. But then, I see that I was silly. This chmod is done on git-init time, and easy to undo _if_ you want it. So, colour me a supporter of that feature. > I wonder what you are doing inside .git directory in the first place. > I never chdir() into it myself, but that may be because I practicaly > live inside Emacs. :-) Lucky you. Since long time, I became a vi user, not out of fun, but out of necessity. I had to work on many machines which had vi installed, but not emacs. On some, my quota was not large enough to compile the beast, so I eventually gave in. Back to the subject: Sometimes I just want to look if a certain file is present. But I cannot be bothered to really type out ".git/index.lock", but rather I do ".g<TAB>/i<TAB>.<TAB>"... Anyway, here is a minimal (completely untested) patch to do what you proposed: -- snipsnap -- [PATCH] init: create GIT_DIR non-readable We access all files in GIT_DIR by name, so we do not really need it to be readable. However, it is less easy to corrupt the repository unintentionally when it is not readable. Those who want to be able to see the contents of GIT_DIR, always can just do a `chown u+r $GIT_DIR`. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx> --- builtin-init-db.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/builtin-init-db.c b/builtin-init-db.c index 12e43d0..8496269 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -18,7 +18,7 @@ static void safe_create_dir(const char *dir, int share) { - if (mkdir(dir, 0777) < 0) { + if (mkdir(dir, share ? 0777 : 0333) < 0) { if (errno != EEXIST) { perror(dir); exit(1); - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html