Pauline Middelink
c95e2b009e
Simpify cmd_backup and cmd_init now we have the password in gopts.
2017-07-24 23:32:55 +02:00
Pauline Middelink
d5615a67c8
Refactor password resolving.
...
Instead of determining the password lazily during ReadPassword(), do so now in
cobra.PersistentPreRunE() so we can store the result in the globalOptions and
reuse/override when applicable without having to worry about the environment
or flag options interfering.
2017-07-24 23:05:37 +02:00
Pauline Middelink
d9b9bbd4a8
Force restic to ask the password when adding a key.
...
As `restic key add` uses the same `ReadPasswordTwice()` as the
rest of restic, it is sensitive to the environment variable
RESTIC_PASSWORD or --password-file= override.
When asking for the new key, temporary remove these 2 overrides, forcing
the password to be asked.
2017-07-24 22:00:44 +02:00
Alexander Neumann
d780b1eede
Rework withTestEnvironment
...
Switch from a function passed as a parameter to a cleanup function,
which is also executed when the test function panics, so no temporary
directories are left behind.
2017-07-24 21:32:34 +02:00
Pauline Middelink
1717391f6c
Fuse testing leaves test mountpoint around. Move it under the testing tree which is removed after each test.
2017-07-24 20:33:39 +02:00
Alexander Neumann
23c903074c
Move restic package to internal/restic
2017-07-24 17:43:32 +02:00
Alexander Neumann
94b27e8933
Fix paths for tests
2017-07-23 14:39:57 +02:00
Alexander Neumann
6caeff2408
Run goimports
2017-07-23 14:21:03 +02:00
Alexander Neumann
83d1a46526
Moves files
2017-07-23 14:19:13 +02:00
Alexander Neumann
b63399d606
Move things around for gb
...
This moves all restic source files to src/, and all vendored
dependencies to vendor/src.
2016-02-20 17:31:20 +01:00
Alexander Neumann
1287b307ac
Add cleanup handler to restore terminal state
...
Closes #402
2016-02-13 18:29:26 +01:00
Alexander Neumann
4ec5050cbb
backup: Hide status output for narrow terminals
...
closes #428
2016-02-10 17:28:48 +01:00
Rached Ben Mustapha
ba35ca522a
Handle pack loading errors in rebuild-index
...
Errors returned from backend.LoadAll() were not handled, leading to
these fatal errors from the unpacker trying to read the size from the end of
an empty buffer:
`seeking to read header length failed: bytes.Reader.Seek: negative position`
This change takes care of returning on error, as well as showing which pack
failed to load and validating pack integrity.
2016-02-07 18:30:47 +00:00
Alexander Neumann
2c3a6a6fa9
cmd_rebuild_index: Remove calls to GetReader()
2016-01-24 00:42:04 +01:00
Alexander Neumann
61551b0591
cmd_cat: Remove calls to GetReader()
2016-01-24 00:42:04 +01:00
Alexander Neumann
f05a32509e
Add "Test" prefix to backend test functions
2016-01-23 19:12:02 +01:00
Alexander Neumann
6ba56befad
Abort fuse integration test on error
...
Before, the fuse integration test was run and the tests were never
finished, because the testing code did not detect any errors when the
fusermount binary returned an error. This commit fixes it.
2016-01-23 19:10:43 +01:00
Alexander Neumann
8b7bf8691d
backend: Remove Get()
...
This is the first commit that removes the (redundant) Get() method of
the backend interface. Get(x, y) is equivalent to GetReader(x, y, 0, 0).
2016-01-23 13:13:05 +01:00
Alexander Neumann
1dd4c52a8b
Add comments, configure flag library
2016-01-17 18:48:05 +01:00
Alexander Neumann
1922a4272c
s3: fix usage
...
Ignore error response for existing bucket, add more debug code.
2016-01-17 18:48:05 +01:00
Alexander Neumann
7d5f8214cf
use new backend open with config
2016-01-17 18:48:05 +01:00
Alexander Neumann
3ac1d0e4d1
add progress
2015-12-06 17:29:31 +01:00
Alexander Neumann
0e66a66bce
read packs concurrently
2015-12-06 17:09:06 +01:00
Alexander Neumann
a1440c819b
Make NoLock a global option
2015-11-13 12:33:59 +01:00
Alexander Neumann
6edb7e02d0
Allow restoring and listing without locking
2015-11-10 22:13:53 +01:00
Alexander Neumann
c79dcbd7c4
Allow checking a read-only repo with --no-lock
2015-11-10 21:41:22 +01:00
Alexander Neumann
acba82c8f7
Merge pull request #252 from restic/repack-blobs
...
WIP: Repack blobs
2015-11-09 20:57:57 +01:00
Alexander Neumann
1f9aea9905
fix test on windows, reset read-only flag
2015-11-08 22:41:45 +01:00
Alexander Neumann
742d69bf4d
Add another test for optimizing unused blobs
2015-11-08 22:38:17 +01:00
Alexander Neumann
5776b8f01c
remove ConvertIndex
2015-11-08 22:27:13 +01:00
Alexander Neumann
2e6eee991d
Add test for optimize command with old indexes
2015-11-08 22:21:08 +01:00
Alexander Neumann
43e2c9837e
check: removing orphaned packs is handled in 'optimize'
2015-11-08 21:24:51 +01:00
Alexander Neumann
c4fc7b52ae
Add 'optimize' command that repacks blobs
2015-11-08 21:10:03 +01:00
Alexander Neumann
cd948b56ac
cmd_check: Don't display unused blobs by default
2015-11-08 20:46:52 +01:00
Alexander Neumann
ea41a1045f
Add integration test for error on readdirnames
2015-11-06 23:19:56 +01:00
Alexander Neumann
18d7f7f835
Read password from stdin if terminal is not a tty
2015-11-04 22:20:58 +01:00
Alexander Neumann
1fc0d78913
Refactor Index.Store() to take a PackedBlob
2015-11-02 19:07:03 +01:00
Alexander Neumann
50c2f2e87f
cmd_cat: allow dumping raw tree blobs
2015-11-02 17:36:04 +01:00
Alexander Neumann
fccde030d5
Refactor Index.Lookup() to return struct PackedBlob
2015-10-31 14:47:42 +01:00
Alexander Neumann
b5976474dd
backup: add debug output for excluded files/dirs
2015-10-27 22:34:30 +01:00
Alexander Neumann
00e05ae3c9
bugfix: close pack files after reading the header
2015-10-27 20:39:52 +01:00
Alexander Neumann
74cd134b54
rebuild index: remember already stored blobs
2015-10-25 22:34:22 +01:00
Alexander Neumann
734ae7fcb8
Add test for corner case
...
It was observed that a restic repository still contained overlapping
indexes after `rebuild-index` has been called. This is caused by
instantly forgetting that blobs have already been saved once a full
index has been written during index rebuilding.
This commit adds a (failing) test that shows the behaviour.
2015-10-25 21:51:57 +01:00
Alexander Neumann
7b8e42a763
Silence rebuild-index tests
2015-10-25 21:51:46 +01:00
Alexander Neumann
efbce9f0fa
rebuild-index: handle not yet indexed packs
2015-10-25 18:07:51 +01:00
Alexander Neumann
88849c06a6
rebuild-index: Refactor a bit
2015-10-25 17:53:02 +01:00
Alexander Neumann
6aed9f268b
Add command rebuild-index
2015-10-25 17:24:52 +01:00
Alexander Neumann
96ecc26507
Let the checker return a list of hints along with errors
2015-10-25 16:26:50 +01:00
Alexander Neumann
650eab6a0e
Fix typo in dump
usage
2015-10-25 13:19:35 +01:00
Alexander Neumann
7ab9915859
Fix 'dump' command
2015-10-12 22:42:31 +02:00
Alexander Neumann
86fcd170f6
Add and use MasterIndex
2015-10-12 22:34:12 +02:00
Alexander Neumann
de2c20be84
Dump individual indexes
2015-10-12 20:53:07 +02:00
Alexander Neumann
db85ab8aa0
Use the correct channel for sending errors
2015-10-11 19:13:45 +02:00
Chapuis Bertil
c765688779
find command integration tests
2015-08-28 19:31:05 +02:00
Chapuis Bertil
d4686ebcc5
Load the index and search subtree
2015-08-27 23:21:44 +02:00
Alexander Neumann
fcb769fa3b
Merge pull request #262 from restic/fix-tests
...
Fix tests
2015-08-18 22:45:50 +02:00
Alexander Neumann
1a47ea4ab8
test helpers: add RemoveAll and ResetReadOnly
...
This is mainly needed in Windows, where files and dirs cannot be
removed unless they are writeable.
2015-08-18 21:40:40 +02:00
klauspost
a3570af500
Create separate disEntry.equals for Windows.
...
Windows does not have UID/GID the same way as unix,
so we don't attempt to compare them.
2015-08-17 11:10:12 +02:00
klauspost
d5dab39a4a
Disable FUSE test on Windows.
2015-08-17 11:02:04 +02:00
Klaus Post
4dc746dac2
Change repository type detection to first check if path is a directory that exists.
...
The method of determining if a repository exists doesn't work on Windows, since
the "url.Scheme" will contain the drive letter - "c" in "c:\backup",
so as a first step we check if the URL can be opened as a file,
and if so, we assume it is a 'local' type repository.
2015-08-14 15:39:16 +02:00
Klaus Post
fb3778abb6
Disable mount command on Windows.
...
FUSE does not support Windows, so we disable it on Windows.
2015-08-14 15:33:11 +02:00
Alexander Neumann
dde0fd8421
Add option to use root as owner of files/dirs
2015-07-26 20:56:27 +02:00
Alexander Neumann
05e2afba0b
Merge pull request #249 from restic/reduce-fuse-memory-usage
...
Reduce memory usage for fuse mount
2015-07-26 19:20:13 +02:00
Alexander Neumann
b85927576b
Address code review comments
2015-07-26 18:01:20 +02:00
Alexander Neumann
d1629e1e4e
fuse: move to top level
2015-07-26 17:20:26 +02:00
Alexander Neumann
bd746a0425
fuse: refactor and add tests for fuse.file
2015-07-26 16:43:42 +02:00
Alexander Neumann
9753c37e31
Remove dead code
...
This removes dead code (functions that aren't called) detected with
`deadcode`.
2015-07-26 14:56:34 +02:00
Alexander Neumann
55ddd5317d
Reduce memory usage for fuse mount
...
This changes `repository.LoadBlob()` so that a destination buffer must
be provided, which enables the fuse code to use a buffer from a
`sync.Pool`. In addition, release the buffers when the file is closed.
At the moment, the max memory usage is defined by the max file size that
is read in one go (e.g. with `cat`). It could be further optimized by
implementing a LRU caching scheme.
2015-07-26 14:25:59 +02:00
Alexander Neumann
054256468b
Fix message display for parent snapshot id
2015-07-25 18:10:23 +02:00
Alexander Neumann
5cdcc99eba
Use array instead of hash for backend.ID
...
Since backend.ID is always a slice of constant length, use an array
instead of a slice. Mostly, arrays behave as slices, except that an
array cannot be nil, so use `*backend.ID` insteaf of `backend.ID` in
places where the absence of an ID is possible (e.g. for the Subtree of a
Node, which may not present when the node is a file node).
This change allows to directly use backend.ID as the the key for a map,
so that arbitrary data structures (e.g. a Set implemented as a
map[backend.ID]struct{}) can easily be formed.
2015-07-25 18:01:57 +02:00
Alexander Neumann
deaca157fe
restore: ignore errors
...
Also add a test for restoring a file that is owned by root. Closes #244 .
2015-07-25 12:59:59 +02:00
Alexander Neumann
cc34401152
Record exclude patterns in snapshot
...
This adds the exclude patterns used to create a backup in the snapshot,
so we can later compute statistics (like git does) on the data
structure, e.g. added/removed files etc. For that, we need the exclude
pattern.
2015-07-22 22:43:32 +02:00
Alexander Neumann
9911d46996
fuse: rename child/children -> node/items
2015-07-21 21:34:59 +02:00
Alexander Neumann
3f4b5b8d48
fuse/mount: display symlinks properly
2015-07-21 21:25:05 +02:00
Alexander Neumann
1ac72b8813
Fix style issue
2015-07-21 21:24:06 +02:00
Alexander Neumann
99dae57b4f
fuse: use node.Type instead of node.Mode
2015-07-21 21:23:40 +02:00
Alexander Neumann
aeb5a694d3
Merge pull request #238 from restic/fix-checks-on-bsd
...
Refactor skipping symlink timestamp checks on *bsd and darwin
2015-07-21 19:47:33 +02:00
Alexander Neumann
258b6a77ee
Refactor skipping symlink ModTime checks, add OpenBSD
2015-07-20 21:29:21 +02:00
Alexander Neumann
bd3ce5d4a3
Fix tests on freebsd
2015-07-20 21:08:29 +02:00
Alexander Neumann
1da89253cf
Add include filter for restore
...
Include and exclude filter are mutually exclusive.
2015-07-20 19:21:01 +02:00
Alexander Neumann
c0337a2675
Add exclude filter to restorer and 'restore' command
2015-07-20 19:21:01 +02:00
Alexander Neumann
7fd52f9f57
Add exclude filter to archiver and 'backup' command
2015-07-20 19:21:01 +02:00
Matthieu Rakotojaona
3767eb2675
Unmount and remove directory for mount in tests
2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
e44716381c
Unmount when closing application from cli
2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
eadfcd3f9e
Add waitForMount for OSX
2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
fe6f1c01f3
Make inodeFromBackendId more explicit
2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
a4d122e5ae
Cleanup mount after test
2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
d7888d4dd5
Fix checks in fuse tests
2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
ca6b7ec533
Add Index.LookupSize
2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
b1426826cc
Extract fuse structs
2015-07-19 23:03:33 +02:00
Matthieu Rakotojaona
0606b9884e
Make file.Read more intelligible
2015-07-19 23:03:33 +02:00
Matthieu Rakotojaona
3731a94367
Use functions to create names
2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
a016f82051
Fix coding style
2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
e654a9659c
Protect the snapshots cache with a RWMutex
2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
0e7c1668d5
Make mountpoint readable by owner only
2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
9ff98d34ef
Add build and test instructions
...
* Don't build on openbsd
* Don't test fuse on travis
2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
1f79a19293
Comment the go trick about static verification of a struct implementing an interface
2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
a8cd74ba7e
Cache known snapshots instead of re-traversing the repository every time
2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
c9b3eebc09
Check that mountpoints are created
2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
25b090a074
Add integration tests for mount command
2015-07-19 23:03:32 +02:00