Update pib

This commit is contained in:
sevki 2024-05-25 10:28:23 +00:00
parent cae3cad034
commit 152a80a387

17
pib
View file

@ -13,7 +13,7 @@ REMOTE_REPO="$1"
commits=$(git rev-list --reverse main)
# Set the batch size
BATCH_SIZE=1000
BATCH_SIZE=10000
# Initialize counter and range variables
start=0
@ -35,12 +35,21 @@ do
# Get the range of commits for the current batch
range="${commit_array[$end-1]}"
# Progress display before each push
percent_complete=$((start * 100 / total_commits))
echo -ne "Pushing commits $start to $((end-1)) of $total_commits ($percent_complete%)\r"
# Push the current batch
git push $REMOTE_REPO $range:refs/heads/main -f
# Redirect git push output
git push $REMOTE_REPO $range:refs/heads/main -f > /dev/null 2>&1
# Check if push succeeded
if [ $? -ne 0 ]; then
echo "Error pushing commits. Exiting."
exit 1
fi
# Update the start and end for the next batch
start=$end
end=$(($end + $BATCH_SIZE))