greatroar
31119ed61a
lib/ignore: Store cache timestamps as Unix ns counts ( #7326 )
2021-02-04 18:39:06 +01:00
Jakob Borg
946170f3fc
gui, lib/ignore: Handle editing ignores with error ( fixes #5425 ) ( #6757 )
...
This changes the error handling in loading ignores slightly:
- There is a new ParseError type that is returned as the error
(somewhere in the chain) when the problem was not an I/O error loading
the file, but some issue with the contents.
- If the file was read successfully but not parsed successfully we still
return the lines read (in addition to nil patterns and a ParseError).
- In the API, if the error IsParseError then we return a successful
HTTP response with the lines and the actual error included in the JSON
object.
- In the GUI, as long as the HTTP call to load the ignores was
successful we can edit the ignores. If there was an error we show this
as a validation error on the dialog.
Also some cleanup on the Javascript side as it for some reason used
jQuery instead of Angular for this editor...
2020-06-18 11:04:00 +02:00
Simon Frei
07ce3572a0
lib/ignore: Only skip for toplevel includes ( fixes #6487 ) ( #6508 )
2020-04-07 10:23:38 +02:00
Jakob Borg
dd92b2b8f4
all: Tweak error creation ( #6391 )
...
- In the few places where we wrap errors, use the new Go 1.13 "%w"
construction instead of %s or %v.
- Where we create errors with constant strings, consistently use
errors.New and not fmt.Errorf.
- Remove capitalization from errors in the few places where we had that.
2020-03-03 22:40:00 +01:00
Jakob Borg
e0d4cdc9a3
lib/ignore: Don't crash on empty patterns ( fixes #6300 ) ( #6301 )
...
Instead of panicking when we try to look closer at the empty pattern,
return something like `invalid pattern "(?d)" in ignore file: missing
pattern`.
2020-01-30 09:58:44 +01:00
Marcus Legendre
b3fd9a8d53
lib/ignore: Don't create empty ".stignore" files ( fixes #6190 ) ( #6197 )
...
This will:
1. prevent creation of a new .stignore if there are no ignore patterns
2. delete an existing .stignore if all ignore patterns are removed
2019-12-02 08:19:02 +01:00
Simon Frei
f747ba6d69
lib/ignore: Keep skipping ignored dirs for rooted patterns ( #6151 )
...
* lib/ignore: Keep skipping ignored dirs for rooted patterns
* review
* clarify comment and lint
* glob.QuoteMeta
* review
2019-11-26 07:37:41 +00:00
Simon Frei
cf312abc72
lib: Wrap errors with errors.Wrap instead of fmt.Errorf ( #6181 )
2019-11-23 15:20:54 +00:00
Jakob Borg
60c07b259e
lib/ignore: Don't crash in partial #include line (ref #5985 ) ( #5986 )
...
If the line is just "#include" with nothing following it we would crash
with an index out of bounds error. Now it's a little more careful.
2019-08-30 11:36:31 +02:00
Jakob Borg
2984d40641
lib/ignore: Additional test case ( #5672 )
2019-04-28 21:20:11 +01:00
Jakob Borg
c2ddc83509
all: Revert the underscore sillyness
2019-02-02 12:16:27 +01:00
Jakob Borg
9fd270d78e
all: A few more interesting linter fixes ( #5502 )
...
A couple of minor bugs and simplifications
2019-02-02 12:09:07 +01:00
Jakob Borg
df5c1eaf01
all: Bunch of more linter fixes ( #5500 )
2019-02-02 11:02:28 +01:00
Simon Frei
2f9840ddae
lib: Introduce fs.IsParent ( fixes #5324 ) ( #5326 )
2018-11-22 11:16:45 +01:00
Simon Frei
8ff7ceeddc
lib/ignore, lib/scanner: Fix recursion to catch included paths ( fixes #5009 ) ( #5010 )
2018-06-18 08:22:19 +02:00
Simon Frei
d59aecba31
lib/ignore, lib/scanner: Catch included items below ignored ones ( #4811 )
2018-05-14 09:47:23 +02:00
Audrius Butkevicius
a48a31e3f5
lib/ignores: Fix ignore loading, report errors to UI ( fixes #4901 ) ( #4932 )
2018-05-08 23:37:13 +02:00
Simon Frei
5520022766
lig/ignore, lib/logger: Fix race and potential dead-locks when logging ( #4821 )
2018-03-17 16:49:12 +01:00
Simon Frei
885e3f19bd
lib/ignores: Update lines even if patterns didn't change ( fixes #4689 )
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4690
2018-01-20 07:52:57 +00:00
Simon Frei
a1761795fe
lib/ignore: Only handle lines prefixed with #include specially ( fixes #4680 )
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4684
LGTM: AudriusButkevicius, calmh
2018-01-17 16:56:53 +00:00
Simon Frei
9dbc509996
lib/ignore: Consistent behaviour for nil *Matcher
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4310
2017-09-06 06:39:18 +00:00
Simon Frei
c41aaad3bb
lib/ignore: Ignore duplicate lines in .stignore
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4350
LGTM: AudriusButkevicius, calmh
2017-09-04 12:46:19 +00:00
Audrius Butkevicius
ab132ff6fe
lib: Folder marker is now a folder
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4341
LGTM: calmh
2017-09-02 05:52:38 +00:00
Audrius Butkevicius
0a96a1150b
lib/model, lib/ignores: Properly handle out of folder ignores and free space checks ( fixes #4313 , fixes #4314 )
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4318
2017-08-22 06:45:00 +00:00
Audrius Butkevicius
3d8b4a42b7
all: Convert folders to use filesystem abstraction
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4228
2017-08-19 14:36:56 +00:00
Simon Frei
b75c9f2bbb
lib/ignores: Don't add text from includes to lines ( fixes #4249 )
...
Otherwise all the lines from includes will be shown in the web UI instead of
just the #include ... line. This problem was introduced in #3996 .
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4248
LGTM: calmh
2017-07-06 11:44:11 +00:00
Jakob Borg
68c1a0b9b4
lib/ignore, lib/model: Use an interface to detect file changes, improving tests
...
This solves the erratic test failures on model.TestIgnores by ensuring
that the ignore patterns are reloaded even in the face of unchanged
timestamps.
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4208
2017-06-11 10:27:12 +00:00
Simon Frei
0b854dff9d
lib/ignore: Don't match root (".")
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4122
2017-05-01 16:58:08 +00:00
Simon Frei
25b314f5f1
lib/model, gui: Allow creating and editing ignores of paused folders ( fixes #3608 )
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3996
LGTM: calmh, AudriusButkevicius
2017-04-01 09:58:06 +00:00
Jakob Borg
f7fc0c1d3e
all: Update license url to https (ref #3976 )
2017-02-09 08:04:16 +01:00
Simon Frei
dbb3a34887
lib/ignore: Centralize handling of temporary filenames ( fixes #3899 )
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3901
LGTM: calmh, AudriusButkevicius
2017-01-17 07:33:48 +00:00
Jakob Borg
d41c131364
build: Enable gometalinter "gosimple" check, improve build.go
2016-12-21 14:53:45 +01:00
Jakob Borg
e3cf718998
lib/ignore: Add central check for internal files, used in scanning, pulling and requests
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3779
2016-12-01 14:00:11 +00:00
Jakob Borg
2dbeea21c4
lib/ignore: Don't slow down tests by sleeping
2016-11-22 22:44:04 +01:00
Jakob Borg
a2b8485a89
lib/ignore: Fast reload of unchanged ignores ( fixes #3394 )
...
This changes the "seen" map that we're anyway keeping around to track
the modtimes of loaded files instead. When doing a Load() we check that
1) the file we are loading is in the modtime set, and 2) that none of
the files in the modtime set have changed modtimes. If that's the case
we do a quick return without parsing anything or clearing the cache.
This required adding two one seconds sleeps in the tests to make sure
the modtimes were updated when we expect cache reloads, because I'm on a
crappy filesystem with one second timestamp granularity. That also
proves it works...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3754
2016-11-22 21:30:45 +00:00
Jakob Borg
4b3adfa21c
vendor: Update gobwas/glob to fix question mark handling
2016-10-23 15:47:31 +02:00
Simon Frei
7c37301c91
lib/ignore: Add directory separator to glob.Compile call
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3674
LGTM: calmh
2016-10-21 07:33:40 +00:00
Tim Howes
fe9c2b9857
lib/ignore: Match directory contents for patterns ending in / ( fixes #3639 )
...
Appends "**" to patterns with a terminal slash, so that directory
contents are ignored, but not the directory itself.
2016-10-04 08:12:55 +09:00
Jakob Borg
4453236949
vendor: Update github.com/gobwas/glob ( fixes #3174 )
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3207
2016-05-28 04:43:54 +00:00
Audrius Butkevicius
915e1ac7de
lib/model: Handle (?d) deletes of directories ( fixes #3164 )
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3170
2016-05-23 23:32:08 +00:00
Jakob Borg
1be40cc4fa
lib/ignore: Revert comma handling, upgrade globbing package
...
This was fixed upstream due to our ticket, so we no longer need the
manual handling of commas. Keep the tests and better debug output around
though.
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3081
2016-05-12 07:11:16 +00:00
klemens
bd41e21c26
all: Correct spelling in comments
...
Skip-check: authors pr-build-mac
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3056
2016-05-08 10:54:22 +00:00
Jakob Borg
5d337bb24f
lib/ignore: Handle bare commas in ignore patterns ( fixes #3042 )
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3048
2016-05-06 15:45:11 +00:00
Jakob Borg
6720906ee5
lib/ignore: Refactor: notMatched should be one of the constants
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3031
2016-05-04 07:15:56 +00:00
Audrius Butkevicius
abb96802cb
lib/ignores: Use bitmask for result
...
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3030
2016-05-01 15:58:23 +00:00
Audrius Butkevicius
5a98af622d
lib/ignore: Implement deletable ignores using (?d) prefix ( fixes #1362 )
2016-04-07 09:34:07 +00:00
Jakob Borg
181939c841
lib/ignore: Correct case insensitive matching on Mac/Windows
...
There was a bug in that we only did the lowercase folding when the
pattern had an explicit (?i), which is not the case on Windows/Mac
necessarily.
2016-04-05 06:35:51 +00:00
Jakob Borg
1934b3a5b6
lib/ignore: Remove pattern for foo/** which is already covered by foo/
...
Actual speed difference according to benchmarks is hidden in the noise
Also make the "pattern" field for each entry match what is actually
evaluated.
2016-04-04 13:22:25 +01:00
Jakob Borg
4c3cd4c9e3
lib/ignore: Replace lib/fnmatch with github.com/gobwas/glob
...
Because it's literally ten times faster:
benchmark old ns/op new ns/op delta
BenchmarkMatch-8 13842 1200 -91.33%
BenchmarkMatchCached-8 139 147 +5.76%
benchmark old allocs new allocs delta
BenchmarkMatch-8 0 0 +0.00%
BenchmarkMatchCached-8 0 0 +0.00%
benchmark old bytes new bytes delta
BenchmarkMatch-8 12 0 -100.00%
BenchmarkMatchCached-8 0 0 +0.00%
2016-04-02 20:03:24 +01:00
Jakob Borg
a80fc1b062
Correctly report errors encountered parsing ignores ( fixes #2309 , fixes #2296 )
...
An error on opening .stignore will satisfy os.IsNotExist() and not be
reported. Other errors will be reported and stop the folder, including
is-not-exist errors from #include as these are passed through fmt.Errorf.
Also fixes minor issue where we would not print cause of folder stopping
to the log.
Also fixes minor issue with capitalization of errors.
2015-09-29 18:04:18 +02:00