for safely creating a `String` object from `StoreId` which can be shown
to the user.
Mainly introduced because this is useful for error handling (when
putting a `StoreId` into an error kind, the compiler complains that
`StoreId` does not meet the required trait bounds. But `String` does and
we do not process the ID any further anyways).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Basically a complete rewrite. This now is able to parse git installed
imag version strings and behave accordingly.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
The implementation of the in-memory filesystem for testing imag code did
not actually use `HashMap::remove()` when an entry was moved, but
`HashMap::get().cloned()`, which caused the original entry to exist
_after_ the move.
I'm not sure why this did not fail much earlier, but it was clearly
wrong. This commit adjust the test to check the "filesystem" before
checking the store and fixes the bug.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This actually caused tests to fail if there was indeed a file at
/tmp/store/test and the test tried to create a "test" entry in the store.
Do use backend instead to check whether entry actually exists.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This fixes a bug where a re-import of the contacts directory failed
because some entries already exist.
With this change, one can import the contact directory after things
changed in there and the imag database is updated accordingly, but not
altered. So links and notes are persisting.
For completeness: before, the workflow was to
`cd $IMAG_RTP && git rm store/contacts -r && imag contact import /path/to/contacts`
which is of course not optimal.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Checking whether we have a file (on the FS) here is not enough for
either case (external link/internal link).
Thus, we should check whether a store entry with that ID exists. If it
does, we link internally, else externally by trying to parse the string
as URL.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Finally some updates for the dependencies. We had a "dependency update
branch" already some weeks ago, but this branch has even more updates.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
The issue was that the handlebars implementation logs as well and if we
use handlebars in the logger implementation that causes recursion which
crashes the program.
With handlebars 1.0.5, there is a feature[0] to disable logging in
handlebars (compiletime) which we use with this patch. The
exception-checking in the log implementation can be removed therefore.
[0]: https://github.com/sunng87/handlebars-rust/pull/236#issuecomment-427014611
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
The current implementation does not panic on VcardBuilder::build(), so
we unwrap() that directly.
Should be fixed in future versions of either rust-vobject or here, so
that we error appropriately.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>