[gnome-builder] vcs: handle user host:foo/bar path handling
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] vcs: handle user host:foo/bar path handling
- Date: Wed, 27 Apr 2016 22:57:16 +0000 (UTC)
commit 06c7f19b282bd0d31d051b20ccd1acda7fba9e8a
Author: Christian Hergert <christian hergert me>
Date: Wed Apr 27 15:55:40 2016 -0700
vcs: handle user host:foo/bar path handling
We don't want to translate this to /foo/bar, but instead ~/foo/bar.
libide/ide-vcs-uri.c | 6 ++++++
tests/test-ide-vcs-uri.c | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-vcs-uri.c b/libide/ide-vcs-uri.c
index dd6f1c0..08f4614 100644
--- a/libide/ide-vcs-uri.c
+++ b/libide/ide-vcs-uri.c
@@ -165,6 +165,12 @@ ide_vcs_uri_parse (IdeVcsUri *self,
host = g_match_info_fetch (match_info, 2);
path = g_match_info_fetch (match_info, 3);
+ if (path && path[0] != '~' && path[0] != '/')
+ {
+ g_autofree gchar *tmp = path;
+ path = g_strdup_printf ("~/%s", tmp);
+ }
+
ide_vcs_uri_set_user (self, user);
ide_vcs_uri_set_host (self, host);
ide_vcs_uri_set_path (self, path);
diff --git a/tests/test-ide-vcs-uri.c b/tests/test-ide-vcs-uri.c
index 46527ea..c43710d 100644
--- a/tests/test-ide-vcs-uri.c
+++ b/tests/test-ide-vcs-uri.c
@@ -29,8 +29,8 @@ test_sample_uris (void)
{ "host.xz:/path/to/repo.git/", "ssh", NULL, "host.xz", "/path/to/repo.git/", 0,
"ssh://host.xz/path/to/repo.git/" },
{ "user host xz:~user/path/to/repo.git/", "ssh", "user", "host.xz", "~user/path/to/repo.git/", 0,
"ssh://user host xz/~user/path/to/repo.git/" },
{ "host.xz:~user/path/to/repo.git/", "ssh", NULL, "host.xz", "~user/path/to/repo.git/", 0,
"ssh://host.xz/~user/path/to/repo.git/" },
- { "user host xz:path/to/repo.git", "ssh", "user", "host.xz", "path/to/repo.git", 0, "ssh://user host
xz/path/to/repo.git" },
- { "host.xz:path/to/repo.git", "ssh", NULL, "host.xz", "path/to/repo.git", 0,
"ssh://host.xz/path/to/repo.git" },
+ { "user host xz:path/to/repo.git", "ssh", "user", "host.xz", "~/path/to/repo.git", 0, "ssh://user host
xz/~/path/to/repo.git" },
+ { "host.xz:path/to/repo.git", "ssh", NULL, "host.xz", "~/path/to/repo.git", 0,
"ssh://host.xz/~/path/to/repo.git" },
{ "rsync://host.xz/path/to/repo.git/", "rsync", NULL, "host.xz", "/path/to/repo.git/", 0,
"rsync://host.xz/path/to/repo.git/" },
{ "git://host.xz/path/to/repo.git/", "git", NULL, "host.xz", "/path/to/repo.git/", 0,
"git://host.xz/path/to/repo.git/" },
{ "git://host.xz/~user/path/to/repo.git/", "git", NULL, "host.xz", "~user/path/to/repo.git/", 0,
"git://host.xz/~user/path/to/repo.git/" },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]