[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Migrating from Jgit 1.0 to 1.1

Hi,

I'm working in a project with Jgit 1.0 and I want to migrate to 1.1, but I'm stuck in one problem. Let me explain the workflow:

1) Let's assume that in my remote there are 3 branches: master, b1 and b2.
2) Clone remote repository with clonecommand passing the branch "master". This way my local repository is created and the local branch "master" is linked to the remote master.
        cc.setURI(remoteSSHConnection);
        cc.setDirectory(new File(localRepoPath));
        cc.setBranch("refs/heads/master");
        cc.setCredentialsProvider(credential);
        cc.call();

With JGit 1.0, I could run clonecommand again  in the same local repository passing "refs/heads/b1", and a local branch is created linked to remote. But in 1.1 an error occurs, saying that I cannot clone into a folder that already exists and is not empty. What do I have to do? All I want is to checkout in a branch that not exists locally, but it has to track the remote branch and have the same name. 

ps: With original git command line, if i checkout in a branch that not exist locally but exists in remote, it is automatically created locally and linked to remote


-- 
Thanks in advance,

Eduardo Falcão