Willy-JL 2 лет назад
Родитель
Сommit
eedf0fcd8a
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      .utils/subtree-subdir-helper.sh

+ 7 - 1
.utils/subtree-subdir-helper.sh

@@ -19,4 +19,10 @@ git fetch --no-tags "${repo}" "${branch}:${fetch}"
 git checkout "${fetch}"
 git subtree split -P "${subdir}" -b "${split}"
 git checkout "${prev}"
-git subtree "${action}" -P "${path}" "${split}" -m "${action^} ${path} from ${repo}"
+
+exec 69>&1
+result="$(git subtree "${action}" -P "${path}" "${split}" -m "${action^} ${path} from ${repo}" 2>&1 | tee >(cat - >&69))"
+if echo "$result" | grep "refusing to merge unrelated histories" > /dev/null; then
+    echo "History at ${repo} is unrelated, using quash..."
+    git subtree "${action}" -P "${path}" "${split}" -m "${action^} ${path} from ${repo}" --squash
+fi