8000 Fix git prompt breaking on some systems by Seldaek · Pull Request #12437 · composer/composer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix git prompt breaking on some systems #12437

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

Merged
merged 1 commit into from
Jun 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
16 changes: 12 additions & 4 deletions src/Composer/Util/Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public function fetchRefOrSyncMirror(string $url, string $dir, string $ref, ?str
public static function getNoShowSignatureFlag(ProcessExecutor $process): string
{
$gitVersion = self::getVersion($process);
if ($gitVersion && version_compare($gitVersion, '2.10.0-rc0', '>=')) {
if ($gitVersion !== null && version_compare($gitVersion, '2.10.0-rc0', '>=')) {
return ' --no-show-signature';
}

Expand Down Expand Up @@ -532,9 +532,17 @@ public function getMirrorDefaultBranch(string $url, string $dir, bool $isLocalPa

public static function cleanEnv(): void
{
// added in git 1.7.1, prevents prompting the user for username/password
if (Platform::getEnv('GIT_ASKPASS') !== 'echo') {
Platform::putEnv('GIT_ASKPASS', 'echo');
$gitVersion = self::getVersion(new ProcessExecutor());
if ($gitVersion !== null && version_compare($gitVersion, '2.3.0', '>=')) {
// added in git 2.3.0, prevents prompting the user for username/password
if (Platform::getEnv('GIT_TERMINAL_PROMPT') !== '0') {
Platform::putEnv('GIT_TERMINAL_PROMPT', '0');
}
} else {
// added in git 1.7.1, prevents prompting the user for username/password
if (Platform::getEnv('GIT_ASKPASS') !== 'echo') {
Platform::putEnv('GIT_ASKPASS', 'echo');
}
}

// clean up rogue git env vars in case this is running in a git hook
Expand Down
Loading
0