Skip to content

[bug] Option sparse-checkout-cone-mode is not honored correctly when using git < 2.37 #1868

Open
@samkearney

Description

@samkearney

To reproduce:

On a runner/image with git < 2.37 (for example, Ubuntu 22.04):

on: push

jobs:
  test:
    runs-on: ubuntu-latest
    container:
      image: ubuntu:22.04
    steps:
      - run: |
          apt-get update
          apt-get install -y git tree
      - uses: actions/checkout@v4
        with:
          sparse-checkout: subdir/subdir
          sparse-checkout-cone-mode: true
      - run: |
          echo "Sparse checkout: $(git config --get core.sparseCheckout)"
          echo "Cone mode: $(git config --get core.sparseCheckoutConeMode)"
          tree

Expected Results: Checked-out tree contains top-level files in the repo, per the sparse-checkout documentation on cone mode
Results: Only subdirectory specified is present in the tree

Note: Cone mode became the default in Git 2.37. In earlier versions of Git, cone mode needs to be set explicitly to work (e.g. git sparse-checkout set --cone). But the Checkout action is not doing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions