aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Locati <michele@locati.it>2018-03-14 17:39:08 +0100
committerMichele Locati <michele@locati.it>2018-03-14 17:39:08 +0100
commite2d1251453d2016794980081d1a4e306fe777a74 (patch)
tree28efa90dd4a28be2079547500c22ad568d7a6b90
parent6d34f332b587a11c002f9a76cf2ec85a8c45a959 (diff)
downloadincremental-git-filter-branch-e2d1251453d2016794980081d1a4e306fe777a74.zip
incremental-git-filter-branch-e2d1251453d2016794980081d1a4e306fe777a74.tar.gz
incremental-git-filter-branch-e2d1251453d2016794980081d1a4e306fe777a74.tar.bz2
Reduce memory footprint
-rwxr-xr-xbin/incremental-git-filterbranch.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/incremental-git-filterbranch.sh b/bin/incremental-git-filterbranch.sh
index 9bcc02f..06cb300 100755
--- a/bin/incremental-git-filterbranch.sh
+++ b/bin/incremental-git-filterbranch.sh
@@ -482,6 +482,7 @@ processBranch () {
processBranch_tagNameFilter='read -r tag; printf "filter-branch/converted-tags/%s" "${tag}"'
fi
# shellcheck disable=SC2086
+ rm -rf "${WORKER_REPOSITORY_DIR}.map"
if git -C "${WORKER_REPOSITORY_DIR}" filter-branch \
${FILTER} \
--remap-to-ancestor \
@@ -518,7 +519,7 @@ getWorkingTagHash () {
getTranslatedNearestCommitHash () {
getTranslatedNearestCommitHash_originalHash="${1}"
- getTranslatedNearestCommitHash_translatedHash="$(printf '%s' "${TRANSLATION_MAP}" | grep -E "^${getTranslatedNearestCommitHash_originalHash}:" | sed -E 's_^.+?:__')"
+ getTranslatedNearestCommitHash_translatedHash="$(cat "${WORKER_REPOSITORY_DIR}.map" | grep -E "^${getTranslatedNearestCommitHash_originalHash}:" | sed -E 's_^.+?:__')"
if test -n "${getTranslatedNearestCommitHash_translatedHash}"
then
printf '%s' "${getTranslatedNearestCommitHash_translatedHash}"
@@ -547,7 +548,10 @@ processNotConvertedTag () {
printf 'Failed to get hash of tag %s\n' "${processNotConvertedTag_tag}">&2
exit 1
fi
- TRANSLATION_MAP="$(git -C "${WORKER_REPOSITORY_DIR}" show refs/filter-branch/state:filter.map)"
+ if test ! -f "${WORKER_REPOSITORY_DIR}.map"
+ then
+ git -C "${WORKER_REPOSITORY_DIR}" show refs/filter-branch/state:filter.map >"${WORKER_REPOSITORY_DIR}.map"
+ fi
if processNotConvertedTag_commitHash="$(getTranslatedNearestCommitHash "${processNotConvertedTag_tagOriginalHash}")"
then
printf '%s -> filter-branch/converted-tags/%s (%s -> %s)\n' "${processNotConvertedTag_tag}" "${processNotConvertedTag_tag}" "${processNotConvertedTag_tagOriginalHash}" "${processNotConvertedTag_commitHash}"

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