summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/claude-inbox.nix23
1 files changed, 13 insertions, 10 deletions
diff --git a/pkgs/claude-inbox.nix b/pkgs/claude-inbox.nix
index ccb0403..14e8ed8 100644
--- a/pkgs/claude-inbox.nix
+++ b/pkgs/claude-inbox.nix
@@ -2,9 +2,10 @@
# VM has (~claude/src, but for symlinks, i.e. third parties' in ~/tmp/src)
# need attention, i.e. have branches there with something master
# doesn't have (by content, so rebased ones count as merged), whose
-# (a remote's, by the branch's prefix, or tv's, without one), and what to
-# do about them. Goes by each repository's own checkout here, in
-# $CLAUDE_INBOX_SRC (default ~/sync/src), with its remote claude.
+# (a remote's, by the branch's prefix, or $LOGNAME's, else $USER's,
+# without one), and what to do about them. Goes by each repository's
+# own checkout here, in $CLAUDE_INBOX_SRC (default ~/sync/src), with its
+# remote claude.
{ lib, runCommand, writeShellScript, writeText
, coreutils, findutils, gawk, git, gnugrep, gnused, openssh, util-linux
}:
@@ -74,11 +75,11 @@ let
The list:
OWNER the remote, by the branch's prefix (?: no such remote), or
- tv, without one
+ $LOGNAME (else $USER), without one
STATE review new, and master is in it
rebase master moved on: the remote's turn
done master has it all: to delete
- yours tv's own
+ yours $LOGNAME's own
* changed since --show or --take
NEW its commits that master doesn't have, by content
BEHIND master's commits that it doesn't have
@@ -142,6 +143,8 @@ let
src=''${CLAUDE_INBOX_SRC:-$HOME/sync/src}
vm=''${CLAUDE_INBOX_VM:-claude}
+ # the owner of branches without a remote's prefix
+ me=''${LOGNAME:-''${USER:-$(id -un)}}
fetch=1
by=repo
cmd=
@@ -348,7 +351,7 @@ let
# seen from one for-each-ref, and per branch, just cherry and
# rev-list
rows_of() {
- local n=$1 r=$src/$1 ref tip age i b new behind owner state ahead master= tilde="~"
+ local n=$1 r=$src/$1 ref tip age i b new behind owner mine state ahead master= tilde="~"
local -A seen=()
local branches=() tips=() ages=()
while read -r ref tip age; do
@@ -368,7 +371,7 @@ let
if test "$ahead" -gt 0; then
echo "$n master - VM-ahead! $ahead $behind -"
elif test "$behind" -gt 0; then
- echo "$n master tv push 0 $behind -"
+ echo "$n master $me push 0 $behind -"
fi
fi
for i in "''${!branches[@]}"; do
@@ -376,11 +379,11 @@ let
new=$(git -C "$r" cherry master "claude/$b" | grep -c '^+' || :)
behind=$(git -C "$r" rev-list --count "claude/$b..master")
case $b in
- */*) owner=''${b%%/*}; case $remotes in *" $owner "*) ;; *) owner="$owner?" ;; esac ;;
- *) owner=tv
+ */*) mine= owner=''${b%%/*}; case $remotes in *" $owner "*) ;; *) owner="$owner?" ;; esac ;;
+ *) mine=1 owner=$me
esac
if test "$new" = 0; then state=done
- elif test "$owner" = tv; then state=yours
+ elif test -n "$mine"; then state=yours
elif test "$behind" = 0; then state=review
else state=rebase
fi