Skip to content

🐞 using HEAD as ref of a git repository #7712

@becojo

Description

@becojo

What is the issue?

When using a git repository URL for a directory argument, Dagger seems to assume that the default branch is named main. This is often not the case.

I also cannot use HEAD as ref. You can see in the error message the commit HEAD is pointing to but Dagger does not handle it.

When Dagger is provided a Git URL without ref, it should mimic a git clone of that URL and not guess the default branch.

Dagger version

dagger v0.11.6 (registry.dagger.io/engine) linux/amd64

Steps to reproduce

dagger call -m github.com/jpadams/semgrep-dagger-module@2d91746e95d15790051f3e3544b51dac84743e4c scan --source https://github.com/JustinCoker991/serverless-plugin-treeshake
Stderr:
╭─ Error ──────────────────────────────────────────────────────────────────────╮
│ Function execution error: resolve: failed to load cache key: repository does │
│ not contain ref main, output: ""                                             │
╰──────────────────────────────────────────────────────────────────────────────╯
dagger call -m github.com/jpadams/semgrep-dagger-module@2d91746e95d15790051f3e3544b51dac84743e4c scan --source https://github.com/JustinCoker991/serverless-plugin-treeshake#HEAD
Stderr:
╭─ Error ──────────────────────────────────────────────────────────────────────╮
│ Function execution error: resolve: failed to load cache key: repository does │
│ not contain ref HEAD, output:                                                │
│ "689aa86aff89bf2e0240a12dfeee30481cce8d4b\tHEAD\n"                           │
╰──────────────────────────────────────────────────────────────────────────────╯

Log output

No response

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