git: bb727917364f - stable/12 - freebsd-update: re-edit files if merge conflict markers remain
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 Jun 2023 12:58:37 UTC
The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=bb727917364f7ded1d24f599389288c63b23d862 commit bb727917364f7ded1d24f599389288c63b23d862 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-12-14 17:34:59 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2023-06-21 12:58:01 +0000 freebsd-update: re-edit files if merge conflict markers remain freebsd-update will open ${EDITOR} if conflicts occur while merging updates to config files. Inform the user if they've left conflict markers behind, and go back to editing the file. PR: 185546 PR: 229689 Reviewed by: delphij Approved by: re (cperciva, expedited MFC) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37703 (cherry picked from commit ceb5f28ba5fcfa69de7410d2327d4a5abf2a421f) (cherry picked from commit c7e3703352037a5afacdc4126725f351fe7da72b) (cherry picked from commit e27ded83c76a609687a3d9e82b80fe7e1b782bf6) (cherry picked from commit b562307b70346030f59fe6a05d125814c74da47b) --- usr.sbin/freebsd-update/freebsd-update.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index cad1b9d617fd..56a7ac422cd9 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -2543,8 +2543,21 @@ The following file could not be merged automatically: ${F} Press Enter to edit this file in ${EDITOR} and resolve the conflicts manually... EOF - read dummy </dev/tty - ${EDITOR} `pwd`/merge/new/${F} < /dev/tty + while true; do + read dummy </dev/tty + ${EDITOR} `pwd`/merge/new/${F} < /dev/tty + + if ! grep -qE '^(<<<<<<<|=======|>>>>>>>)([[:space:]].*)?$' $(pwd)/merge/new/${F} ; then + break + fi + cat <<-EOF + +Merge conflict markers remain in: ${F} +These must be resolved for the system to be functional. + +Press Enter to return to editing this file. + EOF + done done < failed.merges rm failed.merges