소스 검색

Add COMPOSER_DISCARD_CHANGE env var, refs #1188

Jordi Boggiano 12 년 전
부모
커밋
894f530898
2개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 0
      doc/03-cli.md
  2. 1 1
      src/Composer/Config.php

+ 4 - 0
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

+ 1 - 1
src/Composer/Config.php

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