Avoid check mistakenly current folder for .git/.svn/.CVS, when going up the path checking for parents.

This commit is contained in:
Tommaso Cucinotta 2013-04-07 01:10:31 +01:00
parent ceb2303e2b
commit 34dfe2d71e

View File

@ -102,20 +102,18 @@ bool VCS::makeRCSRevision(string const &version, string &revis) const
bool VCS::checkparentdirs(FileName const & file, std::string const & pathname)
{
FileName dirname = file.onlyPath();
FileName tocheck = FileName(addName(dirname.absFileName(),pathname));
LYXERR(Debug::LYXVC, "check file: " << tocheck.absFileName());
bool result = tocheck.exists();
while ( !result && !dirname.empty() ) {
do {
FileName tocheck = FileName(addName(dirname.absFileName(), pathname));
LYXERR(Debug::LYXVC, "check file: " << tocheck.absFileName());
if (tocheck.exists())
return true;
//this construct because of #8295
dirname = FileName(dirname.absFileName()).parentPath();
LYXERR(Debug::LYXVC, "check directory: " << dirname.absFileName());
tocheck = FileName(addName(dirname.absFileName(),pathname));
result = tocheck.exists();
}
return result;
} while (!dirname.empty());
return false;
}
/////////////////////////////////////////////////////////////////////
//
// RCS