Skip to content

Commit 58545b3

Browse files
committed
setup-development-environment: Simplify git repository handling
Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
1 parent 14a51e1 commit 58545b3

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

setup-development-environment.bash

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ init() {
8888
exit 1
8989
fi
9090

91-
export GIT_DIR="${SHC_PREFIX_DIR}/.git"
92-
export GIT_WORK_TREE="${SHC_PREFIX_DIR}"
91+
unset GIT_DIR GIT_WORK_TREE
9392

94-
if [ ! -d "${GIT_DIR}" ]; then
93+
cd "${RUNTIME_EXECUTABLE_DIRECTORY}"
94+
95+
if [ ! -d "${RUNTIME_EXECUTABLE_DIRECTORY}/.git" ]; then
9596
printf "ERROR: git repository doesn't exist, you must initialize a git repository before running this script\\n" 1>&2
9697
exit "${COMMON_RESULT_FAILURE}"
9798
fi
@@ -102,16 +103,11 @@ init() {
102103
git submodule init\
103104
"${SDC_CLEAN_FILTER_FOR_BASH_DIR}"
104105
git submodule update --depth=30
105-
local GIT_DIR_OLD="${GIT_DIR}"
106-
local GIT_WORK_TREE_OLD="${GIT_WORK_TREE}"
107-
GIT_DIR="${SDC_CLEAN_FILTER_FOR_BASH_DIR}/.git"
108-
GIT_WORK_TREE="${SDC_CLEAN_FILTER_FOR_BASH_DIR}"
106+
109107
pushd "${SDC_CLEAN_FILTER_FOR_BASH_DIR}" >/dev/null
110108
git submodule init
111109
# FIXME: Should be specifying this in the submodule
112110
git submodule update 'Code Formatters and Beautifiers/the Bash Script Beautifier'
113-
GIT_DIR="${GIT_DIR_OLD}"; unset GIT_DIR_OLD
114-
GIT_WORK_TREE="${GIT_WORK_TREE_OLD}"; unset GIT_WORK_TREE_OLD
115111
popd >/dev/null
116112
printf 'done\n'
117113

0 commit comments

Comments
 (0)