diff options
author | Philip Withnall <withnall@endlessm.com> | 2017-11-20 14:48:04 +0000 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-12-14 14:18:44 +0000 |
commit | 5d1753f59bace948f0763e5de533c22e6ed5304b (patch) | |
tree | 4f6fc73be96a8bbd9a0d0b90bc1b8c188ab5b184 /src/ostree/ot-builtin-commit.c | |
parent | fb7692bd448ef0a395485a79a050193e50e417ac (diff) | |
download | ostree-5d1753f59bace948f0763e5de533c22e6ed5304b.tar.gz |
ostree/commit: Allow --orphan and --bind-ref to be specified together
Typically you’d use --branch and --bind-ref together to add additional
bindings as well as creating a main --branch for the commit. However,
you might also want to occasionally use --orphan --bind-ref to create a
commit with bindings for one or more refs, but not actually create any
of those refs pointing to the commit (you might create them as a later
step).
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1347
Approved by: cgwalters
Diffstat (limited to 'src/ostree/ot-builtin-commit.c')
-rw-r--r-- | src/ostree/ot-builtin-commit.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index 7c81712a..e53d7309 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -378,13 +378,11 @@ compare_strings (gconstpointer a, gconstpointer b) static void add_ref_binding (GVariantBuilder *metadata_builder) { - if (opt_orphan) - return; - - g_assert_nonnull (opt_branch); + g_assert (opt_branch != NULL || opt_orphan); g_autoptr(GPtrArray) refs = g_ptr_array_new (); - g_ptr_array_add (refs, opt_branch); + if (opt_branch != NULL) + g_ptr_array_add (refs, opt_branch); for (char **iter = opt_bind_refs; iter != NULL && *iter != NULL; ++iter) g_ptr_array_add (refs, *iter); g_ptr_array_sort (refs, compare_strings); |