private void sendStatusReport(bool forClient, Reporter rout) { if (unpackError != null) { rout.sendString("unpack error " + unpackError.Message); if (forClient) { foreach (ReceiveCommand cmd in commands) { rout.sendString("ng " + cmd.getRefName() + " n/a (unpacker error)"); } } return; } if (forClient) rout.sendString("unpack ok"); foreach (ReceiveCommand cmd in commands) { if (cmd.getResult() == ReceiveCommand.Result.OK) { if (forClient) rout.sendString("ok " + cmd.getRefName()); continue; } StringBuilder r = new StringBuilder(); r.Append("ng "); r.Append(cmd.getRefName()); r.Append(" "); switch (cmd.getResult()) { case ReceiveCommand.Result.NOT_ATTEMPTED: r.Append("server bug; ref not processed"); break; case ReceiveCommand.Result.REJECTED_NOCREATE: r.Append("creation prohibited"); break; case ReceiveCommand.Result.REJECTED_NODELETE: r.Append("deletion prohibited"); break; case ReceiveCommand.Result.REJECTED_NONFASTFORWARD: r.Append("non-fast forward"); break; case ReceiveCommand.Result.REJECTED_CURRENT_BRANCH: r.Append("branch is currently checked out"); break; case ReceiveCommand.Result.REJECTED_MISSING_OBJECT: if (cmd.getMessage() == null) r.Append("missing object(s)"); else if (cmd.getMessage().Length == 2 * Constants.OBJECT_ID_LENGTH) r.Append("object " + cmd.getMessage() + " missing"); else r.Append(cmd.getMessage()); break; case ReceiveCommand.Result.REJECTED_OTHER_REASON: if (cmd.getMessage() == null) r.Append("unspecified reason"); else r.Append(cmd.getMessage()); break; case ReceiveCommand.Result.LOCK_FAILURE: r.Append("failed to lock"); break; case ReceiveCommand.Result.OK: // We shouldn't have reached this case (see 'ok' case above). continue; } rout.sendString(r.ToString()); } }