liximomo / vscode-sftp

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

After changing git branch the sftp remains connected #833

Open aariza-argentina opened 3 years ago

aariza-argentina commented 3 years ago

Do you read the FAQ?

Describe the bug If you are connected with an sftp and switch the branch (changing the sftp.json file) the connection remains open and if you do an upload you are using the other branch configuration.

To Reproduce Steps to reproduce the behavior: Configure one stftp in a branch Configure another stftp in a branch Connect to sftp from one branch Change branch Upload a file

Expected behavior When a sftp.json change after swiching branches, sftp disconnect

Desktop (please complete the following information):

esemlabel commented 3 years ago

Mine is hangs out every time when switching branch. It requires to restart vscode and run command Sync manually.

ghost commented 3 years ago

@aariza-argentina why would you want sftp to disconnect when the Git branch changes? Would you also want it to reconnect when you switch back to the original branch?

aariza-argentina commented 3 years ago

@aariza-argentina why would you want sftp to disconnect when the Git branch changes? Would you also want it to reconnect when you switch back to the original branch? Because the file sftp.json is different

ghost commented 3 years ago

I think adding that feature as a default would break a lot of users' workflows. It'd be nice to hear from the community how they use Git with this plugin and SFTP, in general. I appreciate the simplicity of the default behavior that it pushes whatever your working copy is. If you only want a working copy of a single branch on your SFTP server then it doesn't make since to manually push a different branch's changes to the SFTP server.

If I'm not understanding your proposition correctly, please explain it in more detail.

aariza-argentina commented 3 years ago

I try to explain my point:

1) I'm workng on master branch and one sftp then 2) Y switch to different branch, maybe develop and this branch has a different sftp.json and change when I switch the branch. 3) I think when the file sftp.json change (for any reason, edit or switch from git) the plugin has to disconnect to prevent upload to a different server

By the way, when you change manualy the file sftp.json the plugin disconnect, but if the file change because a git command it doesn't

I hope I explained myself clearly. PD: Sorry for my english

ghost commented 3 years ago

I understand now. That sounds more like a user configuration issue than a problem with the plugin's behavior.

It sounds like you want to use context. There is an example in the README:

[
  {
    "name": "server1",
    "context": "project/build",
    "host": "host",
    "username": "username",
    "password": "password",
    "remotePath": "/remote/project/build"
  },
  {
    "name": "server2",
    "context": "project/src",
    "host": "host",
    "username": "username",
    "password": "password",
    "remotePath": "/remote/project/src"
  }
]
aariza-argentina commented 3 years ago

I think is the same, If the file on the other branch has a different host for that context, I think it's better disconect and reconnect to the host in the new file.

ghost commented 3 years ago

I finally see what you're saying now. Or possibly have multiple connections alive at once? I haven't dug into the dug that deeply yet some I'm not sure how it works on the backend yet.