From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-5.6 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 527BE207EC for ; Fri, 30 Sep 2016 04:28:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751665AbcI3E2B (ORCPT ); Fri, 30 Sep 2016 00:28:01 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:53368 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751506AbcI3E17 (ORCPT ); Fri, 30 Sep 2016 00:27:59 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id E180942883; Fri, 30 Sep 2016 00:27:57 -0400 (EDT) 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=UkcUCyfort3mvj1yHDL9LZDqQGM=; b=TzgpY6 z7OtvRzcP5io2k83uMQwd5yqP5QTN2WVwP3220KhOCgBW+a9YrbpkYarVBiH0MAZ t3nXLMvGTiel0vX0Ge1lCOf9+F+E2OMN4G/kul/OxcWtZNE9mfvrpNvIogdy82+n YBnIj39epdPBHN4C5CjeD2tVh/5vrG0NErzfo= 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=rfFwLv4bngUwg6bT3UzLHn2c1Lr5sdMB r7UHiCpLtXNY2fz4bU/JlXVaxsLz/xt6kCrJcnJvzRpySzYzeXMg1nmJo2aB0JO0 IWqb3btnH+84VLREvpnD4Z69s7hjqzNEPiyoxb6N0y0d8L2NgGEJMQTU1rwrNhDl yfEfeVO1oSc= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id D9E6A42882; Fri, 30 Sep 2016 00:27:57 -0400 (EDT) Received: from pobox.com (unknown [104.132.0.95]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 46C2942881; Fri, 30 Sep 2016 00:27:57 -0400 (EDT) From: Junio C Hamano To: Linus Torvalds Cc: Jeff King , Johannes Sixt , Git Mailing List Subject: Re: [PATCH 4/4] core.abbrev: raise the default abbreviation to 12 hexdigits References: <20160928233047.14313-1-gitster@pobox.com> <20160928233047.14313-5-gitster@pobox.com> <20160929191609.maxggcli76472t4g@sigill.intra.peff.net> Date: Thu, 29 Sep 2016 21:27:55 -0700 In-Reply-To: (Junio C. Hamano's message of "Thu, 29 Sep 2016 21:10:30 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 435AB3EC-86C6-11E6-9F38-EAAE7A1B28F4-77302942!pb-smtp2.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Junio C Hamano writes: > There still are breakages seen in t5510 and t5526 that are about the > verbose output of "git fetch". I'll stop digging at this point > tonight, and welcome others who look into it ;-) OK, just before I leave the keyboard for the night... -- >8 -- From: Junio C Hamano Date: Thu, 29 Sep 2016 21:19:20 -0700 Subject: [PATCH] abbrev: adjust to the new world order The default_abbrev used to be a concrete value usable as the default abbreviation length. The code that sets custom abbreviation length, in response to command line argument, often did something like: if (skip_prefix(arg, "--abbrev=", &arg)) abbrev = atoi(arg); else if (!strcmp("--abbrev", &arg)) abbrev = DEFAULT_ABBREV; /* make the value sane */ if (abbrev < 0 || 40 < abbrev) abbrev = ... some sane value ... The new world order however is that the default_abbrev is a negative value that signals find_unique_abbrev() that it needs to dynamically find out a good default value. We shouldn't coerce a negative value into a random positive value like the above sample code. Signed-off-by: Junio C Hamano --- builtin/rev-parse.c | 5 +++-- diff.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 76cf05e2ad..17cbfabdde 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -643,8 +643,9 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) filter &= ~(DO_FLAGS|DO_NOREV); verify = 1; abbrev = DEFAULT_ABBREV; - if (arg[7] == '=') - abbrev = strtoul(arg + 8, NULL, 10); + if (!arg[7]) + continue; + abbrev = strtoul(arg + 8, NULL, 10); if (abbrev < MINIMUM_ABBREV) abbrev = MINIMUM_ABBREV; else if (40 <= abbrev) diff --git a/diff.c b/diff.c index c6da383c56..cefc13eb8e 100644 --- a/diff.c +++ b/diff.c @@ -3399,7 +3399,7 @@ void diff_setup_done(struct diff_options *options) */ read_cache(); } - if (options->abbrev <= 0 || 40 < options->abbrev) + if (40 < options->abbrev) options->abbrev = 40; /* full */ /* -- 2.10.0-612-g22341905f2