Skip to content

✨ Support --depth when using dag.git #7637

Closed

Description

@Xiot

What are you trying to do?

Trying to pull down more history for a ref than just the single commit.

The request is to have a property on the dag.git to specify the depth (number of commits) to checkout

Why is this important to you?

We currently have a couple different jobs within our workflow that rely on checking the differences between the given commit and its parent.

How are you currently working around this?

Right now, we are using dag.git to do the initial checkout, then running a separate git fetch --depth=2, to pull the history.

For some reason, the separate fetch doesn't always pull down the history properly.

Activity

  1. added
    area/engine
    and removed on Oct 30, 2024
  2. jedevc commented on Oct 30, 2024

    @jedevc
    Contributor

    Yup, this seems very reasonable to me, in my head this is strongly related to all the API improvements in #8520 (comment).

    As a note to anyone picking this up - the logic for this needs to end up in our custom buildkit git source here:

    if !isCommitSHA(ref) { // TODO: find a branch from ls-remote?
    args = append(args, "--depth=1", "--no-tags")
    } else {
    args = append(args, "--tags")
    if _, err := os.Lstat(filepath.Join(gitDir, "shallow")); err == nil {
    args = append(args, "--unshallow")
    }
    }

    There are two git repositories involved in a clone - the "farm" which keeps track of most of the repository, and then the clone off of the farm to get the git dir that the user sees. When specifying a depth, we need to ensure that the "farm" has at least the required depth, and then we just need to set the depth correctly when cloning off of the farm. The rest of this, plumbing through from the dagger API should be pretty easy.

  3. jedevc commented on Apr 23, 2025

    @jedevc
    Contributor

    Fixed by #9980.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/enginekind/user-request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions