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

Ignore VSC folders by default with update subcommand #257

Open
iandunn opened this issue Sep 26, 2020 · 1 comment
Open

Ignore VSC folders by default with update subcommand #257

iandunn opened this issue Sep 26, 2020 · 1 comment

Comments

@iandunn
Copy link
Contributor

iandunn commented Sep 26, 2020

Problem

Running the update subcommand deletes the contents of cloned plugin/theme folders.

A similar report was closed 4 years ago, but I think that should be reconsidered. I routinely run into this, and end up having to restore local changes from backups.

I have lots of sites in my dev environment, and most of those have lots of plugins. I can't memorize which ones are VCS and which aren't, so I have to manually check each one, and then update non-VCS plugins individually.

  1. git clone [email protected]:WordPress/gutenberg.git (or any other plugin that's in the repository) and cd to it's folder
  2. git checkout v8.0.0
  3. wp plugin update --all
Downloading update from https://downloads.wordpress.org/plugin/gutenberg.9.0.0.zip...
The authenticity of gutenberg.9.0.0.zip could not be verified as no signature was found.
Unpacking the update...
Installing the latest version...
Removing the old version of the plugin...
Warning: Could not remove the old plugin.
Plugin update failed.
+-----------+-------------+-------------+--------+
| name      | old_version | new_version | status |
+-----------+-------------+-------------+--------+
| gutenberg | 8.0.0       | 9.0.0       | Error  |
+-----------+-------------+-------------+--------+
Error: No plugins updated.

The folder is now empty, and any work that was done locally is lost.

> ls
.  ..  node_modules

Proposed Solution

The update subcommands aren't intended to work with VCS repos, so I think they should gracefully ignore them, rather than breaking them. An --include-vcs flag could override that for the rare time when someone does want to blow away a VCS checkout with the version from the w.org repo.

Environment

> wp cli info
OS:	Darwin 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64
Shell:	/bin/bash
PHP binary:	/usr/local/Cellar/php/7.4.10/bin/php
PHP version:	7.4.10
php.ini used:	/usr/local/etc/php/7.4/php-cli.ini
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/Users/ian-work/vhosts/localhost/wp.test/public_html/content/plugins/gutenberg
WP-CLI packages dir:	/Users/ian-work/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config:	/Users/ian-work/vhosts/localhost/wp.test/wp-cli.yml
WP-CLI version:	2.4.0
@danielbachhuber danielbachhuber changed the title update subcommand deletes local version control checkouts Ignore VSC folders by default with update subcommand Apr 26, 2023
@danielbachhuber
Copy link
Member

I'm open to either changing the default behavior, or introducing a --skip-vcs flag to maintain backwards compatibility.

It would be good to parallel whatever core does in this regard (I don't recall exactly off the top of my head).

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

No branches or pull requests

2 participants