new FileChange(oldPath, newPath, additions, deletions)); } else { String oldPath = QuotedString.GIT_PATH.dequote(path.substring(0, renameSignIndex)); String newPath = QuotedString.GIT_PATH.dequote(path.substring(renameSignIndex+4)); commitBuilderRef.get().fileChanges.add( new FileChange(oldPath, newPath, additions, deletions)); path = QuotedString.GIT_PATH.dequote(path); commitBuilderRef.get().fileChanges.add(new FileChange(null, path, additions, deletions));
r.append(QuotedString.GIT_PATH.quote(RawParseUtils.decode( delta, deltaPtr, deltaPtr + cmd))); r.append(")\n"); //$NON-NLS-1$
public static final GitPathStyle GIT_PATH = new GitPathStyle();
public static final GitPathStyle GIT_PATH = new GitPathStyle();
r.append(QuotedString.GIT_PATH.quote(RawParseUtils.decode( delta, deltaPtr, deltaPtr + cmd))); r.append(")\n"); //$NON-NLS-1$
r.append(QuotedString.GIT_PATH.quote(RawParseUtils.decode( delta, deltaPtr, deltaPtr + cmd))); r.append(")\n"); //$NON-NLS-1$
return eol; oldPath = QuotedString.GIT_PATH.dequote(buf, bol, sp - 1); oldPath = p1(oldPath); } else {
return eol; oldPath = QuotedString.GIT_PATH.dequote(buf, bol, sp - 1); oldPath = p1(oldPath); } else {
private String parseName(final String expect, int ptr, final int end) { if (ptr == end) return expect; String r; if (buf[ptr] == '"') { // New style GNU diff format // r = QuotedString.GIT_PATH.dequote(buf, ptr, end - 1); } else { // Older style GNU diff format, an optional tab ends the name. // int tab = end; while (ptr < tab && buf[tab - 1] != '\t') tab--; if (ptr == tab) tab = end; r = decode(Constants.CHARSET, buf, ptr, tab - 1); } if (r.equals(DEV_NULL)) r = DEV_NULL; return r; }
private String parseName(String expect, int ptr, int end) { if (ptr == end) return expect; String r; if (buf[ptr] == '"') { // New style GNU diff format // r = QuotedString.GIT_PATH.dequote(buf, ptr, end - 1); } else { // Older style GNU diff format, an optional tab ends the name. // int tab = end; while (ptr < tab && buf[tab - 1] != '\t') tab--; if (ptr == tab) tab = end; r = decode(UTF_8, buf, ptr, tab - 1); } if (r.equals(DEV_NULL)) r = DEV_NULL; return r; }
@Override protected void run() throws Exception { final TreeWalk walk = new TreeWalk(db); walk.reset(); // drop the first empty tree, which we do not need here if (paths.size() > 0) walk.setFilter(PathFilterGroup.createFromStrings(paths)); walk.setRecursive(recursive); walk.addTree(tree); while (walk.next()) { final FileMode mode = walk.getFileMode(0); if (mode == FileMode.TREE) outw.print('0'); outw.print(mode); outw.print(' '); outw.print(Constants.typeString(mode.getObjectType())); outw.print(' '); outw.print(walk.getObjectId(0).name()); outw.print('\t'); outw.print(QuotedString.GIT_PATH.quote(walk.getPathString())); outw.println(); } } }
@Override public void consume(String line) { if (line.contains("\t")) { StringTokenizer tokenizer = new StringTokenizer(line, "\t"); int additions; String field = tokenizer.nextToken(); if (field.equals("-")) additions = -1; else additions = Integer.parseInt(field); int deletions; field = tokenizer.nextToken(); if (field.equals("-")) deletions = -1; else deletions = Integer.parseInt(field); String file = QuotedString.GIT_PATH.dequote(tokenizer.nextToken()); fileChanges.add(new FileChange(null, file, additions, deletions)); } }
private static String quotePath(String name) { return QuotedString.GIT_PATH.quote(name); }
private static String quotePath(String name) { return QuotedString.GIT_PATH.quote(name); }
@Override public String dequote(final byte[] in, final int inPtr, final int inEnd) { if (2 <= inEnd - inPtr && in[inPtr] == '"' && in[inEnd - 1] == '"') return dq(in, inPtr + 1, inEnd - 1); return RawParseUtils.decode(Constants.CHARSET, in, inPtr, inEnd); }
@Override public String dequote(byte[] in, int inPtr, int inEnd) { if (2 <= inEnd - inPtr && in[inPtr] == '"' && in[inEnd - 1] == '"') return dq(in, inPtr + 1, inEnd - 1); return RawParseUtils.decode(UTF_8, in, inPtr, inEnd); }
@Override public void consume(String line) { if (line.trim().length() != 0) changedFiles.add(QuotedString.GIT_PATH.dequote(line)); }
public static final GitPathStyle GIT_PATH = new GitPathStyle();
return eol; oldPath = QuotedString.GIT_PATH.dequote(buf, bol, sp - 1); oldPath = p1(oldPath); } else {
private String parseName(String expect, int ptr, int end) { if (ptr == end) return expect; String r; if (buf[ptr] == '"') { // New style GNU diff format // r = QuotedString.GIT_PATH.dequote(buf, ptr, end - 1); } else { // Older style GNU diff format, an optional tab ends the name. // int tab = end; while (ptr < tab && buf[tab - 1] != '\t') tab--; if (ptr == tab) tab = end; r = decode(UTF_8, buf, ptr, tab - 1); } if (r.equals(DEV_NULL)) r = DEV_NULL; return r; }