generated from CPP-KT/template-task
-
Notifications
You must be signed in to change notification settings - Fork 1
/
init-repo.sh
executable file
·35 lines (29 loc) · 1.04 KB
/
init-repo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Данный скрипт следует вызвать после первого клонирования
# репозитория. Подробная информация:
# https://cpp-kt.github.io/course/instruction.html
set -euo pipefail
IFS=$' \t\n'
if [[ ! $(git remote get-url origin) =~ ^git@ ]]; then
echo "The project is not cloned via SSH"
exit 1
fi
if git branch | grep --quiet feedback; then
echo "init-repo.sh was already done on this repository."
exit 1
fi
if [[ -n $(git status --untracked-files=no --porcelain) ]]; then
echo "init-repo.sh is intended to work on a freshly created repository."
echo "The working copy of this repository is dirty. Please checkout or"
echo "stash changes and run ./init-repo.sh again."
exit 1
fi
source ci-extra/set-upstream.sh
git remote add upstream "git@github.com:$UPSTREAM_REPO.git"
git fetch upstream
git branch feedback upstream/master
git push -u origin feedback:feedback
git checkout feedback
git branch -f master feedback
git checkout master
git push -f origin master