From 24f120d1b8d607a55d21f01032cb785813432a43 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 1 Oct 2025 16:28:04 +0100 Subject: get.sh: only pull if the local revision is missing we pull from upstream in cached git repos, before performing an operation, and we run from the cache, but we do this every time, even if a local revision exists, defeating the purpose of the caching; on unreliable/intermittent internet connections, this can cause a problem. this also causes us problems with gnulib.git and grub.cfg, which for *some reason* are really slow, even when doing a pull. this change improves the efficiency of the build system, during release builds, on a development repository where we already have lots of caches. Signed-off-by: Leah Rowe --- include/get.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/get.sh b/include/get.sh index 38096e8c..6c7ddcf3 100644 --- a/include/get.sh +++ b/include/get.sh @@ -232,6 +232,15 @@ try_git() x_ mv "$tmpgitcache" "$gitdest" fi + if git -C "$gitdest" whatchanged "$7" 1>/dev/null 2>/dev/null; then + # don't try to pull the latest changes if the given target + # revision already exists locally. this saves a lot of time + # during release builds, and reduces the chance that we will + # interact with grub.git or gnulib.git overall during runtime + + return 0 + fi + ( x_ git -C "$gitdest" remote remove main ) || : ( x_ git -C "$gitdest" remote remove backup ) || : -- cgit v1.2.1