Browse Source

Let CloneCommand not checkout HEAD on bare repos

If the clone command clones into a bare repository it should not try
to checkout HEAD in the end. For bare repos checkout is not possible.

Change-Id: I359719d421b93c9d2e962e3c0eccc2b59235c3d1
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
stable-0.12
Christian Halstrick 14 years ago
parent
commit
6935db4ec2
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java

5
org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java

@ -177,10 +177,13 @@ public class CloneCommand implements Callable<Git> {
u.setNewObjectId(commit.getId()); u.setNewObjectId(commit.getId());
u.forceUpdate(); u.forceUpdate();
if (!bare) {
DirCache dc = repo.lockDirCache(); DirCache dc = repo.lockDirCache();
DirCacheCheckout co = new DirCacheCheckout(repo, dc, commit.getTree()); DirCacheCheckout co = new DirCacheCheckout(repo, dc,
commit.getTree());
co.checkout(); co.checkout();
} }
}
private RevCommit parseCommit(final Repository repo, final Ref ref) private RevCommit parseCommit(final Repository repo, final Ref ref)
throws MissingObjectException, IncorrectObjectTypeException, throws MissingObjectException, IncorrectObjectTypeException,

Loading…
Cancel
Save