unexpectedEofInPack=Unexpected EOF in partially created pack
unexpectedHunkTrailer=Unexpected hunk trailer
unexpectedOddResult=odd: {0} + {1} - {2}
+unexpectedPacketLine=unexpected {0}
unexpectedRefReport={0}: unexpected ref report: {1}
unexpectedReportLine=unexpected report line: {0}
unexpectedReportLine2={0} unexpected report line: {1}
unknownObjectType2=unknown
unknownRepositoryFormat=Unknown repository format
unknownRepositoryFormat2=Unknown repository format "{0}"; expected "0".
+unknownTransportCommand=unknown command {0}
unknownZlibError=Unknown zlib error.
unmergedPath=Unmerged path: {0}
unmergedPaths=Repository contains unmerged paths
/***/ public String unexpectedEofInPack;
/***/ public String unexpectedHunkTrailer;
/***/ public String unexpectedOddResult;
+ /***/ public String unexpectedPacketLine;
/***/ public String unexpectedRefReport;
/***/ public String unexpectedReportLine;
/***/ public String unexpectedReportLine2;
/***/ public String unknownObjectType2;
/***/ public String unknownRepositoryFormat;
/***/ public String unknownRepositoryFormat2;
+ /***/ public String unknownTransportCommand;
/***/ public String unknownZlibError;
/***/ public String unmergedPath;
/***/ public String unmergedPaths;
if (useProtocolV2) {
String symrefPart = symrefs.containsKey(ref.getName())
- ? (" symref-target:" + symrefs.get(ref.getName()))
- : "";
- String peelPart = "";
+ ? (" symref-target:" + symrefs.get(ref.getName())) //$NON-NLS-1$
+ : ""; //$NON-NLS-1$
+ String peelPart = ""; //$NON-NLS-1$
if (derefTags) {
if (!ref.isPeeled() && repository != null) {
ref = repository.peel(ref);
}
ObjectId peeledObjectId = ref.getPeeledObjectId();
if (peeledObjectId != null) {
- peelPart = " peeled:" + peeledObjectId.getName();
+ peelPart = " peeled:" + peeledObjectId.getName(); //$NON-NLS-1$
}
}
- writeOne(objectId.getName() + " " + ref.getName() + symrefPart + peelPart + "\n");
+ writeOne(objectId.getName() + " " + ref.getName() + symrefPart //$NON-NLS-1$
+ + peelPart + "\n"); //$NON-NLS-1$
continue;
}
* Used in protocol.version.
*/
enum ProtocolVersion {
- V0("0"),
- V2("2");
+ V0("0"), //$NON-NLS-1$
+ V2("2"); //$NON-NLS-1$
final String name;
this(db.getConfig());
}
+ @SuppressWarnings("nls")
TransferConfig(final Config rc) {
- boolean fsck = rc.getBoolean("transfer", "fsckobjects", false); //$NON-NLS-1$ //$NON-NLS-2$
- fetchFsck = rc.getBoolean("fetch", "fsckobjects", fsck); //$NON-NLS-1$ //$NON-NLS-2$
- receiveFsck = rc.getBoolean("receive", "fsckobjects", fsck); //$NON-NLS-1$ //$NON-NLS-2$
- fsckSkipList = rc.getString(FSCK, null, "skipList"); //$NON-NLS-1$
- allowInvalidPersonIdent = rc.getBoolean(FSCK, "allowInvalidPersonIdent", false); //$NON-NLS-1$
- safeForWindows = rc.getBoolean(FSCK, "safeForWindows", //$NON-NLS-1$
+ boolean fsck = rc.getBoolean("transfer", "fsckobjects", false);
+ fetchFsck = rc.getBoolean("fetch", "fsckobjects", fsck);
+ receiveFsck = rc.getBoolean("receive", "fsckobjects", fsck);
+ fsckSkipList = rc.getString(FSCK, null, "skipList");
+ allowInvalidPersonIdent = rc.getBoolean(FSCK, "allowInvalidPersonIdent",
+ false);
+ safeForWindows = rc.getBoolean(FSCK, "safeForWindows",
SystemReader.getInstance().isWindows());
- safeForMacOS = rc.getBoolean(FSCK, "safeForMacOS", //$NON-NLS-1$
+ safeForMacOS = rc.getBoolean(FSCK, "safeForMacOS",
SystemReader.getInstance().isMacOS());
ignore = EnumSet.noneOf(ObjectChecker.ErrorType.class);
EnumSet<ObjectChecker.ErrorType> set = EnumSet
.noneOf(ObjectChecker.ErrorType.class);
for (String key : rc.getNames(FSCK)) {
- if (equalsIgnoreCase(key, "skipList") //$NON-NLS-1$
- || equalsIgnoreCase(key, "allowLeadingZeroFileMode") //$NON-NLS-1$
- || equalsIgnoreCase(key, "allowInvalidPersonIdent") //$NON-NLS-1$
- || equalsIgnoreCase(key, "safeForWindows") //$NON-NLS-1$
- || equalsIgnoreCase(key, "safeForMacOS")) { //$NON-NLS-1$
+ if (equalsIgnoreCase(key, "skipList")
+ || equalsIgnoreCase(key, "allowLeadingZeroFileMode")
+ || equalsIgnoreCase(key, "allowInvalidPersonIdent")
+ || equalsIgnoreCase(key, "safeForWindows")
+ || equalsIgnoreCase(key, "safeForMacOS")) {
continue;
}
}
}
if (!set.contains(ObjectChecker.ErrorType.ZERO_PADDED_FILEMODE)
- && rc.getBoolean(FSCK, "allowLeadingZeroFileMode", false)) { //$NON-NLS-1$
+ && rc.getBoolean(FSCK, "allowLeadingZeroFileMode", false)) {
ignore.add(ObjectChecker.ErrorType.ZERO_PADDED_FILEMODE);
}
allowTipSha1InWant = rc.getBoolean(
- "uploadpack", "allowtipsha1inwant", false); //$NON-NLS-1$ //$NON-NLS-2$
+ "uploadpack", "allowtipsha1inwant", false);
allowReachableSha1InWant = rc.getBoolean(
- "uploadpack", "allowreachablesha1inwant", false); //$NON-NLS-1$ //$NON-NLS-2$
+ "uploadpack", "allowreachablesha1inwant", false);
allowFilter = rc.getBoolean(
- "uploadpack", "allowfilter", false); //$NON-NLS-1$ //$NON-NLS-2$
+ "uploadpack", "allowfilter", false);
protocolVersion = ProtocolVersion.parse(rc.getString("protocol", null, "version"));
- hideRefs = rc.getStringList("uploadpack", null, "hiderefs"); //$NON-NLS-1$ //$NON-NLS-2$
+ hideRefs = rc.getStringList("uploadpack", null, "hiderefs");
}
/**
package org.eclipse.jgit.transport;
import static org.eclipse.jgit.lib.RefDatabase.ALL;
-import static org.eclipse.jgit.transport.GitProtocolConstants.COMMAND_LS_REFS;
import static org.eclipse.jgit.transport.GitProtocolConstants.COMMAND_FETCH;
+import static org.eclipse.jgit.transport.GitProtocolConstants.COMMAND_LS_REFS;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_AGENT;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_ALLOW_REACHABLE_SHA1_IN_WANT;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_ALLOW_TIP_SHA1_IN_WANT;
import java.util.List;
import java.util.Map;
import java.util.Set;
+
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
// UploadPack sends these lines as the first response to a client that
// supports protocol version 2.
private static final String[] v2CapabilityAdvertisement = {
- "version 2",
+ "version 2", //$NON-NLS-1$
COMMAND_LS_REFS,
COMMAND_FETCH
};
* @since 5.0
*/
public void setExtraParameters(Collection<String> params) {
- this.clientRequestedV2 = params.contains("version=2"); // $NON-NLS-1$
+ this.clientRequestedV2 = params.contains("version=2"); //$NON-NLS-1$
}
private boolean useProtocolV2() {
// line is DELIM if there are arguments or END if not.
if (line == PacketLineIn.DELIM) {
while ((line = pckIn.readString()) != PacketLineIn.END) {
- if (line.equals("peel")) {
+ if (line.equals("peel")) { //$NON-NLS-1$
adv.setDerefTags(true);
- } else if (line.equals("symrefs")) {
+ } else if (line.equals("symrefs")) { //$NON-NLS-1$
needToFindSymrefs = true;
- } else if (line.startsWith("ref-prefix ")) {
- refPrefixes.add(line.substring("ref-prefix ".length()));
+ } else if (line.startsWith("ref-prefix ")) { //$NON-NLS-1$
+ refPrefixes.add(line.substring("ref-prefix ".length())); //$NON-NLS-1$
} else {
- throw new PackProtocolException("unexpected " + line);
+ throw new PackProtocolException(MessageFormat
+ .format(JGitText.get().unexpectedPacketLine, line));
}
}
} else if (line != PacketLineIn.END) {
- throw new PackProtocolException("unexpected " + line);
+ throw new PackProtocolException(MessageFormat
+ .format(JGitText.get().unexpectedPacketLine, line));
}
rawOut.stopBuffering();
// Currently, we do not support any capabilities, so the next
// line is DELIM.
if ((line = pckIn.readString()) != PacketLineIn.DELIM) {
- throw new PackProtocolException("unexpected " + line);
+ throw new PackProtocolException(MessageFormat
+ .format(JGitText.get().unexpectedPacketLine, line));
}
while ((line = pckIn.readString()) != PacketLineIn.END) {
- if (line.startsWith("want ")) {
+ if (line.startsWith("want ")) { //$NON-NLS-1$
wantIds.add(ObjectId.fromString(line.substring(5)));
- } else if (line.startsWith("have ")) {
+ } else if (line.startsWith("have ")) { //$NON-NLS-1$
peerHas.add(ObjectId.fromString(line.substring(5)));
- } else if (line.equals("done")) {
+ } else if (line.equals("done")) { //$NON-NLS-1$
doneReceived = true;
} else if (line.equals(OPTION_THIN_PACK)) {
options.add(OPTION_THIN_PACK);
if (doneReceived) {
processHaveLines(peerHas, ObjectId.zeroId(), new PacketLineOut(NullOutputStream.INSTANCE));
} else {
- pckOut.writeString("acknowledgments\n");
+ pckOut.writeString("acknowledgments\n"); //$NON-NLS-1$
for (ObjectId id : peerHas) {
if (walk.getObjectReader().has(id)) {
- pckOut.writeString("ACK " + id.getName() + "\n");
+ pckOut.writeString("ACK " + id.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
processHaveLines(peerHas, ObjectId.zeroId(), new PacketLineOut(NullOutputStream.INSTANCE));
if (okToGiveUp()) {
- pckOut.writeString("ready\n");
+ pckOut.writeString("ready\n"); //$NON-NLS-1$
} else if (commonBase.isEmpty()) {
- pckOut.writeString("NAK\n");
+ pckOut.writeString("NAK\n"); //$NON-NLS-1$
}
sectionSent = true;
}
if (doneReceived || okToGiveUp()) {
if (sectionSent)
pckOut.writeDelim();
- pckOut.writeString("packfile\n");
+ pckOut.writeString("packfile\n"); //$NON-NLS-1$
sendPack(new PackStatistics.Accumulator());
}
pckOut.end();
// case.
return true;
}
- if (command.equals("command=" + COMMAND_LS_REFS)) {
+ if (command.equals("command=" + COMMAND_LS_REFS)) { //$NON-NLS-1$
lsRefsV2();
return false;
}
- if (command.equals("command=" + COMMAND_FETCH)) {
+ if (command.equals("command=" + COMMAND_FETCH)) { //$NON-NLS-1$
fetchV2();
return false;
}
- throw new PackProtocolException("unknown command " + command);
+ throw new PackProtocolException(MessageFormat
+ .format(JGitText.get().unknownTransportCommand, command));
}
private void serviceV2() throws IOException {
// not, the client is expected to call
// sendAdvertisedRefs() on its own.)
for (String s : v2CapabilityAdvertisement) {
- pckOut.writeString(s + "\n");
+ pckOut.writeString(s + "\n"); //$NON-NLS-1$
}
pckOut.end();