DESCRIPTION

Improve Gerrit configuration

Fix enablement of the push to/fetch from Gerrit commands.

Try to auto-configure existing repositories when added, similar to
after cloning: if there's a push refspec indicating a push to Gerrit,
add the fetch refspec for review notes, and do add the
gerrit.createChangeId entry if not present yet.

Bug: 497479
Change-Id: I9bd3dc3679b7010580e80cd4528c356b437688d0
Signed-off-by: Alayna Houston xxx@xxx.xxx

COMMENTS

author: Alayna Houston
date: 2016-07-09 12:57:21.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2016-07-09 12:57:27.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/8815/

-------------------------------------
author: Brenden Conley
date: 2016-07-09 13:22:08.000000000

Patch Set 1: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/8815/ : UNSTABLE

-------------------------------------
author: Brenden Conley
date: 2016-07-09 14:39:26.000000000

Patch Set 1: -Code-Review

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/8816/

-------------------------------------
author: Brenden Conley
date: 2016-07-09 15:04:23.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/8816/ : SUCCESS

-------------------------------------
author: Kaeden Tapia
date: 2016-07-11 14:26:05.000000000

Patch Set 1:

(1 comment)

Line:232, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java -> isn't the change ID optional?

-------------------------------------
author: Alayna Houston
date: 2016-07-11 16:58:51.000000000

Patch Set 1:

(1 comment)

Line:232, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java -> For Gerrit? That would be a new one to me. Try pushing something without change-ID to a refs/for/... refspec. I thought it was mandatory...

EGit creates that setting when it auto-configures for Gerrit after a clone, so I included it here, too. But frankly said, I'd have to check if EGit actually uses it. Maybe not... I know that Gerrit's commit-msg hook does use it, though. (Which in turn is not used by EGit AFAIK.)

-------------------------------------
author: Kaeden Tapia
date: 2016-07-11 17:02:58.000000000

Patch Set 1:

(1 comment)

Line:232, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java -> It's configurable at the project level in Gerrit:
"Require Change-Id in commit message: FALSE/TRUE"

A lot of projects at Eclipse.org set it to TRUE though, but not everywhere.

-------------------------------------
author: Alayna Houston
date: 2016-07-11 17:12:18.000000000

Patch Set 1:

(1 comment)

Line:232, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java -> I have never ever encountered a Gerrit (project) that did not require change-IDs. I believe it's a left-over from very early times, and as they point out themselves, working without change-IDs can be rather tedious: see https://git.eclipse.org/r/Documentation/user-upload.html#push_replace .

But I'll check whether EGit uses that at all, and if not, I can leave it out here. Auto-configure after clone will still add it, though.

-------------------------------------
author: Kaeden Tapia
date: 2016-07-11 18:03:16.000000000

Patch Set 1:

(1 comment)

Line:232, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java -> It's FALSE by default on the Eclipse server, so there are actually a lot of them
https://git.eclipse.org/r/#/admin/projects/platform/eclipse.platform.swt
https://git.eclipse.org/r/#/admin/projects/platform/eclipse.platform.releng
https://git.eclipse.org/r/#/admin/projects/pde/eclipse.pde.ui
etc

It's fine if you keep it, but at least it's a conscious thing now. I was more worried that code that detected whether or not it's a Git push relied on change-id. If that was the case, it would mean some remote configs would not correctly be detected. I understand if EGit does that for you but a lot of people use mainly the command line and occasionally use EGit/EGerrit and it should work as much as possible out of the box.

-------------------------------------
author: Alayna Houston
date: 2016-07-11 18:36:16.000000000

Patch Set 1:

(1 comment)

Line:232, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java -> OK. Intrestingly the vast majority of commits in eclipse.platform.swt _has_ a change-ID. (I admit that I only spot-checked two dozen or so...)

Anyway: I think I'll keep this. It's only added if not present yet, and setting it doesn't hurt. EGit uses the config setting to determine the default state of its "Create Change-ID" button in the commit dialog/staging view.

And no, the logic to detect whether we are dealing with a likely Gerrit is based on push refspecs. If there is one that looks like a Gerrit refspec /refs/for, refs/publish, refs/drafts, then we consider the server to be a Gerrit.

The alternative (which would be much more expensive, though), would be go asking the servers (for all ssh or https refspecs) whether one of them was a Gerrit, but I think that's not necessary here, where we add an already existing git repo.

-------------------------------------
author: Kaeden Tapia
date: 2016-07-11 19:26:47.000000000

Patch Set 1:

(1 comment)

Line:232, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java -> Sounds good! (too keep it)

-------------------------------------
author: Douglas Trujillo
date: 2016-07-11 23:08:24.000000000

Patch Set 1:

(3 comments)

Line:232, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java -> I think the default on the Eclipse Gerrit server should be changed to TRUE

Line:232, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java -> AFAIK requiring a changeID is optional, but only for the first patchset, for all subsequent patchsets the changeID is required since otherwise Gerrit doesn't know for which change this should be a new patchset [1]. Hence I think it makes sense to always add the changeID if we know the remote is a Gerrit server.

For the same reason I think it would make sense to change the default on the Eclipse Gerrit server to always require changeID.

[1] https://gerrit-review.googlesource.com/Documentation/user-changeid.html

Line:232, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java -> if this option isn't set EGit will not automatically add a changeID

-------------------------------------
author: Gerrit Johnathan Pham
date: 2016-07-12 09:32:01.000000000

Change has been successfully merged into the git repository by Douglas Trujillo

-------------------------------------
