Merge pull request #2039 from cgwalters/commit-cli-cleanup
main/commit: Rework control flow to use --tree=X path
This commit is contained in:
commit
41d3dfa7b8
|
|
@ -601,18 +601,24 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
|
||||||
|
|
||||||
mtree = ostree_mutable_tree_new ();
|
mtree = ostree_mutable_tree_new ();
|
||||||
|
|
||||||
if (argc <= 1 && (opt_trees == NULL || opt_trees[0] == NULL))
|
/* Convert implicit . or explicit path via argv into
|
||||||
|
* --tree=dir= so that we only have one primary code path below.
|
||||||
|
*/
|
||||||
|
if (opt_trees == NULL || opt_trees[0] == NULL)
|
||||||
{
|
{
|
||||||
if (!ostree_repo_write_dfd_to_mtree (repo, AT_FDCWD, ".", mtree, modifier,
|
char *path;
|
||||||
cancellable, error))
|
if (argc <= 1)
|
||||||
goto out;
|
path = ".";
|
||||||
|
else
|
||||||
|
path = argv[1];
|
||||||
|
opt_trees = g_new0 (char *, 2);
|
||||||
|
opt_trees[0] = g_strconcat ("dir=", path, NULL);
|
||||||
}
|
}
|
||||||
else if (opt_trees != NULL)
|
|
||||||
{
|
|
||||||
const char *const*tree_iter;
|
const char *const*tree_iter;
|
||||||
const char *tree;
|
const char *tree;
|
||||||
const char *eq;
|
const char *eq;
|
||||||
|
g_assert (opt_trees && *opt_trees);
|
||||||
for (tree_iter = (const char *const*)opt_trees; *tree_iter; tree_iter++)
|
for (tree_iter = (const char *const*)opt_trees; *tree_iter; tree_iter++)
|
||||||
{
|
{
|
||||||
tree = *tree_iter;
|
tree = *tree_iter;
|
||||||
|
|
@ -715,14 +721,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_assert (argc > 1);
|
|
||||||
if (!ostree_repo_write_dfd_to_mtree (repo, AT_FDCWD, argv[1], mtree, modifier,
|
|
||||||
cancellable, error))
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode_adds && g_hash_table_size (mode_adds) > 0)
|
if (mode_adds && g_hash_table_size (mode_adds) > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue