diff --git a/src/builder-manifest.c b/src/builder-manifest.c index 9304587d..293e2f8e 100644 --- a/src/builder-manifest.c +++ b/src/builder-manifest.c @@ -1477,13 +1477,16 @@ 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 + * 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); @@ -1491,6 +1494,9 @@ builder_manifest_get_branch (BuilderManifest *self, if (self->default_branch) return self->default_branch; + if (self->branch) + return self->branch; + return "master"; } diff --git a/tests/test-default-branch.json b/tests/test-default-branch.json new file mode 100644 index 00000000..d3422fdb --- /dev/null +++ b/tests/test-default-branch.json @@ -0,0 +1,26 @@ +{ + "id": "org.test.DefaultBranch", + "runtime": "org.gnome.Platform", + "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\"" + ] + } + ] + } + ] +}