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>
This commit is contained in:
Leah Rowe
2025-10-01 16:28:04 +01:00
parent 084b8b65c6
commit 24f120d1b8
+9
View File
@@ -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 ) || :