Update scripts with a couple of new ones

This commit is contained in:
Alexis Sellier 2023-04-27 11:08:56 +02:00
parent 0ecd8fb074
commit 44298df48f
No known key found for this signature in database
3 changed files with 38 additions and 2 deletions

View File

@ -8,10 +8,10 @@ if [ "$#" -lt 2 ]; then
fi
RAD_HOME=${RAD_HOME:-"$HOME/.radicle"}
REPO=$1
REPO=$(echo "$1" | sed 's/rad://')
REMOTE=$2
cd $RAD_HOME/storage/$1
cd $RAD_HOME/storage/$REPO
refs=$(git for-each-ref --format="%(refname)")
pattern="refs/namespaces/$2/refs/*"

12
scripts/patch-rebase.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -e
if [ "$#" -lt 1 ]; then
printf "usage: %s <patch-id>\n" "$(basename "$0")"
exit 1
fi
rad patch checkout $1
git rebase master --autosquash
rad patch update $1 --message "Rebased on master"
git checkout master

24
scripts/show-sigrefs.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
if [ "$#" -lt 2 ]; then
printf "usage: %s <rid> <nid>\n" "$(basename "$0")"
exit 1
fi
RAD_HOME=${RAD_HOME:-"$HOME/.radicle"}
REPO=$(echo "$1" | sed 's/^rad://')
REMOTE=$2
cd $RAD_HOME/storage/$REPO
sigrefs=$(git rev-parse "refs/namespaces/$REMOTE/refs/rad/sigrefs")
signed=$(git show "$sigrefs:refs")
actual=$(git for-each-ref "refs/namespaces/$REMOTE/refs/**" --format="%(objectname) %(refname)")
# Strip namespace prefix.
actual=$(echo "$actual" | sed "s@refs/namespaces/$REMOTE/@@")
# Remove `sigrefs` itself.
actual=$(echo "$actual" | grep -v "refs/rad/sigrefs$")
diff <(echo "$signed") <(echo "$actual") --color=always -y --minimal -W 240