From 80774680e8df8d0fa9da295b981be3d8ba86bc8c Mon Sep 17 00:00:00 2001 From: Mathnerd314 Date: Mon, 23 May 2016 12:49:37 -0600 Subject: [PATCH] commit: Don't require a subject In practice, a lot of subjects are empty, because the commit date and branch are sufficient identification. For example, rpm-ostree does not use subjects. It also doesn't use the command-line ostree commit tool, so this was not a problem there, but this makes the behavior consistent. Also adds a test that empty subjects and omitting the subject are equivalent. The --timestamp is so that the commits do not have different timestamps. Closes: #305 Approved by: cgwalters --- src/ostree/ot-builtin-commit.c | 7 ------- tests/basic-test.sh | 8 +++++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index 99687c52..85c4c65d 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -437,13 +437,6 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError goto out; } - if (!opt_subject) - { - g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "A subject must be specified with --subject"); - goto out; - } - if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error)) goto out; diff --git a/tests/basic-test.sh b/tests/basic-test.sh index 0373fcbc..93f67f17 100755 --- a/tests/basic-test.sh +++ b/tests/basic-test.sh @@ -19,7 +19,7 @@ set -euo pipefail -echo "1..56" +echo "1..57" $OSTREE checkout test2 checkout-test2 echo "ok checkout" @@ -103,6 +103,12 @@ $OSTREE commit -b test2-no-parent -s '' --parent=none $test_tmpdir/checkout-test assert_streq $($OSTREE log test2-no-parent |grep '^commit' | wc -l) "1" echo "ok commit no parent" +cd ${test_tmpdir} +empty_rev=$($OSTREE commit -b test2-no-subject -s '' --timestamp="2005-10-29 12:43:29 +0000" $test_tmpdir/checkout-test2-4) +omitted_rev=$($OSTREE commit -b test2-no-subject-2 --timestamp="2005-10-29 12:43:29 +0000" $test_tmpdir/checkout-test2-4) +assert_streq $empty_rev $omitted_rev +echo "ok commit no subject" + cd ${test_tmpdir} $OSTREE commit -b test2-custom-parent -s '' $test_tmpdir/checkout-test2-4 $OSTREE commit -b test2-custom-parent -s '' $test_tmpdir/checkout-test2-4