From: Phillip Wood <phillip.wood123@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>,
Phillip Wood via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Orgad Shaneh <orgads@gmail.com>,
Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH] prune: mark rebase autostash and orig-head as reachable
Date: Fri, 9 Feb 2024 11:08:33 +0000 [thread overview]
Message-ID: <6ed59006-9572-460e-996b-63a1321b3db5@gmail.com> (raw)
In-Reply-To: <CAPig+cRASFkTD6=YumZJKv7XJjr1asxKB-mAyBFox8tuwmNnFw@mail.gmail.com>
Hi Eric
On 08/02/2024 17:25, Eric Sunshine wrote:
> On Thu, Feb 8, 2024 at 12:00 PM Phillip Wood via GitGitGadget
>> +static int add_one_file(const char *path, struct rev_info *revs)
>> +{
>> + struct strbuf buf = STRBUF_INIT;
>> +
>> + if (!read_oneliner(&buf, path, READ_ONELINER_SKIP_IF_EMPTY)) {
>> + strbuf_release(&buf);
>> + return 0;
>> + }
>> + strbuf_trim(&buf);
>> + if (!get_oid_hex(buf.buf, &oid)) {
>> + object = parse_object_or_die(&oid, buf.buf);
>> + add_pending_object(revs, object, "");
>> + }
>> + return 0;
>> +}
>
> Is this leaking the strbuf? Should the function instead end with:
>
> strbuf_release(&buf);
> return 0;
Yes, well spotted
> Also, what is the significance of the return value of this function?
> All code paths seem to be returning 0 unconditionally, and the caller
> ignores the return value.
Good point, I think in an earlier draft it returned an error at one
point, I'll change the return types.
>> +/* Mark objects recored in rebase state files as reachable. */
>
> s/recored/recorded/
Sharp eyes as ever, thanks for looking at this I'll re-roll
Phillip
next prev parent reply other threads:[~2024-02-09 11:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 17:00 [PATCH] prune: mark rebase autostash and orig-head as reachable Phillip Wood via GitGitGadget
2024-02-08 17:25 ` Eric Sunshine
2024-02-09 11:08 ` Phillip Wood [this message]
2024-02-08 18:06 ` Junio C Hamano
2024-02-09 14:15 ` Phillip Wood
2024-02-09 16:19 ` [PATCH v2] " Phillip Wood via GitGitGadget
2024-02-09 18:04 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6ed59006-9572-460e-996b-63a1321b3db5@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=orgads@gmail.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=sunshine@sunshineco.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).