Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

[feature request] Allow configuring cloneDepth #285

Open
fsubal opened this issue Aug 6, 2021 · 0 comments
Open

[feature request] Allow configuring cloneDepth #285

fsubal opened this issue Aug 6, 2021 · 0 comments

Comments

@fsubal
Copy link

fsubal commented Aug 6, 2021

Problem

When you start deploying a branch and someone push to that branch immediately after that, you will see the deploy fails ( when shallowClone: true ).

Checking out commit-ish "2e9d5dc95b5c48a2bbe4c7607df253881a65cfef"
Running "git checkout 2e9d5dc95b5c48a2bbe4c7607df253881a65cfef" on local.
@ fatal: reference is not a tree: 2e9d5dc95b5c48a2bbe4c7607df253881a65cfef
'deploy:fetch' errored after 4.08 s
Error: Command failed: git checkout 2e9d5dc95b5c48a2bbe4c7607df253881a65cfef
fatal: reference is not a tree: 2e9d5dc95b5c48a2bbe4c7607df253881a65cfef
    at ChildProcess.exithandler (child_process.js:308:12)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12)
error Command failed with exit code 1.

This happens since I was using shallowClone: true and it makes sense.

const fetchDepth = shipit.config.shallowClone ? ' --depth=1' : ''

Solution

I want to avoid shallowClone: false because we do not need to fully cloning the repo ( and could be slow for some bigger project ),
I think it would be better to have something like cloneDepth: 10 ( cloneDepth: 1 and cloneDepth: Infinity would be equivalent to the current shallowClone behavior ).

const { cloneDepth } = shipit.config
const unlimitedDepth = cloneDepth === undefined || cloneDepth === Infinity
const fetchDepth = unlimitedDepth ? '' : ` --depth=${cloneDepth}`

Concern

If shallowClone option is dropped and substituted, this will be a breaking change

@fsubal fsubal changed the title [feature request] Allow configuring fetchDepth [feature request] Allow configuring cloneDepth Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant