Closed
Description
Currently the git extensions api does not have a method to check if the user has unsynced changes. To achieve that I am doing a check like such
git.onDidOpenRepository(async function(repo: Repository) {
updateGitChanges(repo.state);
repo.state.onDidChange(async function(this: any) {
const repo: any = this;
updateGitChanges(repo.state);
}, repo);
});
async function updateGitChanges(repoState: RepositoryState) {
const hasChanges = !!(
repoState.indexChanges.length !== 0 ||
repoState.mergeChanges.length !== 0 ||
repoState.workingTreeChanges.length !== 0 ||
repoState.rebaseCommit !== undefined ||
(repoState.HEAD?.ahead && repoState.HEAD?.ahead !== 0)
);
...
}
Would be nice to have a api method that does this.
Thanks,
Jason