Re: [PATCH 02/21] Return error messages when parsing fails.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 9, 2007, 18:01 UTC
- Message-ID
- <7vwsydf1m8.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <200706090213.16031.johan@herland.net>
Johan Herland <johan@herland.net> writes:
> This patch brings the already similar tag.c:parse_tag_buffer() and > mktag.c:verify_tag() a little bit closer to eachother.
While I would agree that it makes sense to have the same definition of what is and is not a 100% well formatted tag object for producer side and consumer side, I do not necessarily think it is a good idea to make parse_tag_buffer() chattier on errors. mktag.c:verify_tag() can afford to be verbose in its diagnosis, because it is used when the user is _creating_ the tag, and it is generally a good idea to be strict when we create.
On the other hand, parse_tag_buffer() is on the side of users who use existing tag objects that were produced by somebody else. It is generally a good practice to be more lenient when you are consuming.
Also, callers of parse_tag_buffer() know the function is silent on errors (unless there is something seriously wrong with the repository); they do their own error messages when they get an error return.