From 16069ba8c67e276033bae2c32d78faf4d0d442ff Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Wed, 1 Jul 2026 04:45:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgit=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bashMergeProjects-to-Projects_Keeper.sh | 10 ++++++---- ...ashMergeProjects-to-Projects_Keeper_Tag.sh | 20 ++++++++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.winboll/bashMergeProjects-to-Projects_Keeper.sh b/.winboll/bashMergeProjects-to-Projects_Keeper.sh index 520bd82..46190ae 100644 --- a/.winboll/bashMergeProjects-to-Projects_Keeper.sh +++ b/.winboll/bashMergeProjects-to-Projects_Keeper.sh @@ -72,6 +72,7 @@ libaes libappbase libdebugtemp libgpsrelaysentinel +libwinboll local.properties-demo mymessagemanager positions @@ -81,13 +82,14 @@ winboll winboll.properties-demo ) -# ====================== 5. 获取当前目录真实文件列表 ====================== +# ====================== 5. 获取当前目录真实文件列表(兼容过滤 . ..) ====================== REAL_ITEMS=() +# 使用固定排序ls,自动过滤 . 和 ..,不会进入比对数组 while IFS= read -r line; do if [[ "$line" != "." && "$line" != ".." ]]; then REAL_ITEMS+=("$line") fi -done < <(ls -a) +done < <(LC_COLLATE=C ls -a1 --color=none) # ====================== 6. 差异比对函数 ====================== check_diff() { @@ -165,7 +167,7 @@ echo -e "#@@@ 开始合并应用型模块源码 @@@# for item in "${MERGE_APP_PROJECT_LIST[@]}"; do echo "正在合并 $item 项目 ..." item_lower=$(echo "$item" | tr 'A-Z' 'a-z') -git checkout origin/$item_lower $item_lower + git checkout origin/$item_lower $item_lower git add . git commit -m "合并 $item 项目" done @@ -181,7 +183,7 @@ echo -e "#@@@ 开始合并类库型模块源码 @@@# for item in "${MERGE_LIB_PROJECT_LIST[@]}"; do echo "正在合并 $item 项目 ..." item_lower=$(echo "$item" | tr 'A-Z' 'a-z') -git checkout origin/$item_lower $item_lower lib$item_lower + git checkout origin/$item_lower $item_lower lib$item_lower git add . git commit -m "合并 $item 项目" done diff --git a/.winboll/bashMergeProjects-to-Projects_Keeper_Tag.sh b/.winboll/bashMergeProjects-to-Projects_Keeper_Tag.sh index 3676aae..8811d3a 100644 --- a/.winboll/bashMergeProjects-to-Projects_Keeper_Tag.sh +++ b/.winboll/bashMergeProjects-to-Projects_Keeper_Tag.sh @@ -38,7 +38,7 @@ if [ "${NOW_BRANCH}" != "${TARGET_BRANCH}" ];then exit 1 fi -# 目录结构校验 +# 目录结构校验白名单(不含 . ..) MERGE_OBJECTS_LIST=( .git .gitignore @@ -76,9 +76,13 @@ winboll.properties-demo ) REAL_ITEMS=() +# 标准排序ls输出,循环强制过滤 . 和 .. 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(){ local miss=() extra=() @@ -89,7 +93,17 @@ check_diff(){ [[ ! " ${MERGE_OBJECTS_LIST[@]} " =~ " ${i} " ]] && extra+=("$i") done if [[ ${#miss[@]} -gt 0 || ${#extra[@]} -gt 0 ]];then + 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 fi }