* Re: git-update-cache: allow dot-files
@ 2005-05-25 0:12 Junio C Hamano
2005-05-25 0:24 ` Linus Torvalds
0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2005-05-25 0:12 UTC (permalink / raw)
To: torvalds; +Cc: git
Linus, I think this is wrong. GIT_DIR could be something other
than ".git". I'd rather allow everything other than . and .. in
the core layer, and have Porcelain layer ignore-paths logic to
deal with "^.git/" (only when GIT_DIR is .git; otherwise
ignore-path configuration file for that particular tree needs to
say what to ignore).
git-update-cache: allow dot-files
diff --git a/update-cache.c b/update-cache.c
--- a/update-cache.c
+++ b/update-cache.c
@@ -238,13 +238,42 @@ static int refresh_cache(void)
/*
* We fundamentally don't like some paths: we don't want
- * dot or dot-dot anywhere, and in fact, we don't even want
- * any other dot-files (.git or anything else). They
- * are hidden, for chist sake.
+ * dot or dot-dot anywhere, and for obvious reasons don't
+ * want to recurse into ".git" either.
*
* Also, we don't want double slashes or slashes at the
* end that can make pathnames ambiguous.
*/
+static int verify_dotfile(const char *rest)
+{
+ /*
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: git-update-cache: allow dot-files
2005-05-25 0:12 git-update-cache: allow dot-files Junio C Hamano
@ 2005-05-25 0:24 ` Linus Torvalds
2005-05-25 0:32 ` Junio C Hamano
0 siblings, 1 reply; 11+ messages in thread
From: Linus Torvalds @ 2005-05-25 0:24 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Tue, 24 May 2005, Junio C Hamano wrote:
>
> Linus, I think this is wrong. GIT_DIR could be something other
> than ".git".
I considered it, but it's so much easier to allow things later than deny
them, that I preferred being anal about it.
Linus
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: git-update-cache: allow dot-files
2005-05-25 0:24 ` Linus Torvalds
@ 2005-05-25 0:32 ` Junio C Hamano
2005-05-25 0:44 ` [PATCH] Allow dot files in ls-files as well Junio C Hamano
2005-05-25 0:52 ` git-update-cache: allow dot-files Linus Torvalds
0 siblings, 2 replies; 11+ messages in thread
From: Junio C Hamano @ 2005-05-25 0:32 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> I considered it, but it's so much easier to allow things
LT> later than deny them, that I preferred being anal about it.
That is not the point. GIT_DIR set to "GIT" would happily suck
index file in. You are not being anal enough.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] Allow dot files in ls-files as well.
2005-05-25 0:32 ` Junio C Hamano
@ 2005-05-25 0:44 ` Junio C Hamano
2005-05-25 0:54 ` Linus Torvalds
2005-05-25 0:52 ` git-update-cache: allow dot-files Linus Torvalds
1 sibling, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2005-05-25 0:44 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
>>>>> "JCH" == Junio C Hamano <junkio@cox.net> writes:
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> I considered it, but it's so much easier to allow things
LT> later than deny them, that I preferred being anal about it.
JCH> That is not the point. GIT_DIR set to "GIT" would happily suck
JCH> index file in. You are not being anal enough.
... which makes me feel that, since you cannot be anal enough
anyway, it would be more consistent not to be more restrictive
than necessary (the user has every right to screw himself
anyway).
No matter what you end up doing, you would need something like
this as well (I am not screening .git here but that should be
easy for you to add).
------------
Allow dot files in ls-files as well.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
cd /opt/packrat/playpen/public/in-place/git/git.junio/
PATH=.:$PATH jit-diff 1: ls-files.c
# - linus: git-update-cache: allow dot-files
# + (working tree)
diff --git a/ls-files.c b/ls-files.c
--- a/ls-files.c
+++ b/ls-files.c
@@ -136,7 +136,9 @@ static void read_directory(const char *p
while ((de = readdir(dir)) != NULL) {
int len;
- if (de->d_name[0] == '.')
+ if (de->d_name[0] == '.' &&
+ (de->d_name[1] == 0 ||
+ (de->d_name[1] == '.' && de->d_name[2] == 0)))
continue;
if (excluded(de->d_name) != show_ignored)
continue;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: git-update-cache: allow dot-files
2005-05-25 0:32 ` Junio C Hamano
2005-05-25 0:44 ` [PATCH] Allow dot files in ls-files as well Junio C Hamano
@ 2005-05-25 0:52 ` Linus Torvalds
2005-05-25 1:11 ` Junio C Hamano
1 sibling, 1 reply; 11+ messages in thread
From: Linus Torvalds @ 2005-05-25 0:52 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Tue, 24 May 2005, Junio C Hamano wrote:
> >>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
>
> LT> I considered it, but it's so much easier to allow things
> LT> later than deny them, that I preferred being anal about it.
>
> That is not the point. GIT_DIR set to "GIT" would happily suck
> index file in. You are not being anal enough.
Heh. There's a difference between being anal, and allowing people to shoot
themselves in the foot.
I'll happily allow people who _try_ to do stupid things to do them ;)
It's the
find . -type f | cut -d/ -f2- | xargs git-update-cache --add --
kinds of "unintentionally stupid" scripts I want to avoid (and the reason
I do that is because that's basically _exactly_ the script I used when
testing something ;)
Linus
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow dot files in ls-files as well.
2005-05-25 0:44 ` [PATCH] Allow dot files in ls-files as well Junio C Hamano
@ 2005-05-25 0:54 ` Linus Torvalds
2005-05-25 1:06 ` Junio C Hamano
2005-05-25 1:20 ` [PATCH] Allow dot files in ls-files as well (take #2) Junio C Hamano
0 siblings, 2 replies; 11+ messages in thread
From: Linus Torvalds @ 2005-05-25 0:54 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Tue, 24 May 2005, Junio C Hamano wrote:
>
> No matter what you end up doing, you would need something like
> this as well (I am not screening .git here but that should be
> easy for you to add).
Ehh, this will do bad things for "git-show-files --others", no?
You really _do_ want to strip out the ".git" file.
Linus
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow dot files in ls-files as well.
2005-05-25 0:54 ` Linus Torvalds
@ 2005-05-25 1:06 ` Junio C Hamano
2005-05-25 1:20 ` [PATCH] Allow dot files in ls-files as well (take #2) Junio C Hamano
1 sibling, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2005-05-25 1:06 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> You really _do_ want to strip out the ".git" file.
Yes I do, but not probably hardcoded ".git".
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: git-update-cache: allow dot-files
2005-05-25 0:52 ` git-update-cache: allow dot-files Linus Torvalds
@ 2005-05-25 1:11 ` Junio C Hamano
2005-05-26 8:37 ` Petr Baudis
0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2005-05-25 1:11 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> Heh. There's a difference between being anal, and allowing people to shoot
LT> themselves in the foot.
How about we do something like this:
(1) we keep hardcoded .git refusing as you did;
(2) we forbid GIT_DIR to be set to anything other than what
ends with "/.git", unless it is literally ".git";
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] Allow dot files in ls-files as well (take #2).
2005-05-25 0:54 ` Linus Torvalds
2005-05-25 1:06 ` Junio C Hamano
@ 2005-05-25 1:20 ` Junio C Hamano
1 sibling, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2005-05-25 1:20 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
This attempts to match "the directory '.git' anywhere in the
tree is ignored" approach taken in update-cache.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
cd /opt/packrat/playpen/public/in-place/git/git.junio/
PATH=.:$PATH jit-diff : ls-files.c
# - linus: git-update-cache: allow dot-files
# + (working tree)
diff --git a/ls-files.c b/ls-files.c
--- a/ls-files.c
+++ b/ls-files.c
@@ -136,7 +136,10 @@ static void read_directory(const char *p
while ((de = readdir(dir)) != NULL) {
int len;
- if (de->d_name[0] == '.')
+ if ((de->d_name[0] == '.') &&
+ (de->d_name[1] == 0 ||
+ !strcmp(de->d_name + 1, ".") ||
+ !strcmp(de->d_name + 1, "git")))
continue;
if (excluded(de->d_name) != show_ignored)
continue;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: git-update-cache: allow dot-files
2005-05-25 1:11 ` Junio C Hamano
@ 2005-05-26 8:37 ` Petr Baudis
2005-05-26 9:02 ` Junio C Hamano
0 siblings, 1 reply; 11+ messages in thread
From: Petr Baudis @ 2005-05-26 8:37 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Linus Torvalds, git
Dear diary, on Wed, May 25, 2005 at 03:11:42AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> >>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
>
> LT> Heh. There's a difference between being anal, and allowing people to shoot
> LT> themselves in the foot.
>
> How about we do something like this:
>
> (1) we keep hardcoded .git refusing as you did;
> (2) we forbid GIT_DIR to be set to anything other than what
> ends with "/.git", unless it is literally ".git";
That doesn't make any sense. When I'm working on kernel.org, why
would you prohibit me to set GIT_DIR to /pub/scm/cogito/cogito.git ?
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: git-update-cache: allow dot-files
2005-05-26 8:37 ` Petr Baudis
@ 2005-05-26 9:02 ` Junio C Hamano
0 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2005-05-26 9:02 UTC (permalink / raw)
To: Petr Baudis; +Cc: Linus Torvalds, git
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
PB> That doesn't make any sense. When I'm working on kernel.org, why
PB> would you prohibit me to set GIT_DIR to /pub/scm/cogito/cogito.git ?
What you say makes perfect sense, but avoiding hardcoded ".git/"
does not make any sense either in that situation.
Alternative suggestions welcome.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-05-26 9:01 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-25 0:12 git-update-cache: allow dot-files Junio C Hamano
2005-05-25 0:24 ` Linus Torvalds
2005-05-25 0:32 ` Junio C Hamano
2005-05-25 0:44 ` [PATCH] Allow dot files in ls-files as well Junio C Hamano
2005-05-25 0:54 ` Linus Torvalds
2005-05-25 1:06 ` Junio C Hamano
2005-05-25 1:20 ` [PATCH] Allow dot files in ls-files as well (take #2) Junio C Hamano
2005-05-25 0:52 ` git-update-cache: allow dot-files Linus Torvalds
2005-05-25 1:11 ` Junio C Hamano
2005-05-26 8:37 ` Petr Baudis
2005-05-26 9:02 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).