Bug 485326 - Jgit add missing -A option. Currently, we need to perform AddCommand twice to stage added, modified, removed files.
Summary: Jgit add missing -A option. Currently, we need to perform AddCommand twice to...
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-07 04:06 EST by Anurag Jain CLA
Modified: 2016-01-07 04:06 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anurag Jain CLA 2016-01-07 04:06:53 EST
Does Jgit have a "-A" option like git?
We are currently executing:

AddCommand addCmd = git().add();
addCmd.addFilepattern(".");
DirCache retVal = addCmd.call();

CommitCommand commitCmd = git().commit();
final boolean includeDeleted = true;
commitCmd.setAll(includeDeleted);
commitCmd.setMessage(message);

final RevCommit commitResult = commitCmd.call();
String retVal = commitResult.getId().name();


In above, AddCommand is executed twice, first (by us) to account for new files or changed files and second by commit to include deleted files.

AddCommand loops over the Git repo. Based on above, we are looping twice over the repo. That is proving to be costly for us. Can we do any better w.r.t. AddCommand such that it stages new, modified, deleted files in the repo in one loop?

Any other suggestions to improve performance are invited. 

Thanks!