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=-3.9 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,T_DKIMWL_WL_HIGH 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 058571F406 for ; Fri, 11 May 2018 21:15:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751989AbeEKVPj (ORCPT ); Fri, 11 May 2018 17:15:39 -0400 Received: from mail-sn1nam02on0114.outbound.protection.outlook.com ([104.47.36.114]:34789 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751903AbeEKVP0 (ORCPT ); Fri, 11 May 2018 17:15:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ItFSrXVME4ntQ+C7UUZoluaPhEmQatK0RYxp7TJqE8I=; b=aJ5oO+w/Qb8uuhaANrmi0nOPy6yrLDixVkw7vka8MCkk5t33VIu5LtJ25he/RWCFdovLJzEGL11Ak+H8JlffIvFkqH9lfnmAWkiKBwMq4s0ZoODp0uB+b7+D8ozxWjA/W1roOOFt/KwIEkARcfMxAFRauu0YwXYVIm9EFZS9rX8= Received: from BL0PR2101MB1011.namprd21.prod.outlook.com (52.132.24.10) by BL0PR2101MB0962.namprd21.prod.outlook.com (52.132.20.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.776.1; Fri, 11 May 2018 21:15:20 +0000 Received: from BL0PR2101MB1011.namprd21.prod.outlook.com ([fe80::714b:5398:58e0:b4d8]) by BL0PR2101MB1011.namprd21.prod.outlook.com ([fe80::714b:5398:58e0:b4d8%3]) with mapi id 15.20.0776.004; Fri, 11 May 2018 21:15:20 +0000 From: Derrick Stolee To: "git@vger.kernel.org" CC: "jnareb@gmail.com" , "avarab@gmail.com" , "martin.agren@gmail.com" , "peff@peff.net" , Derrick Stolee Subject: [PATCH v2 06/12] commit: force commit to parse from object database Thread-Topic: [PATCH v2 06/12] commit: force commit to parse from object database Thread-Index: AQHT6W0qS12+akZJvEy2xs7xbCtZNw== Date: Fri, 11 May 2018 21:15:20 +0000 Message-ID: <20180511211504.79877-7-dstolee@microsoft.com> References: <20180510173345.40577-1-dstolee@microsoft.com> <20180511211504.79877-1-dstolee@microsoft.com> In-Reply-To: <20180511211504.79877-1-dstolee@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BN6PR21CA0020.namprd21.prod.outlook.com (2603:10b6:404:8e::30) To BL0PR2101MB1011.namprd21.prod.outlook.com (2603:10b6:207:37::10) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2001:4898:8010:0:eb4a:5dff:fe0f:730f] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BL0PR2101MB0962;7:IedSticHrGYoExOmqQrb9bFby3sR1PQxXcEn5/YnB5KHQkYi2HPiWH2hpj/P4c7gnYxc+M7XGRVlwzM6cNLCJDRJRsHPXnop8bcP2tGiLV6MUBjkE/zfbDKg3PLg9bFEChpahW/ysgZ1WB42EelFO1qfXrOU5/zBhD0Mu7QAkSF2JOyc8wIqilcMX6tyAh+XwTUezljtZXrbmQ7oH5o5/MkWam+rvCQy5l7Th3ofxL+Lb9wC8JRHIcXH4z/FoOg4;20:gdxvY2gDk7an3PEFl3x6x7wiE8vvyqAbbo/dqFIbb8Tl+fEzg8JL3MUQiL5BYjJsRZi1r8bQx+pKJRSl84vINY1mwD0uQ2L1EIcyf57X2Xxryok503cvFAhmeqV7f2h9cKASPzuX5vLmSk2Qcf+39HLBPFEKTlCPpKpSk/qiu60= x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:BL0PR2101MB0962; x-ms-traffictypediagnostic: BL0PR2101MB0962: authentication-results: spf=none (sender IP is ) smtp.mailfrom=dstolee@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231254)(2018427008)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:BL0PR2101MB0962;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB0962; x-forefront-prvs: 06691A4183 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(376002)(396003)(39860400002)(346002)(39380400002)(189003)(199004)(5660300001)(39060400002)(316002)(305945005)(6116002)(7736002)(6506007)(52116002)(386003)(81166006)(81156014)(186003)(3660700001)(5640700003)(46003)(76176011)(54906003)(1730700003)(68736007)(6436002)(446003)(102836004)(3280700002)(1076002)(97736004)(2351001)(11346002)(22452003)(106356001)(99286004)(2616005)(476003)(2501003)(36756003)(14454004)(2906002)(8936002)(105586002)(107886003)(4326008)(8676002)(86612001)(6486002)(486006)(25786009)(10090500001)(53936002)(478600001)(2900100001)(86362001)(6916009)(6512007)(10290500003)(5250100002)(22906009);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB0962;H:BL0PR2101MB1011.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: GPnywFBo6h3Ljg740RdUGtgOw4vQjSmaLRZIXKgxjlOC5Z4mdY6iBGURVpUgcl2vUrsoBIqW9See95yuciYdDMF42OW+EnbjptdSAyHv4OzOf3cOAsWFza8o1wIcdj4agXKZPbHBjNh3H8+8xqSCgXuS208kohrw4bU/gK77WZJUlTdUFuTZCK9eWmXfPFeD spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 274f4240-739b-4741-0aff-08d5b7844cf8 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 274f4240-739b-4741-0aff-08d5b7844cf8 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2018 21:15:20.3317 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB0962 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In anticipation of verifying commit-graph file contents against the object database, create parse_commit_internal() to allow side-stepping the commit-graph file and parse directly from the object database. Due to the use of generation numbers, this method should not be called unless the intention is explicit in avoiding commits from the commit-graph file. Signed-off-by: Derrick Stolee --- commit.c | 13 +++++++++---- commit.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/commit.c b/commit.c index 1d28677dfb..7c92350373 100644 --- a/commit.c +++ b/commit.c @@ -392,7 +392,7 @@ int parse_commit_buffer(struct commit *item, const void= *buffer, unsigned long s return 0; } =20 -int parse_commit_gently(struct commit *item, int quiet_on_missing) +int parse_commit_internal(struct commit *item, int quiet_on_missing, int u= se_commit_graph) { enum object_type type; void *buffer; @@ -403,17 +403,17 @@ int parse_commit_gently(struct commit *item, int quie= t_on_missing) return -1; if (item->object.parsed) return 0; - if (parse_commit_in_graph(item)) + if (use_commit_graph && parse_commit_in_graph(item)) return 0; buffer =3D read_sha1_file(item->object.oid.hash, &type, &size); if (!buffer) return quiet_on_missing ? -1 : error("Could not read %s", - oid_to_hex(&item->object.oid)); + oid_to_hex(&item->object.oid)); if (type !=3D OBJ_COMMIT) { free(buffer); return error("Object %s not a commit", - oid_to_hex(&item->object.oid)); + oid_to_hex(&item->object.oid)); } ret =3D parse_commit_buffer(item, buffer, size, 0); if (save_commit_buffer && !ret) { @@ -424,6 +424,11 @@ int parse_commit_gently(struct commit *item, int quiet= _on_missing) return ret; } =20 +int parse_commit_gently(struct commit *item, int quiet_on_missing) +{ + return parse_commit_internal(item, quiet_on_missing, 1); +} + void parse_commit_or_die(struct commit *item) { if (parse_commit(item)) diff --git a/commit.h b/commit.h index b5afde1ae9..5fde74fcd7 100644 --- a/commit.h +++ b/commit.h @@ -73,6 +73,7 @@ struct commit *lookup_commit_reference_by_name(const char= *name); struct commit *lookup_commit_or_die(const struct object_id *oid, const cha= r *ref_name); =20 int parse_commit_buffer(struct commit *item, const void *buffer, unsigned = long size, int check_graph); +int parse_commit_internal(struct commit *item, int quiet_on_missing, int u= se_commit_graph); int parse_commit_gently(struct commit *item, int quiet_on_missing); static inline int parse_commit(struct commit *item) { --=20 2.16.2.329.gfb62395de6