canReadCommit: swap preconditions check to improve performance

It is much cheaper to check READ access on a ref than to check
if a commit is merged into that ref. Therefore, do the checks in
this order and avoid traversal of potentially large commit graph
when we know that the user cannot read that branch.

Change-Id: I008990915e15854100a84b3d795f6c54efe35c81
1 file changed