Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#2898 - Add support for git reference repositories #7679

Open
openwrt-bot opened this issue Mar 12, 2020 · 0 comments
Open

FS#2898 - Add support for git reference repositories #7679

openwrt-bot opened this issue Mar 12, 2020 · 0 comments
Labels

Comments

@openwrt-bot
Copy link

mike-meshplusplus:

If OpenWRT added support for git reference repositories when fetching feeds, builds can be conducted with less bandwidth usage.

https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---reference-if-ableltrepositorygt

For example, I've modified the feeds script to allow this, but the modification is pretty rough.

From 44b08ccb6abbcffc8566312b8d92d729e9b09e15 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Tue, 10 Mar 2020 20:09:15 -0500 Subject: [PATCH] Make git clones happen via a reference repository to save bandwidth

scripts/feeds | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/feeds b/scripts/feeds
index 304ef6cbaf..31a61b230c 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -133,18 +133,18 @@ my %update_method = (
'update' => "",
'revision' => "echo -n 'dummy'"},
'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'          => "(export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -f `echo \$NAME | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache --depth 1 \$URL \$NAME)",
    
  •       'init_branch'   => "(export BRANCH='%s' ; export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -t \$BRANCH -f `echo \$NAME-\$BRANCH | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache --depth 1 --branch \$BRANCH \$URL \$NAME)",
    
  •       'init_commit'   => "(export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -f `echo \$NAME | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache \$URL \$NAME && cd '%s' && git checkout -b '%s' '%s' && cd -)",
          'update'	=> "git pull --ff",
          'update_force'	=> "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
          'post_update'	=> "git submodule update --init --recursive",
          'controldir'	=> ".git",
          'revision'	=> "git rev-parse --short HEAD | tr -d '\n'"},
    
    'src-git-full' => {
  •       'init'          => "git clone '%s' '%s'",
    
  •       'init_branch'   => "git clone --branch '%s' '%s' '%s'",
    
  •       'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
    
  •       'init'          => "(export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -f `echo \$NAME | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache \$URL \$NAME)",
    
  •       'init_branch'   => "(export BRANCH='%s' ; export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -t \$BRANCH -f `echo \$NAME-\$BRANCH | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache --branch \$BRANCH \$URL \$NAME)",
    
  •       'init_commit'   => "(export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -f `echo \$NAME | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache \$URL \$NAME && cd '%s' && git checkout -b '%s' '%s' && cd -)",
          'update'	=> "git pull --ff",
          'update_force'	=> "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
          'post_update'	=> "git submodule update --init --recursive",
    

--
2.24.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant