Update clone depth:1 behaviour

If using the default clone step with the depth attribute set to 1, whenever rebuilding from past build (commit) will throw an error since that commit won’t be part of the tree which was just pulled.

With that in mind, wouldn’t be better to update the built-in clone command to use $DRONE_COMMIT when pulling with depth: 1 by default?

Something like:

clone: {disable: true}

steps:
  - name: pull
    image: alpine/git
    commands:
      - git init
      - git remote add origin "$DRONE_REMOTE_URL"
      - git fetch --depth 1 origin "$DRONE_COMMIT"
      - git checkout -b "$DRONE_BRANCH" FETCH_HEAD

I was having issues with default shallow clone behavior when the event was pull_request. I ended up using this:

clone: {disable: true}

steps:
  - name: clone
    image: drone/git
    commands:
      - 'git clone --single-branch --depth 1 --branch $${DRONE_SOURCE_BRANCH} $${DRONE_GIT_HTTP_URL} .'