]> git.ipfire.org Git - thirdparty/git.git/commitdiff
usage.c API users: use die_message() for error() + exit 128
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 7 Dec 2021 18:26:31 +0000 (19:26 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Dec 2021 21:25:15 +0000 (13:25 -0800)
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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/notes.c

index 71c59583a17f8da6eb948248e19a262781091f28..2812d1eac409feb55a15a426a752058f055b2120 100644 (file)
@@ -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);
        }
 }