Prevent "test.git.git" turning into "test.git" in the Changes table.

Prevent "test.git.git" turning into "test.git" in the
Changes table even though the project name is really "test".

Gerrit drops the project name's trailing ".git" suffix like:

 'p'      -> 'p'
 'p.git'  -> 'p'
 'p/.git' -> 'p'.

then Gerrit try to search 'p' in cache, if Gerrit cannot find 'p' in
cache, Gerrit will check disk repositories with name 'p', 'p/.git' and
'p.git' in order.

So once users provide 'test.git.git', Gerrit firstly convert it into
'test.git', then search 'test.git' in cache, then search 'test.git',
'test.git/.git', 'test.git.git' in order in the disk repositories.
So if 'test.git' exists on disk, Gerrit will return it back and stop
searching 'test.git/.git' or 'test.git.git'.

But in fact Gerrit should search 'test.git/.git' or 'test.git.git' on
the disk repositories, the logic is:

 ---------------------------------------------------------------
  users provide  | search in cache|  search in disk repositories
 ----------------+----------------+-----------------------------
 'p'             |       'p'      |  'p' or  'p/.git' or 'p.git'
 'p/.git'        |       'p'      |  'p' or  'p/.git' or 'p.git'
 'p.git'         |       'p'      |  'p' or  'p/.git' or 'p.git'
 ----------------+----------------+-----------------------------
  p.git/.git     |     'p.git'    |  'p.git/.git' or 'p.git.git'
  p.git.git      |     'p.git'    |  'p.git/.git' or 'p.git.git'
 ----------------+----------------+-----------------------------

This patch fix this bug based on this logic, thus in the case of
issue 1699 Gerrit will not think of 'test.git' on disk as the provided
'test.git.git', so reject the push command and will not create dirty
data any more.

Bug: issue 1699
Change-Id: I1a884b1e9c95fb940af5d9e8d3d5a074e6388da5
1 file changed