fix: Check if repo is shallow before unshallowing
parent
f0fabf6d88
commit
c5bb2b18af
|
@ -96,9 +96,18 @@ module.exports = new (class Git {
|
||||||
*
|
*
|
||||||
* @return {Promise<>}
|
* @return {Promise<>}
|
||||||
*/
|
*/
|
||||||
pull = () => (
|
pull = async() => {
|
||||||
this.exec(`pull --unshallow --tags ${core.getInput('git-pull-method')}`)
|
const args = ['pull']
|
||||||
)
|
|
||||||
|
// Check if the repo is unshallow
|
||||||
|
if (await this.isShallow()) {
|
||||||
|
args.push('--unshallow')
|
||||||
|
}
|
||||||
|
|
||||||
|
args.push(core.getInput('git-pull-method'))
|
||||||
|
|
||||||
|
return this.exec(args.join(' '))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Push all changes
|
* Push all changes
|
||||||
|
@ -109,6 +118,17 @@ module.exports = new (class Git {
|
||||||
this.exec(`push origin ${branch} --follow-tags`)
|
this.exec(`push origin ${branch} --follow-tags`)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the repo is shallow
|
||||||
|
*
|
||||||
|
* @return {Promise<>}
|
||||||
|
*/
|
||||||
|
isShallow = async () => {
|
||||||
|
const isShallow = await this.exec('rev-parse --is-shallow-repository')
|
||||||
|
|
||||||
|
return isShallow.trim().replace('\n', '') === 'true'
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the origin remote
|
* Updates the origin remote
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue