Example usage for org.eclipse.jgit.lib Constants MASTER

List of usage examples for org.eclipse.jgit.lib Constants MASTER

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib Constants MASTER.

Prototype

String MASTER

To view the source code for org.eclipse.jgit.lib Constants MASTER.

Click Source Link

Document

Default main branch name

Usage

From source file:org.eclipse.orion.server.tests.servlets.git.GitRemoteTest.java

License:Open Source License

@Test
public void testGetRemoteBranches() throws Exception {
    // clone a  repo
    URI workspaceLocation = createWorkspace(getMethodName());
    JSONObject project = createProjectOrLink(workspaceLocation, getMethodName(), null);
    IPath clonePath = new Path("file").append(project.getString(ProtocolConstants.KEY_ID)).makeAbsolute();
    JSONObject clone = clone(clonePath);
    String cloneContentLocation = clone.getString(ProtocolConstants.KEY_CONTENT_LOCATION);
    String cloneLocation = clone.getString(ProtocolConstants.KEY_LOCATION);
    String branchesLocation = clone.getString(GitConstants.KEY_BRANCH);

    // get project metadata
    WebRequest request = getGetFilesRequest(project.getString(ProtocolConstants.KEY_CONTENT_LOCATION));
    WebResponse response = webConversation.getResponse(request);
    assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());
    project = new JSONObject(response.getText());

    JSONObject gitSection = project.optJSONObject(GitConstants.KEY_GIT);
    assertNotNull(gitSection);//  w  ww  .  j  ava  2s  . co  m
    String gitRemoteUri = gitSection.optString(GitConstants.KEY_REMOTE, null);
    assertNotNull(gitRemoteUri);

    Repository db1 = getRepositoryForContentLocation(cloneContentLocation);
    Git git = new Git(db1);
    int localBefore = git.branchList().call().size();
    int remoteBefore = git.branchList().setListMode(ListMode.REMOTE).call().size();
    int allBefore = git.branchList().setListMode(ListMode.ALL).call().size();
    branch(branchesLocation, "a");

    assertEquals(1, git.branchList().call().size() - localBefore);
    assertEquals(0, git.branchList().setListMode(ListMode.REMOTE).call().size() - remoteBefore);
    assertEquals(1, git.branchList().setListMode(ListMode.ALL).call().size() - allBefore);

    // push all
    // TODO: replace with REST API when bug 339115 is fixed
    git.push().setPushAll().call();

    assertEquals(1, git.branchList().call().size() - localBefore);
    assertEquals(1, git.branchList().setListMode(ListMode.REMOTE).call().size() - remoteBefore);
    assertEquals(2, git.branchList().setListMode(ListMode.ALL).call().size() - allBefore);

    checkoutBranch(cloneLocation, Constants.MASTER);
    JSONObject remoteBranch = getRemoteBranch(gitRemoteUri, 2, 0, Constants.MASTER);
    assertNotNull(remoteBranch);

    checkoutBranch(cloneLocation, "a");
    remoteBranch = getRemoteBranch(gitRemoteUri, 2, 0, "a");
    assertNotNull(remoteBranch);
}

From source file:org.eclipse.orion.server.tests.servlets.git.GitStatusTest.java

License:Open Source License

@Test
public void testConflict() throws Exception {
    URI workspaceLocation = createWorkspace(getMethodName());

    // clone1: create
    JSONObject project1 = createProjectOrLink(workspaceLocation, getMethodName() + "1", null);
    String projectId1 = project1.getString(ProtocolConstants.KEY_ID);
    IPath clonePath1 = new Path("file").append(project1.getString(ProtocolConstants.KEY_ID)).makeAbsolute();
    String contentLocation1 = clone(clonePath1).getString(ProtocolConstants.KEY_CONTENT_LOCATION);

    // get project metadata
    WebRequest request = getGetFilesRequest(project1.getString(ProtocolConstants.KEY_CONTENT_LOCATION));
    WebResponse response = webConversation.getResponse(request);
    assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());
    project1 = new JSONObject(response.getText());
    JSONObject gitSection1 = project1.getJSONObject(GitConstants.KEY_GIT);
    String gitIndexUri1 = gitSection1.getString(GitConstants.KEY_INDEX);
    String gitHeadUri1 = gitSection1.getString(GitConstants.KEY_HEAD);
    String gitRemoteUri1 = gitSection1.getString(GitConstants.KEY_REMOTE);

    // clone2: create
    JSONObject project2 = createProjectOrLink(workspaceLocation, getMethodName() + "2", null);
    String projectId2 = project2.getString(ProtocolConstants.KEY_ID);
    IPath clonePath2 = new Path("file").append(project2.getString(ProtocolConstants.KEY_ID)).makeAbsolute();
    String contentLocation2 = clone(clonePath2).getString(ProtocolConstants.KEY_CONTENT_LOCATION);

    // get project metadata
    request = getGetFilesRequest(project2.getString(ProtocolConstants.KEY_CONTENT_LOCATION));
    response = webConversation.getResponse(request);
    assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());
    project2 = new JSONObject(response.getText());
    JSONObject gitSection2 = project2.getJSONObject(GitConstants.KEY_GIT);
    String gitIndexUri2 = gitSection2.getString(GitConstants.KEY_INDEX);
    String gitHeadUri2 = gitSection2.getString(GitConstants.KEY_HEAD);
    String gitStatusUri2 = gitSection2.getString(GitConstants.KEY_STATUS);

    // clone1: change
    request = getPutFileRequest(projectId1 + "/test.txt", "change from clone1");
    response = webConversation.getResponse(request);
    assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());

    // clone1: add
    request = GitAddTest.getPutGitIndexRequest(gitIndexUri1);
    response = webConversation.getResponse(request);
    assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());

    // clone1: commit
    request = GitCommitTest.getPostGitCommitRequest(gitHeadUri1, "change from clone1", false);
    response = webConversation.getResponse(request);
    assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());

    // clone1: push
    ServerStatus pushStatus = push(gitRemoteUri1, 1, 0, Constants.MASTER, Constants.HEAD, false);
    assertEquals(true, pushStatus.isOK());

    // this is how EGit checks for conflicts
    Repository db1 = getRepositoryForContentLocation(contentLocation1);
    Git git = new Git(db1);
    DirCache cache = db1.readDirCache();
    DirCacheEntry entry = cache.getEntry("test.txt");
    assertTrue(entry.getStage() == 0);/*from  w  w w .  j  a va 2s.c  o  m*/

    // clone2: change
    request = getPutFileRequest(projectId2 + "/test.txt", "change from clone2");
    response = webConversation.getResponse(request);
    assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());

    // clone2: add
    request = GitAddTest.getPutGitIndexRequest(gitIndexUri2);
    response = webConversation.getResponse(request);
    assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());

    // clone2: commit
    request = GitCommitTest.getPostGitCommitRequest(gitHeadUri2, "change from clone2", false);
    response = webConversation.getResponse(request);
    assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());

    // clone2: pull
    // TODO: replace with REST API for git pull once bug 339114 is fixed
    Repository db2 = getRepositoryForContentLocation(contentLocation2);
    git = new Git(db2);
    PullResult pullResult = git.pull().call();
    assertEquals(pullResult.getMergeResult().getMergeStatus(), MergeStatus.CONFLICTING);

    // this is how EGit checks for conflicts
    cache = db2.readDirCache();
    entry = cache.getEntry("test.txt");
    assertTrue(entry.getStage() > 0);

    request = getGetGitStatusRequest(gitStatusUri2);
    response = webConversation.getResponse(request);
    assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());
    JSONObject statusResponse = new JSONObject(response.getText());
    JSONArray statusArray = statusResponse.getJSONArray(GitConstants.KEY_STATUS_ADDED);
    assertEquals(0, statusArray.length());
    statusArray = statusResponse.getJSONArray(GitConstants.KEY_STATUS_CHANGED);
    assertEquals(0, statusArray.length());
    statusArray = statusResponse.getJSONArray(GitConstants.KEY_STATUS_MISSING);
    assertEquals(0, statusArray.length());
    statusArray = statusResponse.getJSONArray(GitConstants.KEY_STATUS_MODIFIED);
    assertEquals(0, statusArray.length());
    statusArray = statusResponse.getJSONArray(GitConstants.KEY_STATUS_REMOVED);
    assertEquals(0, statusArray.length());
    statusArray = statusResponse.getJSONArray(GitConstants.KEY_STATUS_UNTRACKED);
    assertEquals(0, statusArray.length());
    statusArray = statusResponse.getJSONArray(GitConstants.KEY_STATUS_CONFLICTING);
    assertEquals(1, statusArray.length());
    assertNotNull(getChildByName(statusArray, "test.txt"));
}

From source file:org.eclipse.orion.server.tests.servlets.git.GitStatusTest.java

License:Open Source License

@Test
public void testCloneAndBranchNameFromStatus() throws Exception {
    URI workspaceLocation = createWorkspace(getMethodName());
    JSONObject projectTop = createProjectOrLink(workspaceLocation, getMethodName() + "-top", null);
    IPath clonePathTop = new Path("file").append(projectTop.getString(ProtocolConstants.KEY_ID)).makeAbsolute();

    JSONObject projectFolder = createProjectOrLink(workspaceLocation, getMethodName() + "-folder", null);
    IPath clonePathFolder = new Path("file").append(projectFolder.getString(ProtocolConstants.KEY_ID))
            .append("folder").makeAbsolute();

    IPath[] clonePaths = new IPath[] { clonePathTop, clonePathFolder };

    for (IPath clonePath : clonePaths) {
        // clone a  repo
        JSONObject clone = clone(clonePath);
        String cloneContentLocation = clone.getString(ProtocolConstants.KEY_CONTENT_LOCATION);

        // get project/folder metadata
        WebRequest request = getGetFilesRequest(cloneContentLocation);
        WebResponse response = webConversation.getResponse(request);
        assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());
        JSONObject folder = new JSONObject(response.getText());

        // get status
        request = getGetGitStatusRequest(
                folder.getJSONObject(GitConstants.KEY_GIT).getString(GitConstants.KEY_STATUS));
        response = webConversation.getResponse(request);
        assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());
        JSONObject statusResponse = new JSONObject(response.getText());
        String cloneLocation = statusResponse.getString(GitConstants.KEY_CLONE);
        assertCloneUri(cloneLocation);// www .j a v a 2s  .c o  m

        request = getGetRequest(cloneLocation);
        response = webConversation.getResponse(request);
        assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());
        clone = new JSONObject(response.getText());
        JSONArray clonesArray = clone.getJSONArray(ProtocolConstants.KEY_CHILDREN);
        assertEquals(1, clonesArray.length());
        clone = clonesArray.getJSONObject(0);
        assertEquals(folder.getString(ProtocolConstants.KEY_NAME), clone.getString(ProtocolConstants.KEY_NAME));

        // get branch details
        request = getGetRequest(clone.getString(GitConstants.KEY_BRANCH));
        response = webConversation.getResponse(request);
        assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());
        JSONObject branches = new JSONObject(response.getText());
        assertEquals(Constants.MASTER,
                GitBranchTest.getCurrentBranch(branches).getString(ProtocolConstants.KEY_NAME));
    }

}

From source file:org.fedoraproject.eclipse.packager.git.api.ConvertLocalToRemoteCommand.java

License:Open Source License

/**
 * Merges remote HEAD with local HEAD (uses the JGit API)
 *
 * @param monitor/*from w w w  .ja v a 2 s .c om*/
 * @throws LocalProjectConversionFailedException
 */
private void mergeLocalRemoteBranches(IProgressMonitor monitor) throws LocalProjectConversionFailedException {

    MergeCommand merge = git.merge();
    try {
        merge.include(git.getRepository().getRef(Constants.R_REMOTES + "origin/" + Constants.MASTER)); //$NON-NLS-1$
        if (monitor.isCanceled()) {
            throw new OperationCanceledException();
        }
        merge.call();
    } catch (Exception e) {
        throw new LocalProjectConversionFailedException(e.getCause().getMessage(), e);
    }
}

From source file:org.fedoraproject.eclipse.packager.git.FedoraPackagerGitCloneOperation.java

License:Open Source License

/**
 * Execute the clone including local branch name creation.
 * //  ww  w  .  j a  va2s.  c o m
 * @param monitor
 * @throws IllegalStateException
 * @throws InvocationTargetException
 * @throws InterruptedException
 * @throws CoreException
 * @throws IOException
 * @return A Git API instance.
 */
public Git run(IProgressMonitor monitor) throws IllegalStateException, InvocationTargetException,
        InterruptedException, CoreException, IOException {
    if (!runnable || hasRun) {
        throw new IllegalStateException(
                NLS.bind(FedoraPackagerGitText.FedoraPackagerGitCloneOperation_operationMisconfiguredError,
                        this.getClass().getName()));
    }

    final CloneOperation clone = new CloneOperation(uri, true, null,
            ResourcesPlugin.getWorkspace().getRoot().getLocation().append(packageName).toFile(),
            Constants.R_HEADS + Constants.MASTER, "origin", 0); //$NON-NLS-1$
    clone.run(monitor);
    if (monitor.isCanceled()) {
        throw new InterruptedException();
    }

    // Find repo we've just created and set gitRepo
    RepositoryCache repoCache = org.eclipse.egit.core.Activator.getDefault().getRepositoryCache();
    Git git = new Git(repoCache.lookupRepository(clone.getGitDir()));

    createLocalBranches(git, monitor);

    // Add cloned repository to the list of Git repositories so that it
    // shows up in the Git repositories view.
    final RepositoryUtil config = org.eclipse.egit.core.Activator.getDefault().getRepositoryUtil();
    config.addConfiguredRepository(clone.getGitDir());

    this.hasRun = true; // disallow two runs of the same instance

    return git;
}

From source file:org.fedoraproject.eclipse.packager.git.FedoraPackagerGitCloneOperation.java

License:Open Source License

/**
 * Create local branches based on existing remotes (uses the JGit API).
 * //from   w  w  w .  java 2s  .co m
 * @param monitor
 * @throws CoreException
 */
private void createLocalBranches(Git git, IProgressMonitor monitor) throws CoreException {
    monitor.beginTask(FedoraPackagerGitText.FedoraPackagerGitCloneWizard_createLocalBranchesJob,
            IProgressMonitor.UNKNOWN);

    try {
        // get a list of remote branches
        ListBranchCommand branchList = git.branchList();
        branchList.setListMode(ListMode.REMOTE); // want all remote branches
        List<Ref> remoteRefs = branchList.call();
        for (Ref remoteRef : remoteRefs) {
            String name = remoteRef.getName();
            int index = (Constants.R_REMOTES + "origin/").length(); //$NON-NLS-1$
            // Remove "refs/remotes/origin/" part in branch name
            name = name.substring(index);
            // Use "f14"-like branch naming
            if (name.endsWith("/" + Constants.MASTER)) { //$NON-NLS-1$
                index = name.indexOf("/" + Constants.MASTER); //$NON-NLS-1$
                name = name.substring(0, index);
            }
            // Create all remote branches, except "master"
            if (!name.equals(Constants.MASTER)) {
                CreateBranchCommand branchCreateCmd = git.branchCreate();
                branchCreateCmd.setName(name);
                // Need to set starting point this way in order for tracking
                // to work properly. See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=333899
                branchCreateCmd.setStartPoint(remoteRef.getName());
                // Add remote tracking config in order to not confuse
                // fedpkg
                branchCreateCmd.setUpstreamMode(SetupUpstreamMode.TRACK);
                branchCreateCmd.call();
            }
        }
    } catch (JGitInternalException e) {
        e.printStackTrace();
    } catch (RefAlreadyExistsException e) {
        e.printStackTrace();
    } catch (RefNotFoundException e) {
        e.printStackTrace();
    } catch (InvalidRefNameException e) {
        e.printStackTrace();
    }
}

From source file:org.fedoraproject.eclipse.packager.git.FpGitProjectBits.java

License:Open Source License

/**
 * Maps branch names to the internal format used by all IFpProjectBits
 * implementations. For example <code>mapBranchName("f8")</code> would
 * return <code>"F-8"</code> and <code>mapBranchName("master")</code> would
 * return <code>"devel"</code>.
 * //  ww  w  . j a v  a 2s .c  om
 * @param from
 *            The original raw branch name with "refs/something"
 *            prefixes omitted.
 * @return The mapped branch name.
 */
private String mapBranchName(String from) {
    String prefix, version;
    Matcher branchMatcher = BRANCH_PATTERN.matcher(from);
    if (!branchMatcher.matches()) {
        // This should never happen. Maybe something wrong with the regular
        // expression?
        return null;
    }
    for (int i = 1; i < branchMatcher.groupCount(); i++) {
        prefix = branchMatcher.group(i); // null if group didn't match at all
        version = branchMatcher.group(i + 1);
        if (version == null && prefix != null && prefix.equals(Constants.MASTER)) {
            // matched master
            return "devel"; //$NON-NLS-1$
        } else if (version != null && prefix != null) {
            // F, EPEL, OLPC matches
            return prefix.toUpperCase() + "-" + version; //$NON-NLS-1$
        }
    }
    // something's fishy
    return null;
}

From source file:org.fedoraproject.eclipse.packager.git.GitUtils.java

License:Open Source License

/**
 * Create local branches based on existing remotes (uses the JGit API).
 *
 * @param git/* ww  w  .j  a  v a  2  s .  co  m*/
 * @param monitor
 * @throws CoreException
 */
public static void createLocalBranches(Git git, IProgressMonitor monitor) throws CoreException {
    monitor.beginTask(FedoraPackagerGitText.FedoraPackagerGitCloneWizard_createLocalBranchesJob,
            IProgressMonitor.UNKNOWN);
    try {
        // get a list of remote branches
        ListBranchCommand branchList = git.branchList();
        branchList.setListMode(ListMode.REMOTE); // want all remote branches
        List<Ref> remoteRefs = branchList.call();
        for (Ref remoteRef : remoteRefs) {
            String name = remoteRef.getName();
            int index = (Constants.R_REMOTES + "origin/").length(); //$NON-NLS-1$
            // Remove "refs/remotes/origin/" part in branch name
            name = name.substring(index);
            // Use "f14"-like branch naming
            if (name.endsWith("/" + Constants.MASTER)) { //$NON-NLS-1$
                index = name.indexOf("/" + Constants.MASTER); //$NON-NLS-1$
                name = name.substring(0, index);
            }
            // Create all remote branches, except "master"
            if (!name.equals(Constants.MASTER)) {
                CreateBranchCommand branchCreateCmd = git.branchCreate();
                branchCreateCmd.setName(name);
                // Need to set starting point this way in order for tracking
                // to work properly. See:
                // https://bugs.eclipse.org/bugs/show_bug.cgi?id=333899
                branchCreateCmd.setStartPoint(remoteRef.getName());
                // Add remote tracking config in order to not confuse
                // fedpkg
                branchCreateCmd.setUpstreamMode(SetupUpstreamMode.TRACK);
                if (monitor.isCanceled()) {
                    throw new OperationCanceledException();
                }
                branchCreateCmd.call();
            }
        }
    } catch (JGitInternalException e) {
        e.printStackTrace();
    } catch (RefAlreadyExistsException e) {
        e.printStackTrace();
    } catch (RefNotFoundException e) {
        e.printStackTrace();
    } catch (InvalidRefNameException e) {
        e.printStackTrace();
    }
}

From source file:org.flowerplatform.web.git.GitService.java

License:Open Source License

@RemoteInvocation
public List<Object> getBranches(ServiceInvocationContext context, String repositoryUrl) {
    tlCommand.set((InvokeServiceMethodServerCommand) context.getCommand());
    Repository db = null;//w w  w  .j a  v  a  2  s  . com
    try {
        URIish uri = new URIish(repositoryUrl.trim());
        db = new FileRepository(new File("/tmp"));

        Git git = new Git(db);
        LsRemoteCommand rc = git.lsRemote();
        rc.setRemote(uri.toString()).setTimeout(30);

        Collection<Ref> remoteRefs = rc.call();
        List<GitRef> branches = new ArrayList<GitRef>();

        Ref idHEAD = null;
        for (Ref r : remoteRefs) {
            if (r.getName().equals(Constants.HEAD)) {
                idHEAD = r;
            }
        }
        Ref head = null;
        boolean headIsMaster = false;
        String masterBranchRef = Constants.R_HEADS + Constants.MASTER;
        for (Ref r : remoteRefs) {
            String n = r.getName();
            if (!n.startsWith(Constants.R_HEADS))
                continue;
            branches.add(new GitRef(n, Repository.shortenRefName(n)));
            if (idHEAD == null || headIsMaster)
                continue;
            if (r.getObjectId().equals(idHEAD.getObjectId())) {
                headIsMaster = masterBranchRef.equals(r.getName());
                if (head == null || headIsMaster)
                    head = r;
            }
        }
        Collections.sort(branches, new Comparator<GitRef>() {
            public int compare(GitRef r1, GitRef r2) {
                return r1.getShortName().compareTo(r2.getShortName());
            }
        });
        if (idHEAD != null && head == null) {
            head = idHEAD;
            branches.add(0, new GitRef(idHEAD.getName(), Repository.shortenRefName(idHEAD.getName())));
        }

        GitRef headRef = head != null ? new GitRef(head.getName(), Repository.shortenRefName(head.getName()))
                : null;
        return Arrays.asList(new Object[] { branches, headRef });
    } catch (JGitInternalException | GitAPIException e) {
        context.getCommunicationChannel()
                .appendOrSendCommand(
                        new DisplaySimpleMessageClientCommand(CommonPlugin.getInstance().getMessage("error"),
                                GitPlugin.getInstance().getMessage("git.cloneWizard.branch.cannotListBranches")
                                        + "\n" + e.getCause().getMessage(),
                                DisplaySimpleMessageClientCommand.ICON_ERROR));
    } catch (IOException e) {
        context.getCommunicationChannel().appendOrSendCommand(
                new DisplaySimpleMessageClientCommand(CommonPlugin.getInstance().getMessage("error"),
                        GitPlugin.getInstance().getMessage("git.cloneWizard.branch.cannotCreateTempRepo"),
                        DisplaySimpleMessageClientCommand.ICON_ERROR));
    } catch (URISyntaxException e) {
        context.getCommunicationChannel().appendOrSendCommand(
                new DisplaySimpleMessageClientCommand(CommonPlugin.getInstance().getMessage("error"),
                        e.getReason(), DisplaySimpleMessageClientCommand.ICON_ERROR));
    } catch (Exception e) {
        if (GitPlugin.getInstance().getUtils().isAuthentificationException(e)) {
            openLoginWindow();
            return null;
        }
        logger.debug(CommonPlugin.getInstance().getMessage("error"), e);
    } finally {
        if (db != null) {
            db.close();
        }
    }
    return null;
}

From source file:org.gitective.tests.CommitBaseTest.java

License:Open Source License

/**
 * Test getting the base commit of a branch and master and then walking
 * between the tip of the branch and its branch point.
 * /*from  w  w  w.  jav a2s  . c om*/
 * @throws Exception
 */
@Test
public void baseCommits() throws Exception {
    RevCommit commit1 = add("file.txt", "content");
    branch("release1");
    RevCommit commit2 = add("file.txt", "edit 1");
    RevCommit commit3 = add("file.txt", "edit 2");

    Repository repo = new FileRepository(testRepo);
    RevCommit base = CommitUtils.getBase(repo, Constants.MASTER, "release1");
    assertEquals(commit1, base);

    RevCommit base2 = CommitUtils.getBase(repo, CommitUtils.getCommit(repo, Constants.MASTER),
            CommitUtils.getCommit(repo, "release1"));
    assertEquals(base, base2);

    CommitListFilter filter = new CommitListFilter();
    new CommitFinder(testRepo).setFilter(filter).findBetween(commit3, base);
    assertEquals(2, filter.getCommits().size());
    assertEquals(commit3, filter.getCommits().get(0));
    assertEquals(commit2, filter.getCommits().get(1));
}