2012-08-10 22 views
0

使用命令行Git命令我可以做以下如何使用JGit API檢出遠程文件?

git checkout ref/origin/remotebranch projectA/* 

但是如果我做了使用jgit以下,了projectA下的文件/ *未簽出。

CheckoutCommand checkout= git.checkout(); 
    checkout.addPath("projectA/*"); 
    checkout.setName("ref/origin/remotebranch"); 
    checkout.setAllPaths(false);//tried with both true and false 
    checkout.call(); 

如何在JGit中解決此問題?

回答

1

我不知道,如果水珠符號是支持的,所以嘗試這個:

checkout.addPath("projectA"); 

setAllPaths不應該是必要的。

+0

無法與checkout.addPath(「projectA」)一起使用 – codejammer 2012-08-11 13:53:29

+0

您使用的是哪個版本的JGit?下面的工作與JGit大師:https://gist.github.com/3338160 – robinst 2012-08-13 08:21:34

+1

順便說一句,是'ref/origin/remotebranch'一個錯字,或者你真的有這樣的裁判?通常這是'refs/remotes/origin/remotebranch'。 – robinst 2012-08-13 08:25:05