本文整理汇总了Java中org.eclipse.jgit.api.AddCommand.setUpdate方法的典型用法代码示例。如果您正苦于以下问题:Java AddCommand.setUpdate方法的具体用法?Java AddCommand.setUpdate怎么用?Java AddCommand.setUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.api.AddCommand
的用法示例。
在下文中一共展示了AddCommand.setUpdate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFiles
import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
/**
* Adds the files returned from {@link #filePatternGetter} and then calls {@link #updateFiles(List)}
*/
public final void addFiles() {
try {
AddCommand addCmd = git.getOrThrow().add();
// insure add command will add newly staged files
addCmd.setUpdate(false);
// add files
List<String> files = filePatternGetter.get();
files.forEach(addCmd::addFilepattern);
addCmd.call();
updateFiles(files);
} catch (GitAPIException e) {
handleGitAPIException(e);
}
}
示例2: createMember
import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
@Override
public void createMember(RequestContext ctx, ResourceState state, Responder responder) throws Exception {
String commitMsg = state.getPropertyAsString("msg");
Boolean includeUntracked = state.getPropertyAsBoolean("include-untracked");
if (includeUntracked == null) {
// Default to include all untracked files
includeUntracked = Boolean.TRUE;
}
// Add changed files to staging ready for commit
AddCommand addCmd = parent.git().add().addFilepattern(".");
if (!includeUntracked) {
// This will prevent new files from being added to the index, and therefore the commit
addCmd.setUpdate(true);
}
// Commit staged changes
RevCommit commit;
CommitCommand commitCmd = parent.git().commit();
if (ctx.securityContext() != null) {
UserProfile user = ctx.securityContext().getUser();
if (user != null && user.name() != null && user.email() != null) {
commitCmd.setCommitter(user.name(), user.email());
}
}
if (commitMsg != null) {
commitCmd.setMessage(commitMsg);
}
commit = GitHandler.commit(() -> {
addCmd.call();
return commitCmd.call();
});
responder.resourceCreated(new GitCommitResource(this, commit));
}
示例3: addFiles
import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
/**
* Add (stage) files to the index.
* @param git the git repository
* @param relativePaths the relative paths of the files to add
* @param excludeNewFiles if true, any untracked files in {@code relativePaths} will not be added (they won't
* become "tracked" at the end of the call).
* @throws GitAPIException
*/
public static void addFiles(Git git, List<String> relativePaths, boolean excludeNewFiles) throws GitAPIException {
AddCommand adder = git.add();
adder.setUpdate(excludeNewFiles);
relativePaths.forEach(adder::addFilepattern);
adder.call();
}