Change-Id: I73f38492b6a2e7fd6e77005efd0a8a8c65763e74tags/v3.5.0.201409071800-rc1
@@ -232,16 +232,16 @@ public class Main { | |||
/** | |||
* Evaluate the {@code --git-dir} option and open the repository. | |||
* | |||
* @param gitdir | |||
* @param aGitdir | |||
* the {@code --git-dir} option given on the command line. May be | |||
* null if it was not supplied. | |||
* @return the repository to operate on. | |||
* @throws IOException | |||
* the repository cannot be opened. | |||
*/ | |||
protected Repository openGitDir(String gitdir) throws IOException { | |||
protected Repository openGitDir(String aGitdir) throws IOException { | |||
RepositoryBuilder rb = new RepositoryBuilder() // | |||
.setGitDir(gitdir != null ? new File(gitdir) : null) // | |||
.setGitDir(aGitdir != null ? new File(aGitdir) : null) // | |||
.readEnvironment() // | |||
.findGitDir(); | |||
if (rb.getGitDir() == null) |
@@ -485,35 +485,35 @@ public class MergeCommand extends GitCommand<MergeResult> { | |||
} | |||
/** | |||
* @param commit | |||
* @param aCommit | |||
* a reference to a commit which is merged with the current head | |||
* @return {@code this} | |||
*/ | |||
public MergeCommand include(Ref commit) { | |||
public MergeCommand include(Ref aCommit) { | |||
checkCallable(); | |||
commits.add(commit); | |||
commits.add(aCommit); | |||
return this; | |||
} | |||
/** | |||
* @param commit | |||
* @param aCommit | |||
* the Id of a commit which is merged with the current head | |||
* @return {@code this} | |||
*/ | |||
public MergeCommand include(AnyObjectId commit) { | |||
return include(commit.getName(), commit); | |||
public MergeCommand include(AnyObjectId aCommit) { | |||
return include(aCommit.getName(), aCommit); | |||
} | |||
/** | |||
* @param name | |||
* a name given to the commit | |||
* @param commit | |||
* @param aCommit | |||
* the Id of a commit which is merged with the current head | |||
* @return {@code this} | |||
*/ | |||
public MergeCommand include(String name, AnyObjectId commit) { | |||
public MergeCommand include(String name, AnyObjectId aCommit) { | |||
return include(new ObjectIdRef.Unpeeled(Storage.LOOSE, name, | |||
commit.copy())); | |||
aCommit.copy())); | |||
} | |||
/** |
@@ -672,15 +672,15 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
FileUtils.delete(currentCommitFile); | |||
} | |||
private RebaseResult finishRebase(RevCommit newHead, | |||
boolean lastStepWasForward) throws IOException, GitAPIException { | |||
private RebaseResult finishRebase(RevCommit finalHead, | |||
boolean lastStepIsForward) throws IOException, GitAPIException { | |||
String headName = rebaseState.readFile(HEAD_NAME); | |||
updateHead(headName, newHead, upstreamCommit); | |||
updateHead(headName, finalHead, upstreamCommit); | |||
boolean stashConflicts = autoStashApply(); | |||
FileUtils.delete(rebaseState.getDir(), FileUtils.RECURSIVE); | |||
if (stashConflicts) | |||
return RebaseResult.STASH_APPLY_CONFLICTS_RESULT; | |||
if (lastStepWasForward || newHead == null) | |||
if (lastStepIsForward || finalHead == null) | |||
return RebaseResult.FAST_FORWARD_RESULT; | |||
return RebaseResult.OK_RESULT; | |||
} | |||
@@ -753,7 +753,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
private RevCommit squashIntoPrevious(boolean sequenceContainsSquash, | |||
RebaseTodoLine nextStep) | |||
throws IOException, GitAPIException { | |||
RevCommit newHead; | |||
RevCommit retNewHead; | |||
String commitMessage = rebaseState | |||
.readFile(MESSAGE_SQUASH); | |||
@@ -765,7 +765,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
commitMessage = interactiveHandler | |||
.modifyCommitMessage(commitMessage); | |||
} | |||
newHead = new Git(repo).commit() | |||
retNewHead = new Git(repo).commit() | |||
.setMessage(stripCommentLines(commitMessage)) | |||
.setAmend(true).call(); | |||
rebaseState.getFile(MESSAGE_SQUASH).delete(); | |||
@@ -773,11 +773,11 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
} else { | |||
// Next step is either Squash or Fixup | |||
newHead = new Git(repo).commit() | |||
retNewHead = new Git(repo).commit() | |||
.setMessage(commitMessage).setAmend(true) | |||
.call(); | |||
} | |||
return newHead; | |||
return retNewHead; | |||
} | |||
private static String stripCommentLines(String commitMessage) { | |||
@@ -862,13 +862,13 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
return ourCommitName; | |||
} | |||
private void updateHead(String headName, RevCommit newHead, RevCommit onto) | |||
private void updateHead(String headName, RevCommit aNewHead, RevCommit onto) | |||
throws IOException { | |||
// point the previous head (if any) to the new commit | |||
if (headName.startsWith(Constants.R_REFS)) { | |||
RefUpdate rup = repo.updateRef(headName); | |||
rup.setNewObjectId(newHead); | |||
rup.setNewObjectId(aNewHead); | |||
rup.setRefLogMessage("rebase finished: " + headName + " onto " //$NON-NLS-1$ //$NON-NLS-2$ | |||
+ onto.getName(), false); | |||
Result res = rup.forceUpdate(); |
@@ -122,12 +122,12 @@ public class StashApplyCommand extends GitCommand<ObjectId> { | |||
} | |||
/** | |||
* @param ignoreRepositoryState | |||
* @param willIgnoreRepositoryState | |||
* @return {@code this} | |||
* @since 3.2 | |||
*/ | |||
public StashApplyCommand ignoreRepositoryState(boolean ignoreRepositoryState) { | |||
this.ignoreRepositoryState = ignoreRepositoryState; | |||
public StashApplyCommand ignoreRepositoryState(boolean willIgnoreRepositoryState) { | |||
this.ignoreRepositoryState = willIgnoreRepositoryState; | |||
return this; | |||
} | |||
@@ -751,26 +751,26 @@ public class RepoCommand extends GitCommand<RevCommit> { | |||
Config cfg = new Config(); | |||
for (Project proj : bareProjects) { | |||
String name = proj.path; | |||
String uri = proj.name; | |||
String nameUri = proj.name; | |||
cfg.setString("submodule", name, "path", name); //$NON-NLS-1$ //$NON-NLS-2$ | |||
cfg.setString("submodule", name, "url", uri); //$NON-NLS-1$ //$NON-NLS-2$ | |||
cfg.setString("submodule", name, "url", nameUri); //$NON-NLS-1$ //$NON-NLS-2$ | |||
// create gitlink | |||
DirCacheEntry dcEntry = new DirCacheEntry(name); | |||
ObjectId objectId; | |||
if (ObjectId.isId(proj.revision)) | |||
objectId = ObjectId.fromString(proj.revision); | |||
else { | |||
objectId = callback.sha1(uri, proj.revision); | |||
objectId = callback.sha1(nameUri, proj.revision); | |||
} | |||
if (objectId == null) | |||
throw new RemoteUnavailableException(uri); | |||
throw new RemoteUnavailableException(nameUri); | |||
dcEntry.setObjectId(objectId); | |||
dcEntry.setFileMode(FileMode.GITLINK); | |||
builder.add(dcEntry); | |||
for (CopyFile copyfile : proj.copyfiles) { | |||
byte[] src = callback.readFile( | |||
uri, proj.revision, copyfile.src); | |||
nameUri, proj.revision, copyfile.src); | |||
objectId = inserter.insert(Constants.OBJ_BLOB, src); | |||
dcEntry = new DirCacheEntry(copyfile.dest); | |||
dcEntry.setObjectId(objectId); |
@@ -264,17 +264,17 @@ public class RecursiveMerger extends ResolveMerger { | |||
*/ | |||
private DirCache dircacheFromTree(ObjectId treeId) throws IOException { | |||
DirCache ret = DirCache.newInCore(); | |||
DirCacheBuilder builder = ret.builder(); | |||
TreeWalk tw = new TreeWalk(reader); | |||
tw.addTree(treeId); | |||
tw.setRecursive(true); | |||
while (tw.next()) { | |||
DirCacheEntry e = new DirCacheEntry(tw.getRawPath()); | |||
e.setFileMode(tw.getFileMode(0)); | |||
e.setObjectId(tw.getObjectId(0)); | |||
builder.add(e); | |||
DirCacheBuilder aBuilder = ret.builder(); | |||
TreeWalk atw = new TreeWalk(reader); | |||
atw.addTree(treeId); | |||
atw.setRecursive(true); | |||
while (atw.next()) { | |||
DirCacheEntry e = new DirCacheEntry(atw.getRawPath()); | |||
e.setFileMode(atw.getFileMode(0)); | |||
e.setObjectId(atw.getObjectId(0)); | |||
aBuilder.add(e); | |||
} | |||
builder.finish(); | |||
aBuilder.finish(); | |||
return ret; | |||
} | |||
} |
@@ -630,15 +630,15 @@ public class TransportHttp extends HttpTransport implements WalkTransport, | |||
} | |||
class HttpObjectDB extends WalkRemoteObjectDatabase { | |||
private final URL objectsUrl; | |||
private final URL httpObjectsUrl; | |||
HttpObjectDB(final URL b) { | |||
objectsUrl = b; | |||
httpObjectsUrl = b; | |||
} | |||
@Override | |||
URIish getURI() { | |||
return new URIish(objectsUrl); | |||
return new URIish(httpObjectsUrl); | |||
} | |||
@Override | |||
@@ -661,7 +661,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, | |||
@Override | |||
WalkRemoteObjectDatabase openAlternate(final String location) | |||
throws IOException { | |||
return new HttpObjectDB(new URL(objectsUrl, location)); | |||
return new HttpObjectDB(new URL(httpObjectsUrl, location)); | |||
} | |||
@Override | |||
@@ -689,7 +689,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, | |||
@Override | |||
FileStream open(final String path) throws IOException { | |||
final URL base = objectsUrl; | |||
final URL base = httpObjectsUrl; | |||
final URL u = new URL(base, path); | |||
final HttpConnection c = httpOpen(u); | |||
switch (HttpSupport.response(c)) { |
@@ -328,13 +328,13 @@ public abstract class AbstractTreeIterator { | |||
* position to start reading the raw buffer. | |||
* @param end | |||
* one past the end of the raw buffer (length is end - pos). | |||
* @param mode | |||
* @param pathMode | |||
* the mode of the path. | |||
* @return -1 if this entry sorts first; 0 if the entries are equal; 1 if | |||
* p's entry sorts first. | |||
*/ | |||
public int pathCompare(byte[] buf, int pos, int end, int mode) { | |||
return pathCompare(buf, pos, end, mode, 0); | |||
public int pathCompare(byte[] buf, int pos, int end, int pathMode) { | |||
return pathCompare(buf, pos, end, pathMode, 0); | |||
} | |||
private int pathCompare(byte[] b, int bPos, int bEnd, int bMode, int aPos) { |
@@ -376,8 +376,8 @@ public class FileUtils { | |||
*/ | |||
public static File createTempDir(String prefix, String suffix, File dir) | |||
throws IOException { | |||
final int RETRY = 1; // When something bad happens, retry once. | |||
for (int i = 0; i < RETRY; i++) { | |||
final int RETRIES = 1; // When something bad happens, retry once. | |||
for (int i = 0; i < RETRIES; i++) { | |||
File tmp = File.createTempFile(prefix, suffix, dir); | |||
if (!tmp.delete()) | |||
continue; |