From 7b6887a5d327036861853c615ba2d9a3127e5833 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 21 Nov 2026 21:00:59 +0000 Subject: pkgs/claude-inbox: take --force, an abandoned branch of its own each time A second take --force within the same second found its abandoned/master-DATE taken already, and stopped (with git's error, before changing anything). Now it adds -2, -3, ... to the name, as long as that's taken. --- pkgs/claude-inbox.nix | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkgs') diff --git a/pkgs/claude-inbox.nix b/pkgs/claude-inbox.nix index 86bedcf..5920440 100644 --- a/pkgs/claude-inbox.nix +++ b/pkgs/claude-inbox.nix @@ -218,6 +218,13 @@ let # master, renamed, and a new one, of BRANCH, with the old one's # upstream (which the rename took along) old=abandoned/master-$(date -Is | tr : -) # no : in branch names + i=1 + s= + while git -C "$r" rev-parse -q --verify "refs/heads/$old$s" >/dev/null; do + i=$((i + 1)) # another in the same second: -2, -3, ... + s=-$i + done + old=$old$s up=$(git -C "$r" rev-parse -q --verify --abbrev-ref 'master@{upstream}' 2>/dev/null || :) git -C "$r" branch -m master "$old" if ! git -C "$r" switch -q --no-track -c master "claude/$b"; then -- cgit v1.3.1