Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codecept clean command does not delete directory if there is a .gitignore file in it #2444

Closed
Naktibalda opened this issue Oct 12, 2015 · 5 comments

Comments

@Naktibalda
Copy link
Member

PHP Warning: rmdir(/Project/tests/_output/sites/test_5617e447ddefc): Directory not empty in phar:///Project/codecept.phar/src/Codeception/Util/FileSystem.php on line 28

It happens because there is a special exception for .gitignore in

if ($basename === '.' || $basename === '..' || $basename === '.gitignore') {

It was introduced by this pull request #597

My suggestion is to check if it is _output/.gitignore specifically and delete all .gitignore files in subdirs.

@eXorus
Copy link
Member

eXorus commented Jan 19, 2021

We still have the issue it's pretty easy to replace:

            if ($basename === '.' || $basename === '..' || $basename === '.gitignore') {
                continue;
            }

by

            if ($basename === '.' || $basename === '..') {
                continue;
            }
            if ($basename === '.gitignore' && $path->getPathInfo()->getBasename() === Configuration::outputDir()) {;
                continue;
            }

But it doesn't look good because we are in Util\FileSystem.php.

Any others idea?
If I have a folder within _output/myFolder/.gitignore, I guess we don't want to clean it.

@Naktibalda
Copy link
Member Author

I have almost opposite issue now - I don't like that clean command deletes .gitkeep files in output directories, so I will add another exception for .gitkeep files.

@Naktibalda
Copy link
Member Author

I raised PR to keep .gitkeep files: #6118

@eXorus
Copy link
Member

eXorus commented Feb 24, 2021

Great so we can close this issue, it's not relevant anymore, what do you think?

@Naktibalda
Copy link
Member Author

Naktibalda commented Feb 24, 2021

I don't remember why it was an issue to me anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants