Fix CLA hyperlink on account registration page.

The New Contributor Agreement hyperlink on the Account Registration page
is malformed, compared to the working one in the Account Settings menu.
This adjusts the way that link is formed.

Bug: Issue 1076
Change-Id: I4ef42411369e2247231214922030b928edaf5936
Improve performance of ReceiveCommits for repos with many refs

Commit 2fbea6c already improved performance of ReceiveCommits for repos
which have a lot of refs (>100000). In this case adding all existing
refs to RevWalk's as "uninteresting" caused performance problems. But
there was another place in ReceiveCommands where we added all existing
refs as uninteresting: in validateNewCommits(). This commit improves
the performance of this method in the same way as it was done in
2fbea6c.

Change-Id: I1ce6e4198daeabbcf5b8da61e6209b45672eb4be
Merge "Improve performance of ReceiveCommits for repos with many refs" into stable-2.5
Documentation: Fix broken link

Change-Id: I8a80b877f504258db55b0e6fc2341c786f5cf946
Fix: don't display all files from a merge-commit when auto-merge fails

The 60848f89959d41de83dfac2a0ee20d336cd7b3f1 tried to address the issue
that the Change Screen couldn't open for a patch set with merge commit
when the creation of an auto-merge tree failed in JGit (which happens
when the parents of the merge commit have multiple merge bases as JGit
doesn't support this case yet).  It considered the failure to create the
auto-merge tree as if the tree creation succeeded with conflicts. In
fact, the auto merge tree was empty and Gerrit considered all paths
as unmerged.  This caused several issues:
- the file list was too large for a project with large number of files
- Gerrit would send too many false notification emails to those watching
  changes under certain paths
- both client and server needed a lot of resources in order to handle
  such a large list of files

With this change the file list will be empty when creation of auto-merge
commit fails. This is not worse than showing a list of all files and it
resolves the issues listed above.

JGit will be able to auto-merge commits with multiple merge bases in a
near future [1] which will further reduce the number of cases where
Gerrit will incorrectly show an empty list of files for a patch-set with
merge commit.

[1] https://git.eclipse.org/r/8113

Change-Id: I76c51802f70d8d7f3d7cb797034ad19b77d84aa4
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Create ref for new patch set on direct push

If a change is in review and a new commit that has the Change-Id of
this change in its commit message is pushed directly, then a new patch
set for this commit is created and the change gets automatically
closed. The problem is that no change ref for this new patch set is
created and as result the change ref that is shown for the new patch
set in the WebUI and which is contained in the patchset-created event
is invalid.

Bug: issue 1726
Change-Id: I4e2ead6841565c3193b04fd4a39add1c8e900055
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
Revert "Create ref for new patch set on direct push"

This reverts commit 928a29657a0c122ce6e3fdc32f83b3a8f5bed8e3

It turned out that this breaks uploading of new patch sets for review
since in this case the change ref is already created and trying to
create it again fails.

Change-Id: Icb3678d19bf10201a3731f3f534942fa064416e2
Create ref for new patch set on direct push (second try)

If a change is in review and a new commit that has the Change-Id of
this change in its commit message is pushed directly, then a new patch
set for this commit is created and the change gets automatically
closed. The problem is that no change ref for this new patch set is
created and as result the change ref that is shown for the new patch
set in the WebUI and which is contained in the patchset-created event
is invalid.

Change-Id: I30843889a3f1d1e5a09503b2f30b363f1bf79495
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
Remove Mailing-List header from sent meails

The non-standard Mailing-List header included in the emails Gerrit
sends isn't allowed by Amazon Simple Email Service and isn't very
useful anyway. For filtering purposes in email clients the List-Id
header should be sufficient.

Bug: issue 1444
Change-Id: I8eb29f0e3bb8e09f797190286499436c06352c56
Improve SMTP client error messages

Change the wording of a couple of the error messages in the SMTP client
to make it more clear at exactly what stage in the SMTP transaction the
server returned an error, and always include the server's response text.

Also, make sure already rejected recipients are included in the error
message when the server rejects the DATA command. Otherwise there's no
way of debugging rejected recipients if all recipients are rejected
since that typically results in a DATA command rejection. Because some
SMTP servers (e.g. Postfix with the default configuration) delay
rejection of HELO/EHLO and MAIL FROM commands to the RCPT TO stage,
this can happen not only for bad recipients.

Change-Id: I4cdd5f18563b038dc724346d79cb77e1dc3aa4c1
Merge "Improve SMTP client error messages" into stable-2.5
Allow time unit variables to be 0

plugins.checkFrequency can be disabled by setting the time to 0,
but this is not allowed in a time unit typed variable due to the
regex requiring the value to start with a digit in the range 1-9.
Permit 0 as a value.

Change-Id: I2deca08fe9b0ea93ef23f626fc44cffe98ad2d95
Prepare release notes for Gerrit 2.5.2

Describe the bug-fixes that were done for Gerrit 2.5.2 in the 2.5.2
release notes. Gerrit 2.5.2 will not be released yet, but it's good
to have the release notes already prepared.

Change-Id: I0b94127e33218414ce3f5c819466b884b93e669e
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
Merge "Prepare release notes for Gerrit 2.5.2" into stable-2.5
Remove wrong error message if pushing a new ref fails

If pushing a new ref is rejected because the user is not allowed to
create it the error message always told the user that he's missing the
'Create Reference' access right. This is not true in all cases, users
may have the 'Create Reference' access right assigned and still they
are not allowed to create the ref:
- pushing an annotated tag requires the 'Push Annotated Tag' access
  right
- pushing a signed tag requires the 'Push Signed Tag' access right
- the project state may be set to 'Read Only'

It is better to have a generic error message that is described in the
documentation than having a more concrete error message that is wrong
in some cases. A wrong error message misleads and confuses the user.

Updating the description of the 'Prohibited by Gerrit' error in the
documentation to explain some additional cases in which this error
occurs.

Bug: issue 1767
Change-Id: I45470256107198ae9208ccc375a6ec8d0c4f6e1d
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
Discard cache-automerge/* refs early in VisibleRefFilter.

By discarding refs in refs/cache-automerge/ early in
VisibleRefFilter, we can make life easier for both
the TagMatcher and later RevWalks.

For typical large Git, with many refs and lots of cached merges,
we could cut the push time down significantly.

Change-Id: I1c1c1bda1944f42bc5a64c02114045e7bbd9bede
Unset GREP_OPTIONS in the commit-msg hook

If GREP_OPTIONS is set, it can cause unexpected behaviour in the
commit-msg hook.  For example if it includes a setting like:

  --exclude=".git/*"

it causes a new Change-Id line to be appended to the commit message
on every amend.

Unsetting GREP_OPTIONS at the beginning of the hook script will
prevent such problems from occurring.

The GREP_OPTIONS setting in the user's environment is unaffected
by this change.

Bug: Issue 1569

Change-Id: If53566abf370cd526aa8159a6a243a56afa8d4e0
Update 2.5.2 release notes with info about commit-msg hook fix

Change-Id: Ifaa58931fc550ad4a769f53cf4240f10823221b8
Merge "Discard cache-automerge/* refs early in VisibleRefFilter." into stable-2.5
Update release notes for Gerrit 2.5.2

Describe two more fixes that were merged lately.

Change-Id: Ia3cbe48e2e578beb92f5d5835403931d1e541893
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>