Fix rebase patch set and revert change to update Git first

Like ReceiveCommits, update the Git reference before writing to
the database. This way the repository cannot be corrupted if the
server goes down between the two actions.

Change-Id: I8c1d70d65a1f3b121d4bdd8a0cc649f553eabfab
1 file changed