Fix sync process (#16)

Signed-off-by: Fran Mulero <fmulero@vmware.com>

Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
Fran Mulero
2022-07-06 18:51:19 +02:00
committed by GitHub
co-authored by Bitnami Containers
parent 96b4bb94a9
commit bf877118cc
2 changed files with 6 additions and 15 deletions
+4 -15
View File
@@ -64,12 +64,12 @@ findCommitsToSync() {
local max=100 # If we need to sync more than 100 commits there must be something wrong since we run the job on a daily basis
# Get all commits IDs on the origin
local commits=()
while IFS='' read -r line; do commits+=("$line"); done < <(git rev-list "${origin_name}/master" -- .)
# Get the revision list in topological order ignoring merge commits
while IFS='' read -r line; do commits+=("$line"); done < <(git rev-list --topo-order --no-merges "${origin_name}/master" -- .)
for commit in "${commits[@]}"; do
if [[ "$commit" != "$last_synced_commit_id" ]] && [[ "$max" -gt "0" ]]; then
actual_commit_id="$(plainCommit "${commit}")"
if [[ "$commit" != "$SKIP_COMMIT_ID" ]] && [[ ! $commits_to_sync =~ (^|[[:space:]])$actual_commit_id($|[[:space:]]) ]]; then
commits_to_sync="${actual_commit_id} ${commits_to_sync}"
if [[ "$commit" != "$SKIP_COMMIT_ID" ]]; then
commits_to_sync="${commit} ${commits_to_sync}"
fi
else
# We reached the last commit synced
@@ -82,16 +82,6 @@ findCommitsToSync() {
echo "$commits_to_sync"
}
plainCommit() {
local commit="${1:?Missing commit}"
local result="$commit"
actual_merge_commit_id="$(git log --pretty=%P -n 1 "$commit" | awk '{print $2}')"
if [[ -n "$actual_merge_commit_id" ]]; then
result="$(plainCommit "${actual_merge_commit_id}")"
fi
echo "$result"
}
syncCommit() {
local -r commit_id="${1:?Missing commit id}"
local -r app="${2:?Missing app name}"
@@ -178,5 +168,4 @@ syncRepos() {
pushChanges
}
pip install git-filter-repo==2.34.0
syncRepos