From: Patrick Steinhardt <ps@pks.im>
To: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH 1/2] upload-pack: fix ambiguous error message
Date: Tue, 5 Nov 2024 07:27:56 +0100 [thread overview]
Message-ID: <Zym65pRWPqu9VIvq@pks.im> (raw)
In-Reply-To: <bb8dbc5c7086ce5c09f8980c923ec85da38c9147.1730746964.git.gitgitgadget@gmail.com>
On Mon, Nov 04, 2024 at 07:02:43PM +0000, Elijah Newren via GitGitGadget wrote:
> diff --git a/upload-pack.c b/upload-pack.c
> index 6d6e0f9f980..640d45295e1 100644
> --- a/upload-pack.c
> +++ b/upload-pack.c
> @@ -1025,10 +1025,14 @@ static int process_deepen_not(const char *line, struct oidset *deepen_not, int *
> {
> const char *arg;
> if (skip_prefix(line, "deepen-not ", &arg)) {
> + int cnt;
> char *ref = NULL;
> struct object_id oid;
> - if (expand_ref(the_repository, arg, strlen(arg), &oid, &ref) != 1)
> + cnt = expand_ref(the_repository, arg, strlen(arg), &oid, &ref);
> + if (cnt > 1)
> die("git upload-pack: ambiguous deepen-not: %s", line);
> + if (cnt < 1)
> + die("git upload-pack: deepen-not is not a ref: %s", line);
I was wondering whether `expand_ref()` could ever return negative, but
after reading through its implementation that doesn't seem to be the
case. It's somewhat misleading that it returns `int`, as `size_t` would
convey the return value in a better spirit.
Anyway, that is not an issue of this patch series, and the change looks
good.
Patrick
next prev parent reply other threads:[~2024-11-05 6:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 19:02 [PATCH 0/2] A few --shallow-exclude fixes Elijah Newren via GitGitGadget
2024-11-04 19:02 ` [PATCH 1/2] upload-pack: fix ambiguous error message Elijah Newren via GitGitGadget
2024-11-05 6:27 ` Patrick Steinhardt [this message]
2024-11-04 19:02 ` [PATCH 2/2] doc: correct misleading descriptions for --shallow-exclude Elijah Newren via GitGitGadget
2024-11-05 6:27 ` Patrick Steinhardt
2024-11-05 6:55 ` Junio C Hamano
2024-11-05 1:27 ` [PATCH 0/2] A few --shallow-exclude fixes 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zym65pRWPqu9VIvq@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=newren@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).