@@ -144,7 +144,7 @@ case "$COMMAND" in
144144 echo " No interrupted state found, cannot continue."
145145 exit 1
146146 fi
147- read START_BRANCH END_BRANCH ORIGIN_MSG NEXT_BRANCH < " $STATE_FILE "
147+ { read -r START_BRANCH; read -r END_BRANCH; read -r NEXT_BRANCH; read -r ORIGIN_MSG ; } < " $STATE_FILE "
148148 echo " Continuing interrupted merge from ch$NEXT_BRANCH ..."
149149 ;;
150150
@@ -160,7 +160,7 @@ case "$COMMAND" in
160160
161161 status)
162162 if [[ -f " $STATE_FILE " ]]; then
163- read START_BRANCH END_BRANCH ORIGIN_MSG NEXT_BRANCH < " $STATE_FILE "
163+ { read -r START_BRANCH; read -r END_BRANCH; read -r NEXT_BRANCH; read -r ORIGIN_MSG ; } < " $STATE_FILE "
164164 echo " Merge status: In progress"
165165 echo " Start branch: ch${START_BRANCH} "
166166 echo " End branch: ch${END_BRANCH} "
@@ -313,14 +313,14 @@ for ((i=NEXT_BRANCH; i<=END_BRANCH; i++)); do
313313 # Check if target branch exists
314314 if ! git show-ref --verify --quiet refs/heads/${CUR_BRANCH} ; then
315315 echo " Error: Branch ${CUR_BRANCH} does not exist"
316- echo " $START_BRANCH $END_BRANCH \" $ORIGIN_MSG \" $i " > " $STATE_FILE "
316+ printf ' %s\n ' " $START_BRANCH " " $END_BRANCH " " $i " " $ORIGIN_MSG " > " $STATE_FILE "
317317 exit 1
318318 fi
319319
320320 echo " Switching to branch ${CUR_BRANCH} ..."
321321 if ! git checkout " ${CUR_BRANCH} " ; then
322322 echo " Error: Cannot switch to branch ${CUR_BRANCH} "
323- echo " $START_BRANCH $END_BRANCH \" $ORIGIN_MSG \" $i " > " $STATE_FILE "
323+ printf ' %s\n ' " $START_BRANCH " " $END_BRANCH " " $i " " $ORIGIN_MSG " > " $STATE_FILE "
324324 exit 1
325325 fi
326326
@@ -336,7 +336,7 @@ for ((i=NEXT_BRANCH; i<=END_BRANCH; i++)); do
336336 echo " "
337337 echo " Or run '$0 abort' to abort the merge"
338338 echo " Or run '$0 status' to check current status"
339- echo " $START_BRANCH $END_BRANCH \" $ORIGIN_MSG \" $i " > " $STATE_FILE "
339+ printf ' %s\n ' " $START_BRANCH " " $END_BRANCH " " $i " " $ORIGIN_MSG " > " $STATE_FILE "
340340 exit 1
341341 fi
342342
0 commit comments