summaryrefslogtreecommitdiff
path: root/src/libregit
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-10-30 20:45:16 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-10-30 21:33:39 -0400
commite90114b0122a8b8338b472a0c4d475a9fd3eb66f (patch)
tree2d3b9803e9c9a9f6eb65027239f78b0aa3cd83a1 /src/libregit
parent9e61ab4abaf5eb94df3eb43769649c8e0afe5a7b (diff)
rename libregit to gitget, add bare repository support
Diffstat (limited to 'src/libregit')
-rw-r--r--src/libregit/Makefile1
-rwxr-xr-xsrc/libregit/libregit74
2 files changed, 0 insertions, 75 deletions
diff --git a/src/libregit/Makefile b/src/libregit/Makefile
deleted file mode 100644
index 2c76089..0000000
--- a/src/libregit/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-include ../../common.mk
diff --git a/src/libregit/libregit b/src/libregit/libregit
deleted file mode 100755
index 8687d2f..0000000
--- a/src/libregit/libregit
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env bash
-
-# Copyright (c) 2012-2013 Pacman Development Team <pacman-dev@archlinux.org>
-# Copyright (c) 2012-2013 Luke Shumaker <lukeshu@sbcglobal.net>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-. libremessages
-
-cd_safe() {
- if ! cd "$1"; then
- error "Failed to change to directory %s" "$1"
- plain "Aborting..."
- exit 1
- fi
-}
-
-download_git() {
- if [[ ! -d "$dir/.git" ]] ; then
- msg2 "Cloning %s %s repo..." "${repo}" "git"
- if ! git clone "$repo" "$dir"; then
- error "Failure while downloading %s %s repo" "${repo}" "git"
- plain "Aborting..."
- exit 1
- fi
- else
- cd_safe "$dir"
- # Make sure we are fetching the right repo
- if [[ "$repo" != "$(git config --get remote.origin.url)" ]] ; then
- error "%s is not a clone of %s" "$dir" "$repo"
- plain "Aborting..."
- exit 1
- fi
- msg2 "Updating %s %s repo..." "${repo}" "git"
- if ! git pull origin "$ref"; then
- # only warn on failure to allow offline builds
- warning "Failure while updating %s %s repo" "${repo}" "git"
- fi
- fi
-}
-
-usage() {
- print 'Usage: %s repo ref dir' "${0##*/}"
- echo
- print "Clones or pulls from the git URL 'repo', and checks out the git ref"
- print "'ref' to the directory 'dir'."
- echo
- print "It does safety checks, figures out whether to clone or pull, and other"
- print "helpful things. This exists because the same 'download_git' function"
- print "from makepkg was being copied again and again."
-}
-
-main() {
- [[ $# == 3 ]] || { usage >&2; return 1; }
- repo=$1
- ref=$2
- dir=$3
-
- [[ -d "${dir%/*}" ]] || mkdir -p "${dir%/*}"
- download_git
-}
-
-main "$@"