(
repository: Repository,
remote: IRemote,
options?: {
progressCallback?: (progress: IPullProgress) => void
onHookProgress?: (progress: HookProgress) => void
onHookFailure?: (
hookName: string,
terminalOutput: TerminalOutput
) => Promise<'abort' | 'ignore'>
onTerminalOutputAvailable?: TerminalOutputCallback
noVerify?: boolean
}
)
| 27 | * 'git pull'. |
| 28 | */ |
| 29 | export async function pull( |
| 30 | repository: Repository, |
| 31 | remote: IRemote, |
| 32 | options?: { |
| 33 | progressCallback?: (progress: IPullProgress) => void |
| 34 | onHookProgress?: (progress: HookProgress) => void |
| 35 | onHookFailure?: ( |
| 36 | hookName: string, |
| 37 | terminalOutput: TerminalOutput |
| 38 | ) => Promise<'abort' | 'ignore'> |
| 39 | onTerminalOutputAvailable?: TerminalOutputCallback |
| 40 | noVerify?: boolean |
| 41 | } |
| 42 | ): Promise<void> { |
| 43 | let opts: IGitStringExecutionOptions = { |
| 44 | env: await envForRemoteOperation(remote.url), |
| 45 | // git pull triggers merge or rebase hooks depending on config, instead of |
| 46 | // trying to check pull.rebase and friends we'll just intercept all possible |
| 47 | // hooks that could be run as part of a pull operation. |
| 48 | interceptHooks: [ |
| 49 | 'pre-merge-commit', |
| 50 | 'prepare-commit-msg', |
| 51 | 'commit-msg', |
| 52 | 'post-merge', |
| 53 | 'pre-rebase', |
| 54 | 'pre-commit', |
| 55 | 'post-rewrite', |
| 56 | ], |
| 57 | } |
| 58 | |
| 59 | if (options?.progressCallback) { |
| 60 | const title = `Pulling ${remote.name}` |
| 61 | const kind = 'pull' |
| 62 | |
| 63 | opts = await executionOptionsWithProgress( |
| 64 | { ...opts, trackLFSProgress: true }, |
| 65 | new PullProgressParser(), |
| 66 | progress => { |
| 67 | // In addition to progress output from the remote end and from |
| 68 | // git itself, the stderr output from pull contains information |
| 69 | // about ref updates. We don't need to bring those into the progress |
| 70 | // stream so we'll just punt on anything we don't know about for now. |
| 71 | if (progress.kind === 'context') { |
| 72 | if (!progress.text.startsWith('remote: Counting objects')) { |
| 73 | return |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | const description = |
| 78 | progress.kind === 'progress' ? progress.details.text : progress.text |
| 79 | |
| 80 | const value = progress.percent |
| 81 | |
| 82 | options?.progressCallback?.({ |
| 83 | kind, |
| 84 | title, |
| 85 | description, |
| 86 | value, |
no test coverage detected