-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix svn add/rm commands for release tool #27886
Conversation
Size Change: 0 B Total Size: 1.28 MB ℹ️ View Unchanged
|
@ockham we might want to include this fix in your PR github action PR too. |
I wanted to note that the |
fd89f33
to
b16316d
Compare
Yeah, read in some docs that macOS will silently ignore the |
ok, updated the docs accordingly. Unless there's anyone that wants to try this on a Linux OS before giving a 👍 I guess you need to trust me this works :D |
Does this mean there's a risk of breaking in MacOS? Is there a consistent way to do this? |
Not after the last change I pushed. Only linux-based OS will get the option for xargs. |
yes, that's my point, so if there's no file changes, MacOs could break (like today)? |
Ah, misunderstood your comment. Updated the testing instructions in the issue. What happens if you do this on macOS? svn checkout https://plugins.svn.wordpress.org/gutenberg/trunk test
cd test
svn st | grep '^?' | awk '{print $2}' | xargs svn add It's the same as before (shouldn't fail), and what I understand is that it doesn't report any error precisely because the default behavior is different from linux (xargs won't run in macOS if there's no input, hence, why there's no |
I just tested and it seems to work without errors 👍 |
@nosolosw BSD
In my experience, having OS-specific logic will bite us when we least expect it. For example some people on macOS swap the At this point, though, it looks safe to add the |
From the feedback in the PR I understood |
This PR fixes the release tool in the use case where no files are to be added or removed for users of linux-based OS.
The commands we use to add and remove files to be committed to the WordPress svn repo for the plugin are:
However, when there are no files to add or remove, xargs still runs the svn commands, and because there are no files to add or remove, they fail and the release tools stops. On non-linux OS this works differently, reportedly on macOS, xargs won't run if it receives no input.
According to the docs, there's an option that prevents the command from being executed if no input is given,
--no-run-if-empty
or-r
, but not every system supports it. To make sure it runs well in every OS we add the-r
option for systems that support it.How to test
svn checkout https://plugins.svn.wordpress.org/gutenberg/trunk test
cd test
svn st | grep '^?' | awk '{print $2}' | xargs -r svn add
. The expected behavior is that shouldn't report any message, check that without the-r
it reports an error like this one:svn st | grep '^?' | awk '{print $2}' | xargs svn add
. The expected behavior is that shouldn't report any message.