Skip to content

Conversation

@BrianHenryIE
Copy link
Member

Example project:

test.php
maybe-ignore-me.txt
test-dir/maybe-ignore-me.txt
test-dir/foo/maybe-ignore-me.txt

with example .distignore:

/maybe-ignore-me.txt

Should archive:

test.php
test-dir/maybe-ignore-me.txt
test-dir/foo/maybe-ignore-me.txt

This is working for zip.

The tests are failing for tar, but when I echo the tar command that is being used and manually cd to the directory and paste and run it, it works.

Could someone please take a look and see if they can make sense of why it's not working? I'm guessing it's related to the current working directory being somehow affected inside WP_CLI::launch().

@markjaquith

Working for zip
Not quite working for tar

The tar command is correct and works when I run it on the command line, but the tests are failing to exclude the file properly.
@BrianHenryIE
Copy link
Member Author

Tests are now passing on MacOS but not on GitHub Actions.

The problem was that PHP's escapeshellcmd() was escaping the ^ used in the exclude rule to tie the path to the root.

I've added a function to permit exceptions in escapeshellcmd().

I'll have to set up Ubuntu locally and run the tests there. I'll use nektos/act.

@BrianHenryIE BrianHenryIE marked this pull request as draft June 18, 2022 00:24
@schlessera schlessera added this to the 2.0.2 milestone Jun 30, 2022
@schlessera schlessera added the bug label Jun 30, 2022
Working for zip
Not quite working for tar

The tar command is correct and works when I run it on the command line, but the tests are failing to exclude the file properly.
@schlessera schlessera force-pushed the anchor-distignore-entries-to-root branch from a23834b to a1f922b Compare June 30, 2022 17:11
1. It seems `sys_get_temp_dir()` was being shared across multiple tests, so files already existed when subsequent tests were run.
2. Looks like the "no distignore file is present" test was failing after wp-cli#56 was merged.
@BrianHenryIE
Copy link
Member Author

It seems sys_get_temp_dir() was being shared across multiple test Examples, so files already existed as subsequent tests were run. This scenario is not possible when running the command from CLI wp dist-archive ....

There's a new test failure now! I have a feeling #59 will solve it. I'll work on the PR now.

@danielbachhuber
Copy link
Member

Ship #61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants