From 152a80a3870fc930675d9daf3dc7296db6cd4b5c Mon Sep 17 00:00:00 2001 From: sevki Date: Sat, 25 May 2024 10:28:23 +0000 Subject: [PATCH] Update pib --- pib | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pib b/pib index 6b7f427..11a6750 100644 --- a/pib +++ b/pib @@ -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))