From patchwork Thu Apr 30 19:48:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 11521391 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A198115AB for ; Thu, 30 Apr 2020 19:48:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A7DD207DD for ; Thu, 30 Apr 2020 19:48:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20150623.gappssmtp.com header.i=@ttaylorr-com.20150623.gappssmtp.com header.b="JdXqBVvf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbgD3Tsu (ORCPT ); Thu, 30 Apr 2020 15:48:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbgD3Tsu (ORCPT ); Thu, 30 Apr 2020 15:48:50 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11F8CC035494 for ; Thu, 30 Apr 2020 12:48:50 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id a32so1287051pje.5 for ; Thu, 30 Apr 2020 12:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7dkz/Jd0fjk6gIBT8np814V6zRlWTh2MCX37MDQT3EM=; b=JdXqBVvfyJ3HKTKjvD7OLNHZDpZ4/Ft5aH0qjhr1yswQnJE6cRk/sDlm0kDq6zv/hy 25IxwuF2P4HM6zHwJ5/inXzsh+QDpaZn4AVakIxYx26aeSvc5LT6JGUbcbG9SVK56rlg pp+ZQQ4NoTWLobmO0qyKcamYjYQsBHKSWHASzeIpISfGPc8jsygyAlnQFYOlWewxJpff TI3wxgmOOJNDu6lo5JlEg61/2dWouOqpRvnAPq/ER6igrXSSE2Cnxi0rg4HFxxTxwx7E xzKSlb7V+wZhQuC+uOo71NoC8uncYA4Y2DB47lvZb2C7IvPjDCaTI/BQkkfDihgYAJKk FV6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7dkz/Jd0fjk6gIBT8np814V6zRlWTh2MCX37MDQT3EM=; b=MOllsYU8kKdMYYQr7+gL2NE+4m1kItmgpwFkGjRNa6OAzBVNg9oUAtvh2RJX+2KtLT nw7Du6Ed7MndMK2sGsU1SXcHeYvzis8iXRxXwJif3f+DfUPMkEgvc7unYlnoIoE5pEHq a1G9LiMqtNaCBWysFCEYq4ttu4XD7V1tOMyxNHDXqTzrd+2R99kzq1dETI6mGKisrR2k XDMg5r7n88P4z9aEaKgYke1j7gY2r+J2bGQye2CXWs9iZvf5ZI0AA9d8YLp2shPlRIXd w+17t6LSFY7XS5MVmZ+Q03UmxAti7rrFz2TjKzqXdGNHwZr/Rurw92L6/CqkYQLazaRA KT8Q== X-Gm-Message-State: AGi0PuYFP2skwfu3ZPTbOKbjqhMdtoyw77v982Cqc3HvHVXnl3+Pz1y0 brEZRBiCPi8y1Pncl5ByW85BGlyn6PT/Ow== X-Google-Smtp-Source: APiQypLnsUxj/t/qCfpaY6qKxoqVjpxn6jrQ9IQO++8Bvu3LXGobmaSMYkyz/pMTh6IAbKww/RHXvA== X-Received: by 2002:a17:902:b708:: with SMTP id d8mr591280pls.69.1588276129175; Thu, 30 Apr 2020 12:48:49 -0700 (PDT) Received: from localhost ([8.44.146.30]) by smtp.gmail.com with ESMTPSA id u9sm479752pfn.197.2020.04.30.12.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:48:48 -0700 (PDT) Date: Thu, 30 Apr 2020 13:48:47 -0600 From: Taylor Blau To: git@vger.kernel.org Cc: gitster@pobox.com, jonathantanmy@google.com, jrnieder@gmail.com, sunshine@sunshineco.com Subject: [PATCH v2 1/4] commit: make 'commit_graft_pos' non-static Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In the next patch, some functions will be moved from 'commit.c' to have prototypes in a new 'shallow.h' and their implementations in 'shallow.c'. Three functions in 'commit.c' use 'commit_graft_pos()' (they are 'register_commit_graft()', 'lookup_commit_graft()', and 'unregister_shallow()'). The first two of these will stay in 'commit.c', but the latter will move to 'shallow.c', and thus needs 'commit_graft_pos' to be non-static. Prepare for that by making 'commit_graft_pos' non-static so that it can be called from both 'commit.c' and 'shallow.c'. Signed-off-by: Taylor Blau Signed-off-by: Taylor Blau --- commit.c | 2 +- commit.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/commit.c b/commit.c index c7099daeac..b76f7d72be 100644 --- a/commit.c +++ b/commit.c @@ -110,7 +110,7 @@ static const unsigned char *commit_graft_sha1_access(size_t index, void *table) return commit_graft_table[index]->oid.hash; } -static int commit_graft_pos(struct repository *r, const unsigned char *sha1) +int commit_graft_pos(struct repository *r, const unsigned char *sha1) { return sha1_pos(sha1, r->parsed_objects->grafts, r->parsed_objects->grafts_nr, diff --git a/commit.h b/commit.h index ab91d21131..eb42e8b6d2 100644 --- a/commit.h +++ b/commit.h @@ -236,6 +236,7 @@ struct commit_graft { typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *); struct commit_graft *read_graft_line(struct strbuf *line); +int commit_graft_pos(struct repository *r, const unsigned char *sha1); int register_commit_graft(struct repository *r, struct commit_graft *, int); void prepare_commit_graft(struct repository *r); struct commit_graft *lookup_commit_graft(struct repository *r, const struct object_id *oid); From patchwork Thu Apr 30 19:48:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 11521393 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2948E81 for ; Thu, 30 Apr 2020 19:48:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0963420731 for ; Thu, 30 Apr 2020 19:48:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20150623.gappssmtp.com header.i=@ttaylorr-com.20150623.gappssmtp.com header.b="Ye5L98xC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726787AbgD3Tsy (ORCPT ); Thu, 30 Apr 2020 15:48:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbgD3Tsx (ORCPT ); Thu, 30 Apr 2020 15:48:53 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A55B9C035494 for ; Thu, 30 Apr 2020 12:48:53 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id f8so2697427plt.2 for ; Thu, 30 Apr 2020 12:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=StdJs8SBwTdSKDUsq0n3LDE3QUv2BNI7rFfvsP73dWU=; b=Ye5L98xC+PXu+eF0zU6ojBfapjdQIjxSJNbOoMxXRL407M+2U/YHhLnThoQDuHSli6 dSax0KjB7kuxrH6ZkS2Tjs8EWVoNfIJggEP4Oj5CjmHr5w7oUA98IxpQONb+cDv0HdME FAl8Lg9NAuL4bZ2JkzMM8RCpljs9fj4sS+q4T2XOOuYfjDO80hRteviH5jb4bA3woRlS 0ba+Pv/0byguL/ZxQUCbIy44wZ7+jFcFYQmrbxYAawr+ox2DZIDjG0oX0qm17Eifv8+3 wIEIe3FOcnj1MKZBZeT56UsHTU4VVcZmnG5WTF1kZ3/9cyau0Uio6VPBH+ADrCV/orQk 9mDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=StdJs8SBwTdSKDUsq0n3LDE3QUv2BNI7rFfvsP73dWU=; b=Sbb86eUAt8kmKEUruJinU5n/Qi3Y5qMfNG3Jkxy2goTV7OXp83uFK5qS3oFvxu1LOq UOyyGcqvKU1oYLFqCPqE2QPtvF0bi7ooZ1TSDxCkfCYmsi2kBzW+9Lb6D99WxL57e9PV 7VkiBpTMJgIRd8xSOXU04Wq2CNcFW+f3aS4XWYmPxqEWoGf4JPdYiCysdoKE/gidI/L8 EDFgik0N8cjo9sDrIKQBLWVj/DyDERh/RkSwdV8XqXwrkMHcCws6iJXLIava28AxAx0Q UtGCbyG7X7luttmM1VB3mX50PogpGlUNLZNNGMfFSs2wadQm5NW+F472DY7R3wOz4cdz uqHw== X-Gm-Message-State: AGi0PubDBh0nydcIrtkVSbqCkGogYRU9XmgqaWE+KgGauhlz/WKizD9m dc7YDQu/hkUNg8mlz9hpR6MHZAfRUwl5Zw== X-Google-Smtp-Source: APiQypJ8ymckxJI2tCJWvi+llUIPaJi8Goy4D5/zYb/QN12jFYYiAl8slMRB6eyA7FWnEDhSj1htfw== X-Received: by 2002:a17:902:7207:: with SMTP id ba7mr632482plb.204.1588276132627; Thu, 30 Apr 2020 12:48:52 -0700 (PDT) Received: from localhost ([8.44.146.30]) by smtp.gmail.com with ESMTPSA id b8sm503939pft.11.2020.04.30.12.48.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:48:51 -0700 (PDT) Date: Thu, 30 Apr 2020 13:48:50 -0600 From: Taylor Blau To: git@vger.kernel.org Cc: gitster@pobox.com, jonathantanmy@google.com, jrnieder@gmail.com, sunshine@sunshineco.com Subject: [PATCH v2 2/4] shallow: extract a header file for shallow-related functions Message-ID: <0631e2a87dc83220af27f7be7d7d8cd2bbb117fc.1588275891.git.me@ttaylorr.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There are many functions in commit.h that are more related to shallow repositories than they are to any sort of generic commit machinery. Likely this began when there were only a few shallow-related functions, and commit.h seemed a reasonable enough place to put them. But, now there are a good number of shallow-related functions, and placing them all in 'commit.h' doesn't make sense. This patch extracts a 'shallow.h', which takes all of the declarations from 'commit.h' for functions which already exist in 'shallow.c'. We will bring the remaining shallow-related functions defined in 'commit.c' in a subsequent patch. For now, move only the ones that already are implemented in 'shallow.c', and update the necessary includes. Signed-off-by: Taylor Blau --- builtin/fetch.c | 1 + builtin/pack-objects.c | 1 + builtin/prune.c | 1 + builtin/receive-pack.c | 1 + builtin/repack.c | 1 + builtin/rev-parse.c | 1 + commit-graph.c | 1 + commit.c | 14 +-------- commit.h | 48 ------------------------------- environment.c | 1 + fetch-pack.c | 1 + git.c | 1 + send-pack.c | 1 + shallow.c | 14 +++++++++ shallow.h | 64 ++++++++++++++++++++++++++++++++++++++++++ upload-pack.c | 1 + 16 files changed, 91 insertions(+), 61 deletions(-) create mode 100644 shallow.h diff --git a/builtin/fetch.c b/builtin/fetch.c index bf6bab80fa..a292acd1c0 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -27,6 +27,7 @@ #include "branch.h" #include "promisor-remote.h" #include "commit-graph.h" +#include "shallow.h" #define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index dc7c58ce3f..303ae312a9 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -34,6 +34,7 @@ #include "dir.h" #include "midx.h" #include "trace2.h" +#include "shallow.h" #define IN_PACK(obj) oe_in_pack(&to_pack, obj) #define SIZE(obj) oe_size(&to_pack, obj) diff --git a/builtin/prune.c b/builtin/prune.c index 2b76872ad2..028ff786d6 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -7,6 +7,7 @@ #include "parse-options.h" #include "progress.h" #include "object-store.h" +#include "shallow.h" static const char * const prune_usage[] = { N_("git prune [-n] [-v] [--progress] [--expire