Skip to content

Ignore some files by default? #837

Open

Description

@gunwald

I would suggest to introduce a global ignore list, that has some default entries. For example:
.git/ # ignore git repros
.sparkleshare/ # ignore git sparkleshare
.~lock. # ignore LibreOffice lock files
.owncloudsync # ignore owncloud

It is annoying to add to each folder on each node every time all files you want to be ignored.

Activity

  1. calmh commented on Oct 13, 2014

    @calmh
    Member

    I'm not convinced. I see how that's useful in your case, but what about the hundreds of other kinds of files people might want excluded (temp and lock files for every other office package, .svn if you include .git, etc). Also, I do want my .git folders backed up for sure. I think this is a case where there isn't a list that will make everyone happy, and just leaving it up to the user in all cases is simpler.

  2. Goobles commented on Oct 13, 2014

    @Goobles

    I don't think he meant THAT globally, OP means having a global configurable ignore list that applies to all folders of the specified node.

  3. gunwald commented on Oct 13, 2014

    @gunwald
    Author

    Ok, you maybe right. But then it would be useful to have a global ignore list anyway. May be without default entries.

  4. AudriusButkevicius commented on Oct 13, 2014

    @AudriusButkevicius
    Member

    ln -s from your other folders.

  5. gunwald commented on Oct 13, 2014

    @gunwald
    Author

    Ok, but you have to do this for all folders and on all nodes and that is much work.

  6. kozec commented on Oct 13, 2014

    @kozec
    Contributor

    I would like this as well. Vision of going around 6 machines * 8 repos just to ignore .pyc, .class and bin/ makes current method of ignoring files pretty-much unusable for me.

  7. AudriusButkevicius commented on Oct 13, 2014

    @AudriusButkevicius
    Member

    There already is a #include directive, which means as long as all of your repos/folders include the same file, it will be global.

    You can also keep the file synced between machines by having it in one of your folders.

    I do not see ignores shared between devices in any other way.

    I do perhaps see a global ignore list which gets added on top of each folders ignores as a useful feature, but the case is so niche and specific to a certain group of people who can already solve/automate it in other means just because they can.

    There will only be the initial cost of setting the include on all your devices and all your folders, but I am sure you can automate this with a bash one-liner.

  8. kozec commented on Oct 13, 2014

    @kozec
    Contributor

    But #include practically means that I have to go around 6 machines * 8 repos to #include some synchronized file :)

    And automating that it's harder than it looks - i have Windows machines (no bash there), Android devices (no ssh there)... Having something like .stglobalignore #included by default would solve this easily and it doesn't sound hard to implement (to someone who never coded go, ofc)

  9. AudriusButkevicius commented on Oct 13, 2014

    @AudriusButkevicius
    Member

    You can write a small go script, cross compile it to all platforms, spread it using syncthing, and then invoke it on each machine ;)

  10. kozec commented on Oct 13, 2014

    @kozec
    Contributor

    Yeah, and then I can go around 6 machines and run that script :D

    By the way, as I already said, I don't speak go, but based on what I caught from sources, wouldn't this two-liner enough to add new, auto-included ignore file?

    http://pastebin.com/xDApEVL3 (model.go)

  11. calmh commented on Oct 13, 2014

    @calmh
    Member

    Yeah, so I responded to the "default entries" and not really to the "global ignore list" part. A global (as in it applies to every folder on a given device) ignore list I would be OK with. It would need to be stored in the config (just as an implementation note).

  12. calmh commented on Oct 13, 2014

    @calmh
    Member

    @kozec Theoretically you could automate it through syncthing though, today, using a POST request to the admin interface to set the ignore list per folder. @AudriusButkevicius that should probably be documented in https://discourse.syncthing.net/t/the-rest-interface/85.

  13. pepa65 commented on Oct 18, 2014

    @pepa65

    I like the fact that Syncthing doesn't litter the directories that are to be synced. Therefore I don't like it that .stignore files have to be put into the directories. Of course I am free not to use that feature, but could it be possible to have an ignore-file somewhere in the .config/syncthing? It could also serve as a global-ignore file as per the topic of this thread.

  14. Zillode commented on Dec 1, 2014

    @Zillode
    Contributor

    I'm also not convinced about the .git and .sparkleshare ignores as I also sync my .git folders.
    However, OS-specific temporary files should be filtered imo as they generate conflicts outside the user's actions (as proposed in #1055).

  15. pepa65 commented on Dec 1, 2014

    @pepa65

    A .stglobalignore or somesuch outside of the actual folders-to-be-synced would be better for my use case. I really don't like to need to litter my folders with .stignore files.

  16. 70 remaining items

  17. calmh commented on Dec 21, 2016

    @calmh
    Member

    I agree for those. And I'm not saying there is never cause to ignore thumbs.db, just that if it's not clearly the right thing to do I don't think we should do it automagically for the user. So I think the set of files to auto ignore is a bit smaller than what's suggested in a couple of places. For example the list of things git autoignores (links a fair bit up) is super inappropriate for us.

  18. jhasse commented on Dec 21, 2016

    @jhasse

    So I think the set of files to auto ignore is a bit smaller than what's suggested in a couple of places. For example the list of things git autoignores (links a fair bit up) is super inappropriate for us.

    I agree.

    But what about my Thumbs.db conflict example? Don't you agree that 99% of users would want to ignore that file? (Also keep in mind that Thumbs.db isn't invisible on Linux, for that reason alone I always want to ignore it)

  19. canton7 commented on Dec 21, 2016

    @canton7
    Contributor

    Agreed. I was just making sure we didn't discount the idea entirely 😄

    (On the thumbs.db point, I agree with @jhasse that it should be ignored, but we're heading off into bikeshedding territory...)

  20. calmh commented on Dec 21, 2016

    @calmh
    Member

    Yeah just making conversation on issues that popped on my notification list... We're going to bikeshed the shit out of this when it becomes a PR, that's for sure. 🚲 🏠🖌

  21. Ferroin commented on Dec 21, 2016

    @Ferroin

    Having a default set and then the ability to add to that list on a per-device basis would be nice.

    I would assume the basic list should look something like:

    # From Windows
    $RECYCLE.BIN
    System Volume Information
    $WINDOWS.~BT
    pagefile.sys
    desktop.ini
    
    # From OS X
    Icon?
    .Spotlight-V100
    .Trashes
    .DS_Store
    .fseventsd
    
    # From Linux
    lost+found
    .gvfs
    .local/share/trash
    .Trash-*
    
    # Generic stuff
    ._*
    

    $RECYCLE.BIN (case insensitive, since newer Windows versions use $Recycle.Bin) is the per-drive recycling bin for Windows
    $WINDOWS.~BT is a temporary directory used for OS upgrades on Windows (and is often huge if it exists). I've only ever seen this on the C: drive, but I think it shows up on a different drive if there's not enough room on C:.

    .fseventsd is something I see a lot on removable media. I'm not 100% certain what OS it's from, but it looks like ancillary volume metadata (which makes me think it's probably OS X), so it probably shouldn't be synced.

    .gvfs is found in most people's home directories on Linux when they use most desktop environments other than KDE, and shouldn't be scanned because it covers dynamic access to access transiently connected and non-filesystem items (network filesystems, archives, MTP devices, etc)
    .local/share/trash is the per-user trash-can for XDG compliant desktop environments on Linux (which is 90% of what people who use X use on Linux).

    Regardless of what platform we're on, we should use the same default excludes for consistency (and because people do share storage devices between systems).

  22. CONSULitAS commented on Apr 29, 2017

    @CONSULitAS

    Hi,

    i am just having the problem of having an error while syncing with the OS X Icon file (filename is invalid)!

    After thinking about the Problem that @flungo mentioned, that Icon? ignores the rather common Icons i would suggest the following:

    !Icon[0-9a-zA-Z]
    (?d)Icon?
    

    Regards

  23. removed this from the milestone on Feb 11, 2018
  24. NatoBoram commented on May 29, 2020

    @NatoBoram

    There's already a list of sane .gitignore : https://www.gitignore.io/api/linux,macos,windows

    If Syncthing could simply use the .gitignore format and extend it for their needs, I think it would've been a better solution than a default list.

    Then, to automate adding the ignore file on each machine and each folders, one could simply curl https://www.gitignore.io/api/linux,macos,windows -o .stignore each folders.

    But also a global .stignore in Syncthing's configs would also be a very efficient way of dealing with this.

  25. AudriusButkevicius commented on May 29, 2020

    @AudriusButkevicius
    Member

    We can't use gitignore because our format is already different, plus it has control sequences that control what happens if the file is detected ((?d)/(?i)) etc.

  26. NatoBoram commented on May 29, 2020

    @NatoBoram

    Then Syncthing should add a feature to migrate the well-known .gitignore file into their custom .stignore. It's the one inventing their own format, they should be responsible for creating an easy way to use it.

  27. AudriusButkevicius commented on May 29, 2020

    @AudriusButkevicius
    Member

    It shouldn't, because there is disagreement in what the format is able to describe, so if we were to follow what you are suggesting, we'd have to remove features that people currently rely on.

    The .gitignore ship has sailed many moons ago, so people should stop bringing this up, as this is going nowhere. People can use it as a reference for coming up with their ignore list, but its not a format we can go for.

  28. calmh commented on May 30, 2020

    @calmh
    Member

    Git itself is also a super niche tool used by a tiny clique of people in the world. I realize it’s a vocal minority here given the site we’re on, but that doesn’t really matter in the grander scheme of Syncthing users generally. So what Audrius says, let’s stop talking about gitignores.

  29. hyiltiz commented on Oct 27, 2020

    @hyiltiz

    So far, trying to sync a folder which somehow contained (not directly) a version control repository (e.g. .git) corrupts the .git/* objects unpredictably --- it doesn't happen all the time and doesn't corrupt all the repos; just happens sometimes for some repos under some weird race(?) conditions. We can argue if .git is a niche tool but consider this: the number that really matters here is the conditional probability of a syncthing user also using git aka p(uses git | uses syncthing). I bet this number is fairly high, meaning we should not ignore a large portion of our current user base.

    There is a much stronger point here about usability by default; a backup software should never corrupt what is already there. Syncthing by default can and will corrupt .git projects at some point. I have a few projects of mine corrupted and had to rm -rf .git and start afresh again.

    The solution, however, breaks nothing and is simple; just include default ignore lists. Yes, we cannot have an exhaustive list of everything one would like to ignore, but that shouldn't stop us from trying our best.

    If it matters, I volunteer to tally up the people who care about this enough to type a few sentences here over the past five years. This by no means is representative of the masses, but better than not having numbers on the table.

  30. beerse commented on Dec 1, 2020

    @beerse

    Wild idea on extending/updating the .stignore feature:
    First: Use the file '.stignore' (the current filename) and add to that the directory '.stignore.d' and all files (recursive) in it.
    Reason: There everyone can ad there and/or with dedicated ignore patterns for that area.

    Second: Read the .stignore and .stignore.d (in this order) from the software installation location (default: file containing ".stignore"), the 'standard map location' and the root of the current tree-to-sync.

    Major change: do sync the .stignore file and .stignore.d tree in the current tree-to-sync. If you donnot want to do so, Just add "/.stignore" to one of your .stignore files.
    To keep up with the current configuration: Add "/.stignore" to the .stignore in the installation directory. The I can put "!./stignore in the .stignore file in the three and it is synced to my wishes.

  31. added theissue type on May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issue

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions