aboutsummaryrefslogtreecommitdiff
path: root/contrib/git-fetch-vendor.sh
blob: abb844dbc6a56b27f15c60c4bc101ffa626fa8b6 (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
#!/bin/sh

if [ $# != 1 ]
then
    echo "Usage: $0 <vendor>"
    exit 1
fi

vendor=$1
upstream=`git config --get "gcc-config.upstream"`
if [ x"$upstream" = x ]
then
    echo "Config gcc-config.upstream not set, run contrib/gcc-git-customization"
    exit 1
fi

# This entry needs to come last, so unset it now, then reset it after the updates.
git config --unset "remote.${upstream}.push" "refs/heads/\\*:refs/heads/\\*"

echo "setting up git to fetch vendor ${vendor} to remotes/${upstream}/${vendor}"
git config --replace-all "remote.${upstream}.fetch" "refs/vendors/${vendor}/heads/*:refs/remotes/${upstream}/${vendor}/*" ":refs/remotes/${upstream}/${vendor}/"
git config --replace-all "remote.${upstream}.fetch" "+refs/vendors/${vendor}/tags/*:refs/tags/${vendor}/*" ":refs/tags/${vendor}/"
git config --replace-all "remote.${upstream}.push" "refs/heads/${vendor}/*:refs/vendors/${vendor}/heads/*" "^\+?refs/heads/${vendor}/"
# Re-add the line deleted above.
git config --add "remote.${upstream}.push" "refs/heads/*:refs/heads/*"
git fetch