Skip to content

Commit dad4d9c

Browse files
committed
improve feedback from script
1 parent f03d758 commit dad4d9c

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

scripts/2_synchronize.sh

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ main() {
133133

134134
# Check if the last commit SHA is different
135135
if [ "$last_commit_sha" != "$new_commit_sha" ]; then
136-
echo "======================================================================
137-
Commit "${new_commit_sha:0:6}" found for $path_to_folder_to_synchronize_from"
136+
echo "======================================================================"
137+
echo "Commit "${new_commit_sha:0:6}" found for $path_to_folder_to_synchronize_from"
138138

139139
# Debug
140140
# echo "will perform the cloning with params
@@ -146,42 +146,47 @@ main() {
146146
# path_to_folder_to_synchronize_to: "$path_to_folder_to_synchronize_to"
147147
# replacement: "${replacements:0:20}...""
148148

149+
echo "======= Branch ========"
149150

150151
# Create a branch only if it hasn't been created yet
151152
if [ "$branch_created" = false ]; then
152153
# # Delete branch
153-
git push origin --delete auto_fetch
154-
git branch -D auto_fetch
154+
git push origin --delete auto_fetch --quiet
155+
git branch -D auto_fetch --quiet
155156

156-
git pull origin fusion_site_ssplab
157-
git checkout -b auto_fetch
158-
git push -u origin auto_fetch
157+
git pull origin fusion_site_ssplab --quiet
158+
git checkout -b auto_fetch --quiet
159+
git push -u origin auto_fetch --quiet
159160
branch_created=true
160161
fi
161162

162-
git checkout auto_fetch
163+
git checkout auto_fetch --quiet
163164

164165
# Clone the repository and move the subfolder
166+
echo "======= Cloning repo ========"
165167
clone_repo "$owner" "$repo" "$path" "$path_to_folder_to_synchronize_to"
166168

167169
# Replace patterns in .qmd files
170+
echo "======= Cleaning cloned files ========"
168171
replace_in_qmd_files "$path_to_folder_to_synchronize_to" "$replacements"
169172

170173
# Update the last commit SHA in the JSON file
174+
echo "======= Update "$json_file" ========"
171175
update_commit_sha "$last_commit_sha" "$new_commit_sha" "$json_file"
172176

177+
echo "======= Commit & push ========"
173178
# Commit the changes
174179
git add "$path_to_folder_to_synchronize_to" "$json_file"
175180
git commit -m "Update $path_to_folder_to_synchronize_to based on commit $new_commit_sha made to $path_to_folder_to_synchronize_from"
176-
git push
181+
git push --quiet
177182
else
178-
echo "======================================================================
179-
No new commit since ${last_commit_sha:0:6} found for $path_to_folder_to_synchronize_from"
183+
echo "======================================================================"
184+
echo "No new commit since ${last_commit_sha:0:6} found for $path_to_folder_to_synchronize_from"
180185
fi
181186
done
182187
}
183188

184189
# To run the script
185190
main
186191

187-
git checkout fusion_site_ssplab
192+
git checkout fusion_site_ssplab --quiet

0 commit comments

Comments
 (0)