liximomo / vscode-sftp

Super fast sftp/ftp extension for VS Code
MIT License
1.51k stars 265 forks source link

During uploadOnSave, files in "ignored" directories are still uploaded #15

Closed duanehutchins closed 6 years ago

duanehutchins commented 7 years ago

Issue:

During uploadOnSave, files in "ignored" directories are still uploaded on save. In other words, the 'ignore' setting is not respected for directories during uploadOnSave.

Relevant Settings:

{
    ...
    "uploadOnSave": true,
    "ignore": [
        "**/ignoreme"
    ]
}

Steps to duplicate:

What should happen:

Please fix this. It is very annoying. It causes my local .git/ files to upload to the server.

liximomo commented 7 years ago

Please change you vscode setting option sftp.printDebugLog to true and provide me the full log(view -> output-> sftp).

duanehutchins commented 7 years ago

I will get this for you on Monday.

liximomo commented 7 years ago

@tomjaimz Thanks for your help! I will take your advice.

duanehutchins commented 7 years ago

Thanks @liximomo for looking at this, and thanks @tomjaimz for your help.

Here's the debug log output for sftp:

config at @workroot {
    "host": "web01",
    "port": 22,
    "username": "drh",
    "password": null,
    "protocol": "sftp",
    "agent": null,
    "privateKeyPath": "C:\\Users\\drh\\.ssh\\privatekey.ppk",
    "passphrase": null,
    "passive": false,
    "interactiveAuth": false,
    "remotePath": "./public_html/myinventory",
    "uploadOnSave": true,
    "syncMode": "update",
    "watcher": {
        "files": false,
        "autoUpload": false,
        "autoDelete": false
    },
    "ignore": [
        "c:/Users/drh/WebDocs/myinventory/**/.vscode",
        "c:/Users/drh/WebDocs/myinventory/**/.git",
        "c:/Users/drh/WebDocs/myinventory/**/.DS_Store",
        "c:/Users/drh/WebDocs/myinventory/.htaccess",
        "c:/Users/drh/WebDocs/myinventory/index.cgi",
        "c:/Users/drh/WebDocs/myinventory/invoice_pdfs",
        "c:/Users/drh/WebDocs/myinventory/jobpdfs",
        "c:/Users/drh/WebDocs/myinventory/pdfs",
        "c:/Users/drh/WebDocs/myinventory/materialimages/proofs",
        "public_html/myinventory/**/.vscode",
        "public_html/myinventory/**/.git",
        "public_html/myinventory/**/.DS_Store",
        "public_html/myinventory/.htaccess",
        "public_html/myinventory/index.cgi",
        "public_html/myinventory/invoice_pdfs",
        "public_html/myinventory/jobpdfs",
        "public_html/myinventory/pdfs",
        "public_html/myinventory/materialimages/proofs"
    ],
    "configRoot": "c:/Users/drh/WebDocs/myinventory"
}

Using the ignore pattern of **/.git/** works, but then causes another issue. When I ignore that pattern and keep uploadOnSave true, then I get a message in vscode on the bottom-left stating: retriving directory .git

image

This message doesn't go away. Well, sometimes it goes away, but then it comes back, and my memory and CPU usage for vscode goes up a bit.

duanehutchins commented 7 years ago

Update: The issue with setting ignore **/.git/** may actually be causing a memory leak.

By using that setting and simply leaving my vscode open, unused, vscode memory usage climbs steadily at a rate of about 10kb per minute. This does not happen without that setting.

liximomo commented 7 years ago

**/.git/** means every file under .git but not include .git itself, which cause necessary retrieval of .git folder. I will fix the counter-intuitive behavior.

BMannell commented 7 years ago

I am not seeing any memory leakage using **/.git/**. I will keep an eye on it though.

jessemao commented 7 years ago

I am trying to ignore node_modules and tried **/node_modules/**, /node_modules, /node_modules/**, none of them works, need help!

liximomo commented 7 years ago

@jessemao Get me the logs. Set option sftp.printDebugLog to true, then reload vscode, reproduce the problem, get the logs(view -> output-> sftp)

liximomo commented 6 years ago

I close this because how the ignore works changed after v1.0.0.

tomazcp commented 6 years ago

Hey liximomo. I'm having the exact same issue, I can't get the package to ignore anything other than the .vscode folder where the config is in. I think it was working properly some time ago. I've been testing some variations of the config, none works. I've tried multiple patterns for the ignore array but nothing seems to work.

Anyway here's my output:

[info]: config at /Users/** {
    "protocol": "sftp",
    "host": "foo.bar",
    "port": 22,
    "username": "username",
    "password": "***********",
    "agent": null,
    "privateKeyPath": null,
    "passphrase": null,
    "interactiveAuth": false,
    "secure": false,
    "secureOptions": null,
    "passive": false,
    "remotePath": "/foo.bar",
    "uploadOnSave": true,
    "syncMode": "update",
    "ignore": [
        "**/.vscode/**",
        "**/.DS_Store/**",
        "project_details.txt",
        ".eslintrc.json",
        "**/node_modules/**",
        "**/.git/**"
    ],
    "watcher": {
        "files": false,
        "autoUpload": false,
        "autoDelete": false
    },
    "concurrency": 512,
    "context": "/Users/**"
}

Thanks in advance.

liximomo commented 6 years ago

Change to this and provide me the log if it still can't work.

"ignore": [
        ".vscode",
        ".DS_Store",
        "project_details.txt",
        ".eslintrc.json",
        "node_modules",
        ".git"
]
tomazcp commented 6 years ago

Working now thanks a lot.

joerimarquerinck commented 6 years ago

Hi,

This issue is the one I am having where I have a local folder structure that is having the folders /assets/styles/ and then several .scss files (also within folder like /pages/, /components/. I would like to ignore this entire /assets/styles/ folder or every .scss file. I have tried several things but nothing is ignoring these files.

What's the correct way of ignoring files within subfolders or entire subfolders?

EFXPROMedia commented 5 years ago

This is not working for subdirectories /folder/subfolders/