|
@@ -12,9 +12,9 @@ subdir="${4}"
|
|
|
action="${5}"
|
|
action="${5}"
|
|
|
|
|
|
|
|
prev="$(git branch --show-current)"
|
|
prev="$(git branch --show-current)"
|
|
|
-temp="$(echo "${repo%/}" | rev | cut -d/ -f1,2 | rev | tr / -)-${branch}"
|
|
|
|
|
|
|
+temp="$(rev <<< "${repo%/}" | cut -d/ -f1,2 | rev | tr / -)-${branch}"
|
|
|
fetch="_fetch-${temp}"
|
|
fetch="_fetch-${temp}"
|
|
|
-split="_split-${temp}-$(echo "${subdir}" | tr / -)"
|
|
|
|
|
|
|
+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}"
|
|
git subtree split -P "${subdir}" -b "${split}"
|
|
@@ -22,7 +22,7 @@ git checkout "${prev}"
|
|
|
|
|
|
|
|
exec 69>&1
|
|
exec 69>&1
|
|
|
result="$(git subtree "${action}" -P "${path}" "${split}" -m "${action^} ${path} from ${repo}" 2>&1 | tee >(cat - >&69))"
|
|
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
|
|
|
|
|
|
|
+if grep "refusing to merge unrelated histories" <<< "$result" > /dev/null; then
|
|
|
echo "History at ${repo} is unrelated, using quash..."
|
|
echo "History at ${repo} is unrelated, using quash..."
|
|
|
git subtree "${action}" -P "${path}" "${split}" -m "${action^} ${path} from ${repo}" --squash
|
|
git subtree "${action}" -P "${path}" "${split}" -m "${action^} ${path} from ${repo}" --squash
|
|
|
fi
|
|
fi
|