Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.Git.status()


        for (File file : workTreeFilesToDelete)
        {
            FileUtils.deleteQuietly(file);
        }

        Status status = git.status().call();
        if (!status.getAdded().isEmpty() ||
            !status.getChanged().isEmpty() ||
            !status.getMissing().isEmpty() ||
            !status.getRemoved().isEmpty() ||
            !status.getUntracked().isEmpty())
View Full Code Here


            {
                Git git = new Git(repo);
                if (repo.getAllRefs().containsKey("refs/heads/master"))
                {
                    git.reset().setMode(ResetCommand.ResetType.HARD).setRef("HEAD").call();
                    for (String path : git.status().call().getUntracked())
                    {
                        new File(repo.getWorkTree(), path).delete();
                    }
                }
                return ZipWriter.addDirectoryContentsToJar(repo.getWorkTree(), ".git");
View Full Code Here

                doCommit = JGitUtils.addAllFiles( git, fileSet ).size() > 0;
            }
            else
            {
                // add all tracked files which are modified manually
                Set<String> changeds = git.status().call().getModified();
                if ( changeds.isEmpty() )
                {
                    // warn there is nothing to add
                    getLogger().warn( "there are no files to be added" );
                    doCommit = false;
View Full Code Here

    Ref masterRef = git.getRepository()
        .getRef("master");
    if (null != masterRef)
      commitId = ObjectId.toString(masterRef.getObjectId());

    Status status = git.status().call();

    boolean pushAhead = false;

    if (null != commitId && status.isClean()) {
      versionLabel = lookupVersionLabelForCommitId(commitId);
View Full Code Here

    Ref masterRef = git.getRepository()
        .getRef("master");
    if (null != masterRef)
      commitId = ObjectId.toString(masterRef.getObjectId());

    Status status = git.status().call();

    boolean pushAhead = false;

    if (null != commitId && status.isClean()) {
      versionLabel = lookupVersionLabelForCommitId(commitId);
View Full Code Here

    {
        Git git = null;
        try
        {
            git = Git.open( fileSet.getBasedir() );
            Status status = git.status().call();
            List<ScmFile> changedFiles = getFileStati( status );

            return new StatusScmResult( "JGit status", changedFiles );
        }
        catch ( Exception e )
View Full Code Here

                doCommit = JGitUtils.addAllFiles( git, fileSet ).size() > 0;
            }
            else
            {
                // add all tracked files which are modified manually
                Set<String> changeds = git.status().call().getModified();
                if ( changeds.isEmpty() )
                {
                    // warn there is nothing to add
                    getLogger().warn( "there are no files to be added" );
                    doCommit = false;
View Full Code Here

    git.commit().setMessage("delete and ignore file").call();

    writeTrashFile(fname, "Something different");
    git.checkout().setName("master").call();
    assertWorkDir(mkmap(fname, "b"));
    assertTrue(git.status().call().isClean());
  }

  @Test
  public void testFileModeChangeWithNoContentChangeUpdate() throws Exception {
    if (!FS.DETECTED.supportsExecute())
View Full Code Here

    db.getFS().setExecute(file, true);
    git.add().addFilepattern("file.txt").call();
    git.commit().setMessage("commit2").call();

    // Verify executable and working directory is clean
    Status status = git.status().call();
    assertTrue(status.getModified().isEmpty());
    assertTrue(status.getChanged().isEmpty());
    assertTrue(db.getFS().canExecute(file));

    // Switch branches
View Full Code Here

    // Switch branches
    git.checkout().setName("b1").call();

    // Verify not executable and working directory is clean
    status = git.status().call();
    assertTrue(status.getModified().isEmpty());
    assertTrue(status.getChanged().isEmpty());
    assertFalse(db.getFS().canExecute(file));
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.