Open pdewouters opened 9 years ago
Thanks for the report. This is happening because your git repo is not located at ABSPATH. For the moment, this is hardcoded into the tool, though there's a note that says to fix it! https://github.com/boonebgorges/wp-cli-git-helper/blob/master/wp-cli-git-helper.php#L55
ok thanks!
You got it! A proper fix for this is pretty straightforward - instead of hardcoding ABSPATH
here https://github.com/boonebgorges/wp-cli-git-helper/blob/master/wp-cli-git-helper.php#L56, it would be set by an $assoc_args
param, which would default to ABSPATH
. Pull requests welcome :) Or you can just hardcode the proper path yourself.
Sure, I'll do a PR :)
Just ran into this too. Another solution might be to search recursively from WP_PLUGIN_DIR up the directory tree until a directory is found with a .git folder. This would work for basic installs and ones where Wordpress is a submodule.
Should I submit a PR for this? Currently I just check if WP_PLUGIN_DIR
or it's parent/grandparent directory contains a Git repo, and use the first one I find (or print an error message).
Walking up the tree recursively seems dangerous to me - you wouldn't want to accidentally commit to the incorrect repo. A PR that implements this idea https://github.com/boonebgorges/wp-cli-git-helper/issues/1#issuecomment-67847064 seems safer to me. (You can then define a default for the new flag in your wp-cli.yml file.)