mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vignesh Raman <vignesh.raman@collabora.com>
To: dri-devel@lists.freedesktop.org
Cc: daniels@collabora.com, helen.fornazier@gmail.com,
	airlied@gmail.com, simona.vetter@ffwll.ch, robdclark@gmail.com,
	guilherme.gallo@collabora.com, sergi.blanch.torne@collabora.com,
	valentine.burley@collabora.com, lumag@kernel.org,
	quic_abhinavk@quicinc.com, mripard@kernel.org,
	maarten.lankhorst@linux.intel.com, tzimmermann@suse.de,
	linux-kernel@vger.kernel.org
Subject: [PATCH v1 2/3] drm/ci: check-patch: unshallow repository before fetching
Date: Fri, 28 Mar 2025 16:32:32 +0530	[thread overview]
Message-ID: <20250328110239.993685-3-vignesh.raman@collabora.com> (raw)
In-Reply-To: <20250328110239.993685-1-vignesh.raman@collabora.com>

Ensure the repository is not shallow before fetching branches in
check-patch job. This prevents issues where git merge-base fails
due to incomplete history. Set the timeout of check-patch job to 1h.

Signed-off-by: Vignesh Raman <vignesh.raman@collabora.com>
---
 drivers/gpu/drm/ci/check-patch.py    | 16 ++++++++++++----
 drivers/gpu/drm/ci/static-checks.yml |  1 +
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/ci/check-patch.py b/drivers/gpu/drm/ci/check-patch.py
index a5f399a20e25..b206f12feb64 100755
--- a/drivers/gpu/drm/ci/check-patch.py
+++ b/drivers/gpu/drm/ci/check-patch.py
@@ -18,12 +18,20 @@ repourl = "https://gitlab.freedesktop.org/%s.git" % os.environ["CI_MERGE_REQUEST
 # GitLab CI environment does not give us any direct info about the
 # base for the user's branch. We thus need to figure out a common
 # ancestor between the user's branch and current git master.
-os.environ["GIT_DEPTH"] = "1000"
 subprocess.call(["git", "remote", "remove", "check-patch"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
 subprocess.check_call(["git", "remote", "add", "check-patch", repourl])
-subprocess.check_call(["git", "fetch", "check-patch", os.environ["CI_MERGE_REQUEST_TARGET_BRANCH_NAME"]],
-                      stdout=subprocess.DEVNULL,
-                      stderr=subprocess.DEVNULL)
+
+# Check if the repository is shallow
+shallow = subprocess.run(["git", "rev-parse", "--is-shallow-repository"],
+                         stdout=subprocess.PIPE, universal_newlines=True).stdout.strip()
+
+if shallow == "true":
+    print("Repository is shallow, unshallow git history")
+    subprocess.check_call(["git", "fetch", "--unshallow", "check-patch", os.environ["CI_MERGE_REQUEST_TARGET_BRANCH_NAME"]],
+                          stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+else:
+    subprocess.check_call(["git", "fetch", "check-patch", os.environ["CI_MERGE_REQUEST_TARGET_BRANCH_NAME"]],
+                          stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
 
 ancestor = subprocess.check_output(["git", "merge-base",
                                     "check-patch/%s" % os.environ["CI_MERGE_REQUEST_TARGET_BRANCH_NAME"], "HEAD"],
diff --git a/drivers/gpu/drm/ci/static-checks.yml b/drivers/gpu/drm/ci/static-checks.yml
index 13ffa827b7fa..734d6055fa65 100644
--- a/drivers/gpu/drm/ci/static-checks.yml
+++ b/drivers/gpu/drm/ci/static-checks.yml
@@ -1,4 +1,5 @@
 check-patch:
+  timeout: "1h"
   extends:
     - .build
     - .use-debian/x86_64_build
-- 
2.47.2


  parent reply	other threads:[~2025-03-28 11:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 11:02 [PATCH v1 0/3] drm/ci: mesa uprev and python-artifacts/check-patch fixes Vignesh Raman
2025-03-28 11:02 ` [PATCH v1 1/3] drm/ci: use shallow clone to avoid timeouts Vignesh Raman
2025-03-28 11:02 ` Vignesh Raman [this message]
2025-03-28 11:35   ` [PATCH v1 2/3] drm/ci: check-patch: unshallow repository before fetching Daniel Stone
2025-03-28 12:10     ` Vignesh Raman
2025-04-03  6:02       ` Vignesh Raman
2025-03-28 11:02 ` [PATCH v1 3/3] drm/ci: uprev mesa Vignesh Raman
2025-03-28 11:36   ` Daniel Stone
2025-03-28 11:59     ` Vignesh Raman
2025-04-03  5:59       ` Vignesh Raman
2025-04-29 18:21         ` Dmitry Baryshkov
2025-04-30  1:33           ` Vignesh Raman
2026-03-25  5:32 ` [PATCH v1 0/3] drm/ci: mesa uprev and python-artifacts/check-patch fixes Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250328110239.993685-3-vignesh.raman@collabora.com \
    --to=vignesh.raman@collabora.com \
    --cc=airlied@gmail.com \
    --cc=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=guilherme.gallo@collabora.com \
    --cc=helen.fornazier@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sergi.blanch.torne@collabora.com \
    --cc=simona.vetter@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=valentine.burley@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®