summarylogtreecommitdiffstats
path: root/partial-clone.sh
blob: 9e7983bc3ee9c0cc48677b17e9abdaecafc0be24 (plain)
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
#!/bin/bash

source $PWD/PKGBUILD
for url in $(echo ${source[@]}|xargs -n1|grep "git+")
do
    echo $url
    DIR=${url##*/}
    if [[ -z $DIR ]];then
        DIR=${url%/}
        DIR=${DIR##*/}
    fi
    COMMIT=${DIR#*commit=}
    COMMIT=${COMMIT%\?*}
    DIR=${DIR%#commit=*}
    DIR=${DIR%.git}
    URL=${url%#commit=*}
    if [[ ! $url =~ ^git\+ ]];then
        URL=${URL#*::}
        DIR=${url%::*}
        DIR=${DIR%.git*}
    fi
    URL=${URL#git+}
    echo $URL
    echo $DIR
    echo $COMMIT
    git clone --mirror --filter=tree:0 $URL $DIR
    (cd $DIR;git fetch ;git worktree add tmp $COMMIT;git worktree remove tmp;git worktree add tmp;git worktree remove tmp)
done