-
Notifications
You must be signed in to change notification settings - Fork 34.6k
Closed
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalitygitGIT issuesGIT issuesverification-neededVerification of issue is requestedVerification of issue is requestedverifiedVerification succeededVerification succeeded
Milestone
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
Metadata
Metadata
Assignees
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalitygitGIT issuesGIT issuesverification-neededVerification of issue is requestedVerification of issue is requestedverifiedVerification succeededVerification succeeded