summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2021-06-24 17:23:01 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2021-06-26 13:13:31 +0200
commit80710c666f48c78f65588c967b69ce008d7b799a (patch)
tree32b391fafd26243491f14a5858537753eab5016f /utils
parent2cb1f350869e0c7998d3c99d7d6ba38250ab7675 (diff)
downloadsearxng-80710c666f48c78f65588c967b69ce008d7b799a.tar.gz
searxng-80710c666f48c78f65588c967b69ce008d7b799a.zip
[mod] utils/manage_static.sh: simplify git restore actions
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils')
-rwxr-xr-xutils/manage_static.sh29
1 files changed, 2 insertions, 27 deletions
diff --git a/utils/manage_static.sh b/utils/manage_static.sh
index f6eb1cae3..8f58b5dbf 100755
--- a/utils/manage_static.sh
+++ b/utils/manage_static.sh
@@ -105,31 +105,6 @@ static.build.commit() {
)
}
-static.git.restore.staged() {
- local STAGED_FILES
- STAGED_FILES=$(git diff --name-only --cached)
-
- for i in ${BUILT_PATHS[*]}; do
- STAGED_FILES_FOR_I=$(echo "${STAGED_FILES}" | grep "^${i}")
- if [ -n "${STAGED_FILES_FOR_I}" ]; then
- # shellcheck disable=SC2086
- git restore --staged ${STAGED_FILES_FOR_I}
- fi
- done
-}
-
-static.git.restore() {
- static.git.restore.staged
-
- NOT_COMMITED_FILES="$(git diff --name-only)"
- for i in ${BUILT_PATHS[*]}; do
- NOT_COMMITED_FILES_FOR_I=$(echo "${NOT_COMMITED_FILES}" | grep "^${i}")
- if [ -n "${NOT_COMMITED_FILES_FOR_I}" ]; then
- # shellcheck disable=SC2086
- git restore ${NOT_COMMITED_FILES_FOR_I}
- fi
- done
-}
main() {
case $1 in
@@ -147,11 +122,11 @@ main() {
# after "git add ."
# remove the built files
# so only the source are commited
- static.git.restore.staged
+ git restore --staged "${BUILT_PATHS[@]}"
;;
static.git.restore)
# "git restore" of the built files.
- static.git.restore
+ git restore --worktree --staged "${BUILT_PATHS[@]}"
;;
esac
}