summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-21 21:00:59 +0000
committertv <tv@krebsco.de>2026-11-21 21:29:02 +0000
commit7b6887a5d327036861853c615ba2d9a3127e5833 (patch)
treebf4933357cfcdba3c8eaf1e7e03f51868f9e98f4 /pkgs
parent5feb8d907c85877cc50c70d46533d6191d770bca (diff)
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.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/claude-inbox.nix7
1 files changed, 7 insertions, 0 deletions
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