From c91c90a2a6b7644e5e8aa803c12b0601acb8940a Mon Sep 17 00:00:00 2001 From: Qubasa Date: Thu, 30 May 2024 23:58:02 +0200 Subject: [PATCH] tea-create-pr: Add automatic rebase and autostash --- pkgs/tea-create-pr/script.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/tea-create-pr/script.sh b/pkgs/tea-create-pr/script.sh index a18351d8..04d059f6 100755 --- a/pkgs/tea-create-pr/script.sh +++ b/pkgs/tea-create-pr/script.sh @@ -30,11 +30,15 @@ if ! check_remote "$remoteUpstream"; then exit 1 fi +treefmt -C "$root_dir" + upstream_url=$(git remote get-url "$remoteUpstream") -git fetch "$remoteUpstream" +set -x +git fetch "$remoteUpstream" && git rebase "$remoteUpstream"/main --autostash +set +x repo=$(echo "$upstream_url" | sed -E 's#.*:([^/]+/[^.]+)\.git#\1#') -treefmt -C "$root_dir" + git log --reverse --pretty="format:%s%n%n%b%n%n" "$remoteUpstream/$targetBranch..HEAD" > "$TMPDIR"/commit-msg @@ -51,7 +55,7 @@ fi git push --force -u "$remoteFork" HEAD:refs/heads/"$tempRemoteBranch" -set -x + tea pr create \ --repo "$repo" \ --head "$user:$tempRemoteBranch" \ -- 2.45.2