mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 13:43:45 +03:00
Ports: Make 'package.sh dev' a bit more friendly when importing patches
When a git patch that doesn't apply is encountered, start a git am session and _then_ drop the user in it instead of expeting the user to start the session on their own. Also prompt for leftover files and delete them if the user does not want them.
This commit is contained in:
parent
bf82d9b5d7
commit
e79a766901
Notes:
sideshowbarker
2024-07-17 20:08:04 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/e79a7669011 Pull-request: https://github.com/SerenityOS/serenity/pull/12110
@ -690,21 +690,35 @@ do_dev() {
|
||||
fi
|
||||
|
||||
echo "Importing patch $patch..."
|
||||
git am "$patch" || {
|
||||
git am "$patch" >/dev/null 2>&1 || {
|
||||
git am --abort >/dev/null 2>&1 || true
|
||||
git apply < $patch || {
|
||||
if git apply < $patch; then
|
||||
git add -A
|
||||
if prompt_yes_no "- This patch does not appear to be a git patch, would you like to modify its changes before continuing?"; then
|
||||
>&2 echo "Apply any changes you want, commit them into the current repo and quit this shell to continue."
|
||||
|
||||
launch_user_shell
|
||||
fi
|
||||
git commit --verbose
|
||||
else
|
||||
# The patch didn't apply, oh no!
|
||||
# Ask the user to figure it out :shrug:
|
||||
git am "$patch" || true
|
||||
>&2 echo "- This patch does not apply, you'll be dropped into a shell to investigate and fix this, quit the shell when the problem is resolved."
|
||||
>&2 echo "Note that the patch needs to be committed into the current repository!"
|
||||
launch_user_shell
|
||||
}
|
||||
git add -A
|
||||
if prompt_yes_no "- This patch does not appear to be a git patch, would you like to manually commit its changes?"; then
|
||||
>&2 echo "Apply any changes you want, commit them into the current repo and quit this shell to continue."
|
||||
fi
|
||||
|
||||
launch_user_shell
|
||||
else
|
||||
git commit --verbose
|
||||
if ! git diff --quiet >/dev/null 2>&1; then
|
||||
>&2 echo "- It appears that there are uncommitted changes from applying the previous patch:"
|
||||
for line in $(git diff --color=always); do
|
||||
echo "| $line"
|
||||
done
|
||||
if prompt_yes_no "- Would you like to drop them before moving on to the next patch?"; then
|
||||
git clean -xf
|
||||
else
|
||||
>&2 echo "- The uncommitted changes will be committed with the next patch or left in the tree."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user