From: "Shawn O. Pearce" <spearce@spearce.org>
To: Tim Harper <timcharper@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: surprising error message in parse_opt_with_commit
Date: Thu, 6 Aug 2009 12:34:14 -0700 [thread overview]
Message-ID: <20090806193413.GJ1033@spearce.org> (raw)
In-Reply-To: <e1a5e9a00908061227n67a878f5tb2d5130582b4fd44@mail.gmail.com>
Tim Harper <timcharper@gmail.com> wrote:
> 610 int parse_opt_with_commit(const struct option *opt, const char
> *arg, int unset)
> 611 {
> 612 unsigned char sha1[20];
> 613 struct commit *commit;
> 614
> 615 if (!arg)
> 616 return -1;
> 617 if (get_sha1(arg, sha1))
> 618 return error("malformed object name %s", arg);
> 619 commit = lookup_commit_reference(sha1);
> 620 if (!commit)
> 621 return error("no such commit %s", arg);
> 622 commit_list_insert(commit, opt->value);
> 623 return 0;
> 624 }
>
> It appears the get_sha1 call is returning true, causing the 'malformed
> object name' error to be returned. However, it seems that ideally
> since efabdfb is not malformed (it would be a valid ref if it
> existed), the execution path should continue to line 619, receive no
> commit, and fail on 621.
get_sha1 is responsible for expanding an abbreviated ID to the
full ID. If it can't do the expansion, it errors out. The code
is correct as-is, though the error message on 618 is a bit odd.
--
Shawn.
next prev parent reply other threads:[~2009-08-06 19:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-06 19:27 surprising error message in parse_opt_with_commit Tim Harper
2009-08-06 19:34 ` Shawn O. Pearce [this message]
2009-08-06 19:53 ` [PATCH] clarify error message when an abbreviated non-existent commit was specified Tim Harper
2009-08-07 5:17 ` Tim Harper
2009-08-07 5:36 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2009-08-06 19:41 surprising error message in parse_opt_with_commit Tim Harper
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=20090806193413.GJ1033@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=timcharper@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).