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

[feature request] Allow configuring cloneDepth #285

@fsubal

Description

@fsubal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions