diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index 7558ef47..a62aa8bf 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -212,7 +212,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca mtree = ostree_mutable_tree_new (); - if (argc == 1 && (opt_trees == NULL || opt_trees[0] == NULL)) + if (argc <= 1 && (opt_trees == NULL || opt_trees[0] == NULL)) { char *current_dir = g_get_current_dir (); arg = g_file_new_for_path (current_dir); @@ -222,7 +222,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca cancellable, error)) goto out; } - else + else if (opt_trees != NULL) { const char *const*tree_iter; const char *tree; @@ -276,6 +276,14 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca } } } + else + { + g_assert (argc > 1); + arg = g_file_new_for_path (argv[1]); + if (!ostree_repo_stage_directory_to_mtree (repo, arg, mtree, modifier, + cancellable, error)) + goto out; + } if (mode_adds && g_hash_table_size (mode_adds) > 0) { diff --git a/tests/test-basic.sh b/tests/test-basic.sh index de372bdb..0c17fc5b 100755 --- a/tests/test-basic.sh +++ b/tests/test-basic.sh @@ -19,7 +19,7 @@ set -e -echo "1..39" +echo "1..40" . $(dirname $0)/libtest.sh @@ -275,3 +275,10 @@ $OSTREE reset test6 $checksum1 $OSTREE show test6 > show-output assert_file_has_content show-output "commit $checksum1" echo "ok basic reset" + +cd ${test_tmpdir} +rm checkout-test2 -rf +$OSTREE checkout test2 checkout-test2 +touch checkout-test2/sometestfile +$OSTREE commit -s sometest -b test2 checkout-test2 +echo "ok commit with directory filename"