Skip to content

.stglobalignore file to be synced between nodes #424

Closed

Description

@kattunga

Add a new .stglobalignore file that works the same maner that .stignorefile but in this case the file is synced to other nodes.
The ignored patters are the concatenatios of both .stignore ans .stglobalignore files.

discussion
https://discourse.syncthing.net/t/syncronize-stignore-file/557

Activity

  1. calmh commented on Jul 20, 2014

    @calmh
    Member

    Mmmyes, or some other mechanism to make it easier to sync ignore patterns between nodes (#include directives in .stignore perhaps?).

  2. kattunga commented on Jul 20, 2014

    @kattunga
    Author

    Using #includes does not solve the problem, because you force me the same to have the .stignore file, which is not replicated to the nodes.

    I thing that using a ".stglobalignore" file is the most easy to implement, it's compatible with the way it works now and it's easy to the understand by the simple user. Also, you are sure that it will be replicated to the nodes, you not depend on having a ".stignore" on remote node to makes #includes.

  3. AudriusButkevicius commented on Aug 26, 2014

    @AudriusButkevicius
    Member

    So lets talk how we could do this.

    Can we change

    type IndexMessage struct {
        Repository string // max:64
        Files      []FileInfo
    }

    to

    type IndexMessage struct {
        Repository      string // max:64
        Files           []FileInfo
        IgnoresVersion  uint64
        IgnoresBy       NodeID
        Ignores         []string
    }

    and just use lamport clocks over IgnoresVersion and IgnoresBy to sync them up?
    Nodes in read-only mode would still update IgnoresVersion and IgnoresBy (but not the content of Ignores) so that they could correctly advertise newer changes?

    And we would store Ignores, IgnoresVersion and IgnoresBy as part of the config.xml?

  4. calmh commented on Aug 26, 2014

    @calmh
    Member

    But we don't necessarily want to sync all ignore patterns...

  5. calmh commented on Aug 26, 2014

    @calmh
    Member

    In fact, I might not want to tell the other nodes what files are being ignored.

  6. AudriusButkevicius commented on Aug 26, 2014

    @AudriusButkevicius
    Member

    Yes, but this is 2nd part of #502, whereby we have local ignore and global (synced) ignore per repo, so you have the full right not to use it (and use the local one instead) if you don't want others to know what you are ignoring locally.

    Also, you'd probably want to have a flag saying "ignore global ignore".

  7. calmh commented on Aug 26, 2014

    @calmh
    Member

    Right. So the extension above really only reflects the (per repo) "Global Ignore Patterns" setting. That's fine. It's one more area where we might run into sync conflicts though, when patterns have been edited on more than one node.

  8. AudriusButkevicius commented on Aug 26, 2014

    @AudriusButkevicius
    Member

    That's why we'd have basic lamport clocks, to ensure that everyone agrees on what the end result should look like, so there wouldn't be any conflicts.

  9. calmh commented on Aug 26, 2014

    @calmh
    Member

    Well, the clock doesn't really help in handling conflicts, just in deciding which version is the more recent when there are no conflicts. We'd need a full vector clock to detect conflicts. (Yes, this would be nice for files in general; it's just kind of a pain to implement with cluster membership that varies over time.)

  10. AudriusButkevicius commented on Aug 26, 2014

    @AudriusButkevicius
    Member

    I guess we don't really care about the fact that there was a conflict, the thing we do care about is eventual consistency or eventual conflict resolution.

    One problem I see though, is that the patterns are different on different OS'es.

    As in
    /root/mystuff/*/doc.txt != C:\Users\Administrator\mystuff\*\doc.txt
    and that Windows doesn't support patterns as well as Unix does.

    I guess the path separator issue can be solved by each node advertising their path separator, and then replacing that on the receiving end with a local version of the path separator for each pattern?

  11. AudriusButkevicius commented on Aug 26, 2014

    @AudriusButkevicius
    Member

    Now that I think about it, perhaps you are right, an #include directive would do the job just as well, and perhaps I am just too eager to introduce changes to the structs ;)

  12. kattunga commented on Aug 26, 2014

    @kattunga
    Author

    Hi Audrius,

    One problem I see though, is that the patterns are different on different OS'es.
    As in
    /root/mystuff/_/doc.txt != C:\Users\Administrator\mystuff_\doc.txt
    and that Windows doesn't support patterns as well as Unix does.

    This should not be true. As in .gitignore, file patterns should not differ between different OS'es.
    In .stignorefile all patterns should be relative to repository folder, you can't use absolute patters.
    The path separator should always be "/".
    Git with it's .gitignore file works in this way, and people are used to it.

  13. kattunga commented on Aug 26, 2014

    @kattunga
    Author

    The easiest method to solve this is by allowing the user to use new ".stglobalignore" file is replicated to other nodes in the same way as the rest of the files in the repository.
    Syncthing must consider the sum of the contents of the file ".stignore" and ".stglobalignore" to determine which files to ignore.

    I see no need to change the current internal structure of SyncThing, the ".stglobalignore" should be treated like any other file in the repository and it simply should be evaluated as the file ".stignore" when you find it.

    This is the way that, for example, GIT use to handle the .gitignore file, the .gitignore file is treated as any other file in the repository and it changes are committed to the repository as any other change, (unless file ".gitignore" is specifically included within it).
    This is the way that developers are accustomed to deal with the ".gitignore file" so I think that is good to use it too in SyncThing.

    please, read again my post where I explain how I use SyncThing:
    https://discourse.syncthing.net/t/syncronize-stignore-file/557

  14. AudriusButkevicius commented on Aug 26, 2014

    @AudriusButkevicius
    Member

    I am just giving absolute paths as an example.
    If we add an #include directive, you can create your own .stglobalignore and just include it without any black magic involved.

    The only argument against #include is as follows.
    Developers are accustomed to dealing with .gitignore, non-developers are not.
    So you need UI for this to be honest.

  15. kattunga commented on Aug 26, 2014

    @kattunga
    Author

    After some thought, I agree that using #include directives is a good solution. I deleted my 2 last comments to avoid confusion.

  16. added 2 commits that reference this issue on Aug 28, 2014
    6722985
    8c42aea
  17. added a commit that references this issue on Sep 1, 2014
    4ac67eb
  18. Hout commented on Feb 25, 2016

    @Hout

    For osx users, mackup could help.

  19. added
    frozen-due-to-age
    on Jun 17, 2017
  20. locked and limited conversation to collaborators on Jun 17, 2017
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

    enhancementfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions