.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 \
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):
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
=============
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
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';
+
# 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:
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
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)