MCPcopy Create free account
hub / github.com/angular/dev-infra / hasUncommittedChanges

Method hasUncommittedChanges

ng-dev/utils/git/git-client.ts:168–177  ·  view source on GitHub ↗

Gets whether the current Git repository has uncommitted changes.

()

Source from the content-addressed store, hash-verified

166
167 /** Gets whether the current Git repository has uncommitted changes. */
168 hasUncommittedChanges(): boolean {
169 // We also need to refresh the index in case some files have been touched
170 // but not modified. The diff-index command will not check contents so we
171 // manually need to refresh and cleanup the index before performing the diff.
172 // Relevant info: https://git-scm.com/docs/git-diff-index#_non_cached_mode,
173 // https://git-scm.com/docs/git-update-index and https://stackoverflow.com/a/34808299.
174 this.runGraceful(['update-index', '-q', '--refresh']);
175
176 return this.runGraceful(['diff-index', '--quiet', 'HEAD']).status !== 0;
177 }
178
179 /**
180 * Checks out a requested branch or revision, optionally cleaning the state of the repository

Callers 8

hasLocalChangesFunction · 0.80
rebasePrFunction · 0.80
mergeMethod · 0.80
checkoutPullRequestFunction · 0.80

Calls 1

runGracefulMethod · 0.95

Tested by

no test coverage detected