diff --git a/rhizome_cli.c b/rhizome_cli.c index 1e9e34f2..7921f22e 100644 --- a/rhizome_cli.c +++ b/rhizome_cli.c @@ -222,10 +222,12 @@ static int app_rhizome_add_file(const struct cli_parsed *parsed, struct cli_cont } if (journal && !m->is_journal){ + // TODO: return a special status code for this case ret = WHY("Existing manifest is not a journal"); goto finish; } if (!journal && m->is_journal) { + // TODO: return a special status code for this case ret = WHY("Existing manifest is a journal"); goto finish; } diff --git a/tests/rhizomeops b/tests/rhizomeops index 4e00e742..da35d30b 100755 --- a/tests/rhizomeops +++ b/tests/rhizomeops @@ -994,7 +994,29 @@ test_JournalAdd() { assert diff file filex } -doc_AppendFile="Attempting to append to a non-journal fails" +doc_JournalAddUpdate="Cannot update a journal" +setup_JournalAddUpdate() { + setup_servald + setup_rhizome + echo "Part One" > file1 + executeOk_servald rhizome journal append $SIDB1 "" file1 + assert_stdout_add_file file1 + extract_stdout_keyvalue BID 'manifestid' '[0-9A-F]\+' + executeOk_servald rhizome extract bundle $BID file1x.manifest file1x + assert diff file1 file1x + extract_manifest_version version file1x.manifest + let version=version+1 + $SED -i -e "/^version=/s/=.*/=$version/" file1x.manifest + assert_manifest_fields file1x.manifest version="$version" +} +test_JournalAddUpdate() { + # TODO: servald should return a status code reserved for this case, instead + # of the generic 255 error + execute --exit-status=255 $servald rhizome add file $SIDB1 file1x file1x.manifest + tfw_cat --stdout --stderr +} + +doc_AppendFile="Cannot append to a non-journal" setup_AppendFile() { setup_servald setup_rhizome