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

Method getCurrentBranchOrRevision

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

Gets the currently checked out branch or revision.

()

Source from the content-addressed store, hash-verified

154
155 /** Gets the currently checked out branch or revision. */
156 getCurrentBranchOrRevision(): string {
157 const branchName = this.run(['rev-parse', '--abbrev-ref', 'HEAD']).stdout.trim();
158 // If no branch name could be resolved. i.e. `HEAD` has been returned, then Git
159 // is currently in a detached state. In those cases, we just want to return the
160 // currently checked out revision/SHA.
161 if (branchName === 'HEAD') {
162 return this.run(['rev-parse', 'HEAD']).stdout.trim();
163 }
164 return branchName;
165 }
166
167 /** Gets whether the current Git repository has uncommitted changes. */
168 hasUncommittedChanges(): boolean {

Callers 9

SnapshotPublisherClass · 0.80
ReleaseToolClass · 0.80
rebasePrFunction · 0.80
mergeMethod · 0.80
checkMethod · 0.80
mergeMethod · 0.80

Calls 1

runMethod · 0.95

Tested by

no test coverage detected