Do not retain commit body in RevWalk for reachability checks
Commit body contains the message that is not needed for reachability checks, and takes up memory unnecessarily. Change-Id: I0c7f6da249bf9c4fda9dc9e62e809322c68effce Signed-off-by: Minh Thai <mthai@google.com>
This commit is contained in:
parent
e48410ae9a
commit
cc2a223fea
|
@ -315,6 +315,7 @@ protected boolean compareAndPut(Ref oldRef, @Nullable Ref newRef)
|
|||
throws IOException {
|
||||
ReceiveCommand cmd = toCommand(oldRef, newRef);
|
||||
try (RevWalk rw = new RevWalk(getRepository())) {
|
||||
rw.setRetainBody(false);
|
||||
newBatchUpdate().setAllowNonFastForwards(true).addCommand(cmd)
|
||||
.execute(rw, NullProgressMonitor.INSTANCE);
|
||||
}
|
||||
|
|
|
@ -599,6 +599,7 @@ public Result forceUpdate() throws IOException {
|
|||
*/
|
||||
public Result update() throws IOException {
|
||||
try (RevWalk rw = new RevWalk(getRepository())) {
|
||||
rw.setRetainBody(false);
|
||||
return update(rw);
|
||||
}
|
||||
}
|
||||
|
@ -646,6 +647,7 @@ Result execute(Result status) throws IOException {
|
|||
*/
|
||||
public Result delete() throws IOException {
|
||||
try (RevWalk rw = new RevWalk(getRepository())) {
|
||||
rw.setRetainBody(false);
|
||||
return delete(rw);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -489,6 +489,7 @@ public ObjectId resolve(String revstr)
|
|||
throws AmbiguousObjectException, IncorrectObjectTypeException,
|
||||
RevisionSyntaxException, IOException {
|
||||
try (RevWalk rw = new RevWalk(this)) {
|
||||
rw.setRetainBody(false);
|
||||
Object resolved = resolve(rw, revstr);
|
||||
if (resolved instanceof String) {
|
||||
final Ref ref = findRef((String) resolved);
|
||||
|
@ -515,6 +516,7 @@ public ObjectId resolve(String revstr)
|
|||
public String simplify(String revstr)
|
||||
throws AmbiguousObjectException, IOException {
|
||||
try (RevWalk rw = new RevWalk(this)) {
|
||||
rw.setRetainBody(true);
|
||||
Object resolved = resolve(rw, revstr);
|
||||
if (resolved != null)
|
||||
if (resolved instanceof String)
|
||||
|
|
|
@ -272,6 +272,7 @@ public BasePackFetchConnection(PackTransport packTransport) {
|
|||
|
||||
if (local != null) {
|
||||
walk = new RevWalk(local);
|
||||
walk.setRetainBody(false);
|
||||
reachableCommits = new RevCommitList<>();
|
||||
REACHABLE = walk.newFlag("REACHABLE"); //$NON-NLS-1$
|
||||
COMMON = walk.newFlag("COMMON"); //$NON-NLS-1$
|
||||
|
|
|
@ -314,6 +314,7 @@ public Set<String> getCapabilities() {
|
|||
protected BaseReceivePack(Repository into) {
|
||||
db = into;
|
||||
walk = new RevWalk(db);
|
||||
walk.setRetainBody(false);
|
||||
|
||||
TransferConfig tc = db.getConfig().get(TransferConfig.KEY);
|
||||
objectChecker = tc.newReceiveObjectChecker();
|
||||
|
|
|
@ -200,6 +200,7 @@ else if (tagopt == TagOpt.FETCH_TAGS)
|
|||
.setAllowNonFastForwards(true)
|
||||
.setRefLogMessage("fetch", true); //$NON-NLS-1$
|
||||
try (RevWalk walk = new RevWalk(transport.local)) {
|
||||
walk.setRetainBody(false);
|
||||
if (monitor instanceof BatchingProgressMonitor) {
|
||||
((BatchingProgressMonitor) monitor).setDelayStart(
|
||||
250, TimeUnit.MILLISECONDS);
|
||||
|
|
Loading…
Reference in New Issue