main: Support passing bare directory names to commit
It segfaulted before if you passed non-options, and a single directory name is probably what people want.
This commit is contained in:
parent
499df2a90b
commit
c9d7050d3d
|
|
@ -212,7 +212,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
|
||||||
|
|
||||||
mtree = ostree_mutable_tree_new ();
|
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 ();
|
char *current_dir = g_get_current_dir ();
|
||||||
arg = g_file_new_for_path (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))
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
else
|
else if (opt_trees != NULL)
|
||||||
{
|
{
|
||||||
const char *const*tree_iter;
|
const char *const*tree_iter;
|
||||||
const char *tree;
|
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)
|
if (mode_adds && g_hash_table_size (mode_adds) > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "1..39"
|
echo "1..40"
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
|
|
@ -275,3 +275,10 @@ $OSTREE reset test6 $checksum1
|
||||||
$OSTREE show test6 > show-output
|
$OSTREE show test6 > show-output
|
||||||
assert_file_has_content show-output "commit $checksum1"
|
assert_file_has_content show-output "commit $checksum1"
|
||||||
echo "ok basic reset"
|
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"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue