aboutsummaryrefslogtreecommitdiff
path: root/ebuild/syncers/dogit.in
blob: 9ee055da182515357743561d0ff1e21d353ed17c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

LOCAL="$1"
REMOTE="$2"

[[ "${REMOTE}" == git+http* ]] && REMOTE="${REMOTE:4}"

if [[ -d "${LOCAL}" && ! -d "${LOCAL}/.git" ]]; then
    source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
    eerror "'${LOCAL}' exists but it is not a Git repository"
    exit 1
fi

if [[ -d "${LOCAL}/.git" ]]; then
    cd "${LOCAL}" && git pull
else
    git clone "${REMOTE}" "${LOCAL}"
fi