From patchwork Fri May 20 18:40:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12857307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 493C9C433F5 for ; Fri, 20 May 2022 18:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353074AbiETSmP (ORCPT ); Fri, 20 May 2022 14:42:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353022AbiETSlJ (ORCPT ); Fri, 20 May 2022 14:41:09 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6E63237FD for ; Fri, 20 May 2022 11:41:06 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id n6so4996539wms.0 for ; Fri, 20 May 2022 11:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:mime-version :content-transfer-encoding:fcc:to:cc; bh=x+TY/9N2d674JRCaLR7HnPUQUg+jdft8S9Jv0um4vuM=; b=fytmzWb9EmP95sAl6OQBcfQuWeHO7Fwd66LNb+29JrWw12OknjgM46zqDF4qmaj5iT 9xcvLA1MD1a0KbLG7F04sC2KZ0nzGDoOH5ZkcoNngKzrt77IlPKlEjaLcGbSrz+lz+R1 nI9uDN/7v3CgoK1TDfFBbWU6/kDIGy4duny8Fh/Hzq/2i+GEsGbZi0yuBQ9yT+AvsO8d J7zuElTFohpz8e98DrGQLYJ5qpY5a1USf9bHCith2VdbTQpshXTxFe7r0DM9J7sWQC2+ D0C+CtqexK2TKOFpVHK+njzwl4sDV4wgnrdkVlLjHKcCjcIepSwtcdv1YFkLKhRMwAkI FEgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:mime-version:content-transfer-encoding:fcc:to:cc; bh=x+TY/9N2d674JRCaLR7HnPUQUg+jdft8S9Jv0um4vuM=; b=kQYGeFxlukubLE5FUT+ZjvX3mqWeoiGUhUMcxJSpaUPGHUqWMuBtsQV1OQpRwpBGiw MqyE30Q2VFGidAYKV9vEFLc5LyDpdBRqBMO1yLwEKJr+hDQ/dZyJ5hbV1qs0DfUBOqtd dfGYT0DFPitfU9OrJCOM3CIPEYm8JhXb5O/VquMdZF5V5lFq3HRMvHG9oHTLKK7V86mM /Y/2PRTbBIaXv9zPPeV5vxz6FK3gTy/zbbHiBJ4nv8sPG2vmphZv58YvoKOKJQtOk9wk OfhSlRR8uGG2fojtA73IwKe3Gp5jCR54As4W8ioFJhGLjfLDD2eZFLlS/4RCxtHTbhvI O2vw== X-Gm-Message-State: AOAM533dfIaxh/Ijj6rRw3ImHcm24F9kUDQC+EYeTp8BiM1X0OOCHEjN gU3ZLMFiIaANroln6EDwLAjXaRjws6U= X-Google-Smtp-Source: ABdhPJx8sX+Z4w2ZYu3ykaTzYCX+kIQtiFl49wN47YFGWSAFA7OxMg4q9eYcaz5yZaHl4vv29TCw2A== X-Received: by 2002:a05:600c:4f95:b0:394:8919:7557 with SMTP id n21-20020a05600c4f9500b0039489197557mr9583277wmq.166.1653072064693; Fri, 20 May 2022 11:41:04 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m6-20020adfa3c6000000b0020fc4cd81f6sm279895wrb.60.2022.05.20.11.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 11:41:04 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Fri, 20 May 2022 18:40:36 +0000 Subject: [PATCH 18/24] bundle-uri client: add "git ls-remote-bundle-uri" MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: gitster@pobox.com, me@ttaylorr.com, newren@gmail.com, =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsA==?= Bjarmason , Teng Long , Johannes Schindelin , Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= TODO: make this a test-helper instead of its own builtin? Add a git-ls-remote-bundle-uri command, this is a thin wrapper for issuing protocol v2 "bundle-uri" commands to a server, and to the parsing routines in bundle-uri.c. Since in the "git clone" case we'll have already done the handshake(), but not here, introduce a "got_advertisement" state along with "got_remote_heads". It seems to me that the "got_remote_heads" is badly named in the first place, and the whole logic of eagerly getting ls-refs on handshake() or not could be refactored somewhat, but let's not do that now, and instead just add another self-documenting state variable. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Derrick Stolee --- .gitignore | 1 + Documentation/git-ls-remote-bundle-uri.txt | 62 +++++++++ Documentation/git-ls-remote.txt | 1 + Makefile | 1 + builtin.h | 1 + builtin/clone.c | 2 +- builtin/ls-remote-bundle-uri.c | 71 ++++++++++ command-list.txt | 1 + git.c | 1 + t/lib-t5730-protocol-v2-bundle-uri.sh | 147 ++++++++++++++++++++- transport.c | 43 ++++-- transport.h | 6 +- 12 files changed, 324 insertions(+), 13 deletions(-) create mode 100644 Documentation/git-ls-remote-bundle-uri.txt create mode 100644 builtin/ls-remote-bundle-uri.c diff --git a/.gitignore b/.gitignore index e81de1063a4..e1312b2795c 100644 --- a/.gitignore +++ b/.gitignore @@ -91,6 +91,7 @@ /git-log /git-ls-files /git-ls-remote +/git-ls-remote-bundle-uri /git-ls-tree /git-mailinfo /git-mailsplit diff --git a/Documentation/git-ls-remote-bundle-uri.txt b/Documentation/git-ls-remote-bundle-uri.txt new file mode 100644 index 00000000000..793d7677f2f --- /dev/null +++ b/Documentation/git-ls-remote-bundle-uri.txt @@ -0,0 +1,62 @@ +git-ls-remote-bundle-uri(1) +=========================== + +NAME +---- +git-ls-remote-bundle-uri - List 'bundle-uri' in a remote repository + +SYNOPSIS +-------- +[verse] +'git ls-remote-bundle-uri' [-q |--quiet] [--uri] [--upload-pack=] + [[-o | --server-option=]