Re: [PATCH] fsck: warn about .git in trees

2012-12-04 Thread Andreas Ericsson
On 11/30/2012 08:50 PM, Torsten Bögershausen wrote:
 Having a .git entry inside a tree can cause confusing
 results on checkout. At the top-level, you could not
 checkout such a tree, as it would complain about overwriting
 the real .git directory. In a subdirectory, you might
 check it out, but performing operations in the subdirectory
 would confusingly consider the in-tree .git directory as
 the repository.
 [snip]
 +int has_dotgit = 0;
 
 Name like . or .. are handled as directories by the OS.
 

The patch is for the index, where they're handled as whatever the mode
claims it is. The patch doesn't touch those parts though.

 .git could be a file or a directory, at least in theory,
 and from the OS point of view,
 but we want to have this as a reserved name.
 
 Looking at bad directory names, which gives trouble when checking out:
 
 Should we check for / or ../blabla as well?
 

Apart from the checks already in place, checking for git's internal
directory separator marker (which is '/') is enough to catch both,
and that check is done.

-- 
Andreas Ericsson   andreas.erics...@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] fsck: warn about .git in trees

2012-11-30 Thread Torsten Bögershausen

Having a .git entry inside a tree can cause confusing
results on checkout. At the top-level, you could not
checkout such a tree, as it would complain about overwriting
the real .git directory. In a subdirectory, you might
check it out, but performing operations in the subdirectory
would confusingly consider the in-tree .git directory as
the repository.

[snip]

+   int has_dotgit = 0;


Name like . or .. are handled as directories by the OS.

.git could be a file or a directory, at least in theory,
and from the OS point of view,
but we want to have this as a reserved name.

Looking at bad directory names, which gives trouble when checking out:

Should we check for / or ../blabla as well?

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] fsck: warn about .git in trees

2012-11-30 Thread Jeff King
On Fri, Nov 30, 2012 at 08:50:41PM +0100, Torsten Bögershausen wrote:

 Having a .git entry inside a tree can cause confusing
 results on checkout. At the top-level, you could not
 checkout such a tree, as it would complain about overwriting
 the real .git directory. In a subdirectory, you might
 check it out, but performing operations in the subdirectory
 would confusingly consider the in-tree .git directory as
 the repository.
 [snip]
 +int has_dotgit = 0;
 
 Name like . or .. are handled as directories by the OS.

Right. In theory git could run on a system that does not treat them
specially, but in practice they are going to be problematic on most
systems.

 .git could be a file or a directory, at least in theory, and from
 the OS point of view, but we want to have this as a reserved name.

Exactly.

 Looking at bad directory names, which gives trouble when checking out:
 
 Should we check for / or ../blabla as well?

We do already (the error is contains full pathnames). We also cover
empty pathnames and some other cases.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html