Make the Seafile Client parse .gitignore files on a per-directory basis

While the “seafile-ignore.txt” method is a nice addition for generic libraries, on libraries where programming projects are hosted, it would be nice to have the seafile client also ignore paths stated on a .gitignore, to avoid large and unnecessary temporary file (I’m looking at you visual studio) syncs.

Hi,

a more generic solution might be to extend the syntax of seafile-ignore.txt with an INCLUDE statement to use arbitrary files.

Best regards

Thomas

1 Like

For now, the seafile-ignore.txt can only exclude with a positive rule. I’d like to suggest to add negative rules starting with an exclamation mark, e.g.:

!pictures/*.jpg

with the result that all files in the pictures folder that do not end with .jpg are excluded.
With this logic it should also be possible to create the file as a blacklist or a whitelist.
Imagine following:

# Do not exclude any picture
!*.jpg

# Do not exclude specific directory
!/mydir/importantData/*

# Exclude everything else (make this file kind of a 'whitelist')
*

The evaluation should start at the top and when a rule matches this rule should be applied to the file/folder. No more rules should be checked.

3 Likes

I’m resurrecting this old topic because I’m very interested in syncing my projects this way. Aside from what @Garfield suggested, would it be interesting to have some kind of seafile.json that configures various aspects of synchronization on a per-directory basis? In my case, the seafile.json could enable .gitignore in my Projects folder,

Something like this:

{
  "gitignore": true
}

I have free time and am willing to dig into Seafile’s sources to find a solution.