I am using JGit in a project and I would like to achieve the programmatic equivalent of a git --fetch all
. The JGit API Documentation provides three alternative fetch operations called setRefSpecs(...)
. All alternatives require the developer to define the concrete RefSpecs
to update.
I expect that I have to query the repository for all available RefSpecs
and aggregate them for one combined fetch call (similar to Getting all branches with JGit
). However, I do not understand how to transform a Ref
into a RefSpec
. I would appreciate any pointer here.
Very related to this, I am also not sure how to prune local branches that have been deleted remotely (fetch --prune
). Am I right to assume that setting setRemoveDeletedRefs
to true
achieves exactly this?