Skip to content

Source controller fails to clone when specifying just the revision (and default branch main at origin) #315

@squaremo

Description

@squaremo

If I create a GitRepository with a spec like this:

spec:
  url: https://github.com/squaremo/flux2-example
  ref:
    commit: 92f0a9e59583732a052178427e376b77ae9e248b

then the source controller fails to clone the repo. Naively, I would expect it to do the equivalent of

git clone --no-checkout https://github.com/squaremo/flux2-example
cd flux2-example; git checkout 92f0a9e59583732a052178427e376b77ae9e248b

Unfortunately, the .branch field has a default of master, and the checkout code checks out the branch first, then the commit (whether or not it's on the branch, so far as I can tell). This seems like a needless step; but it also means you can't specify just a commit, you have to name a branch that exists at the origin, otherwise it'll fail.

Metadata

Metadata

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