11#! /usr/bin/env bash
22
3+ set -e
4+
35# #######################################################################################################################
46# #######################################################################################################################
57# this script must be run by root or sudo
4143 if [ -d " ${dir} " ]; then
4244 echo " pulling changes ..."
4345 # IF THE REPO ALREADY EXISTS...
44- pushd " ${dir} " || exit
46+ pushd " ${dir} "
47+
48+ CURRENT_BRANCH=$( git branch --show-current)
4549
4650 # PULL CHANGES
4751 git fetch
4852 git reset --hard HEAD
49- git merge origin/" $CURRENT_BRANCH "
50- popd || exit
53+ git merge origin/" ${ CURRENT_BRANCH} "
54+ popd
5155
5256 else
5357 # THE REPO DID NOT EXIST
5458 echo " the repository did not previously exist cloning... "
55- pushd " ${INCLUDE_DIR} " || exit
56- git clone --depth 1 " https://github.com/tree-sitter/${repo} " || exit
57- popd || exit
59+ pushd " ${INCLUDE_DIR} "
60+ git clone --depth 1 " https://github.com/tree-sitter/${repo} "
61+ popd
5862
5963 fi
6064done
6872# #######################################################################
6973
7074# build tree sitter library
71- pushd " ${INCLUDE_DIR} " /tree-sitter || exit
75+ pushd " ${INCLUDE_DIR} " /tree-sitter
7276
7377make
7478
75- popd || exit
79+ popd
7680
7781echo " building submitty_count_ts ..."
7882
@@ -81,16 +85,16 @@ mkdir -p "${INSTALLATION_DIR}/build"
8185
8286cmake -S " ${INSTALLATION_DIR} " -B " ${INSTALLATION_DIR} /build" -DJSONDIR=" ${NLOHMANN_INCLUDE_DIR} "
8387
84- pushd " ${INSTALLATION_DIR} /build" || exit
88+ pushd " ${INSTALLATION_DIR} /build"
8589
8690make
8791
88- popd || exit
92+ popd
8993
9094# # change permissions
9195if [ $# -eq 0 ]; then
9296 chown -R root:root " ${INSTALLATION_DIR} "
9397 chmod -R 755 " ${INSTALLATION_DIR} "
9498fi
9599
96- echo " Done setting up AnalysisToolsTS"
100+ echo " Done setting up AnalysisToolsTS"
0 commit comments