]> Nutra Git (v2) - gamesguru/git-remote-gcrypt.git/commitdiff
update/fix clean command for sft/rclone
authorShane Jaroch <chown_tee@proton.me>
Thu, 8 Jan 2026 23:44:05 +0000 (18:44 -0500)
committerShane Jaroch <chown_tee@proton.me>
Thu, 8 Jan 2026 23:44:05 +0000 (18:44 -0500)
README.rst
completions/templates/README.rst.in
git-remote-gcrypt

index 8c69674728b7355d81fba590c339fc11a2c89f10..e3a3645d585e0777959f28f5d7425e3fb9bf9f1b 100644 (file)
@@ -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.
index 8c69674728b7355d81fba590c339fc11a2c89f10..e3a3645d585e0777959f28f5d7425e3fb9bf9f1b 100644 (file)
@@ -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.
index 87fe8dcace227c0d5b483744558ad2b9983fa6e3..4e29096865f18b1e7da6bde60868aa4bf00c9cb0 100755 (executable)
@@ -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