From 2942760a4184dfad8b84c51467ba9facc9be0918 Mon Sep 17 00:00:00 2001 From: Tony Tkacik Date: Fri, 3 May 2019 13:00:56 +0200 Subject: [PATCH] Added debug options. Signed-off-by: Tony Tkacik --- bin/clone-or-pull | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/clone-or-pull b/bin/clone-or-pull index 58af854..3b0638d 100755 --- a/bin/clone-or-pull +++ b/bin/clone-or-pull @@ -2,18 +2,21 @@ # FIXME: Add checks # FIXME: Add logging -REPO="$PWD"; +REPO=$(realpath "$PWD"); TARGET_DIR="$1"; BRANCH="$2"; +env + function perform_clone_or_pull { target="$1"; - echo "Checking out working copy to remote:$target" - if [! -e "$target/.git" ]; then + echo "Checking out working copy to remote: $target" + if [ ! -e "$target/.git" ]; then git clone "$REPO" "$target"; fi ( cd "$target"; + echo "Working directory: $target" git fetch git checkout origin/$BRANCH )