mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-10 18:21:34 +03:00
7be9ed95ab
It's very easy to forget to verify that pills have been updated accordingly when the kernel changes. This adds a warning that prints when the kernel in the target has changed but the pills have not. Also prompts the user for confirmation pre-merge.
63 lines
1.1 KiB
Bash
Executable File
63 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
usage() {
|
|
local error="$1"
|
|
|
|
cat >&2 <<EOF
|
|
Usage:
|
|
$0 BRANCH PULL_REQUEST
|
|
|
|
Synopsis:
|
|
Useful script for merging a GitHub pull request with a custom merge commit
|
|
message.
|
|
|
|
Strips "origin" from branch names in title.
|
|
|
|
Example:
|
|
$0 origin/philip/jael-fix 1953
|
|
|
|
Yields:
|
|
|
|
Merge branch 'philip/jael-fix' (#1953)
|
|
|
|
* origin/philip/jael-fix:
|
|
jael: process all ships in %full update
|
|
|
|
Signed-off-by: Jared Tobin <jared@tlon.io>
|
|
|
|
Error:
|
|
-> $error
|
|
EOF
|
|
|
|
exit 1
|
|
}
|
|
|
|
args="$@"
|
|
|
|
if [[ -z "$args" ]]; then
|
|
usage "No arguments specified."
|
|
fi
|
|
|
|
REV=$1
|
|
PR=$2
|
|
|
|
TARGET=$(echo $REV | sed s_origin/__)
|
|
|
|
MERGE_MSG="Merge branch '$TARGET' (#$PR)"
|
|
|
|
KERNEL_CHANGED=`git diff --name-status $TARGET -- pkg/arvo/sys`
|
|
PILLS_CHANGED=`git diff --name-status $TARGET -- bin`
|
|
|
|
[[ ! -z $KERNEL_CHANGED && -z $PILLS_CHANGED ]] && \
|
|
echo "WARNING: kernel has changed, but pills have not"
|
|
echo $KERNEL_CHANGED
|
|
echo
|
|
|
|
read -p "Proceed with merge? (y/n)" -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
then
|
|
git merge --no-ff --signoff --log -m "$MERGE_MSG" $REV
|
|
fi
|
|
|