open(o.localPath).then(function (repo) {
repository = repo;
return repo.fetchAll(credentials);
}).then(function () {
return repository.getReferenceNames(Git.Reference.TYPE.LISTALL);
}).then(function (arrayString) {
console.log(arrayString);
}).catch(err => {
reject(err);
})
I fetched all branches once (5 branches total), and I deleted one branch, local and remote, this still return 5 branches, but it should return 4 branches, how can I get new list of the branch ?
repository.getReferenceNames(Git.Reference.TYPE.LISTALL);
can be synonymous with
git show-ref
command.
This is using the references in .git/refs
folder.
You want to run a git fetch --all --prune
upon deleting the branch to remove remote tracking references that are removed in the remote.
Depending on your version of nodegit (for [v0.5.0] and up)
//...
const fetchOptions = { callbacks: credentials, pruneAfter: true }
return repo.fetchAll(fetchOptions)
//...
For older versions (v0.4.1 - v0.3.0)
//...
return repo.fetchAll(remoteCallbacks, true)
//...