1
0
Fork 0

Add COMPOSER_DISCARD_CHANGE env var, refs #1188

pull/1789/head
Jordi Boggiano 2013-04-10 18:31:10 +02:00
parent 6da31f7c2b
commit 894f530898
2 changed files with 5 additions and 1 deletions

View File

@ -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 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). 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 ### COMPOSER_NO_INTERACTION
If set to 1, this env var will make composer behave as if you passed the If set to 1, this env var will make composer behave as if you passed the

View File

@ -177,7 +177,7 @@ class Config
return rtrim($this->process($this->config[$key]), '/\\'); return rtrim($this->process($this->config[$key]), '/\\');
case 'discard-changes': 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)) {
throw new \RuntimeException( throw new \RuntimeException(
"Invalid value for 'discard-changes': {$this->config[$key]}" "Invalid value for 'discard-changes': {$this->config[$key]}"
); );