diff options
| author | tv <tv@krebsco.de> | 2026-11-21 22:34:49 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-21 22:34:49 +0000 |
| commit | 6b1e7305c6f52705f817a024df136935ca88fa07 (patch) | |
| tree | 46f09efad4cc702a7b25fa833f969a7bae9889d0 /pkgs/claude-inbox.nix | |
| parent | f38e77d825d3e2bed8487f8ffc87c7ae6bf3c4ff (diff) | |
pkgs/claude-inbox: is_repo from .git/config, without git
A BRANCH without REPO is looked for in every repository in DIR, and
is_repo ran git remote get-url for each, which adds up with hundreds
(~0.4s for 300); [remote "claude"] in .git/config does it without git,
but where .git isn't a directory.
Diffstat (limited to 'pkgs/claude-inbox.nix')
| -rw-r--r-- | pkgs/claude-inbox.nix | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/claude-inbox.nix b/pkgs/claude-inbox.nix index 698f2c6..6e0dd6e 100644 --- a/pkgs/claude-inbox.nix +++ b/pkgs/claude-inbox.nix @@ -142,6 +142,15 @@ let # there (but master, which is no branch to show or take) is_repo() { case $1 in "" | . | .. | */*) return 1 ;; esac + # [remote "claude"] in .git/config, without running git (with many + # repositories, it adds up), but where .git isn't a directory + local l + if test -d "$src/$1/.git"; then + while IFS= read -r l; do + case $l in *'[remote "claude"]'*) return 0 ;; esac + done 2>/dev/null < "$src/$1/.git/config" || : + return 1 + fi test -e "$src/$1/.git" && git -C "$src/$1" remote get-url claude >/dev/null 2>&1 } has_branch() { |
