"d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/tags/tag3^{}",
"" }, result.toArray());
}
+
+ @Test
+ public void testLsRemoteHeads() throws Exception {
+ final List<String> result = CLIGitCommand.execute(
+ "git ls-remote --heads "
+ + db.getDirectory(), db);
+ assertArrayEquals(new String[] {
+ "d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/heads/master",
+ "d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/heads/test",
+ "" }, result.toArray());
+ }
}
usage_Glog=View commit history as a graph
usage_IndexPack=Build pack index file for an existing packed archive
usage_LsRemote=List references in a remote repository
+usage_lsRemoteHeads=Show only refs starting with refs/heads
usage_LsTree=List the contents of a tree object
usage_MakeCacheTree=Show the current cache tree structure
usage_MergeBase=Find as good common ancestors as possible for a merge
@Command(common = true, usage = "usage_LsRemote")
class LsRemote extends TextBuiltin {
+ @Option(name = "--heads", usage = "usage_lsRemoteHeads")
+ private boolean heads;
+
@Option(name = "--timeout", metaVar = "metaVar_service", usage = "usage_abortConnectionIfNoActivity")
int timeout = -1;
@Override
protected void run() throws Exception {
LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote)
- .setTimeout(timeout);
+ .setTimeout(timeout).setHeads(heads);
TreeSet<Ref> refs = new TreeSet<Ref>(new Comparator<Ref>() {
public int compare(Ref r1, Ref r2) {