tkonolige / dbignore Goto Github PK
View Code? Open in Web Editor NEW.gitignore for Dropbox
License: BSD 3-Clause "New" or "Revised" License
.gitignore for Dropbox
License: BSD 3-Clause "New" or "Revised" License
Given the following test case:
cd ~/Dropbox
mkdir test
cd test
echo '*' > .dbignore
mkdir -p a/b/c
touch a/b/c/d.txt
You would expect a/b/c/d.txt
not to be synced as it's matched by *
(or at least the a
folder is, which should then not be included).
The following text appears in ~/dbignore_log
:
Ignore on /Users/Tyilo/Dropbox/test/a/b/c
is not ignore file
nearest ignore file is /Users/Tyilo/Dropbox/test
/Users/Tyilo/Dropbox/test/* does not match
Ignore on /Users/Tyilo/Dropbox/test/a/b
is not ignore file
nearest ignore file is /Users/Tyilo/Dropbox/test
/Users/Tyilo/Dropbox/test/* does not match
Ignore on /Users/Tyilo/Dropbox
is not ignore file
no ignore file found
Ignore on /Users/Tyilo/Dropbox/test/.dbignore
is ignore file
Ignore on /Users/Tyilo/Dropbox/test
is not ignore file
nearest ignore file is /Users/Tyilo/Dropbox/test
/Users/Tyilo/Dropbox/test/* does not match
Ignore on /Users/Tyilo/Dropbox/test/a
is not ignore file
nearest ignore file is /Users/Tyilo/Dropbox/test
/Users/Tyilo/Dropbox/test/* matches!
Ignore on /Users/Tyilo/Dropbox/test/a/b/c/d.txt
is not ignore file
nearest ignore file is /Users/Tyilo/Dropbox/test
/Users/Tyilo/Dropbox/test/* does not match
(This is unrelated to issue #6)
I'm pretty sure dropbox_inj.dylib isn't getting loaded as dbignore loaded
isn't printed to the Console. I'm opening Dropbox with Alfred if it matters.
Over on issue #6 I'm injecting the dylib by patching the binary using my own utility called insert_dylib.
I would be willing to pay to help develop a Windows version.
Dropbox should also donate as they are the one who will end up saving bandwidth/storage :)
I know this is now a correct place to do, but kindly upvote the request on dropbox forum so dropbox may enable this type of feature in future releases.
Test:
cd ~/Dropbox
mkdir test
echo '*' > test/.dbignore
mkdir test/a.txt
ln -s test test2
test/a.txt
doesn't get synced, but test2/a.txt
does. I would expect dbignore to ignore them both.
It doesn't seem to work.
I can see "dbignore loaded" in Console, when Dropbox is started.
Commands to reproduce:
$ cd ~/Dropbox
$ mkdir test
$ echo "*" > test/.dbignore
$ touch test/a.txt
After this a.txt
is synced with Dropbox, even though it shouldn't.
If you double-click the install and it opens in iTerm I get the following output:
As you can see pwd
returns $HOME
and $0
returns the full path of the script.
The resulting BUILD_DIR
variable becomes $HOME//$HOME/Downloads/dbignore_0.2
when in fact it should have been just $HOME/Downloads/dbignore_0.2
.
I would love to use this on Ubuntu but I don't have the knowledge to make a port of it, I hope someone will
The solution is to use a different way of launching dropbox. Make a separate app that launches dropbox with DYLD_INSERT_LIBRARIES.
What's broken at the moment?
I've tried:
node_modules
**/node_modules
but it seems to keep uploading files from those directories.
It might be able to hook selective sync to make dbignore more efficient.
Hi,
I am using v0.4 and my Dropbox folder is under DBHOME=~/Public/Dropbox/
and my watched files are symlinked from there.
I have issue #7 (though DYLD_INSERT_LIBRARIES=/Applications/Dropbox.app/Contents/dropbox_inj.dylib /Applications/Dropbox.app/Contents/MacOS/Dropbox
does show Dropbox[562]: dbignore loaded
.
…and also #14 as (having manually inserted the dyld) $DBHOME
dbignored folders are correctly ignored, but not in the symlinked paths.
I reinstalled Dropbox.app
&& did ./install
multiple times to no avail.
Would the fnmatch patch have fixed the symlinks issue?
Any progress on why stat
isn't called on symlinks? FWIW Dropbox follows symlinks.
Great tool! You will encounter sync errors in Dropbox when the user attempts to delete a parent directory of an ignored file from another computer or the web site. I would hook unlink() on directories and delete all ignored child files before redirecting to the system's unlink(), this avoids "directory not empty" errors.
I am unsure if the current mechanism to prevent remote files to be written locally works.
I gave this an attempt in Yosemite but was unable to get any patterns recognized. The install script worked fine as far as I could tell - the plist was backed up and updated.
I'm trying to compile dbignore with ghc and I get the following errors:
/usr/local/Cellar/ghc/7.6.3_2/bin/ghc -threaded -c ignore.hs
ignore.hs:70:33:
Couldn't match type `ByteString'
with `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
Expected type: RawFilePath
Actual type: ByteString
In the first argument of `return', namely `B.empty'
In the second argument of `(<$>)', namely `return B.empty'
In the first argument of `(<*>)', namely
`Config <$> return B.empty'
ignore.hs:75:35:
Couldn't match type `ByteString'
with `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
Expected type: RawFilePath
Actual type: ByteString
In the `dbPath' field of a record
In the expression:
Config {dbPath = B.empty, dbName = ".dbignore", debug = False}
In an equation for `defaultConfig':
defaultConfig
= Config {dbPath = B.empty, dbName = ".dbignore", debug = False}
ignore.hs:81:36:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the return type of a call of `dbPath'
In the first argument of `B8.unpack', namely `(dbPath conf)'
In the first argument of `(++)', namely `B8.unpack (dbPath conf)'
ignore.hs:96:3:
Couldn't match type `ByteString'
with `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
Expected type: IO RawFilePath
Actual type: IO ByteString
In a stmt of a 'do' block: return $ B8.pack $ Text.unpack path
In the expression:
do { home <- getHomeDirectory;
let infoFile = home ++ "/.dropbox/info.json";
info <- B.readFile infoFile;
let Just (Object o) = decodeStrict' info
Object pp = o ! "personal"
....;
.... }
In an equation for `getDropboxPath':
getDropboxPath
= do { home <- getHomeDirectory;
let infoFile = ...;
info <- B.readFile infoFile;
.... }
ignore.hs:100:19:
Couldn't match type `ByteString'
with `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
Expected type: RawFilePath -> Bool
Actual type: ByteString -> Bool
In the return type of a call of `isSuffixOf'
In the expression: isSuffixOf (dbName conf)
In an equation for `isDBIgnore':
isDBIgnore conf = isSuffixOf (dbName conf)
ignore.hs:118:36:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the first argument of `B8.unpack', namely `file'
In the second argument of `($)', namely `B8.unpack file'
In a stmt of a 'do' block: regexs <- B.readFile $ B8.unpack file
ignore.hs:119:40:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the return type of a call of `takeDirectory'
In the first argument of `append', namely `takeDirectory file'
In the first argument of `append', namely
`takeDirectory file `append` "/"'
ignore.hs:120:22:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the return type of a call of `takeDirectory'
In the first argument of `T.insert', namely `(takeDirectory file)'
In the second argument of `($)', namely
`T.insert (takeDirectory file) splits trie'
ignore.hs:125:36:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the first argument of `append', namely `dbpath'
In the second argument of `($)', namely
`dbpath `append` "/.dbignore_config"'
In the second argument of `($)', namely
`B8.unpack $ dbpath `append` "/.dbignore_config"'
ignore.hs:138:84:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the first argument of `B8.unpack', namely `dbpath'
In the second argument of `($)', namely `B8.unpack dbpath'
In a stmt of a 'do' block:
ignores <- G.globDir1
(G.compile $ "**/" ++ B8.unpack (dbName conf))
$ B8.unpack dbpath
ignore.hs:142:48:
Couldn't match type `ByteString'
with `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
Expected type: String -> RawFilePath
Actual type: String -> ByteString
In the first argument of `Prelude.map', namely `B8.pack'
In the second argument of `($)', namely
`Prelude.map B8.pack ignores'
In the expression:
foldM (flip addIgnore) cache $ Prelude.map B8.pack ignores
ignore.hs:153:20:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the return type of a call of `dbPath'
In the first argument of `isPrefixOf', namely `(dbPath conf)'
In the expression: isPrefixOf (dbPath conf) file
ignore.hs:153:33:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the second argument of `isPrefixOf', namely `file'
In the expression: isPrefixOf (dbPath conf) file
In a stmt of a 'do' block:
case isPrefixOf (dbPath conf) file of {
True
-> do { debugMsg conf $ "Ignore on " ++ B8.unpack file;
modifyMVar cacheVar $ \ cache -> ... }
False -> return False }
ignore.hs:155:49:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the first argument of `B8.unpack', namely `file'
In the second argument of `(++)', namely `B8.unpack file'
In the second argument of `($)', namely
`"Ignore on " ++ B8.unpack file'
ignore.hs:164:38:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the first argument of `nearestMatch', namely `file'
In the expression: nearestMatch file cache
In a stmt of a 'do' block:
case nearestMatch file cache of {
Just (path, regexs)
-> do { debugMsg conf
$ " nearest ignore file is " ++ B8.unpack path;
doesMatch regexs >>= return . (,) cache }
where
doesMatch :: [Pattern] -> IO Bool
doesMatch (r : rs) = do { ... }
doesMatch [] = return False
Nothing
-> do { debugMsg conf " no ignore file found";
return (cache, False) } }
ignore.hs:171:37:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString
Actual type: RawFilePath
In the second argument of `fnmatch', namely `file'
In the first argument of `(>>=)', namely `fnmatch r file'
In a stmt of a 'do' block:
fnmatch r file
>>=
\case {
True
-> do { debugMsg conf $ " " ++ show r ++ " matches!";
return True }
False
-> do { debugMsg conf $ " " ++ show r ++ " does not match";
doesMatch rs } }
ignore.hs:188:58:
Couldn't match type `bytestring-0.10.0.2:Data.ByteString.Internal.ByteString'
with `ByteString'
Expected type: ByteString -> IO Bool
Actual type: RawFilePath -> IO Bool
In the second argument of `(.)', namely `ignore'
In the second argument of `(>>=)', namely
`(liftM boolToCInt) . ignore'
In the expression: packCString str >>= (liftM boolToCInt) . ignore
make: *** [i386] Error 1
dbignore does not load in Dropbox 2.10.29.
Hello everyone,
I've recently implemented dropboxignore (before discovering dbignore :/ ) which is a simple shell script that allows you to ignore files or folders from Dropbox based on .dropboxignore
files or even based on existing .gitignore
files. Hope to find it useful. Any feedback is more than welcome.
When I run doxygen, it generates a bunch of .html files in a directory called html/ . Inside that directory, I've put a .dbignore file; here it is:
» cat .dbignore
*.html
In addition to that, one level up, I made a .dbignore file which ignores that whole directory. (It's a copy of my .gitignore file.) It looks like this:
» cat .dbignore
html/
errorLog.txt
.DS_Store
Thus, whenever I run doxygen, I expect not to see Dropbox uploading a bunch of *.html. But in the Dropbox "recently changed" list, that is what I do see.
After first running "./install" a few minutes ago, I restarted Dropbox. That's all I've done so far.
Mac OS 10.9.4
Macbook Pro
Dbignore lacks the following:
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).
An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn't list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined. Put a backslash ("") in front of the first "!" for patterns that begin with a literal "!", for example, "!important!.txt".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.