flatpak-builder icon indicating copy to clipboard operation
flatpak-builder copied to clipboard

Git source conflates tag, branch and commits

Open bbhtt opened this issue 2 months ago • 0 comments

Given a manifest:

id: org.flatpak.Hello
runtime: org.freedesktop.Platform
runtime-version: '25.08'
sdk: org.freedesktop.Sdk
modules:
  - name: hello
    buildsystem: simple
    build-commands: []
    sources:
      - type: git
        url: https://github.com/flatpak/flatpak-builder.git
        tag: 4e2388ce4a04f1887911c816bf36fc4cbc105367

tag accepts a branch, commit, and a tag -> It should only accept a git tag

commit accepts a branch, commit, and a tag -> It should only accept a commit.

branch accepts a branch, commit, and a tag -> It should only accept a branch.

We can probably use git ls-remote to do the right thing (check first)

git ls-remote --tags https://github.com/flatpak/flatpak-builder.git

git ls-remote --branches https://github.com/flatpak/flatpak-builder.git

They also accept a git describe ref format:

git describe --tags --abbrev=40
v6-4-g9a028c440806c271e55d3c51f80525930c6b2bf5

which is a bit of a special case. If it is at a tag it starts at 0, and then it counts commits on top the tag.

Any change done here would be a breaking change so this needs to happen in unstable branch first

bbhtt avatar Oct 22 '25 13:10 bbhtt