From 6e53671fbd25e4460271f430535242744a774cbb Mon Sep 17 00:00:00 2001 From: Shane Jaroch Date: Fri, 16 Jan 2026 20:50:21 -0500 Subject: [PATCH] handle clean/init cases better --- git-remote-gcrypt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/git-remote-gcrypt b/git-remote-gcrypt index f4aec67..e9fce0a 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -551,11 +551,11 @@ EOF xfeed "$2" rclone delete -v --include-from=/dev/stdin "${1#rclone://}/" >&2 elif islocalrepo "$1" then - for fn_ in $2; do + echo "$2" | while IFS= read -r fn_; do rm -f "$1"/"$fn_" done else - for fn_ in $2; do + echo "$2" | while IFS= read -r fn_; do gitception_remove "${1#gitception://}" "$fn_" done fi @@ -1462,9 +1462,15 @@ cmd_clean() if [ "${FORCE_INIT:-}" = "yes" ]; then echo_info "WARNING: No gcrypt manifest found, but --init specified." echo_info "WARNING: Proceeding to scan/clean potential unencrypted files." + elif isnull "$FORCE_CLEAN"; then + echo_info "WARNING: No gcrypt manifest found." + echo_info "WARNING: Listing all files as potential garbage (dry-run)." else - echo_die "Error: No gcrypt manifest found on remote '$URL'." \ - "Aborting clean to prevent accidental data loss." + echo_info "Error: No gcrypt manifest found on remote '$URL'." + echo_info "Aborting clean to prevent accidental data loss." + echo_info "To force initiation of the repository as git-crypt (and delete all old objects):" + echo_info " git-remote-gcrypt clean --init --force $URL" + exit 1 fi fi @@ -1511,7 +1517,11 @@ cmd_clean() if isnull "$FORCE_CLEAN"; then echo_info "NOTE: This is a scan of unencrypted files on the remote." echo_info "To actually delete these files, use:" - echo_info " git-remote-gcrypt clean $URL --force" + if [ "$Did_find_repo" != "yes" ]; then + echo_info " git-remote-gcrypt clean --init --force $URL" + else + echo_info " git-remote-gcrypt clean --force $URL" + fi CLEAN_FINAL "$URL" git remote remove "$NAME" 2>/dev/null || true exit 0 -- 2.52.0