Repository navigation
Expand file tree
/
Copy pathscripts_feeds_24.patch
More file actions
46 lines (40 loc) · 2.39 KB
/
Copy pathscripts_feeds_24.patch
File metadata and controls
46 lines (40 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
commit 1cba45ec35d0f8f9296f5a2994158dc0a28a6d83
Author: Samuele Longhi <agave@dracaena.it>
Date: Fri Jan 10 22:21:29 2025 +0100
scripts/feeds: download the entire history only on src-git-full
When a feed is defined with type "src-git" and a commit is specified (for example in releases)
the 'scripts/feeds' script first downloads the entire history, which takes a long time,
then performs a checkout, but the entire history with its size is still present.
With this modification, only the last commit is retrieved, resulting in a faster download and less space taken up.
Signed-off-by: Samuele Longhi <agave@dracaena.it>
diff --git a/scripts/feeds b/scripts/feeds
index d07c28bc50..279d5573ee 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -157,7 +157,11 @@ 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' => "mkdir '%s' && cd '%s' && git init -q && git remote add origin '%s' \\
+ && (git fetch --depth 1 origin '%s' && git reset --hard FETCH_HEAD) \\
+ || (cd ../../ && git clone '%s' '%s' && cd '%s' && git remote set-url origin ../../'%s' \\
+ && git fetch --depth 1 origin '%s' && git reset --hard FETCH_HEAD \\
+ && git remote set-url origin '%s' && rm -rf ../../'%s')",
'update' => "git pull --ff-only",
'update_rebase' => "git pull --rebase=merges",
'update_stash' => "git pull --rebase=merges --autostash",
@@ -219,7 +223,12 @@ sub update_feed_via($$$$$$$) {
if ($m->{'init_branch'} and $branch) {
system(sprintf($m->{'init_branch'}, $branch, $base_branch, $safepath)) == 0 or return 1;
} elsif ($m->{'init_commit'} and $commit) {
- system(sprintf($m->{'init_commit'}, $base_commit, $safepath, $safepath, $commit, $commit)) == 0 or return 1;
+ if ($type eq 'src-git') {
+ my $localrepo = $safepath.".local";
+ system(sprintf($m->{'init_commit'}, $safepath, $safepath, $base_commit, $commit, $base_commit, $localrepo, $safepath, $localrepo, $commit, $base_commit, $localrepo)) == 0 or return 1;
+ } else {
+ system(sprintf($m->{'init_commit'}, $base_commit, $safepath, $safepath, $commit, $commit)) == 0 or return 1;
+ }
} else {
system(sprintf($m->{'init'}, $src, $safepath)) == 0 or return 1;
}