Search Unity

Unity's version control component has been upgraded to Plastic SCM.

[Solved] Collab ignoring .collabignore

Discussion in 'Unity Collaborate' started by EternalMerodach, Jul 31, 2019.

  1. EternalMerodach

    EternalMerodach

    Joined:
    Jan 27, 2014
    Posts:
    27
    Hi,

    I wanted to give a try to Unity Collaborate, but I am having an annoying issue with it (actually I already had tons of issues, but this one I cannot resolve). I added some asset folders to .collabignore and the editor seems work fine with that, showing a grey icon for the ignored status.

    But the Collab toolbar is still showing all the ignored files as pending to be published. I tried deleting and re-importing the asset, clearing the /AppData/LocalLow/Unity/Browser/Cache as mentioned on another topic (for a different issue) and nothing seems to work. I have already closed and reopened as it seems to be the only way to refresh.......

    I am currently working with Unity 2019.1.10f1 and Collaborate 1.2.16.
     
  2. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @EternalMerodach, that is definitely not intended. You say that they have the gray "ignored" icons over them in the Project Browser but are still showing up in the Collab Toolbar? Could you include a sample of your ignore rules from your .collabignore file? For reference, I've tried on 2019.1.11f1 with Collaborate 1.2.16 on a Mac with using the rule "Assets/Materials/" to ignore a folder and its contents with success, so I'd like to know what I might be doing differently that's keeping me from reproducing this issue you're seeing.
     
  3. EternalMerodach

    EternalMerodach

    Joined:
    Jan 27, 2014
    Posts:
    27
    I have found out what is happening. I added the folder without the the trailing **, like this 'Assets/SurrounDead'. It is ignoring the folder, but not its contents.

    As the Unity Collab documentation mentioned the .gitignore documentation, I thought Collab applied the rules the same way as Git does, but it doesn't seem so (in Git, if I ignore the folder, everything inside is also ignored).

    Now I have to add 2 rules for each folder, because if I add the trailing ** it still wants to push the folder itself.

    Edit: Adding a trailing slash seems to do the trick, ignoring both the folder and its contents. But it still does not comply with git behavior. In Git, the trailing slash is optional as stated on the documentation: "If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in Git)."
     
    Last edited: Aug 1, 2019
  4. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    I'm glad you were able to configure your rules to ignore the entire folder and its contents like you wanted.

    If you look closely in that rule you mentioned it's referring to the ignore rules being the same for whether there's an initial forward slash in the file path or not, not if there's a trailing forward slash or not.

    However the rule before that one in gitignore(5) mentions "The pattern foo/ will match a directory foo and paths underneath it...", which would mean that if you updated your rule to "Assets/SurrounDead/" then both that folder and anything underneath it would be ignored too. Which is what you did and why both the folder and its contents were being ignored like you expected.

    I can totally understand the initial confusion and I might be reading the rules incorrectly myself. But we've based our .collabignore rules off of .gitignore's rules so there shouldn't be any differences in how they behave. Please let us know if you think there are any inconsistencies.
     
  5. EternalMerodach

    EternalMerodach

    Joined:
    Jan 27, 2014
    Posts:
    27
    Hmmm the rules starts with "If the pattern ends with a slash", meaning a trailing slash right? But I tought about it and I think that rule is not meant for my purpose, just to avoid ambiguity between folders and files (you may want to match a folder 'Assets', but not a file 'Assets'). And the example you pointed at that documentation is explaining this same rule.

    But I still tought it was weird, because I work with Git on a daily basis and was sure that if a folder is excluded, its entire content will be ignored (does not make much sense to ignore a folder if you push this same folder anyways to store its contents).

    So I made some tests and indeed, Git ignores everything on a excluded folder (for performance purposes, as mentioned on the documentation "Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined").

    I have made another test on Unity, with the rule without the trailing slash, and it actually shows the grey icon on the folder itself (indicating it is being ignored), but the content files and folders still shows the blue one expecting to be pushed, being consistent with the Collab Toolbar at least.

    My issue has been solved, but it seems there is some difference in behavior. The gitignore documentation does not explicitly mention this behavior and the part about performance cited before is mentioned under another rule (but it seems to be an important information). But if that is intended behavior for Unity Collab, it would be nice to at least mention it on the docs.
     
  6. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    That's an excellent point and you're right that that behavior is inconsistent with Git. I'm sorry for the confusion and we'll look to update the docs until we get the chance to modify the exclusion behavior so that it works the same as Git. Thank you for looking into that and showing the discrepancy.
     
    EternalMerodach likes this.