public class AddCommand extends GitCommand<DirCache>
Add command. It has setters for all
supported options and arguments of this command and a call() method
to finally execute the command. Each instance of this class should only be
used for one invocation of the command (means: one call to call())repo| Constructor and Description |
|---|
AddCommand(Repository repo) |
| Modifier and Type | Method and Description |
|---|---|
AddCommand |
addFilepattern(String filepattern)
Add a path to a file/directory whose content should be added.
|
DirCache |
call()
Executes the
Add command. |
boolean |
isUpdate() |
AddCommand |
setUpdate(boolean update) |
AddCommand |
setWorkingTreeIterator(WorkingTreeIterator f)
Allow clients to provide their own implementation of a FileTreeIterator
|
checkCallable, getRepository, setCallablepublic AddCommand(Repository repo)
repo - public AddCommand addFilepattern(String filepattern)
A directory name (e.g. dir to add dir/file1 and
dir/file2) can also be given to add all files in the
directory, recursively. Fileglobs (e.g. *.c) are not yet supported.
filepattern - repository-relative path of file/directory to add (with
/ as separator)thispublic AddCommand setWorkingTreeIterator(WorkingTreeIterator f)
f - thispublic DirCache call() throws GitAPIException, NoFilepatternException
Add command. Each instance of this class should only
be used for one invocation of the command. Don't call this method twice
on an instance.call in interface Callable<DirCache>call in class GitCommand<DirCache>GitAPIException - or subclass thereof when an error occursNoFilepatternExceptionpublic AddCommand setUpdate(boolean update)
update - If set to true, the command only matches filepattern
against already tracked files in the index rather than the
working tree. That means that it will never stage new files,
but that it will stage modified new contents of tracked files
and that it will remove files from the index if the
corresponding files in the working tree have been removed.
In contrast to the git command line a filepattern must
exist also if update is set to true as there is no
concept of a working directory here.thispublic boolean isUpdate()
Copyright © 2014. All rights reserved.