From adcd4d4c6f9352bef53058161db36bb1ccd5cd9d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 7 Dec 2021 19:26:31 +0100 Subject: [PATCH] usage.c API users: use die_message() for error() + exit 128 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Continue the migration of code that printed a message and exited with 128. In this case the caller used "error()", so we'll be changing the output from "error: " to "fatal: ". This change is intentional and desired. This code is dying, so it should emit "fatal", the only reason it didn't do so was because before the existence of "die_message()" it would have needed to craft its own "fatal: " message. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- builtin/notes.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/builtin/notes.c b/builtin/notes.c index 71c59583a1..2812d1eac4 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -201,11 +201,12 @@ static void prepare_note_data(const struct object_id *object, struct note_data * static void write_note_data(struct note_data *d, struct object_id *oid) { if (write_object_file(d->buf.buf, d->buf.len, blob_type, oid)) { - error(_("unable to write note object")); + int status = die_message(_("unable to write note object")); + if (d->edit_path) - error(_("the note contents have been left in %s"), - d->edit_path); - exit(128); + die_message(_("the note contents have been left in %s"), + d->edit_path); + exit(status); } } -- 2.39.5