mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Use remote credentials for 'git fetch' and 'hg pull' commands
Summary: These are "local" commands, but need remote credentials. If the daemon runs as a user who does not have credentials, the initial clone will work but subsequent updates will fail. Test Plan: - Nuked a local copy of a Git repo. - Ran "phd debug fetch <phid>" as root (or any other user with no natural SSH keys). Verified initial clone worked (since it passes credentials to the command correctly). - Killed daemon, re-ran, verified "fetch" failed (no credentials passed). - Applied this patch. - Re-ran "phd debug fetch <phid>", verified it passed credentials and succeeded. - Did all these steps for a Mercurial repo. Reviewers: btrahan, jungejason Reviewed By: btrahan CC: aran, btrahan Maniphest Tasks: T686 Differential Revision: 1236
This commit is contained in:
parent
0634009720
commit
b5c9b9d059
2 changed files with 9 additions and 4 deletions
|
@ -37,8 +37,10 @@ final class PhabricatorRepositoryGitFetchDaemon
|
|||
PhabricatorRepository $repository,
|
||||
$local_path) {
|
||||
|
||||
$repository->execxLocalCommand(
|
||||
'fetch --all');
|
||||
// This is a local command, but needs credentials.
|
||||
$future = $repository->getRemoteCommandFuture('fetch --all');
|
||||
$future->setCWD($local_path);
|
||||
$future->resolvex();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,8 +35,11 @@ final class PhabricatorRepositoryMercurialPullDaemon
|
|||
protected function executeUpdate(
|
||||
PhabricatorRepository $repository,
|
||||
$local_path) {
|
||||
$repository->execxLocalCommand(
|
||||
'pull -u');
|
||||
|
||||
// This is a local command, but needs credentials.
|
||||
$future = $repository->getRemoteCommandFuture('pull -u');
|
||||
$future->setCWD($local_path);
|
||||
$future->resolvex();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue