From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by sourceware.org (Postfix) with ESMTPS id 4DF473858C62 for ; Thu, 30 Nov 2023 12:17:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4DF473858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4DF473858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::2d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701346670; cv=none; b=oOS08LKlnkzdoZyUjmTTV/z+EApg1YQH9726bB49B+ExFJTKMNVqDg7NayB+EPkmbUOzVuIuFvPaU4XvRSxOVTChJGJz7KHiuCPLdnw83w/9UF3WSVMRAb/aQnsBYAy6X58FZ3LSlaAMMOgM9XyeGJ5URTgb+t7UN0aB4ACj7oE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701346670; c=relaxed/simple; bh=rWYlP35yjX9zY0oVT95uxBsOJdLlaAUZLP/y5Zif7+w=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Yj9331aglLgImL1P50StQhDD1k27Zytn4594ESnSrUAmccp4VNt4fcAMHUhyRY8NcHxXi1xs0OGfvySr5e3c+5GtJkV1H5dDowNjufwCM/WguuHgLfq3uRAlsmxoRe5Ey+kLiA7UPqHAwa8HVErz+B7jgH4X3Er7RMhMCwm0OXk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1fa2b8f7f27so387817fac.0 for ; Thu, 30 Nov 2023 04:17:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701346668; x=1701951468; darn=cygwin.com; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9McolutYMpIWVqOzgvoeTFIfu3gC3bW3sskWmDtq4io=; b=Z+fRMr5FnpAIA5MkbIu8jwZUB9ZQYREWl6IlTanAR7BXofPW2FPdciDhczjP3d1v5y naquix9t1/Kuk4DuLJb7VyIH6D7QFcQ6hYZG5+rIB7P1al9U4831MfymdkmYKg3nBIeU KkedCdSAWGR0XOXKTfKytyfAA/nlnlaoA8dDf0kqXcMwQLGWRqFrebWPs9hdskp40Lf8 3DKPKJWiUtT1jBkFNMwBMJUdLelgTt934FlD35+PpypiQatJsR94Ai+HSec9tIOY7vu5 dYZDjGE95Xs6NhrX7tGPbf3vqaxLY2lsRx4YAn5e/mIkK+JVfjxg9W1yfMWU+3a8Y6/V 6HyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701346668; x=1701951468; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9McolutYMpIWVqOzgvoeTFIfu3gC3bW3sskWmDtq4io=; b=lqD5mx3lBCjjoYrca6XZJgF4U0/oG3Ld14czTfRXwxktN64VfLLew6cGGVbototU2w 2v1MQ6Hlp30n5V1K11ZlyFDIdZpb1TrneqT8sL3th41A0bZEEihwnzim02QBUiswVbpZ n0hpq+0TT494yiAvlz/7P9UCMh/2RF2KuZeH6ORpdpqoZcyQ0ZVWR6zn6BOEjqocomDh OWsYk9Z+LpdoJ+XeNOsHjcVL5kP8TobPQyXSMoXTluFUA8Yu2C5hdH2sVrAeT/0dqs2q YEZ6bqWJni37xOHaFF+HUWahwRkuSTTY8dPyeirNaV/KcOp6a/Lh9X9N9Y5RfbxBMLFC uS5g== X-Gm-Message-State: AOJu0Yx0JGXfsNAkXW6ckTkNQLM1wcB+pnBCkEu0w8HCktC5UR6dM5z8 JsA8LPUPc0pPQl51SUXt2q8u2TVGCmRnpKTLMfGbIj9IVes= X-Google-Smtp-Source: AGHT+IFuvxTAKrsGS9ggFaJ9LeL3FhFD3occm6sLRxo1NaFKCfkgFg5i0E8k9zLOAxFfUp1u7hRQ9muiDQK4hNxMitE= X-Received: by 2002:a05:6870:4989:b0:1f5:cf0e:ea04 with SMTP id ho9-20020a056870498900b001f5cf0eea04mr27109826oab.58.1701346668224; Thu, 30 Nov 2023 04:17:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Daisuke Fujimura Date: Thu, 30 Nov 2023 21:17:11 +0900 Message-ID: Subject: Re: [PATCH cygport] git.cygclass: Suppress the depth option To: cygwin-apps@cygwin.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Implementations that conditionally branch on variables are simple. The proposed retry implementation complicates git.cygclass, but I think it reduces the maintainer's effort. I have created a patch for a retry implementation. Could you review it? diff --git a/cygclass/git.cygclass b/cygclass/git.cygclass index e53a7985..1e26ab37 100644 --- a/cygclass/git.cygclass +++ b/cygclass/git.cygclass @@ -76,19 +76,33 @@ git_fetch() { # (not allowed for a hash, unless remote is configured to permit # it with allow*SHA1InWant). _depth=3D"--depth 1" + _branch=3D"" if defined GIT_TAG then - _depth+=3D" --branch ${GIT_TAG}" + _depth=3D" --branch ${GIT_TAG}" elif defined GIT_BRANCH then - _depth+=3D" --branch ${GIT_BRANCH}" + _depth=3D" --branch ${GIT_BRANCH}" fi fi # T likely doesn't exist at this point, so create it first mkdir -p ${T} cd ${T} - verbose git clone ${_depth} --no-checkout ${GIT_URI} ${GIT_MODULE} || error "git clone failed" + _gitlog=3D${T}/git.$$.log + verbose git clone ${_depth} ${_branch} --no-checkout ${GIT_URI} ${GIT_MODULE} |& tee ${_gitlog} + if [ ${PIPESTATUS[0]} !=3D 0 ] + then + grep "fatal: dumb http transport does not support shallow capabilities" ${_gitlog} >& /dev/null + if [ $? =3D 0 ] + then + warning "git clone failed, retry without --depth option" + verbose git clone ${_branch} --no-checkout ${GIT_URI} ${GIT_MODULE} || error "git clone failed" + else + error "git clone failed" + fi + fi cd ${T}/${GIT_MODULE} #****v* git.cygclass/GIT_BRANCH On Mon, Nov 20, 2023 at 11:23=E2=80=AFPM Jon Turney wrote: > > On 19/11/2023 02:11, Daisuke Fujimura via Cygwin-apps wrote: > > Some git providers do not support smart transport, so specifying the > > depth option will result in an error. > > Right. This is a bug and needs fixing. > > Thanks for the patch. > > > ``` > > Cloning into 'xxxx'... > > fatal: dumb http transport does not support shallow capabilities > > ``` > > > > Therefore, I suggest adding a variable to suppress the depth option. > > (Variable names should be changed to something appropriate according > > to the naming convention.) > > > > diff --git a/cygclass/git.cygclass b/cygclass/git.cygclass > > index e53a7985..0aa97a09 100644 > > --- a/cygclass/git.cygclass > > +++ b/cygclass/git.cygclass > > @@ -75,7 +75,12 @@ git_fetch() { > > # shallow fetch a ref (master, branch or tag) with --depth=3D1 > > # (not allowed for a hash, unless remote is configured to permit > > # it with allow*SHA1InWant). > > - _depth=3D"--depth 1" > > + _depth=3D"" > > + # git provider does not support smart transport > > + if ! defined GIT_PROVIDER_NOT_SUPPORT_SMART_TRANSPORT > > If you're going to add a variable which changes the behaviour of cygport > like this, it should be documented (by adding an appropriate robodoc > comment) > > This could just be named something a little shorter, like > "GIT_URI_NO_SMART_TRANSPORT", since it's really a property of the URI's > host? > > But I wonder if wouldn't just be better to try with --depth and then > fallback to without it, if that fails (especially if we can tell it > failed for that reason). > > (Looking at [1], that seems a better approach than trying to probe the > URI for smart transport support, which seems problematic) > > [1] > https://stackoverflow.com/questions/9270488/is-it-possible-to-detect-whet= her-a-http-git-remote-is-smart-or-dumb > > What do you think? > > > + then > > + _depth=3D"--depth 1" > > + fi > > if defined GIT_TAG > > then > > _depth+=3D" --branch ${GIT_TAG}" > > >