summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-10-01 16:28:04 +0100
committerLeah Rowe <leah@libreboot.org>2025-10-01 16:28:04 +0100
commit24f120d1b8d607a55d21f01032cb785813432a43 (patch)
tree4f706568937f4663340f0e3d0235f95d20973d81 /include
parent084b8b65c69f6c0411be42b843c3e0f99a387282 (diff)
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 <leah@libreboot.org>
Diffstat (limited to 'include')
-rw-r--r--include/get.sh9
1 files changed, 9 insertions, 0 deletions
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 ) || :