mirror of
https://github.com/desktop/desktop
synced 2024-06-30 22:54:41 +00:00
Compare commits
6 Commits
f7404755ec
...
d2c6ddb164
Author | SHA1 | Date | |
---|---|---|---|
|
d2c6ddb164 | ||
|
95f263a23d | ||
|
10c3d47706 | ||
|
8d86091ae3 | ||
|
d8873cb08d | ||
|
a404a3f251 |
|
@ -20,28 +20,22 @@ import { IRemote } from '../../models/remote'
|
|||
export type ProgressCallback = (progress: ICheckoutProgress) => void
|
||||
|
||||
function getCheckoutArgs(progressCallback?: ProgressCallback) {
|
||||
return progressCallback != null
|
||||
? [...gitNetworkArguments(), 'checkout', '--progress']
|
||||
: [...gitNetworkArguments(), 'checkout']
|
||||
return [
|
||||
...gitNetworkArguments(),
|
||||
'checkout',
|
||||
...(progressCallback ? ['--progress'] : []),
|
||||
]
|
||||
}
|
||||
|
||||
async function getBranchCheckoutArgs(branch: Branch) {
|
||||
const baseArgs: ReadonlyArray<string> = []
|
||||
if (enableRecurseSubmodulesFlag()) {
|
||||
return branch.type === BranchType.Remote
|
||||
? baseArgs.concat(
|
||||
branch.name,
|
||||
'-b',
|
||||
branch.nameWithoutRemote,
|
||||
'--recurse-submodules',
|
||||
'--'
|
||||
)
|
||||
: baseArgs.concat(branch.name, '--recurse-submodules', '--')
|
||||
}
|
||||
|
||||
return branch.type === BranchType.Remote
|
||||
? baseArgs.concat(branch.name, '-b', branch.nameWithoutRemote, '--')
|
||||
: baseArgs.concat(branch.name, '--')
|
||||
return [
|
||||
branch.name,
|
||||
...(branch.type === BranchType.Remote
|
||||
? ['-b', branch.nameWithoutRemote]
|
||||
: []),
|
||||
...(enableRecurseSubmodulesFlag() ? ['--recurse-submodules'] : []),
|
||||
'--',
|
||||
]
|
||||
}
|
||||
|
||||
async function getCheckoutOpts(
|
||||
|
|
|
@ -485,8 +485,7 @@ export function gitRebaseArguments() {
|
|||
// uses the merge backend even if the user has the apply backend
|
||||
// configured, since this is the only one supported.
|
||||
// This can go away once git deprecates the apply backend.
|
||||
'-c',
|
||||
'rebase.backend=merge',
|
||||
...['-c', 'rebase.backend=merge'],
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -11,28 +11,16 @@ async function getFetchArgs(
|
|||
remote: string,
|
||||
progressCallback?: (progress: IFetchProgress) => void
|
||||
) {
|
||||
if (enableRecurseSubmodulesFlag()) {
|
||||
return progressCallback != null
|
||||
? [
|
||||
...gitNetworkArguments(),
|
||||
'fetch',
|
||||
'--progress',
|
||||
'--prune',
|
||||
'--recurse-submodules=on-demand',
|
||||
remote,
|
||||
]
|
||||
: [
|
||||
...gitNetworkArguments(),
|
||||
'fetch',
|
||||
'--prune',
|
||||
'--recurse-submodules=on-demand',
|
||||
remote,
|
||||
]
|
||||
} else {
|
||||
return progressCallback != null
|
||||
? [...gitNetworkArguments(), 'fetch', '--progress', '--prune', remote]
|
||||
: [...gitNetworkArguments(), 'fetch', '--prune', remote]
|
||||
}
|
||||
return [
|
||||
...gitNetworkArguments(),
|
||||
'fetch',
|
||||
...(progressCallback ? ['--progress'] : []),
|
||||
'--prune',
|
||||
...(enableRecurseSubmodulesFlag()
|
||||
? ['--recurse-submodules=on-demand']
|
||||
: []),
|
||||
remote,
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,28 +19,15 @@ async function getPullArgs(
|
|||
remote: string,
|
||||
progressCallback?: (progress: IPullProgress) => void
|
||||
) {
|
||||
const divergentPathArgs = await getDefaultPullDivergentBranchArguments(
|
||||
repository
|
||||
)
|
||||
|
||||
const args = [
|
||||
return [
|
||||
...gitNetworkArguments(),
|
||||
...gitRebaseArguments(),
|
||||
'pull',
|
||||
...divergentPathArgs,
|
||||
...(await getDefaultPullDivergentBranchArguments(repository)),
|
||||
...(enableRecurseSubmodulesFlag() ? ['--recurse-submodules'] : []),
|
||||
...(progressCallback ? ['--progress'] : []),
|
||||
remote,
|
||||
]
|
||||
|
||||
if (enableRecurseSubmodulesFlag()) {
|
||||
args.push('--recurse-submodules')
|
||||
}
|
||||
|
||||
if (progressCallback != null) {
|
||||
args.push('--progress')
|
||||
}
|
||||
|
||||
args.push(remote)
|
||||
|
||||
return args
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user