org.eclipse.jgit.api.LogCommand Java Examples
The following examples show how to use
org.eclipse.jgit.api.LogCommand.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommitTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testCommitNoRoots () throws Exception { File toCommit = new File(workDir, "testnotadd.txt"); write(toCommit, "blablabla"); GitClient client = getClient(workDir); Map<File, GitStatus> statuses = client.getStatus(new File[] { toCommit }, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, toCommit, false, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_ADDED, GitStatus.Status.STATUS_ADDED, false); client.add(new File[] { toCommit }, NULL_PROGRESS_MONITOR); statuses = client.getStatus(new File[] { toCommit }, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, toCommit, true, GitStatus.Status.STATUS_ADDED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_ADDED, false); GitRevisionInfo info = client.commit(new File[0], "initial commit", null, null, NULL_PROGRESS_MONITOR); statuses = client.getStatus(new File[] { toCommit }, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, toCommit, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); Git git = new Git(repository); LogCommand log = git.log(); RevCommit com = log.call().iterator().next(); assertEquals("initial commit", info.getFullMessage()); assertEquals("initial commit", com.getFullMessage()); assertEquals(ObjectId.toString(com.getId()), info.getRevision()); Map<File, GitFileInfo> modifiedFiles = info.getModifiedFiles(); assertTrue(modifiedFiles.get(toCommit).getStatus().equals(Status.ADDED)); }
Example #2
Source File: GitSCM.java From repositoryminer with Apache License 2.0 | 6 votes |
private Iterable<RevCommit> getCommitsFromTag(String refName) { try { List<Ref> call = git.tagList().call(); for (Ref ref : call) { if (ref.getName().endsWith(refName)) { LogCommand log = git.log(); Ref peeledRef = git.getRepository().peel(ref); if (peeledRef.getPeeledObjectId() != null) { return log.add(peeledRef.getPeeledObjectId()).call(); } else { return log.add(ref.getObjectId()).call(); } } } return null; } catch (GitAPIException | IncorrectObjectTypeException | MissingObjectException e) { close(); throw new RepositoryMinerException(e); } }
Example #3
Source File: GitProctor.java From proctor with Apache License 2.0 | 6 votes |
@Nonnull @Override public List<Revision> getMatrixHistory(final int start, final int limit) throws StoreException { final LogCommand logCommand; try { final ObjectId branchHead = git.getRepository().resolve(getGitCore().getRefName()); logCommand = git.log() .add(branchHead) .setSkip(start) .setMaxCount(limit); return getHistoryFromLogCommand(logCommand); } catch (final IOException e) { throw new StoreException("Could not get history for starting at " + getGitCore().getRefName(), e); } }
Example #4
Source File: GitProctor.java From proctor with Apache License 2.0 | 6 votes |
@Nonnull @Override public List<Revision> getHistory(final String test, final String revision, final int start, final int limit) throws StoreException { try { final ObjectId commitId = ObjectId.fromString(revision); final LogCommand logCommand = git.log() // TODO: create path to definition.json file, sanitize test name for invalid / relative characters .addPath(getTestDefinitionsDirectory() + File.separator + test + File.separator + FileBasedProctorStore.TEST_DEFINITION_FILENAME) .add(commitId) .setSkip(start) .setMaxCount(limit); return getHistoryFromLogCommand(logCommand); } catch (final IOException e) { throw new StoreException("Could not get history for " + test + " starting at " + getGitCore().getRefName(), e); } }
Example #5
Source File: GitProctor.java From proctor with Apache License 2.0 | 6 votes |
private List<Revision> getHistoryFromLogCommand(final LogCommand command) throws StoreException { final List<Revision> versions = Lists.newArrayList(); final Iterable<RevCommit> commits; try { commits = command.call(); } catch (final GitAPIException e) { throw new StoreException("Could not get history", e); } for (final RevCommit commit : commits) { versions.add(new Revision( commit.getName(), determineAuthorId(commit), new Date((long) commit.getCommitTime() * 1000 /* convert seconds to milliseconds */), commit.getFullMessage() )); } return versions; }
Example #6
Source File: DescribedTags.java From gradle-gitsemver with Apache License 2.0 | 6 votes |
private static TagVersionAndCount fixCommitCount(TagVersionAndCount resolved, Repository repo) throws RefNotFoundException, GitAPIException { Git git = new Git(repo); ObjectId target, head; LogCommand logCommand; try { target = repo.getRef(resolved.getVersion()).getPeeledObjectId(); logCommand = git.log(); logCommand.add(target); } catch (IOException e) { throw new SemverGitflowPlugin.VersionApplicationException(e); } int count = 0; for (RevCommit commit : logCommand.call()) { count ++; } return new TagVersionAndCount(resolved.getVersion(), count); }
Example #7
Source File: CommitTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testSingleFileCommit () throws Exception { repository.getConfig().setString("user", null, "name", "John"); repository.getConfig().setString("user", null, "email", "[email protected]"); repository.getConfig().save(); File toCommit = new File(workDir, "testnotadd.txt"); write(toCommit, "blablabla"); GitClient client = getClient(workDir); Map<File, GitStatus> statuses = client.getStatus(new File[] { toCommit }, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, toCommit, false, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_ADDED, GitStatus.Status.STATUS_ADDED, false); client.add(new File[] { toCommit }, NULL_PROGRESS_MONITOR); statuses = client.getStatus(new File[] { toCommit }, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, toCommit, true, GitStatus.Status.STATUS_ADDED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_ADDED, false); long t1 = System.currentTimeMillis(); Thread.sleep(1000); GitRevisionInfo info = client.commit(new File[] { toCommit }, "initial commit", null, null, NULL_PROGRESS_MONITOR); Thread.sleep(1000); long t2 = System.currentTimeMillis(); statuses = client.getStatus(new File[] { toCommit }, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, toCommit, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertTrue(t1 <= info.getCommitTime() && t2 >= info.getCommitTime()); Git git = new Git(repository); LogCommand log = git.log(); RevCommit com = log.call().iterator().next(); assertEquals("initial commit", info.getFullMessage()); assertEquals("initial commit", com.getFullMessage()); assertEquals( "[email protected]", info.getAuthor().getEmailAddress()); assertEquals( "[email protected]", com.getAuthorIdent().getEmailAddress()); assertEquals(ObjectId.toString(com.getId()), info.getRevision()); Map<File, GitFileInfo> modifiedFiles = info.getModifiedFiles(); assertTrue(modifiedFiles.get(toCommit).getStatus().equals(Status.ADDED)); }
Example #8
Source File: CommitTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testSingleTreeCommit () throws Exception { File folder = new File(workDir, "folder"); File subfolder1 = new File(folder, "subfolder"); File subfolder11 = new File(subfolder1, "subfolder1"); File subfolder12 = new File(subfolder1, "subfolder2"); subfolder11.mkdirs(); subfolder12.mkdirs(); File file1 = new File(subfolder11, "file1"); File file2 = new File(subfolder12, "file2"); write(file1, "file1 content"); write(file2, "file2 content"); File[] files = new File[] { folder }; GitClient client = getClient(workDir); client.add(files, NULL_PROGRESS_MONITOR); GitRevisionInfo info = client.commit(files, "initial commit", null, null, NULL_PROGRESS_MONITOR); Map<File, GitFileInfo> modifiedFiles = info.getModifiedFiles(); assertEquals(2, modifiedFiles.size()); assertTrue(modifiedFiles.get(file1).getStatus().equals(Status.ADDED)); assertTrue(modifiedFiles.get(file2).getStatus().equals(Status.ADDED)); Map<File, GitStatus> statuses = client.getStatus(files, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, file1, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file2, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); Git git = new Git(repository); LogCommand log = git.log(); RevCommit com = log.call().iterator().next(); assertEquals("initial commit", com.getFullMessage()); }
Example #9
Source File: GitMigrator.java From phoebus with Eclipse Public License 1.0 | 5 votes |
private List<RevCommit> findCommitsFor(String filePath) throws Exception { List<RevCommit> commitsList = new ArrayList<>(); ObjectId obj = git.getRepository().resolve(Constants.HEAD); LogCommand log = git.log().add(obj).addPath(filePath); Iterable<RevCommit> commits = log.call(); for (RevCommit commit : commits) { commitsList.add(commit); } return commitsList; }
Example #10
Source File: Gits.java From Notebook with Apache License 2.0 | 4 votes |
public static void push(Callback callback){ try { // URI uri = Gits.class.getResource("/").toURI(); String projectDir = System.getProperty("user.dir"); String deployDir = Preferences.get(Constants.CONFIG_DEPLOY_PATH); // =============== ���� =============== String realDeployDir = null; if("".equals(deployDir)){ realDeployDir = projectDir; }else{ realDeployDir = deployDir; } L.D("begin deploy : " + realDeployDir + File.separator + "encrypt.db"); File encryptdb = new File(realDeployDir,"encrypt.db"); if(!encryptdb.exists()){ encryptdb.createNewFile(); } byte[] datas = IOUtils.toByteArray(new FileInputStream("notebook.db")); String secret = Preferences.get(Constants.CONFIG_SECRET); if("".equals(secret)){ throw new IllegalArgumentException("δ���ü�����Կ"); } byte[] encryptDatas = PBECoder.encript(datas, secret, "13572468".getBytes()); System.out.println(encryptDatas.length); FileUtils.writeByteArrayToFile(encryptdb, encryptDatas); String gitResitory = realDeployDir + File.separator + ".git"; Git git = Git.open(new File(gitResitory)); Repository repository = git.getRepository(); System.out.println(repository.getBranch()); // git log LogCommand logCommand = git.log(); Iterator<RevCommit> iterator= logCommand.call().iterator(); while (iterator.hasNext()) { RevCommit revCommit = iterator.next(); // System.out.println(new String(revCommit.getRawBuffer())); } /****************************************************************************** * ------------------------- git add �÷� ------------------------- * ��ʾ��<path>������tracked�ļ��б��Ĺ�����ɾ���ļ�������untracted���ļ���Ϣ��ӵ������⡣ * addFilepattern(". -A").call() * addFilepattern("README").call() * -------------------------------------------------------------- *****************************************************************************/ git.add().addFilepattern("encrypt.db").call(); // git commit SimpleDateFormat sf = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss"); StringBuffer message = new StringBuffer(); message.append("======="); message.append(" :smile: "); message.append("update Notebook.db"); message.append(" on "); message.append(sf.format(new Date())); message.append(" ======="); // git.commit().setAll(true) �൱�� git commit -a,�����ύȫ���ļ�,���Ƽ��� // git.commit().setAll(true).setAuthor("deeper", "[email protected]").setMessage(message.toString()).call(); git.commit().setAuthor("deeper", "[email protected]").setMessage(message.toString()).call(); String git_user = Preferences.get(Constants.CONFIG_GIT_USER); String git_pass = Preferences.get(Constants.CONFIG_GIT_PASSWORD); if(!"".equals(git_user) || !"".equals(git_pass)){ // https ��ʽ�ύ git.push().setCredentialsProvider(new UsernamePasswordCredentialsProvider(git_user,git_pass)).call(); } else { // ssh��ʽ�ύ AllowHostsCredentialsProvider allowHosts = new AllowHostsCredentialsProvider(); git.push().setCredentialsProvider(allowHosts).call(); } callback.success(); } catch (Exception e) { callback.error(e); } }
Example #11
Source File: CommitTest.java From netbeans with Apache License 2.0 | 4 votes |
public void testMultipleFileCommit () throws Exception { repository.getConfig().setString("user", null, "name", "John"); repository.getConfig().setString("user", null, "email", "[email protected]"); repository.getConfig().save(); File dir = new File(workDir, "testdir"); File newOne = new File(dir, "test.txt"); File another = new File(dir, "test2.txt"); dir.mkdirs(); write(newOne, "this is test!"); write(another, "this is another test!"); GitClient client = getClient(workDir); client.add(new File[] { newOne, another }, NULL_PROGRESS_MONITOR); Map<File, GitStatus> statuses = client.getStatus(new File[] { newOne, another }, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, newOne, true, GitStatus.Status.STATUS_ADDED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_ADDED, false); assertStatus(statuses, workDir, another, true, GitStatus.Status.STATUS_ADDED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_ADDED, false); GitRevisionInfo info = client.commit(new File[] { newOne, another }, "initial commit", null, null, NULL_PROGRESS_MONITOR); statuses = client.getStatus(new File[] { newOne, another }, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, newOne, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, another, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); Map<File, GitFileInfo> modifiedFiles = info.getModifiedFiles(); assertTrue(modifiedFiles.get(newOne).getStatus().equals(Status.ADDED)); assertTrue(modifiedFiles.get(another).getStatus().equals(Status.ADDED)); Git git = new Git(repository); LogCommand log = git.log(); RevCommit com = log.call().iterator().next(); assertEquals("initial commit", com.getFullMessage()); assertEquals( "[email protected]", com.getAuthorIdent().getEmailAddress()); write(newOne, "!modification!"); write(another, "another modification!"); client.add(new File[] { workDir }, NULL_PROGRESS_MONITOR); statuses = client.getStatus(new File[] { workDir }, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, newOne, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); assertStatus(statuses, workDir, another, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); info = client.commit(new File[] { newOne, another }, "second commit", null, null, NULL_PROGRESS_MONITOR); statuses = client.getStatus(new File[] { workDir }, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, newOne, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, another, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); modifiedFiles = info.getModifiedFiles(); assertTrue(modifiedFiles.get(newOne).getStatus().equals(Status.MODIFIED)); assertTrue(modifiedFiles.get(another).getStatus().equals(Status.MODIFIED)); log = git.log(); com = log.call().iterator().next(); assertEquals("second commit", com.getFullMessage()); assertEquals( "[email protected]", com.getAuthorIdent().getEmailAddress()); }
Example #12
Source File: CommitTest.java From netbeans with Apache License 2.0 | 4 votes |
public void testMultipleTreesCommit () throws Exception { File folder1 = new File(workDir, "folder1"); File subfolder11 = new File(folder1, "subfolder1"); File subfolder12 = new File(folder1, "subfolder2"); subfolder11.mkdirs(); subfolder12.mkdirs(); File file11 = new File(subfolder11, "file1"); File file12 = new File(subfolder12, "file2"); write(file11, "file1 content"); write(file12, "file2 content"); File folder2 = new File(workDir, "folder2"); File subfolder21 = new File(folder2, "subfolder1"); File subfolder22 = new File(folder2, "subfolder2"); subfolder21.mkdirs(); subfolder22.mkdirs(); File file21 = new File(subfolder21, "file1"); File file22 = new File(subfolder22, "file2"); write(file21, "file1 content"); write(file22, "file2 content"); File[] files = new File[] { folder1, folder2 }; GitClient client = getClient(workDir); client.add(files, NULL_PROGRESS_MONITOR); GitRevisionInfo info = client.commit(files, "initial commit", null, null, NULL_PROGRESS_MONITOR); Map<File, GitFileInfo> modifiedFiles = info.getModifiedFiles(); assertEquals(4, modifiedFiles.size()); Map<File, GitStatus> statuses = client.getStatus(files, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, file11, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file12, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file21, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file22, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); Git git = new Git(repository); LogCommand log = git.log(); RevCommit com = log.call().iterator().next(); assertEquals("initial commit", com.getFullMessage()); write(file11, "!modification!"); write(file12, "another modification!"); write(file21, "!modification!"); write(file22, "another modification!"); client.add(files, NULL_PROGRESS_MONITOR); statuses = client.getStatus(files, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, file11, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); assertStatus(statuses, workDir, file12, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); assertStatus(statuses, workDir, file21, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); assertStatus(statuses, workDir, file22, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); client.commit(files, "second commit", null, null, NULL_PROGRESS_MONITOR); statuses = client.getStatus(files, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, file11, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file12, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file21, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file22, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); log = git.log(); com = log.call().iterator().next(); assertEquals("second commit", com.getFullMessage()); }
Example #13
Source File: CommitTest.java From netbeans with Apache License 2.0 | 4 votes |
public void testCommitOnlySomeOfAllFilesFromMultipleTrees () throws Exception { File folder1 = new File(workDir, "folder1"); File subfolder11 = new File(folder1, "subfolder1"); File subfolder12 = new File(folder1, "subfolder2"); subfolder11.mkdirs(); subfolder12.mkdirs(); File file11 = new File(subfolder11, "file1"); File file12 = new File(subfolder12, "file2"); write(file11, "file1 content"); write(file12, "file2 content"); File folder2 = new File(workDir, "folder2"); File subfolder21 = new File(folder2, "subfolder1"); File subfolder22 = new File(folder2, "subfolder2"); subfolder21.mkdirs(); subfolder22.mkdirs(); File file21 = new File(subfolder21, "file1"); File file22 = new File(subfolder22, "file2"); write(file21, "file1 content"); write(file22, "file2 content"); File[] trees = new File[] { folder1, folder2 }; File[] filesToCommit = new File[] { folder1, subfolder21 }; File[] filesSingleFolder = new File[] { subfolder21 }; GitClient client = getClient(workDir); client.add(trees, NULL_PROGRESS_MONITOR); // COMMIT SOME GitRevisionInfo info = client.commit(filesSingleFolder, "initial commit", null, null, NULL_PROGRESS_MONITOR); Map<File, GitFileInfo> modifiedFiles = info.getModifiedFiles(); assertEquals(1, modifiedFiles.size()); Map<File, GitStatus> statuses = client.getStatus(trees, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, file11, true, GitStatus.Status.STATUS_ADDED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_ADDED, false); assertStatus(statuses, workDir, file12, true, GitStatus.Status.STATUS_ADDED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_ADDED, false); assertStatus(statuses, workDir, file21, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file22, true, GitStatus.Status.STATUS_ADDED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_ADDED, false); Git git = new Git(repository); LogCommand log = git.log(); RevCommit com = log.call().iterator().next(); assertEquals("initial commit", com.getFullMessage()); // COMMIT ALL info = client.commit(trees, "commit all", null, null, NULL_PROGRESS_MONITOR); modifiedFiles = info.getModifiedFiles(); assertEquals(3, modifiedFiles.size()); statuses = client.getStatus(trees, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, file11, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file12, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file21, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file22, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); write(file11, "!modification!"); write(file12, "another modification!"); write(file21, "!modification!"); write(file22, "another modification!"); client.add(trees, NULL_PROGRESS_MONITOR); statuses = client.getStatus(trees, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, file11, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); assertStatus(statuses, workDir, file12, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); assertStatus(statuses, workDir, file21, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); assertStatus(statuses, workDir, file22, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); info = client.commit(filesToCommit, "second commit", null, null, NULL_PROGRESS_MONITOR); modifiedFiles = info.getModifiedFiles(); assertEquals(3, modifiedFiles.size()); statuses = client.getStatus(trees, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, file11, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file12, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file21, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file22, true, GitStatus.Status.STATUS_MODIFIED, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_MODIFIED, false); log = git.log(); com = log.call().iterator().next(); assertEquals("second commit", com.getFullMessage()); // COMMIT ALL client.commit(trees, "commit all", null, null, NULL_PROGRESS_MONITOR); statuses = client.getStatus(trees, NULL_PROGRESS_MONITOR); assertStatus(statuses, workDir, file11, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file12, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file21, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); assertStatus(statuses, workDir, file22, true, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, GitStatus.Status.STATUS_NORMAL, false); }