Added naive clone or pull.
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
commit
481e59c118
1 changed files with 24 additions and 0 deletions
24
bin/clone-or-pull
Executable file
24
bin/clone-or-pull
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# FIXME: Add checks
|
||||
REPO="$PWD";
|
||||
TARGET_DIR="$1";
|
||||
BRANCH="$2";
|
||||
|
||||
function perform_clone_or_pull {
|
||||
target="$1";
|
||||
if [! -e "$target/.git" ]; then
|
||||
git clone "$REPO" "$target";
|
||||
fi
|
||||
(
|
||||
cd "$target";
|
||||
git fetch
|
||||
git checkout origin/$BRANCH
|
||||
)
|
||||
}
|
||||
|
||||
while read old_rew new_rew ref; do
|
||||
if [ "$ref" == "refs/heads/$BRANCH"]; then
|
||||
perform_clone_or_pull "$TARGET_DIR";
|
||||
fi;
|
||||
done;
|
||||
Loading…
Add table
Add a link
Reference in a new issue