2022-06-02 15:25:07 +02:00
|
|
|
#!/bin/bash
|
2022-06-02 16:00:07 +02:00
|
|
|
# set -x
|
|
|
|
|
|
|
|
GIT_SSL_NO_VERIFY=true
|
|
|
|
|
2022-06-02 15:25:07 +02:00
|
|
|
commit_before_pull=""
|
|
|
|
|
|
|
|
save_commit_before_pull () {
|
|
|
|
commit_before_pull=$(git reflog | grep "HEAD@{0}" | cut -d" " -f1)
|
|
|
|
if ! [ -z "$commit_before_pull" ]; then
|
|
|
|
if grep -qE "^[[:xdigit:]]{6,}$" <<< $commit_before_pull; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
commit_before_pull=""
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
# save_commit_before_pull
|
|
|
|
|
|
|
|
revert_to_commit_before_pull () {
|
|
|
|
if ! [ -z "$commit_before_pull" ]; then
|
|
|
|
if grep -qE "^[[:xdigit:]]{6,}$" <<< $commit_before_pull; then
|
|
|
|
`git reset --hard "$commit_before_pull"`
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
# revert_to_commit_before_pull
|
|
|
|
|
|
|
|
clone_customer_repository () {
|
|
|
|
if [ $(ls -A ./workspace&>/dev/null && printf "N\n" || printf "Y\n") = 'Y' ]; then
|
|
|
|
`git clone https://git.mimbach49.de/GerhardHoffmann/customer_281.git`
|
|
|
|
fi
|
|
|
|
}
|
2022-06-02 16:00:07 +02:00
|
|
|
# clone_customer_repository
|
2022-06-02 15:25:07 +02:00
|
|
|
|
|
|
|
create_workspace () {
|
|
|
|
`mkdir -p ./workspace`
|
2022-06-02 16:00:07 +02:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
set -x
|
|
|
|
pull_customer_repository () {
|
|
|
|
cd ./workspace/customer_281
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
if [ "$(git pull)" = "Already up to date." ]; then
|
|
|
|
cd - &>/dev/null
|
|
|
|
return 1
|
2022-06-02 15:25:07 +02:00
|
|
|
fi
|
2022-06-02 16:00:07 +02:00
|
|
|
cd - &>/dev/null
|
|
|
|
return 0
|
2022-06-02 15:25:07 +02:00
|
|
|
}
|
2022-06-02 16:00:07 +02:00
|
|
|
pull_customer_repository
|