Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.git folder being uploaded #73

Open
sternj opened this issue Sep 25, 2023 · 13 comments
Open

.git folder being uploaded #73

sternj opened this issue Sep 25, 2023 · 13 comments

Comments

@sternj
Copy link

sternj commented Sep 25, 2023

Under default settings on commit 94b56c, files under .git are being uploaded, even though testing ssh-deploy--file-is-included-p on its own returns nil on an example file.

@cjohansson
Copy link
Owner

Very strange, I haven't heard anyone have that issue, can you run:

(describe-variable 'ssh-deploy-exclude-list)

And tell me what it's value is.

(When your current-directory is in folder that you use for deployment, like when visiting a file or directory in it)

@c308-cnelson
Copy link

I am running into a similar issue. I checked the ssh-deploy-exclude-list variable and it is set to exclude .git and .dir-locals.el but it is still pushing them.

@Simon-chevolleau
Copy link

Same here, did someone find a workaround ?

@cjohansson
Copy link
Owner

What Emacs version are you on? Maybe it is related to that..

@Simon-chevolleau
Copy link

Simon-chevolleau commented Dec 2, 2023

I'm using:
GNU Emacs v29.1
Doom core v3.0.0-pre
Doom modules v23.09.0-pre

I just checked and I have two ssh-deploy installed:
ssh-deploy 3.1.16 available gnu Deployment via Tramp, global or per directory.
ssh-deploy 20230702.928 available melpa Deployment via Tramp, global or per directory.

Here is my config file (doom emacs) to specify ssh-deploy variables :
(after! ssh-deploy
(setq ssh-deploy-root-local "/home/simon/gitNantes/")
(setq ssh-deploy-root-remote "/ssh:...")
(setq ssh-deploy-exclude-list '(".*/\.git/" "\.git/" "\.dir-locals\.el"))
(setq ssh-deploy-force-on-explicit-save 0)
(setq ssh-deploy-on-explicit-save 0))

@cjohansson
Copy link
Owner

I think Emacs is a mess when installed via snap in Ubuntu, I tried with Emacs built from source and it was much better.

I tried with Emacs 30.0.50
and ssh-deploy 3.1.16
with following scenario:

test.el contents:

(setq ssh-deploy-root-local "MASKED")
(setq ssh-deploy-root-remote "MASKED")
(setq ssh-deploy-exclude-list '(".*/\.git/" "\.git/" "\.dir-locals\.el"))
(setq ssh-deploy-force-on-explicit-save 0)
(setq ssh-deploy-on-explicit-save 1)

In file test.el I ran M-x eval-buffer

Created a file in root folder and saved, verified that the file was uploaded to remote host.
Created a file in folder .git and saved, verified that the file was not uploaded to remote host.
Created a file in folder .gut and saved, verified that the file was uploaded to remote host.

Working as expected for me

@Simon-chevolleau
Copy link

Simon-chevolleau commented Dec 25, 2023

For my case, I didn't installed via snap, but from source.
I changed a little bit my configuration, I was setting ssh-deploy variables in my init file. I now testing .dir-locals.el, but anyway it keeps syncing my .dir-locals.el and also my .git folder.

I'm using the upload module of Doom which is using your package (3.1.16 also) with small configurations (variables and keybinds), but I tried also by installing myself from melpa, with the same problem.

My last hope was settings the absolute path for .dir-locals.el and .git using:

((nil . (
  (ssh-deploy-root-local . "/path/to/local/folder/")
  (ssh-deploy-root-remote . "/path/to/remote/folder/")
  (ssh-deploy-exclude-list . '("/path/to/local/folder/\.git" "/path/to/local/folder/\.dir-locals\.el"))
  (ssh-deploy-async . 1)
  (ssh-deploy-async-with-threads . 1)
  (ssh-deploy-on-explicit-save . 1)
)))

but it gave me this error:

Debugger entered--Lisp error: (wrong-type-argument stringp quote)
  string-match'"/path/to/remote/folder/.dir-locals.el"
  ssh-deploy--file-is-included-p("//path/to/remote/folder/.dir-locals.el" '("/path/to/remote/folder/.git" "/path/to/remote/folder/.dir-locals.el"))
  ssh-deploy-upload-handler()
  funcall-interactively(ssh-deploy-upload-handler)
  call-interactively(ssh-deploy-upload-handler nil nil)
  command-execute(ssh-deploy-upload-handler)

In the end, I tried several things, with no success, I wonder if there is any problems by letting ssh-deploy syncing the git folder and dir-locals file ?

@cjohansson
Copy link
Owner

Strange, can you describe a scenario step by step how you get the error?

You visit a file and execute the command ssh-deploy-upload-handler ?

@cjohansson
Copy link
Owner

I don't mean the (wrong-type-argument stringp quote) error, I mean the error where a file that should be excluded is included for deploy

@Simon-chevolleau
Copy link

Simon-chevolleau commented Jan 3, 2024

I put myself on root of my project with dired, there I use ssh-deploy-upload-handler.

Here is my configuration:

ssh-deploy-root-local: MASKED
ssh-deploy-root-remote: MASKED
ssh-deploy-debug: 0
ssh-deploy-revision-folder: "/home/simon/.config/emacs/.local/cache/ssh-revisions/"
ssh-deploy-automatically-detect-remote-changes: 1
ssh-deploy-on-explicit-save: 1
ssh-deploy-force-on-explicit-save: 1
ssh-deploy-run-script-on-explicit-save: 0
ssh-deploy-exclude-list: ("/home/simon/gitNantes/umap/.git*" "/home/simon/gitNantes/umap/.git/.*" ".*/envs" ".*/\.envs" ".*/\.git/" "\.git/" "\.dir-locals\.el" "\\.git/" "\\.dir-locals\\.el")
ssh-deploy-async: 0
ssh-deploy-remote-sql-database: nil
ssh-deploy-remote-sql-password: nil
ssh-deploy-remote-sql-port: nil
ssh-deploy-remote-sql-server: nil
ssh-deploy-remote-sql-user: nil
ssh-deploy-remote-shell-executable: nil
ssh-deploy-verbose: 1
ssh-deploy-script: nil
ssh-deploy-async-with-threads: 0

Edit: Is there a way to get the callback when using emacs command, it could help ?

@cjohansson
Copy link
Owner

Oh are you trying to upload the entire root folder? You expect that the excluded files should not be deployed?

If so I haven't considered that case before

@cjohansson
Copy link
Owner

When looking through the code I see that when uploading a directory the plugin does not exclude files.. I think this should be considered a bug. If you instead do a sync, files should be excluded properly

@Simon-chevolleau
Copy link

Yes, this is exactly what I do. Before I found your package, I usually commited, pushed and pulled on remote server, but this way I had to create a commit every time, this isen't relevant and appropriate for my git historic.
Maybe my approach isen't correct ?
Do you think this could be easily done when deploying root folder and I guess this bug is also relevant for subfolders ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants