GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — New core type: GitCommit · Issue #13086 · dagger/dagger

New core type: GitCommit #13086

New issue
Copy link
New issue
Copy link
Closed
#13088
Closed
New core type: GitCommit#13086
#13088
Copy link

Description

@shykes
shykes
opened on May 5, 2026
Issue body actions

Problem

The core Git API currently models branches, tags, HEAD, and commit IDs through GitRef. That works well for ref lookup and tree checkout, because a commit ID can be used as a ref-like revision.

But commit metadata does not belong directly on GitRef. A ref is a pointer or name that resolves to a commit; the commit itself is the immutable object that has author, committer, message, parent, tree, and release-tag metadata.

Today this leaves no clean place to expose commit details such as committer date, author date, message, parent SHAs, or the semver release tag associated with a commit.

Solution

Add a GitCommit object and let refs resolve to it.

extend type GitRepository {
  """Returns details of a commit."""
  commit(id: String!): GitCommit!
}

extend type GitRef {
  """The commit this ref resolves to."""
  asCommit: GitCommit!
}

"""An immutable git commit."""
type GitCommit {
  """The full commit SHA."""
  sha: String!

  """The abbreviated commit SHA."""
  shortSha: String!

  """Git author date, in RFC3339 format."""
  authoredDate: String!

  """Git committer date, in RFC3339 format."""
  committedDate: String!

  """Git author name."""
  authorName: String!

  """Git author email."""
  authorEmail: String!

  """Git committer name."""
  committerName: String!

  """Git committer email."""
  committerEmail: String!

  """Full commit message."""
  message: String!

  """First line of the commit message."""
  messageHeadline: String!

  """Commit message body, excluding the headline."""
  messageBody: String!

  """Parent commit SHAs."""
  parentShas: [String!]!

  """The filesystem tree at this commit."""
  tree(
    discardGitDir: Boolean = false
    depth: Int = 1
    includeTags: Boolean = false
  ): Directory!

  """Highest semver tag pointing directly at this commit, if any."""
  releaseTag(includePreRelease: Boolean = false): GitRef

  """Highest semver tag reachable from this commit, if any."""
  ancestorReleaseTag(includePreRelease: Boolean = false): GitRef
}

GitRef.commit should remain the existing SHA string for compatibility.

GitRepository.commit(id:) can return GitCommit, because GitRepository.ref(name:) already covers the “treat this name or commit ID as a ref” use case.

Release Tags

releaseTag returns the highest semver tag that points directly at the commit.

ancestorReleaseTag returns the highest semver tag reachable from the commit.

“Highest” means semver order, not newest tag date or closest ancestor. If multiple semver tags point at the same commit, the highest semver tag wins.

By default, pre-release tags are ignored. When includePreRelease is true, stable and pre-release tags are considered together.

Tag lookup should be pure and reusable across WorkspaceGit and GitRepository.

Do not implement this with git fetch --tags. Fetching tags mutates local tag refs and object state, which is awkward for a GitCommit that should work for both a mutable local workspace repo and an immutable GitRepository.

Instead, build an effective tag set by reconciling local tags with remote tags:

  • include local-only tags
  • include remote-only tags
  • include matching local and remote tags
  • if local and remote have the same full tag ref but resolve to different commits, return an error

Compare peeled commit SHAs, not raw tag object SHAs, so annotated tags do not produce false conflicts.

For local repositories, choose the remote the same way git fetch --tags does when no remote is specified: use the current branch’s upstream remote if configured, otherwise use origin. If neither exists, use local tags only.

For remote GitRepository, use the repository’s configured remote URL.

Ancestor lookup may fetch commit objects needed for reachability checks, but it must not fetch tags into local tag refs.

Example

{
  git(url: "https://github.com/dagger/dagger") {
    head {
      ref
      commit
      asCommit {
        committedDate
        messageHeadline
        releaseTag {
          ref
        }
        ancestorReleaseTag(includePreRelease: true) {
          ref
        }
      }
    }

    commit(id: "b6315d8f2810962c601af73f86831f6866ea798b") {
      sha
      authoredDate
      committedDate
      parentShas
    }
  }
}

Workspace git composes through the same commit API:

{
  currentWorkspace {
    git {
      head {
        asCommit {
          releaseTag {
            ref
          }
          ancestorReleaseTag {
            ref
          }
        }
      }
    }
  }
}

Laziness

Scalar fields on GitCommit should read only commit object metadata. They should not hydrate or checkout the filesystem tree.

GitCommit.tree should be the boundary where Dagger fetches or materializes tree contents.

Release tag lookup should not checkout the tree or mutate .git. Ancestor release tag lookup should only materialize the commit objects needed to answer reachability.

Activity

Next
  1. shykes
    added 12 commits that reference this issue on May 5, 2026

    core: add Workspace.git API

    47e0712

    core: add Workspace.git API

    5bc4546

    core: add Workspace.git API

    e9f1fa6

    core: add Workspace.git API

    f9727a0

    core: add Workspace.git API

    9f9fef7

    core: add Workspace.git API

    f122066

    core: add Workspace.git API

    98e3490

    core: add Workspace.git API

    5887e47

    core: add Workspace.git API

    db8b186

    core: add Workspace.git API

    00ebda2

    core: add Workspace.git API

    b684ab1

    core: add Workspace.git API

    4d8cb1b
  2. dagger-codex
    added 2 commits that reference this issue on May 21, 2026

    core: add Workspace.git API

    b19e833

    core: add Workspace.git API

    6b77086
  3. dagger-codex
    added a commit that references this issue on May 29, 2026

    core: add Workspace.git API

    43505ca
  4. 8 remaining items

  5. dagger-codex
    added 5 commits that reference this issue on Jun 8, 2026

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    4a3d587

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    dceaabe

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    46161c1

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    47abad4

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    38fc829
  6. tiborvass
    added a commit that references this issue on Jun 10, 2026

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    5cc4186
  7. tiborvass
    added a commit that references this issue on Jun 17, 2026

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    2dda168
  8. shykes
    added 4 commits that reference this issue on Jun 18, 2026

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    9ea3503

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    c072a46

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    745beda
  9. tiborvass
    added 3 commits that reference this issue on Jun 29, 2026

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    00ab429

    toolchains/go: stamp VCS info into binaries via buildinfo ldflags

    5362814

    Merge pull request #13313 from dagger/better-version-strings

    499b5fc
  10. vito
    closed this as completedin #13088on Aug 6, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.