From: Kyle Lippincott <spectral@google.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH] Always check the return value of `repo_read_object_file()`
Date: Fri, 9 Feb 2024 11:56:52 -0800 [thread overview]
Message-ID: <CAO_smViXpcwo6_zd3iqpM175nEnH_mjca7XqJ=V4bBobY_02wQ@mail.gmail.com> (raw)
In-Reply-To: <5fd95ae0-cd50-ddc4-5095-ee953c2640b3@gmx.de>
On Fri, Feb 9, 2024 at 12:06 AM Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
>
> Hi Kyle,
>
> On Mon, 5 Feb 2024, Kyle Lippincott wrote:
>
> > On Mon, Feb 5, 2024 at 6:36 AM Johannes Schindelin via GitGitGadget
> > <gitgitgadget@gmail.com> wrote:
> > >
> > > diff --git a/builtin/notes.c b/builtin/notes.c
> > > index e65cae0bcf7..caf20fd5bdd 100644
> > > --- a/builtin/notes.c
> > > +++ b/builtin/notes.c
> > > @@ -716,9 +716,11 @@ static int append_edit(int argc, const char **argv, const char *prefix)
> > > struct strbuf buf = STRBUF_INIT;
> > > char *prev_buf = repo_read_object_file(the_repository, note, &type, &size);
> > >
> > > - if (prev_buf && size)
> > > + if (!prev_buf)
> > > + die(_("unable to read %s"), oid_to_hex(note));
> >
> > This changes the behavior of this function. Previously, it would not
> > add prev_buf output, but still succeed. This now dies.
>
> It does change behavior. The previous behavior looked up the note OID,
> then tried to read it, and if it was missing just pretended that there had
> not been a note.
>
> I'm not quite sure whether we should keep that behavior, as it is unclear
> in which scenarios it would be desirable to paper over missing objects.
>
> In GitGitGadget, I am a heavy user of notes and it wouldn't do any good to
> have this behavior: It would lose information.
>
> And even in scenarios where the `notes` ref is fetch shallowly, I would
> expect all of the actual notes blobs to be present, and I would _want_ the
> `git note edit ...` command to error out when that blob is not found.
>
> Does that reasoning make sense to you?
Sounds good, thanks for talking through it with me.
>
> Ciao,
> Johannes
next prev parent reply other threads:[~2024-02-09 19:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 14:35 [PATCH] Always check the return value of `repo_read_object_file()` Johannes Schindelin via GitGitGadget
2024-02-05 16:10 ` Karthik Nayak
2024-02-06 18:36 ` Junio C Hamano
2024-02-12 23:16 ` Johannes Schindelin
2024-02-06 1:13 ` Kyle Lippincott
2024-02-09 8:06 ` Johannes Schindelin
2024-02-09 16:37 ` Junio C Hamano
2024-02-09 19:56 ` Kyle Lippincott [this message]
2024-02-06 6:51 ` Patrick Steinhardt
2024-02-06 18:42 ` Junio C Hamano
2024-02-09 8:15 ` Johannes Schindelin
2024-02-09 8:17 ` Patrick Steinhardt
2024-02-06 22:02 ` Junio C Hamano
2024-02-12 23:19 ` Johannes Schindelin
2024-02-16 6:43 ` Teng Long
2024-02-18 22:36 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAO_smViXpcwo6_zd3iqpM175nEnH_mjca7XqJ=V4bBobY_02wQ@mail.gmail.com' \
--to=spectral@google.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).