class SyncRemote {

    void fillBranches(final List<Ref> branches,
                      final Collection<String> remoteBranches,
                      final Collection<String> localBranches) {
        for (final Ref branch : branches) {
            final String branchFullName = branch.getName();
            final String remotePrefix = "refs/remotes/" + remote.getK1() + "/";
            final String localPrefix = "refs/heads/";

            if (branchFullName.startsWith(remotePrefix)) {
                remoteBranches.add(branchFullName.replaceFirst(remotePrefix, ""));
            } else if (branchFullName.startsWith(localPrefix)) {
                localBranches.add(branchFullName.replaceFirst(localPrefix, ""));
            } else {
                localBranches.add(branchFullName.substring(branchFullName.lastIndexOf("/") + 1));
            }
        }
    }

    public  SyncRemote(final GitImpl git,
                      final Pair<String, String> remote);

}