From 98f14c0224f64dc565c005aa5a3ec7197e93cea9 Mon Sep 17 00:00:00 2001 From: Shane Jaroch Date: Thu, 8 Jan 2026 18:44:05 -0500 Subject: [PATCH] update/fix clean command for sft/rclone --- README.rst | 2 +- completions/templates/README.rst.in | 2 +- git-remote-gcrypt | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 8c69674..e3a3645 100644 --- a/README.rst +++ b/README.rst @@ -280,7 +280,7 @@ To scan for unencrypted files in a remote gcrypt repo, use:: The clean command is unstable and subject to deprecation or renaming and should not be used in scripts. Supported backends for the clean command are ``rsync://``, ``rclone://``, -and git-based remotes. The ``sftp://`` backend is not currently supported. +``sftp://``, and git-based remotes. If no URL or remote is specified, ``git-remote-gcrypt`` will list all available ``gcrypt::`` remotes. diff --git a/completions/templates/README.rst.in b/completions/templates/README.rst.in index 8c69674..e3a3645 100644 --- a/completions/templates/README.rst.in +++ b/completions/templates/README.rst.in @@ -280,7 +280,7 @@ To scan for unencrypted files in a remote gcrypt repo, use:: The clean command is unstable and subject to deprecation or renaming and should not be used in scripts. Supported backends for the clean command are ``rsync://``, ``rclone://``, -and git-based remotes. The ``sftp://`` backend is not currently supported. +``sftp://``, and git-based remotes. If no URL or remote is specified, ``git-remote-gcrypt`` will list all available ``gcrypt::`` remotes. diff --git a/git-remote-gcrypt b/git-remote-gcrypt index 87fe8dc..4e29096 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -1359,11 +1359,16 @@ elif [ "$NAME" = "gcrypt-clean" ]; then # Get all files in the remote # For rsync backends, list files directly via rsync --list-only (awk extracts filename). # For rclone backends, list files via rclone lsf. + # For sftp backends, list files via curl directory listing. # For git backends, list files from the gcrypt branch tree. if isurl rsync "$URL"; then remote_files=$(rsync --no-motd --list-only "$(rsynclocation "$URL")/" | awk '{print $NF}' | grep -vE '^\.$|^\.\.$' || :) elif isurl rclone "$URL"; then + echo_info "WARNING: rclone clean support is experimental and may cause data loss." remote_files=$(rclone lsf "$(rclonelocation "$URL")" 2>/dev/null || :) + elif isurl sftp "$URL"; then + echo_info "WARNING: sftp clean support is experimental and may cause data loss." + remote_files=$(curl -s -S -k "$URL/" 2>/dev/null | grep -vE '^\.$|^\.\.$' || :) else remote_files=$(git ls-tree --name-only "$Gref" 2>/dev/null || :) fi -- 2.52.0