From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 9BDE61F46C for ; Tue, 21 Jan 2020 22:04:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728988AbgAUWEw (ORCPT ); Tue, 21 Jan 2020 17:04:52 -0500 Received: from pb-smtp2.pobox.com ([64.147.108.71]:61988 "EHLO pb-smtp2.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727847AbgAUWEw (ORCPT ); Tue, 21 Jan 2020 17:04:52 -0500 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 4B61737A28; Tue, 21 Jan 2020 17:04:50 -0500 (EST) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=FNcOQfTlLMGZRWqA17U+fGuO5UA=; b=r+OZk/ 2XiQU+38w7GZxslaM1f5qRBEcxx8yGrn/xcXh+4MxM+2E2Zy8Bff9dKOli+utQgL dJspYWJqccIH9lxUbAxc6dJG14qRs1MB5gvJwos5NMk4y2VbtuHLrTgPXuahpiap nqA4h+JMyvb7ae4MudN+m6OyvQ/amAf+CrTy4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=VNyJNnUDJL1nqCHYDOvhImP62CsigdCA dFa3ikNXbs8o0ucWdAn8+YmuchaGztdqqkcxdUfCKSN7VVU9qB91rdLro56mlanP YrUUiIvIff2Mjc6H5K2wBriuTIfJKxgdxG9fi/AcCMadahtJ+HawyyMdgvAdkaI6 eJzfGr5BrM4= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 416B437A26; Tue, 21 Jan 2020 17:04:50 -0500 (EST) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.76.80.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id B205937A25; Tue, 21 Jan 2020 17:04:49 -0500 (EST) (envelope-from junio@pobox.com) From: Junio C Hamano To: "Johannes Schindelin via GitGitGadget" Cc: git@vger.kernel.org, "brian m. carlson" , Alban Gruin , Eric Sunshine , Johannes Schindelin Subject: Re: [PATCH v2 1/3] parse_insn_line(): improve error message when parsing failed References: <2ae2e435b0ef6888e72defc7abee1909b29aa914.1579304283.git.gitgitgadget@gmail.com> Date: Tue, 21 Jan 2020 14:04:48 -0800 In-Reply-To: <2ae2e435b0ef6888e72defc7abee1909b29aa914.1579304283.git.gitgitgadget@gmail.com> (Johannes Schindelin via GitGitGadget's message of "Fri, 17 Jan 2020 23:38:01 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 0B1F67F6-3C9A-11EA-81DF-D1361DBA3BAF-77302942!pb-smtp2.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org "Johannes Schindelin via GitGitGadget" writes: > From: Johannes Schindelin > > In the case that a `get_oid()` call failed, we showed some rather bogus > part of the line instead of the precise string we sent to said function. > That makes it rather hard for users to understand what is going wrong, > so let's fix that. > > Signed-off-by: Johannes Schindelin > ... > @@ -2125,11 +2127,10 @@ static int parse_insn_line(struct repository *r, struct todo_item *item, > item->arg_len = (int)(eol - bol); > > if (status < 0) > - return error(_("could not parse '%.*s'"), > - (int)(end_of_object_name - bol), bol); > + return status; > > item->commit = lookup_commit_reference(r, &commit_oid); > - return !item->commit; > + return item->commit ? 0 : -1; This changes the polarity of the error exit from positive 1 to negative 1. The only caller of this function takes anything non-zero as a failure so this would not cause behaviour change, but returning negative is more in line with the practice so it is an improvement. It is unrelated to the theme of this patch, and the proposed log message does not even mention it, though.