summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric CHEDALEUX2025-02-17 09:41:32 +0000
committerChristian Marangi2025-03-05 13:18:58 +0000
commit775f9d56ce0684ceee269aaeb43eb09227f17ef1 (patch)
tree0566792a817f28c5f7f69fa2489fb5224371bd28
parent6935d0fac54c78868f3f15f054391fd2f11a7cf9 (diff)
downloadopenwrt-775f9d56ce0684ceee269aaeb43eb09227f17ef1.tar.gz
scripts/feeds: shallow clone for specific commit update
When a feed is referenced with a specific commit (i.e. <git_url>^<sha1>), a full clone was performed and a branch was created from the sha1 and named with the sha1. Other git clones operations are shallowed. As Git does not support clone at a specific commit, let's first perform a shallow clone to latest commit, then fetch the relevant commit and finally checkout it (no more 'pseudo' branch). It saves bandwith and significantly speeds up the feed update process. Signed-off-by: Cedric CHEDALEUX <cedric.chedaleux@orange.com> Link: https://github.com/openwrt/openwrt/pull/18003 Signed-off-by: Robert Marko <robimarko@gmail.com> (cherry picked from commit 32d0a57dc10811a24816e51f10e55963f40fe462) Link: https://github.com/openwrt/openwrt/pull/18168 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rwxr-xr-xscripts/feeds2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/feeds b/scripts/feeds
index aee73e793f..3df947c9c7 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -157,7 +157,7 @@ my %update_method = (
'src-git' => {
'init' => "git clone --depth 1 '%s' '%s'",
'init_branch' => "git clone --depth 1 --branch '%s' '%s' '%s'",
- 'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
+ 'init_commit' => "git clone --depth 1 '%s' '%s' && cd '%s' && git fetch --depth=1 origin '%s' && git -c advice.detachedHead=false checkout '%s' && cd -",
'update' => "git pull --ff-only",
'update_force' => "git pull --ff-only || (git reset --hard HEAD; git pull --ff-only; exit 1)",
'post_update' => "git submodule update --init --recursive",