aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Locati <michele@locati.it>2018-03-21 12:27:19 +0100
committerMichele Locati <michele@locati.it>2018-03-21 12:27:19 +0100
commit987ed0c003ba53a475a240ff5168c4298c09fea0 (patch)
tree3c30c6308c71e3a9895e3adfd0092cb295b2dd95
parent28ee57ca15c9b4778e3d593f40220b4d72dd2ae8 (diff)
downloadincremental-git-filter-branch-987ed0c003ba53a475a240ff5168c4298c09fea0.zip
incremental-git-filter-branch-987ed0c003ba53a475a240ff5168c4298c09fea0.tar.gz
incremental-git-filter-branch-987ed0c003ba53a475a240ff5168c4298c09fea0.tar.bz2
Avoid using tee to capture stderr, add support for upcoming git version
-rwxr-xr-xbin/incremental-git-filterbranch54
1 files changed, 28 insertions, 26 deletions
diff --git a/bin/incremental-git-filterbranch b/bin/incremental-git-filterbranch
index 3f59037..b27cea2 100755
--- a/bin/incremental-git-filterbranch
+++ b/bin/incremental-git-filterbranch
@@ -640,9 +640,9 @@ processBranch () {
processBranch_tagNameFilter='read -r tag; printf "filter-branch/converted-tags/%s" "${tag}"'
fi
rm -rf "${WORKER_REPOSITORY_DIR}.map"
- exec 3>&1
+ set +o errexit
# shellcheck disable=SC2086
- if processBranch_stdErr=$(git -C "${WORKER_REPOSITORY_DIR}" filter-branch \
+ git -C "${WORKER_REPOSITORY_DIR}" filter-branch \
${FILTER} \
--remap-to-ancestor \
--tag-name-filter "${processBranch_tagNameFilter}" \
@@ -651,38 +651,40 @@ processBranch () {
--state-branch "refs/filter-branch/state" \
--force \
-- "${processBranch_range}" \
- 1>&3 2>&1 | tee /dev/stderr
- )
+ 2>"${WORKER_REPOSITORY_DIR}.stderr"
+ processBranch_rc=$?
+ set -o errexit
+ if test -s "${WORKER_REPOSITORY_DIR}.stderr"
then
- processBranch_rc=0
- else
- processBranch_rc=1
+ cat "${WORKER_REPOSITORY_DIR}.stderr" >&2
+ if test ${processBranch_rc} -eq 1
+ then
+ if test -n "$(cat "${WORKER_REPOSITORY_DIR}.stderr" | grep -E '^Found nothing to rewrite$')"
+ then
+ processBranch_rc=2
+ fi
+ fi
+ fi
+ if test ${processBranch_rc} -ne 0 -a ${processBranch_rc} -ne 2
+ then
+ die 'git failed'
fi
- exec 3>&-
- if test "${processBranch_rc}" -ne 0
+ if test "${TAGS_PLAN}" = 'all' -a -n "${processBranch_tags}"
then
- if test -n "${processBranch_stdErr##*Found nothing to rewrite*}"
+ if ! processBranchTag_availableTags="$(git -C "${WORKER_REPOSITORY_DIR}" tag --list | grep -E '^filter-branch/converted-tags/' | sed -E 's:^filter-branch/converted-tags/::')"
then
- die 'git failed'
+ processBranchTag_availableTags=''
fi
- else
- if test "${TAGS_PLAN}" = 'all' -a -n "${processBranch_tags}"
- then
- if ! processBranchTag_availableTags="$(git -C "${WORKER_REPOSITORY_DIR}" tag --list | grep -E '^filter-branch/converted-tags/' | sed -E 's:^filter-branch/converted-tags/::')"
+ for processBranch_tag in ${processBranch_tags}
+ do
+ if ! itemInList "${processBranch_tag}" "${processBranchTag_availableTags}"
then
- processBranchTag_availableTags=''
- fi
- for processBranch_tag in ${processBranch_tags}
- do
- if ! itemInList "${processBranch_tag}" "${processBranchTag_availableTags}"
+ if stringPassesLists "${processBranch_tag}" "${TAG_WHITELIST}" "${TAG_BLACKLIST}"
then
- if stringPassesLists "${processBranch_tag}" "${TAG_WHITELIST}" "${TAG_BLACKLIST}"
- then
- processNotConvertedTag "${processBranch_tag}"
- fi
+ processNotConvertedTag "${processBranch_tag}"
fi
- done
- fi
+ fi
+ done
fi
echo " - storing state"
git -C "${WORKER_REPOSITORY_DIR}" branch -f "filter-branch/filtered/${1}" FETCH_HEAD

© 2014-2020 Faster IT GmbH | imprint | privacy policy