update branchsetup and li
This commit is contained in:
parent
09bfa9af4e
commit
a2517d5c5d
3 changed files with 46 additions and 14 deletions
|
|
@ -14,22 +14,42 @@ branching_setup() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build candidate ignored/untracked file list
|
# Build candidate ignored/untracked top-level entries
|
||||||
local -a candidates=()
|
local -a raw=()
|
||||||
while IFS= read -r -d '' file; do
|
while IFS= read -r -d '' file; do
|
||||||
candidates+=("$file")
|
raw+=("$file")
|
||||||
done < <(git -C "$repo_root" ls-files --others --ignored --exclude-standard -z || true)
|
done < <(git -C "$repo_root" ls-files --others --ignored --exclude-standard -z || true)
|
||||||
|
|
||||||
# Include some common dotfiles at root even if tracked (for selection convenience)
|
# Reduce to top-level names (directories or files)
|
||||||
|
local -a tops=()
|
||||||
|
for c in "${raw[@]}"; do
|
||||||
|
c="${c%/}"
|
||||||
|
local top="${c%%/*}"
|
||||||
|
[ -z "$top" ] && continue
|
||||||
|
local found=0
|
||||||
|
for existing in "${tops[@]}"; do
|
||||||
|
[ "$existing" = "$top" ] && found=1 && break
|
||||||
|
done
|
||||||
|
[ "$found" -eq 0 ] && tops+=("$top")
|
||||||
|
done
|
||||||
|
|
||||||
|
# Include common root items even if tracked (for convenience)
|
||||||
for extra in .env .env.development .env.development.local .envrc .direnv flake.nix flake.lock; do
|
for extra in .env .env.development .env.development.local .envrc .direnv flake.nix flake.lock; do
|
||||||
if [ -e "$repo_root/$extra" ]; then
|
if [ -e "$repo_root/$extra" ]; then
|
||||||
candidates+=("$extra")
|
local exists=0
|
||||||
|
for t in "${tops[@]}"; do [ "$t" = "$extra" ] && exists=1 && break; done
|
||||||
|
[ $exists -eq 0 ] && tops+=("$extra")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# De-duplicate
|
# Hard-coded excludes (noise, build outputs)
|
||||||
local unique
|
local -a EXCLUDES=(build dist)
|
||||||
unique=$(printf "%s\n" "${candidates[@]}" | awk '!seen[$0]++')
|
local -a filtered=()
|
||||||
|
for t in "${tops[@]}"; do
|
||||||
|
local skip=0
|
||||||
|
for e in "${EXCLUDES[@]}"; do [ "$t" = "$e" ] && skip=1 && break; done
|
||||||
|
[ $skip -eq 0 ] && filtered+=("$t")
|
||||||
|
done
|
||||||
|
|
||||||
# Current config values
|
# Current config values
|
||||||
local -a current
|
local -a current
|
||||||
|
|
@ -39,7 +59,7 @@ branching_setup() {
|
||||||
|
|
||||||
# Preselect current ones in fzf (mark with *)
|
# Preselect current ones in fzf (mark with *)
|
||||||
local list
|
local list
|
||||||
list=$(printf "%s\n" $unique | while read -r x; do
|
list=$(printf "%s\n" "${filtered[@]}" | while read -r x; do
|
||||||
local mark=""
|
local mark=""
|
||||||
for c in "${current[@]}"; do [ "$c" = "$x" ] && mark="*" && break; done
|
for c in "${current[@]}"; do [ "$c" = "$x" ] && mark="*" && break; done
|
||||||
printf "%s%s\n" "$mark" "$x"
|
printf "%s%s\n" "$mark" "$x"
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,18 @@ EOF
|
||||||
[ "$found" -eq 0 ] && tops+=("$top")
|
[ "$found" -eq 0 ] && tops+=("$top")
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Hard-coded top-level excludes to avoid noisy build outputs
|
||||||
|
local -a EXCLUDES=(build dist)
|
||||||
|
if [ ${#tops[@]} -gt 0 ]; then
|
||||||
|
local -a tops_filtered=()
|
||||||
|
for t in "${tops[@]}"; do
|
||||||
|
local skip=0
|
||||||
|
for e in "${EXCLUDES[@]}"; do [ "$t" = "$e" ] && skip=1 && break; done
|
||||||
|
[ $skip -eq 0 ] && tops_filtered+=("$t")
|
||||||
|
done
|
||||||
|
tops=("${tops_filtered[@]}")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ${#tops[@]} -eq 0 ]; then
|
if [ ${#tops[@]} -eq 0 ]; then
|
||||||
echo "No top-level ignored/untracked entries found in $repo_root"
|
echo "No top-level ignored/untracked entries found in $repo_root"
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -126,7 +138,7 @@ EOF
|
||||||
local -a chosen
|
local -a chosen
|
||||||
if command -v fzf >/dev/null 2>&1 && [ "$USE_FZF" -eq 1 ]; then
|
if command -v fzf >/dev/null 2>&1 && [ "$USE_FZF" -eq 1 ]; then
|
||||||
local selected
|
local selected
|
||||||
selected=$(printf "%s\n" "${filtered[@]}" | fzf --multi --height=40% --border --prompt="Select files to link: " --preview "if [ -f '$repo_root'/{} ]; then bat --color always --paging=never --style=plain '$repo_root'/{}; else ls -la '$repo_root'/{}; fi")
|
selected=$(printf "%s\n" "${filtered[@]}" | fzf --multi --height=40% --border --prompt="Select items to link: " --preview "if [ -f '$repo_root'/{} ]; then bat --color always --paging=never --style=plain '$repo_root'/{}; else ls -la '$repo_root'/{}; fi")
|
||||||
if [ -z "$selected" ]; then
|
if [ -z "$selected" ]; then
|
||||||
echo "No files selected." && return 0
|
echo "No files selected." && return 0
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
8
hosts/lio/flake.lock
generated
8
hosts/lio/flake.lock
generated
|
|
@ -1269,11 +1269,11 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "flakes/secrets",
|
"dir": "flakes/secrets",
|
||||||
"lastModified": 1761107519,
|
"lastModified": 1762828900,
|
||||||
"narHash": "sha256-HV+W8peuB0elo/32CgwfITp/ox4dFDXaM22z/HlmZ2c=",
|
"narHash": "sha256-0AtMggGG2kUpE3HpWEweLe2jlstMGhEGAHBgqBXA2Ds=",
|
||||||
"ref": "refs/heads/master",
|
"ref": "refs/heads/master",
|
||||||
"rev": "9de4c7892bdf28735875d43849d67d9b16b6d700",
|
"rev": "1dd7e442dd99d8f3e3867655ecb0c5f4d666853c",
|
||||||
"revCount": 731,
|
"revCount": 774,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
|
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue