summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkgs/claude-inbox.nix25
1 files changed, 20 insertions, 5 deletions
diff --git a/pkgs/claude-inbox.nix b/pkgs/claude-inbox.nix
index f789025..c5bdc02 100644
--- a/pkgs/claude-inbox.nix
+++ b/pkgs/claude-inbox.nix
@@ -91,6 +91,9 @@ let
* changed since --show or --take
NEW its commits that master doesn't have, by content
BEHIND master's commits that it doesn't have
+ HEAD whether the checked-out HEAD has its new commits (by
+ content: stacked, or picked), all (yes), some, or none (-);
+ - where HEAD is master
AGE of its last commit
master push: master is ahead of claude's; VM-ahead!: claude's has
what master doesn't
@@ -401,7 +404,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 mine state ahead master= tilde="~"
+ local n=$1 r=$src/$1 ref tip age i b new behind owner mine state ahead master= tilde="~" inhead missing
local -A seen=()
local branches=() tips=() ages=()
while read -r ref tip age; do
@@ -415,18 +418,30 @@ let
done < <(git -C "$r" for-each-ref \
--format='%(refname) %(objectname) %(committerdate:relative)' \
refs/claude-seen refs/remotes/claude)
+ # whether HEAD, if it isn't master, has their commits
+ local head=
+ if test "$(git -C "$r" rev-parse -q --verify HEAD)" != "$(git -C "$r" rev-parse -q --verify master)"; then
+ head=1
+ fi
if test -n "$master"; then
ahead=$(git -C "$r" cherry master claude/master | grep -c '^+' || :)
behind=$(git -C "$r" rev-list --count claude/master..master)
if test "$ahead" -gt 0; then
- echo "$n master - VM-ahead! $ahead $behind -"
+ echo "$n master - VM-ahead! $ahead $behind - -"
elif test "$behind" -gt 0; then
- echo "$n master $me push 0 $behind -"
+ echo "$n master $me push 0 $behind - -"
fi
fi
for i in "''${!branches[@]}"; do
b=''${branches[i]}
new=$(git -C "$r" cherry master "claude/$b" | grep -c '^+' || :)
+ inhead=-
+ if test -n "$head" && test "$new" != 0; then
+ missing=$(git -C "$r" cherry HEAD "claude/$b" | grep -c '^+' || :)
+ if test "$missing" = 0; then inhead=yes
+ elif test "$missing" -lt "$new"; then inhead=some
+ fi
+ fi
behind=$(git -C "$r" rev-list --count "claude/$b..master")
case $b in
*/*) mine= owner=''${b%%/*}; case $remotes in *" $owner "*) ;; *) owner="$owner?" ;; esac ;;
@@ -441,7 +456,7 @@ let
state="$state*"
fi
age=''${ages[i]% ago} # spaces as ~, in no branch name
- echo "$n $b $owner $state $new $behind ''${age// /$tilde}"
+ echo "$n $b $owner $state $new $behind $inhead ''${age// /$tilde}"
done
}
# the repositories in parallel (a line is one write: they don't mix)
@@ -462,7 +477,7 @@ let
rows=$(printf '%s\n' "$rows" | sort -k1,1 -k2,2)
fi
colors 1
- { echo "REPO BRANCH OWNER STATE NEW BEHIND AGE"; printf '%s\n' "$rows"; } |
+ { echo "REPO BRANCH OWNER STATE NEW BEHIND HEAD AGE"; printf '%s\n' "$rows"; } |
column -t | sed 's/~/ /g' | paint_list
;;
show)