diff options
author | Kevin Sawicki | 2011-09-01 17:29:26 +0000 |
---|---|---|
committer | Kevin Sawicki | 2011-09-01 17:29:26 +0000 |
commit | f1baacd2eafc854118ac9bcf6568e34fe9d593cd (patch) | |
tree | dbd417b4d1b1f735f7741ae7809092d3455d3cb4 /org.eclipse.mylyn.github.core | |
parent | 86e4ea89c0b6e131a4ac01b9a5a6e9407a7ca975 (diff) | |
download | egit-github-f1baacd2eafc854118ac9bcf6568e34fe9d593cd.tar.gz egit-github-f1baacd2eafc854118ac9bcf6568e34fe9d593cd.tar.xz egit-github-f1baacd2eafc854118ac9bcf6568e34fe9d593cd.zip |
Use pull URL when not Gist owner.
This bypasses the need for a credentials provider configured
on the clone operation.
Cloning a Gist that you are not the owner of will no longer require
a SSH key.
Change-Id: Iccc527bf5e809b619041066093cfd0018bf484d3
Signed-off-by: Kevin Sawicki <kevin@github.com>
Diffstat (limited to 'org.eclipse.mylyn.github.core')
-rw-r--r-- | org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java index 2e9f9565..7c7397f0 100644 --- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java @@ -84,6 +84,7 @@ public class GistTaskDataHandler extends GitHubTaskDataHandler { */ public TaskData fillTaskData(TaskRepository repository, TaskData data, Gist gist) { + boolean isOwner = isOwner(repository, gist.getUser()); TaskAttributeMapper mapper = data.getAttributeMapper(); TaskAttribute key = GistAttribute.KEY.getMetadata().create(data); @@ -91,8 +92,7 @@ public class GistTaskDataHandler extends GitHubTaskDataHandler { TaskAttribute description = GistAttribute.DESCRIPTION.getMetadata() .create(data); - description.getMetaData().setReadOnly( - !isOwner(repository, gist.getUser())); + description.getMetaData().setReadOnly(!isOwner); String gistDescription = gist.getDescription(); if (gistDescription != null) mapper.setValue(description, gistDescription); @@ -108,9 +108,12 @@ public class GistTaskDataHandler extends GitHubTaskDataHandler { TaskAttribute url = GistAttribute.URL.getMetadata().create(data); url.setValue(gist.getHtmlUrl()); - TaskAttribute pullUrl = GistAttribute.CLONE_URL.getMetadata().create( + TaskAttribute cloneUrl = GistAttribute.CLONE_URL.getMetadata().create( data); - pullUrl.setValue(gist.getGitPushUrl()); + if (isOwner) + cloneUrl.setValue(gist.getGitPushUrl()); + else + cloneUrl.setValue(gist.getGitPullUrl()); IRepositoryPerson reporterPerson = null; User user = gist.getUser(); |