receive-pack.c: use a single transaction for all refs during receive

Switch from one transaction per ref to a single transaction for all refs.
If the transaction fails we flag all refs as "ng" with the same error message.
This message is either "transaction error" if we failed to start a transaction
or it is the output from err.buf which holds what ref_transaction_update
wrote for the first ref that failed and thus broke the transaction.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
walker.c: lock all refs before processing in walker_fetch

Update walker_fetch to lock all refs before we start processing them
by temporarily updating the refs to a magic sha1. Then rely on that
the first _update will lock the ref and the second time we _update the ref
we set it to teh value it should have.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
refs.c: use the transaction to manage the reflog in rename_refs

We have a transaction in rename_ref to managing the ref during the rename.
Use this transaction to manage the changes to the reflog too.
This now means that rename_ref is almost completely agnostic about how refs
storage is implemented and should be easier to migrate if/when we allow a
different store for refs, such as a database.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>