Skip to content

Add #include directive to .stignore (fixes #424) - #589

Merged
calmh merged 5 commits into
syncthing:masterfrom
AudriusButkevicius:include
Sep 1, 2014
Merged

calmh merged 5 commits into
syncthing:masterfrom
AudriusButkevicius:include

Conversation

@AudriusButkevicius

Copy link
Copy Markdown
Member

Though breaks #502 in a way, as .stignore is not the only place where
stuff gets defined anymore.

Though it never was, as .stignore can be placed in each dir, but I think we
should phase that out in favor of globbing which means that we can then
have a single file, which means that we can have a UI for editing that.

Alternative would be as suggested to include a .stglobalignore which is then synced
as a normal file, but gets included by default.

Then when the UI would have two editors, a local ignore, and a global ignore.

@calmh

calmh commented Aug 30, 2014

Copy link
Copy Markdown
Member

Can I be a pain and add a test case? d840d28 An include loop breaks, but not a file that includes itself (for some reason I didn't immediately understand, it didn't look like this was handled?).

Should we log at least an info level message for including a file that doesn't exist?

Including a file in subdirectory has confusing effects, i.e. if I include subdir/excludes from an .stignore file above that subdir, the patterns are applied from that part in the tree and not from inside subdir that one could expect. I'm inclined to just consider that a misconfiguration on the user's part and not spend any code on handling it.

@calmh

calmh commented Aug 30, 2014

Copy link
Copy Markdown
Member

Oh, 1961480 is nice too when running that failing test... :/

@AudriusButkevicius

Copy link
Copy Markdown
Member Author

Yes, I was thinking that I should write some tests, looked at walk_test.go but didn't see that it actually loads files (which is what I needed for tests).

Circular includes are not handled, that is correct, though I don't think it will be such a common error case.
Though if you want, I can fix that.

The fact that ignores are applied at the level the file is somehow made sense to me, as feel that #include should be affected on the current scope we are including at.

Also #include subdir/excludes just makes less sense, as you'd probably just have subdir/.stignore.

But if we do drop .stignore in subdirs, then yes, includes should be applied in the directory the files is being included from.

I will add a info message about non-existing files.

AudriusButkevicius and others added 3 commits August 31, 2014 15:32
Though breaks syncthing#502 in a way, as .stignore is not the only place where
stuff gets defined anymore.

Though it never was, as .stignore can be placed in each dir, but I think we
should phase that out in favor of globbing which means that we can then
have a single file, which means that we can have a UI for editing that.

Alternative would be as suggested to include a .stglobalignore which is then synced
as a normal file, but gets included by default.

Then when the UI would have two editors, a local ignore, and a global ignore.
@AudriusButkevicius

Copy link
Copy Markdown
Member Author

Let me know if you want me to do something else (such as handle recursion)

@calmh

calmh commented Aug 31, 2014

Copy link
Copy Markdown
Member

Yeah I think we need to handle recursion, since the results are so bad if the user happens to do it (basically hang using 100% cpu until it crashes a while later). The test tests that now.

Comment thread scanner/walk.go

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably simplify this to a simple map to just ignore files that we have seen before, recursion or no recursion, but this works too.

calmh added a commit that referenced this pull request Sep 1, 2014
Add #include directive to .stignore (fixes #424)
@calmh
calmh merged commit 4ac67eb into syncthing:master Sep 1, 2014
@AudriusButkevicius
AudriusButkevicius deleted the include branch September 6, 2014 12:55
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Jun 17, 2017
@syncthing syncthing locked and limited conversation to collaborators Jun 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants