git-ftp icon indicating copy to clipboard operation
git-ftp copied to clipboard

Exclude certain files from upload

Open kbjr opened this issue 13 years ago • 13 comments

Add an option to exclude certain files from the upload, perhaps in the form of a git-ftp specific .gitignore file.

kbjr avatar Jan 26 '11 21:01 kbjr

I suggest naming it .gitftpignore or .ftpignore (any preferences?). It would be nice if it followed the same syntax as .gitignore but reimplementing that parser might be nontrivial.

ezyang avatar Jan 26 '11 21:01 ezyang

i like .gitftpignore imho.

kbjr avatar Jan 26 '11 22:01 kbjr

or call it from ftpdata: gitftpignore=.gitftpignore

Gives you the power to set different files for different branches or FTP servers.

Janghou avatar Jan 27 '11 11:01 Janghou

I agree with Janghou, simple yet powerful solution

And .gitftpignore can be default file if gitftpignore can not be found in ftpdata

mrshu avatar Feb 12 '11 18:02 mrshu

Is there any progress on this issue since last year? Due to .gitignore's manpage it uses only few simple rules and fnmatch() function so it shouldn't be that hard.

peteruhnak avatar Jan 03 '12 14:01 peteruhnak

Nope, no one has been working on it.

ezyang avatar Jan 03 '12 15:01 ezyang

How would we handle submodules? One .gitftpignore in the root repo (my +1 here), or one per module?

Would we upload .gitftpignore files to the server? If no: Because of that special name, or because of the name set in ftpdata? If yes: Ok, users can still add .gitftpignore to .gitftpignore.

niklasf avatar Jan 08 '12 22:01 niklasf

I think the question should be one .gitftpignore in the root (+1 here as well) or in any directory – much like .gitignore. Also I don't see any reason to upload .gitftpignore files. Why would anyone need them there? Or you want them there so you can control what is uploaded? Eg. different .ftpignore in staging and production server.

peteruhnak avatar Jan 09 '12 07:01 peteruhnak

Oh ... I didn't realize you could have multiple .gitignores. Not sure then anymore. But we can always start with the easier one, which would also be enough for any use case I have.

And ok, we should not upload the ignore files to the FTP server. We can have the same feature with @Janghou's suggestion.

I think I'll play with this a little.

niklasf avatar Jan 09 '12 09:01 niklasf

What about to use .gitftpignore in root, unless other file in ftpdata is specified? I am actually almost done with the implementation but I haven't tested submodules yet.

peteruhnak avatar Jan 10 '12 15:01 peteruhnak

Oh ... that looks quite good. Made a few comments, also.

Submodules use upload_diff recursively. If the ignored parameter was optional, it at least wouldn't break them. But they also wouldn't work as expected, because the pathnames of the diff will be against the root of the current submodule, not the root where .gitfptignore lies.

niklasf avatar Jan 10 '12 19:01 niklasf

We could either allow to have .gitftpignore in any directory (or just one per (sub)module), but will the submodules inherit rules from parent? If yes, then we don't really need them, we could just join path with parent and match against it. If no, wouldn't it just get too messy because you have to track of several ignore files just so you can upload what you need? But it's more question of use case.

Also if we allow more than one .gitftpignore then specifying it's name in ftpdata is pretty much pointless.

peteruhnak avatar Jan 10 '12 21:01 peteruhnak

Mhh ... I'd vote for a single ignore file in the root of the main repository. Only problem: Submodules need to know the path relative to the root. That would we one more parameter to upload_diff.

niklasf avatar Jan 10 '12 22:01 niklasf