mirror of
http://gitea.winboll.cc/Studio/WinBoLL.git
synced 2026-07-01 21:05:46 +08:00
修复git管理脚本
This commit is contained in:
@@ -72,6 +72,7 @@ libaes
|
|||||||
libappbase
|
libappbase
|
||||||
libdebugtemp
|
libdebugtemp
|
||||||
libgpsrelaysentinel
|
libgpsrelaysentinel
|
||||||
|
libwinboll
|
||||||
local.properties-demo
|
local.properties-demo
|
||||||
mymessagemanager
|
mymessagemanager
|
||||||
positions
|
positions
|
||||||
@@ -81,13 +82,14 @@ winboll
|
|||||||
winboll.properties-demo
|
winboll.properties-demo
|
||||||
)
|
)
|
||||||
|
|
||||||
# ====================== 5. 获取当前目录真实文件列表 ======================
|
# ====================== 5. 获取当前目录真实文件列表(兼容过滤 . ..) ======================
|
||||||
REAL_ITEMS=()
|
REAL_ITEMS=()
|
||||||
|
# 使用固定排序ls,自动过滤 . 和 ..,不会进入比对数组
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
if [[ "$line" != "." && "$line" != ".." ]]; then
|
if [[ "$line" != "." && "$line" != ".." ]]; then
|
||||||
REAL_ITEMS+=("$line")
|
REAL_ITEMS+=("$line")
|
||||||
fi
|
fi
|
||||||
done < <(ls -a)
|
done < <(LC_COLLATE=C ls -a1 --color=none)
|
||||||
|
|
||||||
# ====================== 6. 差异比对函数 ======================
|
# ====================== 6. 差异比对函数 ======================
|
||||||
check_diff() {
|
check_diff() {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ if [ "${NOW_BRANCH}" != "${TARGET_BRANCH}" ];then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 目录结构校验
|
# 目录结构校验白名单(不含 . ..)
|
||||||
MERGE_OBJECTS_LIST=(
|
MERGE_OBJECTS_LIST=(
|
||||||
.git
|
.git
|
||||||
.gitignore
|
.gitignore
|
||||||
@@ -76,9 +76,13 @@ winboll.properties-demo
|
|||||||
)
|
)
|
||||||
|
|
||||||
REAL_ITEMS=()
|
REAL_ITEMS=()
|
||||||
|
# 标准排序ls输出,循环强制过滤 . 和 ..
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
[[ $line != "." && $line != ".." ]] && REAL_ITEMS+=("$line")
|
# 跳过虚拟目录 . 和 ..
|
||||||
done < <(ls -a)
|
if [[ "$line" != "." && "$line" != ".." ]]; then
|
||||||
|
REAL_ITEMS+=("$line")
|
||||||
|
fi
|
||||||
|
done < <(LC_COLLATE=C ls -a1 --color=none)
|
||||||
|
|
||||||
check_diff(){
|
check_diff(){
|
||||||
local miss=() extra=()
|
local miss=() extra=()
|
||||||
@@ -89,7 +93,17 @@ check_diff(){
|
|||||||
[[ ! " ${MERGE_OBJECTS_LIST[@]} " =~ " ${i} " ]] && extra+=("$i")
|
[[ ! " ${MERGE_OBJECTS_LIST[@]} " =~ " ${i} " ]] && extra+=("$i")
|
||||||
done
|
done
|
||||||
if [[ ${#miss[@]} -gt 0 || ${#extra[@]} -gt 0 ]];then
|
if [[ ${#miss[@]} -gt 0 || ${#extra[@]} -gt 0 ]];then
|
||||||
|
echo "========================================"
|
||||||
echo "本地目录结构不一致,终止运行"
|
echo "本地目录结构不一致,终止运行"
|
||||||
|
if [[ ${#miss[@]} -gt 0 ]]; then
|
||||||
|
echo -e "\n缺失条目:"
|
||||||
|
for m in "${miss[@]}"; do echo " $m"; done
|
||||||
|
fi
|
||||||
|
if [[ ${#extra[@]} -gt 0 ]]; then
|
||||||
|
echo -e "\n多余条目:"
|
||||||
|
for e in "${extra[@]}"; do echo " $e"; done
|
||||||
|
fi
|
||||||
|
echo "========================================"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user