#git repo not being mounted with full git history?

1 messages · Page 1 of 1 (latest)

pallid ridge
#

I've created a function to check if the full history is available inside dagger

from typing import Optional, Annotated

import dagger
from dagger import Doc, dag, function, object_type, DefaultPath
from .parse_tools import parse_tool_versions

@object_type
class TofuTest:

    source: Annotated[dagger.Directory, DefaultPath("/")]

    @function
    def git_history(
            self
    ) -> str:

        """
        Show git history
        """

        return (
            dag.container()
            .from_("alpine:latest")
            .with_directory("/workdir", self.source)
            .with_workdir("/workdir")
            .with_exec(["apk", "add", "git"])
            .with_exec(["git", "rev-list", "--count", "HEAD"])
            .stdout()
        )
#

Checking the output from the trace, I can see that, despite using fetch-depth: 0, the container is only seeing 1 commit!