summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py11
-rwxr-xr-xtests.as-root/branch-from-image-works.script2
2 files changed, 10 insertions, 3 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py
index 141c3187..32158a88 100644
--- a/morphlib/plugins/branch_and_merge_plugin.py
+++ b/morphlib/plugins/branch_and_merge_plugin.py
@@ -73,7 +73,14 @@ class BranchAndMergePlugin(cliapp.Plugin):
arg_synopsis='SYSTEM')
self.app.add_subcommand('status', self.status)
self.app.add_subcommand('branch-from-image', self.branch_from_image,
- arg_synopsis='REPO BRANCH [METADATADIR]')
+ arg_synopsis='REPO BRANCH')
+ group_branch = 'Branching Options'
+ self.app.settings.string(['metadata-dir'],
+ 'Set metadata location for branch-from-image'
+ ' (default: /baserock)',
+ metavar='DIR',
+ default='/baserock',
+ group=group_branch)
# Advanced commands
self.app.add_subcommand('foreach', self.foreach,
@@ -859,7 +866,7 @@ class BranchAndMergePlugin(cliapp.Plugin):
'branch-from-image needs repository, ref and path to metadata')
root_repo = args[0]
branch = args[1]
- metadata_path = '/baserock' if len(args) == 2 else args[2]
+ metadata_path = self.app.settings['metadata-dir']
workspace = self.deduce_workspace()
self.lrc, self.rrc = morphlib.util.new_repo_caches(self.app)
diff --git a/tests.as-root/branch-from-image-works.script b/tests.as-root/branch-from-image-works.script
index 1d694e9b..9afab661 100755
--- a/tests.as-root/branch-from-image-works.script
+++ b/tests.as-root/branch-from-image-works.script
@@ -49,7 +49,7 @@ workspace="$DATADIR/workspace"
"$SRCDIR/scripts/test-morph" init "$workspace"
cd "$workspace"
"$SRCDIR/scripts/test-morph" branch-from-image \
- test:morphs mybranch "$extracted/baserock"
+ test:morphs mybranch --metadata-dir="$extracted/baserock"
cd mybranch/test:morphs
grep -qFe "$hello_chunk_commit" hello-stratum.morph
tar=$("$SRCDIR/scripts/test-morph" --find-system-artifact build hello-tarball)