C.16 GitFetchTask

Download objects and refs from another repository. See official documentation.

Table C.17: Attributes

NameTypeDescriptionDefaultRequired
gitPathStringPath to Git binary./usr/bin/gitNo
repositoryStringPath to Git repository.n/aYes
sourceStringThe "remote" repository that is the source of a fetch or pull operation. See <repository> in git-fetch.originNo
refspecStringSee <refspec> in git-fetch. No
groupStringA name referring to a list of repositories as the value of remotes.<group> in the configuration file. See <group> in git-fetch. No
quietBooleanSilence any internally used git commands. Progress is not reported to the standard error stream. See --quiet in git-fetch.falseNo
allBooleanFetch all remotes. See --all in git-fetch.falseNo
keepBooleanKeep downloaded pack. See --keep in git-fetch.falseNo
pruneBooleanAfter fetching, remove any remote tracking branches which no longer exist on the remote. See --prune in git-fetch.falseNo
tagsBooleanSee --tags in git-fetch.falseNo
notagsBooleanSee --no-tags in git-fetch.falseNo
forceBooleanWhen git fetch is used with <rbranch>:<lbranch> refspec, it refuses to update the local branch <lbranch> unless the remote branch <rbranch> it fetches is a descendant of <lbranch>. This option overrides that check. See --force in git-fetch.falseNo

C.16.1 Example

<property name="repo.dir" value="./relative/path/to/repo" />
<resolvepath propertyName="repo.dir.resolved" file="${repo.dir}" />

<!-- Initialize normal repository -->
<gitinit repository="${repo.dir.resolved}" />

<!-- Fetch objects from all remotes -->
<gitfetch
    repository="${repo.dir.resolved}" all="true" />

<!-- Fetch from origin/master to "refspec-branch" local branch -->
<gitfetch
    repository="${repo.dir.resolved}"
    source="origin"
    refspec="master:refspec-branch"
    quiet="true" />