pick-to-branch: warn if target remote is not in github.openssl.org
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Thu, 20 Apr 2023 13:07:02 +0000 (15:07 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 26 Apr 2023 13:33:10 +0000 (15:33 +0200)
Fixes #141

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/tools/pull/142)

review-tools/pick-to-branch

index 7955fd82fec600a1dc9e2e0db2aa6cd7c3b0bc81..d57ca5bb0348b3107ff252c595c21dcc341144d1 100755 (executable)
@@ -69,8 +69,18 @@ m*)
     ;;
 esac
 
+REMOTE=$(git for-each-ref --format='%(push:remotename)' \
+             $(git rev-parse --symbolic-full-name $TARGET))
+# usually this will be 'upstream'
+if [ "$REMOTE" = "" ] ; then
+    echo Cannot find git remote for target branch $TARGET
+    exit 1
+fi
+git remote get-url $REMOTE | grep -q 'github.openssl.org:' \
+ || echo -e "WARNING: URL of remote '$REMOTE' of target branch '$TARGET' does not match 'github.openssl.org'\n"
+
+echo "Target remote and branch is: $REMOTE/$TARGET"
 echo "First commit to cherry-pick is: $id~$((num - 1))"
-echo "Target branch is: $TARGET"
 echo "Number of commits to pick: $num"
 echo
 echo "Commit(s) to be cherry-picked:"