Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 385542

Summary: Git repositories that are Gerrit-enabled show wrong ssh urls on http://git.eclipse.org/c
Product: Community Reporter: Markus Keller <markus.kell.r>
Component: GerritAssignee: Eclipse Webmaster <webmaster>
Status: RESOLVED WORKSFORME QA Contact:
Severity: minor    
Priority: P3 CC: daniel_megert, denis.roy, michael, pascal, roger
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Markus Keller CLA 2012-07-19 14:35:32 EDT
Git repositories that are Gerrit-enabled show wrong ssh urls on the project pages linked from http://git.eclipse.org/c .

E.g. http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/ says at the bottom:
    ssh://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git
but according to bug 379652 comment 1, committers have to use
    ssh://git.eclipse.org:29418/jdt/eclipse.jdt.core.git
now.

Most users who need the ssh connection eventually want to push commits, and this doesn't work any more via the given url.
Comment 1 Denis Roy CLA 2012-07-19 15:12:27 EDT
I'm not sure how I could, from a C program, detect that a repo is using Gerrit.  For now the best I can do is remove the SSH URLs from all the repos.
Comment 2 Markus Keller CLA 2012-07-23 06:54:48 EDT
The outcome of bug 379652 was to keep the original ssh URL working for Eclipse SDK projects, so this is not an issue any more for these projects.

That makes this bug low prio for me.

> I'm not sure how I could, from a C program, detect that a repo is using Gerrit.

This problem only shows up for repos where Gerrit has exclusive write access. The C program could execute "stat -c %U <path-to-repo>", and if the result is "gerrit", then it could add the port and strip "gitroot/".

>  For now the best I can do is remove the SSH URLs from all the repos.

Please leave them -- they're valid in many cases and still better than nothing.
Comment 3 Denis Roy CLA 2014-01-30 09:14:53 EST
*** Bug 426957 has been marked as a duplicate of this bug. ***
Comment 4 Michael Jastram CLA 2014-06-27 10:17:32 EDT
I stumbled on this one as well.  Maybe worth adding a general comment (on ALL pages), along these lines:

NOTE: If the repository is managed via Gerrit, you need a different URL (link to Gerrit Wiki page).
Comment 5 Denis Roy CLA 2014-06-27 10:21:18 EDT
I should be able to look at the file owners to determine it is a Gerrit-owned repo, and make something intelligent of it.  cGit is written in C, which is not my strong suit.
Comment 6 Denis Roy CLA 2014-06-27 16:00:14 EDT
I've got this mostly working.  Compare a pure Git repo:

http://git.eclipse.org/c/datatools/org.eclipse.datatools.build.git/


To a Gerrit repo:
http://git.eclipse.org/c/cdo/cdo.git/

I do need to strip ".git" from the URL, but I'm not sure how to do that in C.

Here is the code snippet:

if (strcmp(ctx.repo->owner, "Code Review") == 0) {
     // TODO: strip ".git" from suffix
     print_url("https://git.eclipse.org/r/#/admin/projects", suffix);
     break;
}
else {
     print_url(h, suffix);
}

Anyone knowledgeable with C out there?  Where's Doug when you need him.
Comment 7 Denis Roy CLA 2014-07-03 10:02:43 EDT
I think I can call this one fixed.

For plain git repos, the usual three clone URLs are shown
http://git.eclipse.org/c/actf/org.eclipse.actf.ai.git/

For Gerrit-enabled repos, I link to Gerrit Code Review, which has all the clone URLs.
http://git.eclipse.org/c/cdo/cdo.git/
Comment 8 Markus Keller CLA 2014-07-03 12:01:32 EDT
> For plain git repos, the usual three clone URLs are shown

That's also the case for Gerrit-enabled repos that still offer direct access:
http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/
Comment 9 Denis Roy CLA 2014-07-03 23:06:07 EDT
I think I'll do this:

- list the anonymous clone URLs (http & git) for all repos

- remove SSH since it only applies to committers, and they already receive instructions from webmaster on how to access their repos

- Link to Gerrit as I do now, for those repos that are owned by Gerrit.

While at the Gerrit User Summit 2014, it was stated that discouraging the usage of Gerrit for anonymous cloning is highly desirable.


> for Gerrit-enabled repos that still offer direct access:
That's a corner case that we don't encourage.  From cGit, unless the repo is owned by Gerrit, I can't easily determine the presence of Gerrit.  Sorry.
Comment 10 Dani Megert CLA 2014-07-23 10:24:19 EDT
(In reply to Denis Roy from comment #9)
> - remove SSH since it only applies to committers, and they already receive
> instructions from webmaster on how to access their repos

No, that would be bad. I often have to clone some rarely used repos and for that I just want to be able to copy/paste the SSH URL.
Comment 11 Eclipse Genie CLA 2016-07-13 06:47:37 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 12 Eclipse Webmaster CLA 2016-07-27 10:06:05 EDT
I'm going to close this as 'worksforme' since nothing has changed in the last 2 years.

It's been a loooong time since I've written C, but I think something like the following *should* work

if (strcmp(ctx.repo->owner, "Code Review") == 0) {
     // TODO: strip ".git" from suffix
     char * destsuffix;
     strncpy(destsuffix,suffix,strcspn(suffix,".git"));
     print_url("https://git.eclipse.org/r/#/admin/projects", destsuffix);
     break;
}
else {
     print_url(h, suffix);
}