aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2018-11-18 11:53:26 +0100
committerDaniel Lange <DLange@git.local>2018-11-18 11:53:26 +0100
commit1d5b066a1233c11cca1de9a0baa0083629fc9b70 (patch)
tree078d2c09d54b614878d2747495e197ff58d4c7c3 /bin
parent987ed0c003ba53a475a240ff5168c4298c09fea0 (diff)
downloadincremental-git-filter-branch-master.tar.gz
incremental-git-filter-branch-master.tar.bz2
incremental-git-filter-branch-master.zip
Add v1.1 with --tempdir and lock file cleanupHEADmaster
Diffstat (limited to 'bin')
-rwxr-xr-xbin/incremental-git-filterbranch34
1 files changed, 31 insertions, 3 deletions
diff --git a/bin/incremental-git-filterbranch b/bin/incremental-git-filterbranch
index b27cea2..e29d645 100755
--- a/bin/incremental-git-filterbranch
+++ b/bin/incremental-git-filterbranch
@@ -4,6 +4,7 @@
# way.
#
# Copyright (c) Michele Locati, 2018
+# v1.1 portions Copyright (c) Faster IT GmbH, 2018
#
# MIT license
# https://github.com/concrete5/incremental-filter-branch/blob/master/LICENSE
@@ -54,6 +55,10 @@ Where:
--workdir workdirpath
set the path to the directory where the temporary local repositories are created.
By default, we'll use a directory named temp in the current directory.
+--tempdir tempdirpath
+ set the path for the tree-filter to create temporary checkouts in
+ By default, we'll use a subdirectory of /dev/shm. This needs to be in a tmpfs
+ to be fast.
--branch-whitelist <whitelist>
a whitespace-separated list of branches to be included in the process.
Multiple options can be specified.
@@ -94,6 +99,7 @@ sourcerepository
The URL or path to the source repository.
filter
The list of parameters to be passed to the git filter-branch command.
+ Please add only one parameter to --tree-filter as the quote escaping is hell otherwise.
destinationrepository
The URL or path to the destination repository.
@@ -111,6 +117,7 @@ Please remark that these regular expressions should comply the POSIX ERE (Extend
# $@: all the command line parameters
readParameters () {
WORK_DIRECTORY="$(pwd)/temp"
+ TEMP_DIRECTORY="/dev/shm"
BRANCH_WHITELIST=''
BRANCH_BLACKLIST=''
TAG_WHITELIST=''
@@ -149,6 +156,18 @@ readParameters () {
fi
shift 2
;;
+ --tempdir)
+ if test $# -lt 2
+ then
+ usage 'Not enough arguments'
+ fi
+ TEMP_DIRECTORY="${2}"
+ if test -z "${TEMP_DIRECTORY}"
+ then
+ die 'The temp directory option is empty'
+ fi
+ shift 2
+ ;;
--branch-whitelist)
if test $# -lt 2
then
@@ -286,7 +305,6 @@ readParameters () {
DESTINATION_REPOSITORY_URL=$(absolutizePath "${DESTINATION_REPOSITORY_URL}")
}
-
# Check if a string is a directory. If so, return its absolute path, otherwise the string itself.
#
# Arguments:
@@ -418,6 +436,15 @@ acquireLock () {
fi
}
+# Release a lock and clean up the filesystem file
+releaseLock () {
+ if test -z "${NO_LOCK}"
+ then
+ flock -u 9
+ rm -f "${WORKER_REPOSITORY_DIR}.lock" 2>/dev/null
+ fi
+}
+
# Create or update the mirror of the source repository.
prepareLocalSourceRepository () {
@@ -623,7 +650,7 @@ processBranch () {
echo ' - initializing filter'
rm -f "${WORKER_REPOSITORY_DIR}/refs/filter-branch/originals/${1}/refs/heads/filter-branch/result/${1}"
git -C "${WORKER_REPOSITORY_DIR}" branch --force "filter-branch/result/${1}" FETCH_HEAD
- rm -rf "${WORKER_REPOSITORY_DIR}.filter-branch"
+ rm -rf "${TEMP_DIRECTORY}/.filter-branch"
echo " - filtering commits"
processBranch_tags=''
if test -z "${TAGS_PLAN}"
@@ -646,7 +673,7 @@ processBranch () {
${FILTER} \
--remap-to-ancestor \
--tag-name-filter "${processBranch_tagNameFilter}" \
- -d "${WORKER_REPOSITORY_DIR}.filter-branch" \
+ -d "${TEMP_DIRECTORY}/.filter-branch" \
--original "refs/filter-branch/originals/${1}" \
--state-branch "refs/filter-branch/state" \
--force \
@@ -937,4 +964,5 @@ prepareWorkerRepository
removeTranslatedTags
processBranches
pruneDestination
+releaseLock
echo "All done."

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