Line data Source code
1 : // Copyright (C) 2016 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.submit; 16 : 17 : import static com.google.gerrit.server.submit.CommitMergeStatus.EMPTY_COMMIT; 18 : 19 : import com.google.gerrit.entities.BooleanProjectConfig; 20 : import com.google.gerrit.server.git.CodeReviewCommit; 21 : import com.google.gerrit.server.update.RepoContext; 22 : 23 : class FastForwardOp extends SubmitStrategyOp { 24 : FastForwardOp(SubmitStrategy.Arguments args, CodeReviewCommit toMerge) { 25 53 : super(args, toMerge); 26 53 : } 27 : 28 : @Override 29 : protected void updateRepoImpl(RepoContext ctx) { 30 53 : if (args.project.is(BooleanProjectConfig.REJECT_EMPTY_COMMIT) 31 6 : && toMerge.getParentCount() > 0 32 2 : && toMerge.getTree().equals(toMerge.getParent(0).getTree())) { 33 2 : toMerge.setStatusCode(EMPTY_COMMIT); 34 2 : return; 35 : } 36 : 37 53 : args.mergeTip.moveTipTo(toMerge, toMerge); 38 53 : } 39 : }