diff --git a/doc/man/task-faq.5.in b/doc/man/task-faq.5.in index 1e7af3527..a0bd42f83 100644 --- a/doc/man/task-faq.5.in +++ b/doc/man/task-faq.5.in @@ -155,8 +155,8 @@ a second database. Here is a basic example of the procedure: - $ task merge ssh://user@myremotehost/.task/ - $ task push ssh://user@myremotehost/.task/ + $ task merge ssh://user@myremotehost/~/.task/ + $ task push ssh://user@myremotehost/~/.task/ The first command fetches the undo.data file from the remote system, reads the changes made and updates the local database. When this merge command completes, diff --git a/doc/man/task-sync.5.in b/doc/man/task-sync.5.in index 1aa4660c6..f3d31c3c9 100644 --- a/doc/man/task-sync.5.in +++ b/doc/man/task-sync.5.in @@ -109,19 +109,26 @@ All the other URIs allow access to remote machines. The first uses SSH and scp .br .RS -ssh://[user@]host[:port]/path/to/.task/ +ssh://[user@]host[:port]/absolute/path/to/.task/ .br -[user@]host:path/to/.task/ +[user@]host:/absolute/path/to/.task/ .RE -Remember that in both cases paths are considered to be relative to the users home directory, -i.e. they will expand to ~/path/to/.task/. You can specify absolute paths as follows: +In both cases paths are considered to be absolute. You can specify paths relative to the +users home directory as follows: .br .RS -ssh://[user@]host[:port]//absolute/path/to/.task/ +ssh://[user@]host[:port]/~/.task/ .br -[user@]host:/absolute/path/to/.task/ +[user@]host:~/.task/ +.RE + +or even shorter + +.br +.RS +[user@]host:.task/ .RE Remark: Since taskwarrior simply calls the scp binary you can specify very much anything @@ -130,9 +137,9 @@ expansion: .br .RS -ssh://configured-host/~[user]/.task/ +ssh://configured-host/~[username]/.task/ .br -configured-host:~[user]/.task/ +configured-host:~[username]/.task/ .RE diff --git a/src/Uri.cpp b/src/Uri.cpp index 36791ff25..67786f622 100644 --- a/src/Uri.cpp +++ b/src/Uri.cpp @@ -255,6 +255,12 @@ void Uri::parse () throw std::string ("The uri '") + data + "' is not in the expected format."; } + // path is absolute for ssh:// syntax + if ( (protocol == "ssh") && (pathDelimiter == "/") ) + { + path = "/" + path; + } + // port specified? // remark: this find() will never be != npos for scp-like syntax // because we found pathDelimiter, which is ":", before diff --git a/test/uri.t.cpp b/test/uri.t.cpp index 1fb4a0db9..55163677e 100644 --- a/test/uri.t.cpp +++ b/test/uri.t.cpp @@ -125,7 +125,7 @@ int main (int argc, char** argv) t.is (uri11.user, "user.name", "Uri::parse() : ssh://user.name@host.com/undo.data"); t.is (uri11.host, "host.com", "Uri::parse() : ssh://user.name@host.com/undo.data"); t.is (uri11.port, "", "Uri::parse() : ssh://user.name@host.com/undo.data"); - t.is (uri11.path, "undo.data", "Uri::parse() : ssh://user.name@host.com/undo.data"); + t.is (uri11.path, "/undo.data", "Uri::parse() : ssh://user.name@host.com/undo.data"); t.is (uri11.protocol, "ssh", "Uri::parse() : ssh://user.name@host.com/undo.data");