mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug #732
- changed the parsing of ssh:// URIs, paths are now absolute by default
This commit is contained in:
parent
df8496edae
commit
398371d324
4 changed files with 24 additions and 11 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue