From: Shane Jaroch Date: Sat, 17 Jan 2026 04:50:22 +0000 (-0500) Subject: wip X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=881c523247caaf13bfea5cd2938a96d800e062e4;p=gamesguru%2Fgit-remote-gcrypt.git wip --- diff --git a/Makefile b/Makefile index 02c5128..6349c40 100644 --- a/Makefile +++ b/Makefile @@ -108,8 +108,10 @@ test/: ##H Run tests (purity checks only if kcov missing) .PHONY: test/installer test/installer: ##H Test installer logic @rm -rf $(COV_INSTALL) - @mkdir -p $(COV_INSTALL) + @mkdir -p $(COV_INSTALL) .tmp + @rm -f .tmp/kcov.log @export COV_DIR=$(COV_INSTALL); \ + set -o pipefail; \ for test_script in tests/installer-test*.sh; do \ if [ "$$test_script" = "tests/installer-test-logic.sh" ]; then \ kcov --bash-dont-parse-binary-dir \ diff --git a/README.rst b/README.rst index b34465d..e9dcabd 100644 --- a/README.rst +++ b/README.rst @@ -61,7 +61,7 @@ Command Reference check [URL] Check if URL is a gcrypt repository clean [URL|REMOTE] Scan/Clean unencrypted files from remote clean --force Actually delete files (default is scan only) - clean --init Allow cleaning valid files (requires --force) + clean --init Allow cleaning uninitialized repos (requires --force) clean --hard Override safety checks (requires --force) stat [URL|REMOTE] Show diagnostics (file counts, tracked vs untracked) Git Protocol Commands (for debugging): @@ -73,6 +73,7 @@ Command Reference Environment Variables: GCRYPT_DEBUG=1 Enable verbose debug logging to stderr GCRYPT_TRACE=1 Enable shell tracing (set -x) for rsync/curl commands + GCRYPT_FULL_REPACK=1 Force full repack when pushing Configuration ============= @@ -312,7 +313,7 @@ If no URL or remote is specified, ``git-remote-gcrypt`` will list all available ``gcrypt::`` remotes. By default, this command only performs a scan. To actually remove the -unencrypted files, you must use the ``--force`` (or ``-f``) flag:: +unencrypted files, you must use the ``--force`` flag:: git-remote-gcrypt clean url --force diff --git a/completions/fish/git-remote-gcrypt.fish b/completions/fish/git-remote-gcrypt.fish index bdb8d42..9b86f70 100644 --- a/completions/fish/git-remote-gcrypt.fish +++ b/completions/fish/git-remote-gcrypt.fish @@ -13,6 +13,7 @@ complete -c git-remote-gcrypt -n "__fish_seen_subcommand_from check" -a "(git re complete -c git-remote-gcrypt -n "__fish_seen_subcommand_from stat" -a "(git remote 2>/dev/null)" -d 'Git Remote' # Clean flags -complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l force -d 'Flag' -complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l init -d 'Flag' -complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l hard -d 'Flag' +complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -s -force -l -d 'Flag'; +complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -s -init -l -d 'Flag'; +complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -s -hard -l -d 'Flag'; + diff --git a/completions/gen_docs.sh b/completions/gen_docs.sh index 93b2a92..4e03f29 100755 --- a/completions/gen_docs.sh +++ b/completions/gen_docs.sh @@ -37,20 +37,39 @@ COMMANDS_LIST=$(echo "$RAW_HELP" | awk '/^ [a-z]+ / {print $1}' | grep -vE "^(h # Extract clean flags # Text: " clean -f, --force Actually delete files..." -# We want: "-f --force -i --init" for Bash -CLEAN_FLAGS_RAW=$(echo "$RAW_HELP" | grep "^ clean -" | awk '{print $2, $3}' | sed 's/,//g') -CLEAN_FLAGS_BASH=$(echo "$CLEAN_FLAGS_RAW" | tr '\n' ' ' | sed 's/ $//') +# We want to extract flags properly. +# Get lines, then extract words starting with - +CLEAN_FLAGS_RAW=$(echo "$RAW_HELP" | grep "^ clean -" | awk '{ + out="" + if ($2 ~ /^-/) out=$2 + if ($3 ~ /^-/) out=out " " $3 + print out +}' | sed 's/,//g') -# For Zsh: we want simple list for now as per plan, user asked for dynamic but safe. -# Constructing a simple list of flags requires parsing. -# The previous python script just injected them. +CLEAN_FLAGS_BASH=$(echo "$CLEAN_FLAGS_RAW" | tr '\n' ' ' | sed 's/ */ /g; s/ $//') + +# For Zsh: Generate proper spec strings CLEAN_FLAGS_ZSH="" -# We'll just provide the flags as a list for _arguments -# ZSH format roughly: '(-f --force)'{-f,--force}'[desc]' -# Let's simplify and just pass the flags for now to match the user's "native completion" request without over-engineering the parsing in shell. -# We will just list them. -COMMA_FLAGS=$(echo "$CLEAN_FLAGS_BASH" | tr ' ' ',') -CLEAN_FLAGS_ZSH="'(${CLEAN_FLAGS_BASH})' {${COMMA_FLAGS}} '[flag]'" +IFS=" +" +for line in $CLEAN_FLAGS_RAW; do + # line is "-f --force" or "--hard" + # simple split + flags=$(echo "$line" | tr ' ' '\n') + # Build exclusion list + excl="($line)" + # Build flag list + if echo "$line" | grep -q " "; then + # multiple flags + fspec="{$line}" + fspec=$(echo "$fspec" | sed 's/ /,/g') + else + fspec="$line" + fi + # Description - we could extract it but for now generic + CLEAN_FLAGS_ZSH="${CLEAN_FLAGS_ZSH} '${excl}'${fspec}'[flag]'" +done +unset IFS # For Fish # We need to turn "-f, --force" into: diff --git a/completions/templates/README.rst.in b/completions/templates/README.rst.in index 67b6ef8..e270963 100644 --- a/completions/templates/README.rst.in +++ b/completions/templates/README.rst.in @@ -295,7 +295,7 @@ If no URL or remote is specified, ``git-remote-gcrypt`` will list all available ``gcrypt::`` remotes. By default, this command only performs a scan. To actually remove the -unencrypted files, you must use the ``--force`` (or ``-f``) flag:: +unencrypted files, you must use the ``--force`` flag:: git-remote-gcrypt clean url --force diff --git a/completions/zsh/_git-remote-gcrypt b/completions/zsh/_git-remote-gcrypt index 0b86da0..29845ea 100644 --- a/completions/zsh/_git-remote-gcrypt +++ b/completions/zsh/_git-remote-gcrypt @@ -14,7 +14,7 @@ _git_remote_gcrypt() { case $line[1] in clean) - _arguments '(--force --init --hard)'{--force,--init,--hard}'[flag]' \ + _arguments '(--force)'--force'[flag]' '(--init)'--init'[flag]' '(--hard)'--hard'[flag]' \ '*:gcrypt URL: _alternative "remotes:gcrypt remote:($(git remote -v 2>/dev/null | grep "gcrypt::" | awk "{print \$1}" | sort -u))" "files:file:_files"' ;; check | stat)