Permalink
Browse files

Add COMPOSER_DISCARD_CHANGE env var, refs #1188

  • Loading branch information...
1 parent 6da31f7 commit 894f53089863bf92d6f44d77b7cd13e6e5fb6f5f @Seldaek Seldaek committed Apr 10, 2013
Showing with 5 additions and 1 deletion.
  1. +4 −0 doc/03-cli.md
  2. +1 −1 src/Composer/Config.php
View
4 doc/03-cli.md
@@ -431,6 +431,10 @@ configuration in the project's `composer.json` always wins.
This env var controls the time composer waits for commands (such as git
commands) to finish executing. The default value is 300 seconds (5 minutes).
+### COMPOSER_DISCARD_CHANGES
+
+This env var controls the discard-changes [config option](04-schema.md#config).
+
### COMPOSER_NO_INTERACTION
If set to 1, this env var will make composer behave as if you passed the
View
2 src/Composer/Config.php
@@ -177,7 +177,7 @@ public function get($key)
return rtrim($this->process($this->config[$key]), '/\\');
case 'discard-changes':
- if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
+ if (!in_array(getenv('COMPOSER_DISCARD_CHANGES') ?: $this->config[$key], array(true, false, 'stash'), true)) {
@stof
stof Apr 11, 2013

the env variable will always be a string. it cannot be a boolean

@Seldaek
Seldaek Apr 15, 2013

Thanks, fixed in 1d5e3c5

throw new \RuntimeException(
"Invalid value for 'discard-changes': {$this->config[$key]}"
@stof
stof Apr 11, 2013

This is wrong when using the env variable

);

0 comments on commit 894f530

Please sign in to comment.