Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/builder-manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1477,20 +1477,26 @@ builder_manifest_get_runtime_version (BuilderManifest *self)
return self->runtime_version ? self->runtime_version : "master";
}

/* default-branch can only be set through the cli, where branch

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default-branch can be set through manifest though.

* is extracted from the manifest. As such the intended behavior
* is that the cli arguments should always override the branch
* set in the manifest, so your manifest can set the branch
* but you are still able to do --default-branch=test-build
*/
const char *
builder_manifest_get_branch (BuilderManifest *self,
BuilderContext *context)
{
if (self->branch)
return self->branch;

if (context &&
builder_context_get_default_branch (context))
return builder_context_get_default_branch (context);

if (self->default_branch)
return self->default_branch;

if (self->branch)
return self->branch;

return "master";
}

Expand Down
26 changes: 26 additions & 0 deletions tests/test-default-branch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"id": "org.test.DefaultBranch",
"runtime": "org.gnome.Platform",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"runtime": "org.gnome.Platform",
"runtime": "org.test.Platform",

Didn't want to bother figuring out where the test runtime was

"sdk": "org.gnome.Sdk",
"command": "hello",
"branch": "something",
"modules": [
{
"name": "install_test",
"buildsystem": "simple",
"build-commands": [
"mkdir -p ${FLATPAK_DEST}/bin",
"cp -vf hello.sh ${FLATPAK_DEST}/bin/hello"
],
"sources": [
{
"type": "script",
"dest-filename": "hello.sh",
"commands": [
"echo \"Hello world, from a sandbox\""
]
}
]
}
]
}