|
@@ -17,6 +17,12 @@ fetch="_fetch-${temp}"
|
|
|
split="_split-${temp}-$(tr / - <<< "${subdir}")"
|
|
split="_split-${temp}-$(tr / - <<< "${subdir}")"
|
|
|
git fetch --no-tags "${repo}" "${branch}:${fetch}"
|
|
git fetch --no-tags "${repo}" "${branch}:${fetch}"
|
|
|
git checkout "${fetch}"
|
|
git checkout "${fetch}"
|
|
|
-git subtree split -P "${subdir}" -b "${split}"
|
|
|
|
|
|
|
+exec 420>&1
|
|
|
|
|
+result="$(git subtree split -P "${subdir}" -b "${split}" 2>&1 | tee /proc/self/fd/420)"
|
|
|
|
|
+if grep "is not an ancestor of commit" <<< "$result" > /dev/null; then
|
|
|
|
|
+ echo "Resetting split branch..."
|
|
|
|
|
+ git branch -D "${split}"
|
|
|
|
|
+ git subtree split -P "${subdir}" -b "${split}"
|
|
|
|
|
+fi
|
|
|
git checkout "${prev}"
|
|
git checkout "${prev}"
|
|
|
git subtree "${action}" -P "${path}" "${split}" -m "${action^} ${path} from ${repo}"
|
|
git subtree "${action}" -P "${path}" "${split}" -m "${action^} ${path} from ${repo}"
|