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
This commit is contained in:
parent
16da16af68
commit
5cf89bc928
@ -506,8 +506,8 @@ public class ProjectControl {
|
||||
} catch (IncorrectObjectTypeException e) {
|
||||
continue;
|
||||
}
|
||||
if (rw.isMergedInto(commit, tip)
|
||||
&& controlForRef(entry.getKey()).canPerform(Permission.READ)) {
|
||||
if (controlForRef(entry.getKey()).canPerform(Permission.READ)
|
||||
&& rw.isMergedInto(commit, tip)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user