aboutsummaryrefslogtreecommitdiff
path: root/ebuild/syncers/dogit.in
diff options
context:
space:
mode:
Diffstat (limited to 'ebuild/syncers/dogit.in')
-rw-r--r--ebuild/syncers/dogit.in19
1 files changed, 19 insertions, 0 deletions
diff --git a/ebuild/syncers/dogit.in b/ebuild/syncers/dogit.in
new file mode 100644
index 0000000..9ee055d
--- /dev/null
+++ b/ebuild/syncers/dogit.in
@@ -0,0 +1,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
+