private String toResultString(ReceiveCommand cmd) { switch (cmd.getType()) { case CREATE: return ReflogEntry.PREFIX_CREATED; case UPDATE: // Match the behavior of a single RefUpdate. In that case, setting // the force bit completely bypasses the potentially expensive // isMergedInto check, by design, so the reflog message may be // inaccurate. // // Similarly, this class bypasses the isMergedInto checks when the // force bit is set, meaning we can't actually distinguish between // UPDATE and UPDATE_NONFASTFORWARD when isAllowNonFastForwards() // returns true. return isAllowNonFastForwards() ? ReflogEntry.PREFIX_FORCED_UPDATE : ReflogEntry.PREFIX_FAST_FORWARD; case UPDATE_NONFASTFORWARD: return ReflogEntry.PREFIX_FORCED_UPDATE; default: return null; } }
private boolean checkNonFastForwards(RevWalk rw, List<ReceiveCommand> pending) throws IOException { if (isAllowNonFastForwards()) { return true; } for (ReceiveCommand cmd : pending) { cmd.updateType(rw); if (cmd.getType() == UPDATE_NONFASTFORWARD) { cmd.setResult(REJECTED_NONFASTFORWARD); ReceiveCommand.abort(pending); return false; } } return true; }
private String toResultString(ReceiveCommand cmd) { switch (cmd.getType()) { case CREATE: return ReflogEntry.PREFIX_CREATED; case UPDATE: // Match the behavior of a single RefUpdate. In that case, setting // the force bit completely bypasses the potentially expensive // isMergedInto check, by design, so the reflog message may be // inaccurate. // // Similarly, this class bypasses the isMergedInto checks when the // force bit is set, meaning we can't actually distinguish between // UPDATE and UPDATE_NONFASTFORWARD when isAllowNonFastForwards() // returns true. return isAllowNonFastForwards() ? ReflogEntry.PREFIX_FORCED_UPDATE : ReflogEntry.PREFIX_FAST_FORWARD; case UPDATE_NONFASTFORWARD: return ReflogEntry.PREFIX_FORCED_UPDATE; default: return null; } }
private boolean checkNonFastForwards(RevWalk rw, List<ReceiveCommand> pending) throws IOException { if (isAllowNonFastForwards()) { return true; } for (ReceiveCommand cmd : pending) { cmd.updateType(rw); if (cmd.getType() == UPDATE_NONFASTFORWARD) { cmd.setResult(REJECTED_NONFASTFORWARD); ReceiveCommand.abort(pending); return false; } } return true; }